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 |
|---|---|---|---|---|---|---|
Running Totals exercise Small Problems exercises from LaunchSchool
|
def running_total(arr)
sum = 0
arr.map do |n|
sum += n
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def problem_six\n (1.upto(100).reduce(:+)) ** 2 - (1.upto(100).map { |n| n ** 2 }).reduce { |sum, n| sum + n }\n end",
"def total\n count = 0\n self.total_time_exercise_workouts.each do |ex|\n count += ex.duration\n end\n count\n end",
"def cupcake_solver(cupcake_counts, number_of_students_in_class)\n # number of cupcakes for each flavor\n cake_set = cupcake_counts\n n = number_of_students_in_class\n cakes_per_student = 0\n\n cake_set.each do |count|\n # cakes per student for this flavor\n c = count / n\n # running total\n cakes_per_student += c\n end\n cakes_per_student\nend",
"def test_case_count\n scenario_count + outlines.reduce(0) { |outline_sum, outline|\n outline_sum += outline.examples.reduce(0) { |example_sum, example|\n example_sum += example.rows.count\n }\n }\n end",
"def exercise_119 (number)\n end",
"def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend",
"def suites(terme)\n if((terme.is_a? Integer) && (terme >= 0))\n\n puts \"- Suite \\\"Le pas croissant\\\"\"\n sum = 1;\n\n for i in 0..terme\n sum += i\n print \"#{sum} \"\n end\n\n puts \"\\n\"\n puts \"- Suite \\\"La boiteuse\\\": \"\n\n sum = 0;\n for i in 0..terme\n if((i % 2 == 0) && (i != 0))\n sum += 2\n else sum += 1\n end\n print \"#{sum} \"\n end\n\n puts \"\\n\"\n\n puts \"- Suite \\\"Fibonacci\\\":\"\n\n tmp = 0;\n first = 0;\n second = 1;\n\n for i in 0..terme\n if (i > 1)\n tmp = first + second;\n first = second;\n second = tmp;\n print \"#{second} \"\n else if(i == 0)\n print \"#{first} \"\n else print \"#{second} \"\n end\n end\n end\n\n puts \"\\n\"\n\n else puts \"Le terme n'est pas entier positif.\"\n end\nend",
"def goals_for()\n\t self.as_regular_contestants.select{|c| c.score}.collect{|c| c.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def compute_total_seconds\n exercise_seconds = exercise_rows.inject(0) do |sum, row|\n sum + row.compute_total_seconds # (default: exclude pause from sum)\n end\n if exercise_seconds == 0 # Found zero esteemed duration (excluding pause) ?\n if start_and_rest > 0\n start_and_rest * times + (pause * times)\n elsif distance > 0\n (pause + ExerciseRow.esteem_time_in_seconds(distance)) * times\n else\n pause * times\n end\n else\n exercise_rows.inject(0) do |sum, row|\n sum + row.compute_total_seconds(true) # (include pause)\n end * times + (pause * times)\n end\n end",
"def calculate_net_calories(foods,exercises)\n\t\ttotal_intake = 0\n\t\ttotal_burn = 0\n\t\tfoods.each do |food|\n\t\t\ttotal_intake += food.calories\n\t\tend\n\t\texercises.each do |exercise|\n\t\t\ttotal_burn += exercise.calories\n\t\tend\n\t\treturn total_intake-total_burn\n\tend",
"def goals_against()\n\t self.as_regular_contestants.select{|c| c.opponent.score}.collect{|c| c.opponent.score}.inject{|gf, c| gf + c} || 0\n\tend",
"def points\n raise \"Not an IOI style task.\" unless task.scoring == \"ioi\"\n total = body.count.to_f\n raise \"Task has no tests.\" unless total > 0\n\n passed = body.count { |test| test[:status] == \"Correct\" }\n ((passed / total) * 100).round\n end",
"def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end",
"def total_number_basic_tasks\n total=0\n @sub_tasks.each { |task| total += task.total_number_basic_tasks }\n total \n end",
"def tiles_remaining\n # still not sure why or how this is working. TODO: may take out later\n total_num_tiles = @default_set.inject(0) { |letter, letter_quantity| letter += letter_quantity[1] }\n p \"++++TEST++++\"\n p total_num_tiles\n return total_num_tiles\n end",
"def calculate_monthly_calories(exercises)\n\t\ttotal_burn = 0\n\t\texercises.each do |exercise|\n\t\t\ttotal_burn += exercise.calories\n\t\tend\n\t\treturn total_burn\n\tend",
"def overall\n avg = @difficulty = @mood = @teaching_skills = 0.0\n @exams_difficulty = @helpfulness = 0.0\n count = 0 + sections.count\n count = 1 if count.zero?\n sections.each do |section|\n avg += section.professor_overall\n @difficulty += section.professor_difficulty\n @teaching_skills += section.professor_teaching\n @mood += section.professor_mood\n @exams_difficulty += section.professor_exam\n @helpfulness += section.professor_helpfulness\n end\n\n @difficulty /= count\n @teaching_skills /= count\n @mood /= count\n @exams_difficulty /= count\n @helpfulness /= count\n avg / count\n end",
"def display_total_calories_per_workout\n puts \"This workout will burn an average of #{self.total_calories} calories.\"\n end",
"def compute_best_score(team, pilots, pilot_contests)\n combination = []\n total = 0.0\n total_possible = 0\n puts 'compute_score TBD'\nend",
"def getNumberOfSolutions; @solutions.length; end",
"def run!\n words = generate_words\n backlog = words.sample(StoriesPerRound)\n\n blank_worksheets = {}\n answer_sheets = {}\n\n match_counts = {}\n round_totals = {}\n\n Rounds.each do |round|\n loop do\n puzzle = make_puzzle(words)\n round_totals[round] = 0\n\n puts \"Generating sheets for round #{round}...\"\n\n backlog.each_with_index do |backlog_item, index_in_backlog|\n story_id = \"#{round}#{index_in_backlog + 1}\"\n\n #puts \" Creating blank worksheet for story #{story_id}...\"\n blank_worksheet = make_worksheet_page(puzzle, story_id, backlog_item)\n blank_worksheets[story_id] = blank_worksheet\n\n #puts \" Creating answer sheet for story #{story_id}...\"\n answer_sheet = make_answer_sheet(puzzle, story_id, backlog_item)\n answer_sheets[story_id] = answer_sheet.content\n\n match_count = answer_sheet.match_count\n match_counts[[round, backlog_item]] = match_count\n round_totals[round] += match_count\n end\n\n desired_total = round_totals[Rounds[0]]\n\n break if round_totals[round] == desired_total\n puts \"...trying again. Shooting for #{desired_total} total...\"\n end\n end\n\n puts \"Saving HTML versions...\"\n blank_worksheets.keys.each do |story_id|\n IO.write(\"blank_worksheet_#{story_id}.html\", blank_worksheets[story_id])\n IO.write(\"answer_sheet_#{story_id}.html\", answer_sheets[story_id])\n end\n\n match_counts_sheet = make_matchcount_page(backlog, match_counts)\n IO.write('quality_check_sheet.html', match_counts_sheet)\n\n puts \"Round totals: #{round_totals}\"\n\n puts \"Converting to PDF...\"\n input_files = \"blank_worksheet_*.html answer_sheet_*.html quality_check_sheet.html\"\n %x(wkhtmltopdf --page-size Letter #{input_files} materials.pdf)\n\n puts \"Cleaning up temp files...\"\n %x(rm answer_sheet_*.html blank_worksheet_*.html quality_check_sheet.html)\nend",
"def solve\n t = IO.read( 'resources/0089_roman.txt' ).split.map do |line|\n n = ProjectEuler::Roman.to_i( line )\n line.length - ProjectEuler::Roman.from_i( n ).length\n end\n\n t.inject( :+ )\n end",
"def total\n sum = 0\n\n @four_result.each do |result|\n sum += result\n end\n @six_result.each do |result|\n sum += result\n end\n @eight_result.each do |result|\n sum += result\n end\n @ten_result.each do |result|\n sum += result\n end\n @twelve_result.each do |result|\n sum += result\n end\n @twenty_result.each do |result|\n sum += result\n end\n @percentile_result.each do |result|\n sum += result\n end\n\n sum\n end",
"def generate_dummy_data_for_presentation(pt1,user)\n\n#generate the exercises:\n# For the legs session type\n legs1 = Exercise.new(\"Full Squat\", \"Legs\", true, 10, 5, 1.2,4,3) \n legs2 = Exercise.new(\"Barbell Lunge\", \"Legs\", false, 15, 5, 1.1,4,2) \n legs3 = Exercise.new(\"Deadlift\", \"Legs\", true, 15, 5, 1.3,2,4) \n legs4 = Exercise.new(\"Leg Press\", \"Legs\", false, 20, 5, 1.25,6,5) \n legs5 = Exercise.new(\"Ham String Curl\", \"Legs\", true, 12, 5, 1.15,4,4) \n # For the Biceps, Triceps, Forearms and Abs (aka BTFA) session type \n btfa1 = Exercise.new(\"Bicep Curls\", \"BTFA\",true, 10, 5, 1.2,4,3) \n btfa2 = Exercise.new(\"Shoulder Press\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa3 = Exercise.new(\"Bench Press\", \"BTFA\", true, 10, 5, 1.2,4,3) \n btfa4 = Exercise.new(\"Triceps Extension\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa5 = Exercise.new(\"Sit Up\", \"BTFA\", true, 10, 5, 1.2,4,3) \n # For the Shoulders and Traps session type\n shoulders_traps1 = Exercise.new(\"Dumbell Shoulder Press\", \"Shoulders and Traps\",true, 10, 5, 1.2,4,3) \n shoulders_traps2 = Exercise.new(\"Upright Barbell Row\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps3 = Exercise.new(\"Seated Bent-over Rear Delt Raise\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n shoulders_traps4 = Exercise.new(\"Side Lateral Raise\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps5 = Exercise.new(\"Barbell Shrug\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n # For the Back session type\n back1 = Exercise.new(\"Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back2 = Exercise.new(\"Wide-Grip Pull Up\", \"Back\", false, 10, 5, 1.2,4,3) \n back3 = Exercise.new(\"Bent-Over Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back4 = Exercise.new(\"Standing T-Bar Row\", \"Back\", false, 10, 5, 1.2,4,3) \n # For the Chest session type\n chest1 = Exercise.new(\"Barbell Bench Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest2 = Exercise.new(\"Flat Bench Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest3 = Exercise.new(\"Seated Machine Chest Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest4 = Exercise.new(\"Incline Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest5 = Exercise.new(\"Machine Decline Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n\n# add exercises to the PT object so that it's aware of them\n pt1.add_exercises(legs1)\n pt1.add_exercises(legs2)\n pt1.add_exercises(legs3)\n pt1.add_exercises(legs4)\n pt1.add_exercises(legs5)\n pt1.add_exercises(btfa1)\n pt1.add_exercises(btfa2)\n pt1.add_exercises(btfa3)\n pt1.add_exercises(btfa4)\n pt1.add_exercises(btfa5)\n pt1.add_exercises(shoulders_traps1)\n pt1.add_exercises(shoulders_traps2)\n pt1.add_exercises(shoulders_traps3)\n pt1.add_exercises(shoulders_traps4)\n pt1.add_exercises(shoulders_traps5)\n pt1.add_exercises(back1)\n pt1.add_exercises(back2)\n pt1.add_exercises(back3)\n pt1.add_exercises(back4)\n pt1.add_exercises(chest1)\n pt1.add_exercises(chest2)\n pt1.add_exercises(chest3)\n pt1.add_exercises(chest4)\n pt1.add_exercises(chest5)\n\n\n # establish id for user\n user.username = \"jim\"\n user.password = \"password\"\n user.first_name = \"Jimmy\"\n user.last_name = \"Coder\"\n user.gender = \"Male\"\n user.body_type = \"Mesomorph\"\n user.goal = \"musclebuild\"\n user.disclaimer = \"accept\"\n user.date_of_birth = Date.new(1990,9,9)\n # binding.pry\n user.weight = 56\n user.goal_weight = 75\n\n#establish some dummy workout history for our user:\n # (weight, completed_reps, exercise_performed, duration, date, session_number, session_type)\n workout_history_for_user = ExerciseInput.new(10, 8, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 9, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 10, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 11, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 5, chest1.name, 10, Date.new(2017,8,5), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,6), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 8, chest1.name, 10, Date.new(2017,8,7), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 10, chest1.name, 10, Date.new(2017,8,8), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 7, chest1.name, 10, Date.new(2017,8,9), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 8, chest1.name, 10, Date.new(2017,8,10), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 9, chest1.name, 10, Date.new(2017,8,11), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 10, chest1.name, 10, Date.new(2017,8,12), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n\n\nend",
"def run_test(questions)\n answer = \"\"\n score = 0\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 #end if\n end #end loop\n puts (\"You got \" + score.to_s + \"/\" + questions.length().to_s)\nend",
"def exercise1\n parse_data\n passports.count(&:valid?)\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 homework_total(student_id)\n @h_total = 0\n @h_earned = 0\n Grade.find_all_by_student_id(student_id).each do |grade|\n Task.find_all_by_id_and_category_id(grade.task_id, 1).each do |homework|\n @h_total += homework.total\n @h_earned += grade.earned\n end\n end\n if @h_total != 0 then return (@h_earned.percent_of(@h_total))*homework_weight else return 0 end\n end",
"def show_total_unattendance_number\n puts 'show_total_unattendance_number'\n total_unattendance_number = @data.inject (0) do |mem, e|\n num_exams = e.size - 1.0\n mem + e.last(num_exams).count('00')\n end\n puts total_unattendance_number.to_s\n end",
"def partial_review_self_check_count\n check_count = 0\n self.sections.each do |s|\n next if !s.dot_rev_check?\n s.subsections.each do |ss|\n next if !ss.dot_rev_check?\n ss.checks.each { |c| check_count += 1 if c.bare_board_design_check? && c.is_self_check? }\n end\n end\n check_count\n end",
"def total_reps\n\t\ttotal_reps = self.reps1 + self.reps2 + self.reps3 \t\n\tend",
"def problem_ten\n Prime.instance.each(2_000_000).reduce(&:+)\n end",
"def summary\n s = tests.keys.size\n puts \"\\n#{s} tests, #{@success_count} succeeded, #{@failure_count} failed\"\n end",
"def total\n # Each square has 1 << (n-1) grains of rice, one more than all squares\n # before it combined. The total number of grains on a chess board can\n # thus be calculated by subtracting one from the number of grains on a\n # theoretical 65th square.\n square(65)-1\n end",
"def set_total_calories\n sum_of_cal = 0\n self.user_workout_exercises.each { |uwe| sum_of_cal += uwe.custom_calories}\n self.update(total_calories: sum_of_cal)\n end",
"def euler006\n square_of_sum = (1..100).reduce(:+) ** 2\n sum_of_squares = (1..100).inject { |sum, n| sum + n*n }\n\n return square_of_sum - sum_of_squares\nend",
"def run_test(questions)\n answer = \"\" # create a variable called answer empty string\n score = 0 # keeping track of the questions they get right\n\n # looping through the questions\n for question in questions\n puts question.prompt\n \n # get answer from the user\n answer = gets.chomp()\n\n if answer == question.answer\n score += 1\n end\n end\n\n puts (\"You got \" + score.to_s + \" / \" + questions.length().to_s)\n\nend",
"def average_finish_time(game, nb_game)\n\n#On initialise la somme des nombres de laps\nsomme = 0\n\n#On teste si le nombre de parties > 100, si non on n'accpete pas\n\tif nb_game < 100 then puts \"Il faut un nombre > 100 !\"\n\n#Si oui, on lance nb_parties (en l'occurence 150) fois le jeu (en l'occurence Stairways)\n\telse\n\t\t\tnb_game.times do game\n\t\t\tsomme += stairway\n\t\t\tend\n\n#On affiche la moyenne du nombre de parties\n\t\tputs \"**************************************************************************\"\n\t\tputs \"Le score moyen de vos #{nb_game} parties est de #{somme/nb_game} !\"\n\t\tputs \"**************************************************************************\"\n\n\tend\n\nend",
"def full_review_self_check_count\n check_count = 0\n self.sections.each do |s|\n next if !s.full_review?\n s.subsections.each do |ss|\n next if !ss.full_review?\n ss.checks.each { |c| check_count += 1 if c.new_design_check? && c.is_self_check? }\n end\n end\n check_count\n end",
"def expected_submissions\n deliverables.count * course.students.count\n end",
"def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend",
"def tasks_progress\n total_done = 0\n total_tasks = 0\n self.stories.each do |story|\n story.issues.each do |issue|\n total_tasks += 1\n total_done += issue.done\n end\n end\n total_tasks > 0 ? total_done / total_tasks : 100\n end",
"def iter_soln\n\ttotal = 0\n\t(0..999).each do |i|\n\t\ttotal += i if(i%3 == 0 || i%5 == 0)\n\tend\n\n\tputs total\nend",
"def problem1(num)\n (1..num-1).select{|a| a%3 ==0 or a%5==0}.reduce(:+)\nend",
"def add_exercise(new_exercise, new_repeats, new_break)\n @exercises.push(new_exercise)\n @repititions.push(new_repeats)\n @break_time.push(new_break)\n end",
"def run_tests\n check_solution(1, [6, 29, 18, 2, 72, 19, 18, 10, 37], 18, 2)\n check_solution(2, [6, 29, 18, 2, 72, 19, 18, 10, 37], 9, -1)\nend",
"def score\n 3*@tally + 5*@strength + 2*@wealth + @food + 30*@monsters_killed\n end",
"def phase_one\n puts \"Phase 1 Starting\".yellow\n counter = 8\n eliminated = []\n while counter > 0\n indexer = 8 - counter\n puts \"Phase one, round #{(indexer+1).to_s}:\".green\n tribe_selected = @borneo.immunity_challenge\n puts \"Tribe selected: #{tribe_selected.to_s}\".green\n puts \"Contestant #{tribe_selected.tribal_council} was eliminated without mercy!\".red\n counter -= 1\n end\n 8 # this is here to pass the test, but not sure it's ver useful beyond that\nend",
"def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end",
"def compute_sum_of_threes_and_fives\r\n sum = 0\r\n (1...1000).each do |n|\r\n sum += n if n % 3 == 0 || n % 5 == 0\r\n end\r\n sum\r\nend",
"def total_time_exercise_workouts\n self.exercise_workouts.select do |ex|\n ex.duration\n end\n end",
"def number_of_kcal_per_meal\n kcal_per_recipe = recipe_ingredients.each.sum do |recipe_ingredient|\n calories_per_gram = recipe_ingredient.ingredient.calories / 100 \n kilograms_of_ingredient = recipe_ingredient.calculated_weight_in_grams / 1000\n (calories_per_gram * kilograms_of_ingredient) #kcal\n end\n kcal_per_recipe / num_people\n end",
"def total\n squares = (1..64).map{|i| square(i)}\n squares.inject(:+)\n end",
"def masterwork_prob_bonus; 0; end",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def score(dice)\n \n if dice.empty?\n return 0\n end\n\n var_score = 0\n\n conteo = (0..9).to_a.each.map { |x| dice.count(x)} \n \n #Evaluating 1\n if ( conteo[1] / 3 ) >= 0\n multiplier1 = conteo[1]/3\n var_score += multiplier1 * 1000\n end\n\n if ( conteo[1] % 3 ) != 0\n var_score += (conteo[1] % 3)*100\n end\n \n #Evaluating 5\n if ( conteo[5] % 3 ) != 0\n var_score += (conteo[5] % 3)* 50\n end\n\n #Evaluating numbers x 3 \n if (conteo[2..9].count { |x| x >= 3 }) > 0\n triplets = conteo[2..9].map {|x| x / 3}\n array_multiplicator = triplets.each_with_index.select {|num,index| (num > 0)}.map {|x| x[0]}\n product_triplets = triplets.each_with_index.select {|num,index| (num > 0)}.map {|x| x[1]}.map {|x| (x+2)*100}\n var_score += array_multiplicator.zip(product_triplets).map{|x| x.inject(&:*)}.sum\n end\n\n var_score\nend",
"def get_works_total_hours\n res_hours =0\n self.works.each do |w|\n res_hours+=w.workhours unless w.workhours.nil?\n end\n return res_hours\n end",
"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 home_run(ppl_on_base)\n points = ppl_on_base + 1\n puts \"There were #{ppl_on_base} people on base so we scored #{points} points\"\n end",
"def total_students(students)\n\ttotal = 0\n\tstudents.each do |cohort, number| \n\t\ttotal += number.to_i\n\tend\n\tputs total\nend",
"def total_score\n\t\tall_scores = picks.collect { |pick|\n\t\t\tpicks_golfers = TournamentGolfer.where(golfer_id: pick.golfer_id, tournament_id: pick.pool.tournament_id).pluck(:total)[0]\n\t\t} - [nil] - [\"CUT\"]\n\t\tif all_scores.count < 5\n\t\t\treturn \"DQ\"\n\t\telse \n\t\t\tall_scores = all_scores.map {|score| score.to_i}\n\t\t\tall_scores = all_scores.sort\n\t\t\treturn all_scores[0..(pool.number_golfers_for_scoring-1)].sum\n\t\tend\n\tend",
"def print_solution\n\n\t\t# The first, the number of test case\n\t\tputs \"Test case \\##{@i}\"\n\n\t\t# For every pair to be tested\n\t\t@sub_sequence_idx.each do |s,e|\n\n\t\t\t# the maximum number of coincidences is stored on max\n\t\t\tmax = 0\n\n\t\t\t# the current number of coincidences in a row is stored on coincidences_on_a_row\n\t\t\tcoincidences_on_a_row = 0\n\n\t\t\t# From start of the range\n\t\t\ti = s - 1\n\n\t\t\t# Until the end of it (please note the index of s,e is 1-based)\n\t\t\twhile i < e - 1\n\n\t\t\t\t# if there is a coincidence\n\t\t\t\tif @equals[ i ]\n\n\t\t\t\t\t# we inc the counter\n\t\t\t\t\tcoincidences_on_a_row += 1\n\n\t\t\t\t# if the coincidences stop...\n\t\t\t\telsif coincidences_on_a_row > 0\n\n\t\t\t\t\t# we store the maximum\n\t\t\t\t\tmax = [ coincidences_on_a_row, max ].max\n\n\t\t\t\t\t# and reset the counter\n\t\t\t\t\tcoincidences_on_a_row = 0\n\t\t\t\tend\n\n\t\t\t\t# next number!!\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t# in case of coincidences found at the end of the range, update the max before...\n\t\t\tmax = [ coincidences_on_a_row, max ].max\n\n\t\t\t# ...before print it. Please note that we compute equalities\n\t\t\t# but problem asks us for numbers-equals-in-a-row, so we need to sum 1\n\t\t\tputs max + 1\n\t\tend\n\tend",
"def problem_80(size = 100)\n total = 0\n (2..100).each do |n|\n n,d = n.sqrt_frac(2*size)\n next unless n\n r = n * (10 ** (size * 1.1).to_i) / d\n r = r.to_s[0,size].split(//).map(&:to_i).reduce(&:+)\n total += r\n# puts r.inspect\n end\n total\nend",
"def steps\n find_solution\n end",
"def avarage_workout_with_km_calories\n # Sum totals\n total_distance = set_sport_by_user.sum(:distance)\n # Return if there are workouts\n return total_distance / total_workouts if total_workouts > 0\n 0\n end",
"def problem_76\n return 100.partitions - 1\nend",
"def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end",
"def calories_counter(orders)\n # TODO: return number of calories for a less constrained order\n total_calories = 0\n orders.each do |order|\n # if it returns a value = number, get the number;\n # otherwise run the method poor_calories_counter passing each item as an argument\n total_calories += MENU[order].is_a?(Fixnum) ? MENU[order] : poor_calories_counter(*MENU[order])\n # *MENU[order] es lo mismo que MENU[order][0], MENU[order][1], MENU[order][2]\n end\n p total_calories\nend",
"def recipe_counter(item_to_make, available_ingredients)\n # Initialize the library hash of items we are making and the quantities neccesary to make them as the value\n # set error_counter to 3\n \n bakery_items = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n # error_counter = 3\n\n \n # my_hash.keys => [\"apples\", \"banana\"]\n # my_hash.keys.include?\n # my_hash.include?\n \n unless bakery_items.include? item_to_make\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # SETS SERVING SIZE EQUAL TO THE VALUE OF THE ITEM\n ingredients_needed = bakery_items[item_to_make]\n #SETS REMAINING INGREDIENTS TO WHATS LEFTOVER THAT DOESN'T MAKE A WHOLE OF THE ITEM\n remaining_ingredients = available_ingredients % ingredients_needed\n \n\n # IF THERE IS A REMAINDER IT RETURNS THE COUNT OF MADE ITEMS AND SUGGESTS A NEW FEATURE \n # IF THE REMAINDER IS ZERO IT JUST RETURNS THE ITEM MADE AND THE COUNT\n \n return_string = \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}.\"\n \n # unless remaining_ingredients == 0\n # suggested_items = \"\"\n # count_of_cakes = 0\n # count_of_cookies = 0\n # until remaining_ingredients >= 5\n # count_of_cakes += 1\n # remaining_ingredients -= 5\n # end\n # if count_of_cakes > 0\n # end \n # end\n \n \n \n \n# results_hash\n# suggested_baking_items = {}\n \n# bakery_items.each do |food, ingredients_needed|\n# suggested_baking_items[food] = 0\n# # Logic here to see if we can make any of the current food.\n# end\n \n# suggested_baking_items.each do |item|\n# if item.qty > 0 \n# return_string += \"2 cakes\"\n# end\n# end\n \n \n \n # end\n \n \n \n \n # If there are enough ingredients to make a pie\n # make pies, subtract from ingredients\n # If there are enough to make at least 1 cake\n # make cakes, subtract ingredients\n # same thing with cookies....\n \n \n \n unless remaining_ingredients == 0\n return_string += \" You have #{remaining_ingredients} leftover ingredients. Suggested baking items: ADD CODE\"\n end\n \n return return_string\n \n \n # if remaining_ingredients\n # return \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}\"\n # else\n # return \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n # end\nend",
"def proof_of_stake\n title(\"Proof of Stake\")\n\n eco_scale = \"https://en.wikipedia.org/wiki/Economies_of_scale\"\n pros1 = \"Energy efficient\"\n pros2 = \"More expensive to attack for attackers\"\n pros3 = \"Not susceptible to ecnomies of scale \\n\\t (for more details about this topic click on this link:\\n\\t #{eco_scale}).\"\n\n pros = [pros1, pros2, pros3]\n\n nothing_at_stake = \"https://medium.com/coinmonks/understanding-proof-of-stake-the-nothing-at-stake-theory-1f0d71bc027\"\n cons = \"nothing-at-stake problem \\n(for more details click on this link:\\n#{nothing_at_stake})\"\n\n\n ppc = {name: \"Peercoin\", website: \"https://peercoin.net/\"}\n pivx = {name: \"Pivx\", website: \"https://pivx.org/\"}\n rdd = {name: \"Reddcoin\", website: \"https://reddcoin.com/\"}\n\n used_by = [ppc, pivx, rdd]\n\n consensus_type = \"Competitive consensus\"\n\n\n explanation = \"\"\"\n The proof of stake was created as an alternative to the proof of work (PoW),\n to tackle inherent issues in the latter. Here instead of using mining, you\n have to have some stake(coins) in the system. So, if you own 10% of the\n stake(coins), then your probability of mining next block will be 10%.\n \"\"\"\n\n further_reading = \"https://en.wikipedia.org/wiki/Proof_of_stake\"\n\n p_o_s = {\n \"pros\" => pros,\n \"cons\" => cons,\n \"used_by\" => used_by,\n \"consensus_type\" => consensus_type,\n \"explanation\" => explanation,\n \"further_reading\" => further_reading\n }\n\n choice = \"0\"\n\n while !choice.include?(\"Q\") && !choice.include?(\"q\")\n choice = consensus_features\n if choice.include?(\"1\")\n puts \"Pros:\"\n p_o_s[\"pros\"].each_with_index { |val, index| puts \"\\t#{index+1}) #{val}\" }\n\n cons = p_o_s[\"cons\"]\n puts \"Cons: #{cons}\"\n elsif choice.include?(\"2\")\n puts \"Used by:\"\n p_o_s[\"used_by\"].each_with_index do\n |valeur, index|\n puts \"#{index+1})\"\n valeur.each do\n |key, value| puts \" #{key}: #{value}\"\n end\n end\n puts \"And others.\"\n elsif choice.include?(\"3\")\n consensus_type = p_o_s[\"consensus_type\"]\n puts \"Type: #{consensus_type}\"\n elsif choice.include?(\"4\")\n explanation = p_o_s[\"explanation\"]\n puts \"Explanation: #{explanation}\"\n elsif choice.include?(\"5\")\n further_reading = p_o_s[\"further_reading\"]\n puts \"Further Reading: #{further_reading}\"\n elsif choice.include?(\"Q\") || choice.include?(\"q\")\n break\n else\n puts \"Error\"\n end\n end\n\nend",
"def tally\n return \"\"\n\n text = \"%s concerns: %s passed, %s failed, %s errored (%s/%s assertions)\"\n total = @passed.size + @failed.size + @raised.size\n text = text % [total, @passed.size, @failed.size, @raised.size, $assertions - $failures, $assertions]\n if @failed.size > 0\n text.ansi(:red)\n elsif @raised.size > 0\n text.ansi(:yellow)\n else\n text.ansi(:green)\n end\n end",
"def evaluate_problems(competition)\n\t\ttotal_value=0\n\t\tproblems=competition.problems\n\t\tproblems.each do |p|\n\t\t\ttotal_value += value_problem(p)\n\t\tend\n\t\thash_percents={}\n\t\t#balta6tina!\n\t\t#the reason for the next line is to make sure that the sum of the percents of the problems is always 100\n\t\tlast_problem_percent=100\n\t\tcount=1\n\t\tproblems.each do |p|\n\t\t\tif count < problems.count\n\t\t\t\tpercent=((value_problem(p).to_f / total_value)*100).round(0).to_i\n\t\t\t\thash_percents[\"percent_problem_#{p.id}\"]=percent\n\t\t\t\tlast_problem_percent -= percent\n\t\t\t\tcount += 1\n\t\t\telse\n\t\t\t\thash_percents[\"percent_problem_#{p.id}\"]=last_problem_percent\n\t\t\tend\n\t\tend\n\t\treturn hash_percents\n\tend",
"def number_of_calories\n self.ingredients.sum(\"calories\")\n end",
"def get_sum_through(target, piece)\n target -= 1\n highest_multiple = target / piece * piece\n sum_chunk = highest_multiple + piece\n quantity = target / piece / 2\n odd = target / piece % 2\n odd_piece = odd * sum_chunk / 2\n\n sum_chunk * quantity + odd_piece\nend",
"def number_of_superwork_evidences(login=nil)\n count_by_frbr(login, :is_evidence_of, :how_many_superworks?) \n end",
"def hours_spent\n hours_spent = 0\n project_tasks.each do |project_task|\n hours_spent += project_task.hours_spent\n end\n hours_spent\n end",
"def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend",
"def summarize_suite(suite, tests); end",
"def summarize_suite(suite, tests); end",
"def total_score\n\t\t0 + score_one.to_i + score_two.to_i + score_three.to_i + score_four.to_i\n\tend",
"def euler001(max)\n\ti = 1\n\tsum = 0\n\tmax.times do |i|\n\t\tif i % 3 == 0 || i % 5 == 0\n\t\t\tsum += i\n\t\tend\n\tend\n\tprint(sum, \"\\n\")\nend",
"def total\n (1..64).inject {|sum, square| sum + square(square)}\n end",
"def sum_hours\n @hours.each do |row|\n @cycling[0] += row[0].to_f\n @entertainment[0] += row[1].to_f\n @programming[0] += row[2].to_f\n @reading[0] += row[3].to_f\n @yoga[0] += row[4].to_f\n end\n end",
"def score\n self.tiles.inject(0){|sum,num| sum+=TileBag.points_for(num)}\n end",
"def doTrials(n)\n total = 0\n n.times do |i|\n total += turn()\n end\n return \"Average damage: $%d\" % [total / n]\nend",
"def sushi_cost(meal)\n cost = 0\n sushi_tracker = 0\n meal.split('').each do |meal_content|\n sushi_tracker += 1 unless meal_content == \" \"\n if meal_content == \"r\" && sushi_tracker % 5 != 0\n cost += 2\n elsif meal_content == \" \"\n cost\n end\n end\n print cost\nend",
"def run_quiz(questions)\r\n answer = \"\"\r\n score = 0\r\n for question in questions #a for loop for every question in the above array\r\n puts question.prompt\r\n answer = gets.chomp()\r\n if answer == question.answer\r\n score += 1\r\n end\r\nend\r\n puts \"you got\" + score.to_s + \"/\" + questions.length.to_s \r\nend",
"def solve\n sum = 0\n (1..999).each do |n|\n if n % 3 == 0 or n % 5 == 0\n sum += n\n end\n end\n sum\nend",
"def work_joule_func\n \t#Exercise.find(exercise_id).work_joule(weight_additional_kg)\n work_joule=1\n end",
"def serving_size_calc(item_to_make, number_of_people)\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n #error_counter = 3\n\n #menu.each do |food|\n # if menu[food] != menu[item_to_make]\n # p error_counter += -1\n # end\n # end\n\n # if error_counter > 0\n # raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n # end\n\n if !menu.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # serving_size = menu.values_at(item_to_make)[0]\n serving_size = menu[item_to_make]\n people_left_over = number_of_people % serving_size\n\n case people_left_over\n when 0\n return \"Calculations complete: Make #{number_of_people/serving_size} #{item_to_make}(s)\"\n else\n return \"Calculations complete: Make #{(number_of_people/serving_size) + 1} #{item_to_make}(s)\"\n end\nend",
"def total_points\n stories.inject(0) do |accumulator, story|\n accumulator += story.points\n end\n end",
"def total\n (1..64).inject {|sum, num| sum + square(num)}\n end",
"def total(day, project_id)\n sum = 0\n Array.wrap(day[project_id]).each do |story|\n sum += story['estimate'].to_i\n end\n sum\nend",
"def difficulty\n 1-correct.to_f/(correct+incorrect)\n end",
"def run_tests()\n check_solution(1, [1, 3, 5, 4], [5])\n check_solution(2, [4, 2, 3, 6, 10], [4, 10])\n check_solution(3, [4, 2, 11, 6, 10], [4, 11, 10])\nend",
"def total_score\n plays.inject(0) { |sum, word| sum + Scoring.score(word) }\n end",
"def runner\nwelcome\ncurrent_sum=hit?(initial_round)\ndisplay_card_total(current_sum)\n until current_sum>=21 do\n current_sum=hit?(current_sum)\n end\n end_game(current_sum)\n \n\nend",
"def success_count\n examples_total - examples_pending - examples_failed\n end",
"def total_the_check\n @total_check = ((check * tip) + check).round(2)\n end",
"def score_factor_count\n com_count = self.complaints.finished.count\n dep_review_count = count_scorable_department_reviews\n city_review_count = count_scorable_city_reviews\n petition_count = self.petitions.finished.count\n return score_count = com_count + dep_review_count + city_review_count + petition_count\n end",
"def main\n test_num = gets.chomp.to_i\n test_num.times do |t|\n # input\n s, k = gets.chomp.split(' ')\n k = k.to_i\n\n ans = calc(s, k)\n \n puts \"Case ##{t+1}: #{ans}\"\n end\nend"
] |
[
"0.6290539",
"0.62784636",
"0.6101511",
"0.60707974",
"0.6009038",
"0.5996178",
"0.5981915",
"0.5974999",
"0.5909027",
"0.5888089",
"0.57509065",
"0.57407546",
"0.5734557",
"0.5728926",
"0.5708297",
"0.5687988",
"0.5655382",
"0.5652746",
"0.56473696",
"0.5620232",
"0.5604142",
"0.5599113",
"0.5598407",
"0.5590318",
"0.5588104",
"0.5584186",
"0.5583182",
"0.5580689",
"0.5558102",
"0.55556756",
"0.55531734",
"0.55459535",
"0.55292547",
"0.55144733",
"0.551253",
"0.55108947",
"0.55099505",
"0.55004185",
"0.5492908",
"0.5482427",
"0.5481723",
"0.54812574",
"0.5477916",
"0.5468439",
"0.5465843",
"0.54581535",
"0.5455531",
"0.5448074",
"0.54462796",
"0.5445534",
"0.5441649",
"0.5438198",
"0.54370594",
"0.5432969",
"0.54202145",
"0.54201096",
"0.54122484",
"0.5401885",
"0.5394525",
"0.53931785",
"0.5390569",
"0.5378993",
"0.537891",
"0.5368908",
"0.5361341",
"0.5357509",
"0.53496766",
"0.5349311",
"0.5348427",
"0.5342313",
"0.5335493",
"0.5330284",
"0.53289646",
"0.5325702",
"0.53248465",
"0.5324073",
"0.5322015",
"0.5317374",
"0.5317374",
"0.531684",
"0.531683",
"0.5313483",
"0.5310651",
"0.530788",
"0.5305963",
"0.53045297",
"0.53030723",
"0.53012735",
"0.53010964",
"0.5297903",
"0.52958804",
"0.52940696",
"0.5292714",
"0.5291757",
"0.52901185",
"0.52883637",
"0.5288071",
"0.52845913",
"0.52818143",
"0.5277945",
"0.5277235"
] |
0.0
|
-1
|
Gets a Blob at a path for a specific revision. This method will check that the Blob exists and contains readable text. revision The String SHA1. path The String file path. Returns a Blob
|
def read_blob(ref, filename)
blob = repository&.blob_at(ref, filename)
raise 'Blob not found' unless blob
raise 'File is not readable' unless blob.readable_text?
blob
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def blob(id, commit_sha=nil, path=nil)\n blob = self.lookup(id); blob_entry={}\n if commit_sha && path\n commit = self.lookup(commit_sha)\n unless commit\n root_tree = commit.tree\n blob_entry = Gitlab::Git::Blob.find_entry_by_path(self, root_tree.oid, path)\n end\n end\n if blob\n Gitlab::Git::Blob.new(\n id: blob.oid,\n name: blob_entry[:name],\n size: blob.size,\n data: blob.content,\n mode: blob_entry[:mode],\n path: path,\n commit_id: commit_sha,\n )\n end\n end",
"def find_blob_data(sha, path)\n commit = barerepo.lookup sha\n tree = barerepo.lookup commit.tree_id\n blob = tree.path path\n blobdata = barerepo.read(blob[:oid]).data\n image = {\n name: blob[:name],\n data: blobdata\n }\n [image , commit]\n end",
"def find(revision, options = {})\n get_path(\n path_to_find(revision),\n options,\n Tinybucket::Parser::CommitParser\n )\n end",
"def find(revision, options = {})\n get_path(\n path_to_find(revision),\n options,\n get_parser(:object, Tinybucket::Model::Commit)\n )\n end",
"def blob\n @blob ||= ($repo.gblob(@rev + ':' + @name))\n end",
"def read(path, rev=nil)\n if rev.nil?\n file = pathname(path)\n return file.read\n else\n git :show, %(#{rev}:\"./#{path.shellescape}\")\n end\n rescue\n raise FileNotFound, \"no such file in repo - #{path}\"\n end",
"def get_indexfile_with_revision revision\n result = nil\n File.open(@indexfile, \"r\") do |f|\n f.each_line do |line|\n row = parse_indexfile_line(line)\n if row[0] == revision\n result = line\n break\n end\n end\n end\n return result\n end",
"def get_sha1(path)\n return @cache_sha1 unless @cache_sha1.nil?\n sha1 = \"\"\n if File.exist?(path)\n Dir.chdir(path) do\n sha1 = %x(git rev-parse HEAD).delete(\"\\n\")\n end\n end\n\n @cache_sha1 = sha1\n sha1\n end",
"def blob(repo, digest, file)\n doreq('get', \"/v2/#{repo}/blobs/#{digest}\", file)\n end",
"def read(sha)\n begin\n JSON.parse(git.get(:blob, sha).data)\n rescue JSON::ParserError, Errno::EISDIR \n nil\n end\n end",
"def get_entry(path, commit = @commit)\n entry_hash = get_entry_hash(path, commit)\n if entry_hash.nil?\n entry = nil\n else\n entry = @repo.lookup(entry_hash[:oid])\n end\n entry\n end",
"def query_revision(revision)\n return revision if revision =~ /^\\d+$/\n result = yield(scm(:info, repository, authentication, \"-r#{revision}\"))\n YAML.load(result)['Revision']\n end",
"def query_revision(revision)\n revision\n end",
"def get_revision(rev = 'HEAD')\n unless @resource.value(:source)\n status = at_path { git_with_identity('status') }\n is_it_new = status =~ %r{Initial commit|No commits yet}\n if is_it_new\n status =~ %r{On branch (.*)}\n branch = Regexp.last_match(1)\n return branch\n end\n end\n current = at_path { git_with_identity('rev-parse', rev).strip }\n if @resource.value(:revision) == current\n # if already pointed at desired revision, it must be a SHA, so just return it\n return current\n end\n if @resource.value(:source)\n update_references\n end\n if @resource.value(:revision)\n canonical = if tag_revision?\n # git-rev-parse will give you the hash of the tag object itself rather\n # than the commit it points to by default. Using tag^0 will return the\n # actual commit.\n at_path { git_with_identity('rev-parse', \"#{@resource.value(:revision)}^0\").strip }\n elsif local_branch_revision?\n at_path { git_with_identity('rev-parse', @resource.value(:revision)).strip }\n elsif remote_branch_revision?\n at_path { git_with_identity('rev-parse', \"#{@resource.value(:remote)}/#{@resource.value(:revision)}\").strip }\n else\n # look for a sha (could match invalid shas)\n at_path { git_with_identity('rev-parse', '--revs-only', @resource.value(:revision)).strip }\n end\n raise(\"#{@resource.value(:revision)} is not a local or remote ref\") if canonical.nil? || canonical.empty?\n current = @resource.value(:revision) if current == canonical\n end\n current\n end",
"def revision(revision)\n revision = 'HEAD' if revision =~ /head/i\n \"`#{git_cmd} rev-parse #{revision}`\"\n end",
"def path_from_sha1(sha1)\n raise NotImplementedError, 'Implemented in subclasses. See filesystem_pool for example.'\n end",
"def get_file(path)\n file = path[1..-1]\n case path\n when '/CURRENT_REVISION'\n change['revisions'][change['current_revision']]['_number']\n when '/COMMIT_MSG'\n commit_file(change['current_revision'])\n when '/.0_COMMIT_MSG'\n ''\n when /\\.(\\d+)_COMMIT_MSG/\n commit_file(Regexp.last_match(1)) # TODO: handle commit like a normal file (with comments for instance)\n when /\\.(\\d+)_(.*)$/\n revision = Regexp.last_match(1).to_i\n filename = file_from_sanitized(Regexp.last_match(2))\n content = get_ab_file(Regexp.last_match(2), revision)\n FileWithComments.new(Regexp.last_match(2),\n content,\n comments(filename, revision),\n comments(filename, revision, draft: true))\n else\n \"Nothing in there, see .xx_#{file} with xx the patchset version\\n\"\n end\n end",
"def query_revision(revision)\n fast_remote_double_cache_remote_repository = variable(:fast_remote_double_cache_remote_repository)\n raise ArgumentError, \"Deploying remote branches is no longer supported. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}').\" if revision =~ /^origin\\//\n return revision if revision =~ /^[0-9a-f]{40}$/\n command = scm('ls-remote', fast_remote_double_cache_remote_repository, revision)\n result = yield(command)\n revdata = result.split(/[\\t\\n]/)\n newrev = nil\n revdata.each_slice(2) do |refs|\n rev, ref = *refs\n if ref.sub(/refs\\/.*?\\//, '').strip == revision.to_s\n newrev = rev\n break\n end\n end\n raise \"Unable to resolve revision for '#{revision}' on repository '#{fast_remote_double_cache_remote_repository}'.\" unless newrev =~ /^[0-9a-f]{40}$/\n return newrev\n end",
"def revision(revision)\n \"`#{hg_cmd} identify -r #{revision} | cut -f1 -d\\\\ `\"\n end",
"def get_ab_file(sanitized_name, revision)\n # any version except the 0th will be reconstructed compared to base version.\n a_or_b = revision > 0 ? 'b' : 'a'\n # TODO: why happens if the file is not mentionned in the current revision ?\n reference = revision > 0 ? revision : 'current'\n file = file_from_sanitized(sanitized_name)\n puts \"#{sanitized_name} => #{file}\"\n diff = @gerrit.file_diff(@id, CGI.escape(file), reference)\n diff['content'].map do |content|\n [\n content['ab'],\n content[a_or_b]\n ].compact\n end.flatten.join(\"\\n\")\n end",
"def scan_for_path(path, revision=nil)\n revision ||= 'tip'\n path = path.without_trailing_slash\n if path == '/' || path == ''\n search_for = \".*\"\n else\n path_re = Regexp.escape(path)\n search_for = \"#{ path_re }$|#{ path_re }\\/.*\"\n end\n contents(revision).scan(/^(\\w{40}) (\\d{3}) (\\*?) +(#{ search_for })/)\n end",
"def getFile(tree, name, path = '')\n blob = nil\n\n tree.each_blob do |file|\n blob = file if file[:name] == name[/[^\\/]*/]\n blob[:name] = path + blob[:name]\n end\n\n if blob.nil?\n tree.each_tree do |subtree|\n if subtree[:name] == name[/[^\\/]*/]\n path += name.slice! name[/[^\\/]*/]\n name[0] = ''\n return getFile($repo.lookup(subtree[:oid]), name, path + '/')\n end\n end\n end\n\n return blob\nend",
"def revision\n revisions.first\n end",
"def revision\n # HEAD is the default, but lets just be explicit here.\n get_revision('HEAD')\n end",
"def blob(repo)\n @blob ||= Grit::Blob.create(repo,\n :id => @sha, :name => name, :size => @size)\n end",
"def tree_blob(ref, path)\n ref ||= 'master'\n commit = self.commit ref\n tree = commit.tree_rpc\n Tree.content_by_path(self, tree.id, path, commit.id, tree.path)\n end",
"def call(env)\n if revision_file.exist?\n ok revision_file.read\n elsif git_repository?\n ok git_current_commit_sha\n else\n not_found 'Could not determine SHA'\n end\n end",
"def getBlobById(blob_id)\n b = @repo.blob(blob_id).data\n if b == \"\"\n # either the blob doesn't exist or it does but the data is empty\n return false\n end\n return b\n end",
"def checkout(revision)\n str = content revision\n\n # write str to current directory\n File.open(@fname, \"w\") do |f|\n f.write str\n end\n end",
"def revision_string\n unless defined? @revision_string\n revision_file = File::join( Rails.root.to_s, 'REVISION' )\n @revision_string = if File.exists? revision_file\n File.open( revision_file ) do |file|\n file.readlines.first\n end\n end\n end\n @revision_string\n end",
"def revision(number=nil)\n return nil if number.nil? || @user.nil? || @repo.nil?\n info = execute( \"commit/#{number}\" )\n return nil unless info\n YAML.load(info)['commit'] rescue nil\n end",
"def blob(id)\n head \"/blobs/#{id}\"\n end",
"def blob\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n params[:action] = \"blob\"\n\n @blob = @repository.get_blob(@branch, @path)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end",
"def file(name, version = nil, try_on_disk = false)\n ::Gollum::File.find(self, name, version.nil? ? @ref : version, try_on_disk)\n end",
"def get_file(from_path, rev=nil)\n response = get_file_impl(from_path, rev)\n parse_response(response, raw=true)\n end",
"def sha1(path)\n result = nil\n chunk_size = 10240\n File.open(path, \"r\") do |file|\n sha1 = Digest::SHA1.new\n\n while true\n chunk = file.read chunk_size\n break if ! chunk\n sha1.update chunk\n end\n result = sha1.hexdigest\n end\n result\n end",
"def find_revision(commit_id)\n # Throw 404 if it doesn't even exist\n @notebook.revisions.find_by!(commit_id: commit_id)\n # Throw forbidden if not in user's allowed list\n revision = @revisions.select {|rev| rev.commit_id == commit_id}.last\n raise User::Forbidden, 'You are not allowed to view this revision.' unless revision\n revision\n end",
"def fetch_revision(commit)\n `git rev-parse #{commit}`.tr(\"\\n\", '')\n end",
"def find_revision(revision_number)\n self.class.find_revision(id, revision_number)\n end",
"def initialize blob, path\n @blob = blob\n self.content = blob.data\n self.path = path\n end",
"def find(path)\n path = full_path(path)\n page_blob = find_blob(path)\n raise MissingResource unless page_blob\n new(page_blob, path)\n end",
"def find(revision, key, options = {})\n get_path(\n path_to_find(revision, key),\n options,\n get_parser(:object, Tinybucket::Model::BuildStatus)\n )\n end",
"def get_content(file, rev = 'HEAD', options = {})\n args = standard_args(options)\n args.push('--revision', rev)\n args.push(\"#{@repo}/#{file}\")\n\n svn('cat', args)\n end",
"def initialize(path)\n @path = path\n \n rev,path = path.split(\":\",2)\n raise ArgumentError.new(\"Must supply a git revision\") unless rev\n path = File.expand_path(path) if path\n init_git(path || '.')\n @file_pattern = if @search_path == ''\n \"**.rb\"\n elsif @search_path =~ /\\.rb#{File::SEPARATOR}$/\n # So appending each piece into the search path during init_git\n # causes the search path to always end with a /\n @search_path[0...-1]\n else\n File.join(@search_path,\"**.rb\")\n end\n \n @files = []\n \n FileUtils.cd(@working_dir) do\n git_list = git \"ls-tree -r #{rev}\"\n git_list.each_line do |line|\n file = GitFile.new(*line.chomp.split(/\\s+/,4))\n \n if file.type == 'blob' and File.fnmatch(@file_pattern, file.name)\n @files << file \n end\n end\n end\n \n end",
"def read\n client[\"/vaults/#{vault_id}/blobs/#{blob_id}\"].get\n end",
"def get_revision(rev_num)\n if @current_revision.revision_identifier.to_s == rev_num\n return @current_revision\n end\n @revision_history.each do |revision|\n if revision.revision_identifier.to_s == rev_num\n return revision\n end\n end\n # revision with the specified revision number does not exist,\n # so raise error\n raise Repository::RevisionDoesNotExist\n end",
"def revision(revision)\n raise NotImplementedError\n end",
"def revision_file\n @root.join('REVISION')\n end",
"def blob\n generate\n storage.get(path).body\n end",
"def find_revision(id, revision_number)\n revision_record_class.find_revision(self, id, revision_number)\n end",
"def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end",
"def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end",
"def git_revision\n puts \"Fetching the git revision\"\n\n _stdin, stdout, stderr, wait_thread = Open3.popen3(\"git rev-parse HEAD\")\n\n success = wait_thread.value.success?\n\n status = success ? Rack::ECG::Check::Status::OK : Rack::ECG::Check::Status::ERROR\n\n value = success ? stdout.read : stderr.read\n value = value.strip\n\n { name: :git_revision, status: status, value: value }\nend",
"def query_revision(revision)\n return revision if revision =~ /^\\d+$/\n command = scm(:info, repository, authentication, \"-r#{revision}\")\n result = yield(command)\n yaml = YAML.load(result)\n raise \"tried to run `#{command}' and got unexpected result #{result.inspect}\" unless Hash === yaml\n yaml['Last Changed Rev'] || yaml['Revision']\n end",
"def revision(version)\n revision_with audit_changes(version)\n end",
"def find_gracefully path\n path = full_path(path)\n if blob = find_blob(path)\n new(blob, path)\n else\n nil\n end\n end",
"def revision_id\n Digest::SHA1.new.hexdigest(canonical_revision_string)\n end",
"def sha1\n @sha1 ||= digest(path, :sha1)\n end",
"def revision\n @revision ||= begin\n unless info(:latest_available_revision)\n self.class.find(info(:id)).revision\n else\n Data::SongRevision.new(info(:latest_available_revision))\n end\n end\n end",
"def revisions(path, opts = {})\n optional_inputs = opts\n input_json = {\n path: path,\n path_revision: optional_inputs[:path_revision],\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/revisions\", input_json)\n Dropbox::API::RevisionHistory.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def fetch_revision\n end",
"def get_file_impl(from_path, rev=nil) # :nodoc:\n params = {}\n params['rev'] = rev.to_s if rev\n\n path = \"/files/#{@root}#{format_path(from_path)}\"\n @session.do_get build_url(path, params, content_server=true)\n end",
"def [](path, entry=false, committed=false)\n tree = committed ? commit_tree : @tree\n \n segments = split(path)\n unless basename = segments.pop\n return entry ? tree : tree.keys\n end\n \n unless tree = tree.subtree(segments)\n return nil \n end\n \n obj = tree[basename]\n return obj if entry\n \n case obj\n when Array then get(:blob, obj[1]).data\n when Tree then obj.keys\n else nil\n end\n end",
"def commit_file(revision)\n c = @gerrit.commit(@id, revision)\n file = []\n file += c['parents'].map do |parent|\n \"Parent: #{parent['commit'][0..6]} (#{parent['subject']})\"\n end\n file += %w(committer author).map do |t|\n [\n \"#{t.capitalize}: #{c[t]['name']} <#{c[t]['email']}>\",\n \"#{t.capitalize}Date: #{c[t]['date']}\"\n ]\n end.flatten\n file << ''\n file << c['message']\n file.join(\"\\n\")\n end",
"def content(revision)\n line = get_indexfile_with_revision(revision)\n if line.nil?\n raise \"Revision does not exist: #{revision} for #{@fname}\"\n end\n parse = parse_indexfile_line line\n offset = parse[1]\n length = parse[2]\n str = \"\"\n\n # read file from offset to (offset+length-1)\n (offset...(offset+length)).each do |l|\n str += IO.readlines(@datafile)[l]\n end\n\n # decompress back to text\n str = Inflate.inflate(str)\n end",
"def read_from_blobs_file(entry)\n begin\n raw = File.read(@blobs_file_name, entry[BYTES], entry[START])\n rescue => e\n PEROBS.log.fatal \"Cannot read blobs file #{@blobs_file_name}: \" +\n e.message\n end\n if Zlib.crc32(raw, 0) != entry[CRC]\n PEROBS.log.fatal \"BTreeBlob for object #{entry[ID]} has been \" +\n \"corrupted: Checksum mismatch\"\n end\n\n raw\n end",
"def to_blob\n File.binread(path)\n end",
"def get_blob(container, blob, options={})\n query = { }\n StorageService.with_query query, 'snapshot', options[:snapshot]\n StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = StorageService.common_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n StorageService.with_header headers, 'x-ms-range', \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n StorageService.with_header headers, 'x-ms-range-get-content-md5', true if options[:get_content_md5]\n end\n add_blob_conditional_headers options, headers\n\n response = call(:get, uri, nil, headers, options)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end",
"def get_file(path, file_id = nil, file_log = nil)\n file_id = file_node(path) if file_id.nil?\n VersionedFile.new(@repo, path, :file_id => file_id, :changeset => self,\n :file_log => file_log)\n end",
"def version(revision_number)\n self.versions.find_by_revision_number(revision_number)\n end",
"def save_revision(revision)\n if revision.save\n revision.page.body = revision.contents\n revision.page.file_path = revision.file_path\n flash[:success] = 'Revision created.'\n redirect_to revision.page and return if revision.page.save\n else\n flash[:danger] = 'Revision failed.'\n redirect_to revision.page\n end\n end",
"def snapshot\r\n date = self.class.service_instance.snapshot_blob(self.path)\r\n properties = self.class.service_instance.get_blob_properties(self.path)\r\n return BlobObject.new(:name => self.name, \r\n :url => self.class.service_instance.generate_request_uri(self.path) + \"?snapshot=#{date}\",\r\n :content_type => properties[:content_type],\r\n :snapshot_date => date)\r\n end",
"def cache_repository_revision\n logger.info cache_repository_path.inspect\n File.exists?(cache_repository_path) ? `cd #{cache_repository_path} && git rev-parse --short #{branch}`.strip : \"<em>uncached</em>\".html_safe\n end",
"def revision(revision)\n \"`#{p4_cmd} changes -s submitted -m 1 ...#{rev_no(revision)} | cut -f 2 -d\\\\ `\"\n end",
"def revision\n @handler.revision_info['commit']\n end",
"def revision\n raise NotImplementedError.new(\"revision() must be implemented by subclasses of AbstractVersionedFile.\")\n end",
"def fetch_svn_commit(rev)\n url_str = bot.config['svn_root_url']\n commit = []\n begin\n @log.info \"checking #{url_str} for new commit...\"\n\n # https://username:password@svn.host.com:8080/svn/path/in/repo/\n url = Addressable::URI.parse(url_str)\n\n @log.debug PP.singleline_pp(url.to_hash, '')\n xmldata = `svn log --xml -v -r #{rev} #{url.omit(:user, :password)}`\n doc = REXML::Document.new(xmldata)\n \n doc.elements.inject('log/logentry', commit) do |commit, element|\n commit.push({:url => url}.merge(parse_entry_info(element)))\n end\n @log.debug PP.singleline_pp(commit, '')\n\n rescue Exception => e\n @log.error \"error connecting to svn: #{e.message}\"\n end\n return commit\n end",
"def get(from_location, local_filepath, revision = nil)\n contents, metadata = @client.get_file_and_metadata(from_location, revision)\n File.open(local_filepath, 'wb'){ |f| f.write contents }\n metadata\n rescue\n puts $! if @@verbose\n nil\n end",
"def get_page(path, raw = false)\n\n #head = @repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n blob = tree / path\n\n return nil if ! blob.is_a? Grit::Blob\n\n text = blob.data.force_encoding('utf-8').encode\n return [ text, blob.id ]\n end",
"def revision_from_ref(repo_path, ref)\n begin\n show_ref(repo_path, ref)\n rescue GitError\n begin\n git('rev-parse', ref)\n ref\n rescue GitError\n raise InvalidGitRef, ref\n end\n end\n end",
"def blob_path(blob)\n tempfile = Tempfile.open(\n [\"Ratonvirus\", blob.filename.extension_with_delimiter],\n tempdir\n )\n\n begin\n tempfile.binmode\n blob.download { |chunk| tempfile.write(chunk) }\n tempfile.flush\n tempfile.rewind\n\n yield tempfile.path\n ensure\n tempfile.close!\n end\n end",
"def file(name, version = 'master')\n @file_class.new(self).find(name, version)\n end",
"def path_to_object(path)\n treeish = (@staging_index ? staging.sha : @current_branch)\n tree = self.tree(treeish, [path])\n return tree.blobs.first if tree && (not tree.blobs.empty?)\n return tree.trees.first if tree && (not tree.trees.empty?)\n\n # check staging index in case object has not been written to object DB\n staging? ? staging.path_to_object(path) : nil\n end",
"def commit_data(sha)\n sha = sha.to_s\n cdata = get_raw_repo.cat_file(revparse(sha))\n process_commit_data(cdata, sha)\n end",
"def revision\n return @changeset.revision if @changeset\n file_log[@file_rev].link_rev\n end",
"def get_file(filename, branch_or_tag='master') \n\t\tlog = repo.log(branch_or_tag, filename) \n\t\treturn log.first.tree.contents.first.data\n\tend",
"def blobs_for_committish(committish)\n commits = grit.batch(committish)\n unless commits.empty?\n commits.first.tree.blobs\n end\n end",
"def find_svn_rev_for_commit(repo_path, commit)\n `(cd \"#{repo_path}\" && git svn find-rev #{commit})`.strip\n end",
"def preview(path, opts = {})\n optional_inputs = opts\n input_json = {\n path: path,\n path_revision: optional_inputs[:path_revision],\n }\n response = @session.do_content_endpoint(\"/#{ @namespace }/preview\", input_json)\n file, metadata = Dropbox::API::HTTP.parse_content_response(response)\n return file, Dropbox::API::File.from_json(metadata)\n end",
"def find_or_create(path)\n path = full_path(path)\n if page_blob = find_blob(path)\n new(page_blob, path)\n else\n new(create_blob_for(path), path)\n end\n end",
"def blob_path(relative = true)\n blob_path = File.join(self.class.name, hash.to_s)\n if relative\n blob_path\n else\n File.join(repository_path, blob_path)\n end\n end",
"def get_path(sha1)\n sha1[0...2] + '/' + sha1[2..40]\n end",
"def get(path, rev = nil)\n invoke(Request.new(:path => path, :rev => rev, :verb => Request::Verb::GET))\n end",
"def get_revision(revision_identifier)\n raise NotImplementedError\n end",
"def path_to_sha(path, head=@current_branch)\n # Return the root of the repo if no path is specified\n return root_sha(head) if (not path) || (path.empty?)\n\n if staging?\n @staging_index.sync\n head = @staging_index.current_tree.id\n end\n\n dir = tree(head, [path])\n (dir && dir.contents.length > 0) ? dir.contents.first.id : nil\n end",
"def file(path)\n full_path = @repository_path + path\n return nil unless full_path.exist?\n FileStreamer.new(full_path)\n end",
"def read_binary(path)\n if exist? path\n File.binread(expand path)\n else\n nil\n end\n end",
"def git_sha_for(path)\n website.git_repository.git_sha path\n end",
"def get_blob(container, blob, options={})\n query = { }\n query['snapshot'] = options[:snapshot] if options[:snapshot]\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n headers['x-ms-range'] = \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n headers['x-ms-range-get-content-md5'] = true if options[:get_content_md5]\n end\n\n response = call(:get, uri, nil, headers)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end",
"def find_commit_for_svn_rev(repo_path, svn_rev, base_branch)\n `(cd \"#{repo_path}\" && git rev-list #{base_branch} --grep=\"git-svn-id:.*@#{svn_rev}\")`.strip\n end"
] |
[
"0.64253104",
"0.6189137",
"0.6151744",
"0.60514784",
"0.5978542",
"0.5820494",
"0.5800391",
"0.5717419",
"0.56746423",
"0.56132966",
"0.5612641",
"0.5598876",
"0.55854297",
"0.554598",
"0.55346954",
"0.55052537",
"0.55003595",
"0.54978174",
"0.5492217",
"0.5423687",
"0.53947526",
"0.53755295",
"0.5366686",
"0.5316235",
"0.531109",
"0.5278289",
"0.527052",
"0.5262349",
"0.52445734",
"0.52252066",
"0.5221514",
"0.5219152",
"0.5217053",
"0.52115613",
"0.5202029",
"0.51992106",
"0.5171918",
"0.5163075",
"0.51527125",
"0.51500493",
"0.51099634",
"0.5102288",
"0.5087094",
"0.5083103",
"0.50817645",
"0.50764424",
"0.5064848",
"0.5061253",
"0.5058298",
"0.50319743",
"0.5014532",
"0.5014532",
"0.5014498",
"0.49994057",
"0.49988636",
"0.49950936",
"0.4983519",
"0.49825934",
"0.49786937",
"0.49772632",
"0.49735013",
"0.49726436",
"0.49707425",
"0.49707067",
"0.49548453",
"0.49525067",
"0.4948353",
"0.4935516",
"0.49293092",
"0.49227738",
"0.49210343",
"0.4908644",
"0.48944527",
"0.48925278",
"0.4882454",
"0.48778942",
"0.48699024",
"0.48628062",
"0.4861553",
"0.4859698",
"0.4853845",
"0.48527464",
"0.48340952",
"0.4832839",
"0.48271504",
"0.48246884",
"0.48184264",
"0.48037696",
"0.47929162",
"0.47908702",
"0.47894758",
"0.47866526",
"0.47828132",
"0.47769043",
"0.4770155",
"0.47696605",
"0.47669134",
"0.47649354",
"0.4758354",
"0.4756044"
] |
0.5585678
|
12
|
Resolves the given relative path of file in repository into canonical path based on the specified base_path. Examples: File in the same directory as the current path resolve_relative_path("users.adoc", "doc/api/README.adoc") => "doc/api/users.adoc" File in the same directory, which is also the current path resolve_relative_path("users.adoc", "doc/api") => "doc/api/users.adoc" Going up one level to a different directory resolve_relative_path("../update/7.14to8.0.adoc", "doc/api/README.adoc") => "doc/update/7.14to8.0.adoc" Returns a String
|
def resolve_relative_path(path, base_path)
p = Pathname(base_path)
p = p.dirname unless p.extname.empty?
p += path
p.cleanpath.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resolvePath(possiblyRelativePath, rootDir)\n\t\tpath = Pathname.new(possiblyRelativePath)\n\t\tif(path.absolute?()) then\n\t\t\treturn path.to_s()\n\t\telse\n\t\t\trootPath = Pathname.new(rootDir)\n\t\t\treturn rootPath.join(path)\n\t\tend\n\tend",
"def getFullPath(relativePath)\n return baseDir + relativePath\n end",
"def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end",
"def absolute_path(relative_path)\n if relative_path.start_with?(\"/\")\n relative_path\n else\n File.join(@@project_root, relative_path)\n end\n end",
"def getFullPath(relativePath)\n return @baseDirectory.fullPath + relativePath\n end",
"def resolve_path(path)\n unless Pathname.new(path).absolute?\n File.join(Dir.pwd, path)\n else\n path\n end\nend",
"def resolve_path(path)\n unless Pathname.new(path).absolute?\n File.join(Dir.pwd, path)\n else\n path\n end\nend",
"def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end",
"def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end",
"def resolve_path(path)\n path = File.absolute_path(path) if path.start_with?('./', '../')\n\n abs_path = File.absolute_path(path)\n if path == abs_path\n path if (@load_paths_subset || File).exist?(path)\n else\n (@load_paths_subset || self).load_paths.each do |load_path|\n possible_path = File.absolute_path(path, load_path)\n\n next unless (@load_paths_subset || File).exist?(possible_path)\n # Ruby 2.5 changed some behaviors of require related to symlinks in $LOAD_PATH\n # https://bugs.ruby-lang.org/issues/10222\n return File.realpath(possible_path) if RUBY_VERSION >= '2.5'\n return possible_path\n end\n nil\n end\n end",
"def resolve_path(path, reference)\n # Absolute URL\n if path =~ %r{^(/|[a-z]+:)}\n if @options[:document_root].nil?\n msg = \"Cannot resolve absolute path '#{path}' without document root option\"\n raise ArgumentError.new(msg)\n end\n\n path.sub!(%r{^[a-z]+://[^/]+/}, '')\n return File.expand_path(File.join(@options[:document_root], path))\n end\n\n File.expand_path(File.join(File.dirname(reference), path))\n end",
"def resolve_path(path)\n path = File.absolute_path(path) if path.start_with?('./') || path.start_with?('../')\n\n if Pathname.new(path).absolute?\n return path if File.exists?(path)\n return nil\n end\n\n @load_path.each do |load_path|\n possible_path = File.absolute_path(path, load_path)\n return possible_path if File.exists?(possible_path)\n end\n\n nil\n end",
"def relative_path(*relative)\n Pathname.pwd.join(*(relative.flatten.map(&:to_s))).expand_path\n end",
"def relative_path_to(path, relative_to = nil)\n if relative_to\n path = File.expand_path(\n # symlink, e.g. \"../../../../grid5000/environments/etch-x64-base-1.0.json\"\n path,\n # e.g. : File.join(\"/\", File.dirname(\"grid5000/sites/rennes/environments/etch-x64-base-1.0\"))\n File.join('/', File.dirname(relative_to))\n ).gsub(%r{^/}, '')\n end\n path\n end",
"def lookup(base_path, relative_path, options={})\n exts = default_file_extensions\n if options[:load] or exts.include?(File.extname(relative_path))\n abspath = File.join(base_path, relative_path)\n File.exist?(abspath) ? abspath : nil\n else\n exts.each do |ext|\n abspath = File.join(base_path, relative_path + ext)\n return abspath if File.exist?(abspath)\n end\n nil\n end\n end",
"def relative_file_path(file_path)\n file_path.gsub(/#{pwd}\\//, '')\n end",
"def relativize(base_uri)\n if self.to_s.start_with?(base_uri.to_s) && %w(# ?).include?(self.to_s[base_uri.to_s.length, 1]) ||\n base_uri.to_s.end_with?(\"/\", \"#\") &&\n self.to_s.start_with?(base_uri.to_s)\n return RDF::URI(self.to_s[base_uri.to_s.length..-1])\n else\n # Create a list of parents, for which this IRI may be relative.\n u = RDF::URI(base_uri)\n iri_set = u.to_s.end_with?('/') ? [u.to_s] : []\n iri_set << u.to_s while (u = u.parent)\n iri_set.each_with_index do |bb, index|\n next unless self.to_s.start_with?(bb)\n rel = \"../\" * index + self.to_s[bb.length..-1]\n return rel.empty? ? \"./\" : rel\n end\n end\n self\n end",
"def relativize_path path\n base_dir = Pathname.new(File.expand_path(DIR))\n other_dir = Pathname.new(File.expand_path(path))\n other_dir.relative_path_from base_dir\n end",
"def merge_path(base, rel)\n\n # RFC2396, Section 5.2, 5)\n # RFC2396, Section 5.2, 6)\n base_path = split_path(base)\n rel_path = split_path(rel)\n\n # RFC2396, Section 5.2, 6), a)\n base_path << '' if base_path.last == '..'\n while i = base_path.index('..')\n base_path.slice!(i - 1, 2)\n end\n\n if (first = rel_path.first) and first.empty?\n base_path.clear\n rel_path.shift\n end\n\n # RFC2396, Section 5.2, 6), c)\n # RFC2396, Section 5.2, 6), d)\n rel_path.push('') if rel_path.last == '.' || rel_path.last == '..'\n rel_path.delete('.')\n\n # RFC2396, Section 5.2, 6), e)\n tmp = []\n rel_path.each do |x|\n if x == '..' &&\n !(tmp.empty? || tmp.last == '..')\n tmp.pop\n else\n tmp << x\n end\n end\n\n add_trailer_slash = !tmp.empty?\n if base_path.empty?\n base_path = [''] # keep '/' for root directory\n elsif add_trailer_slash\n base_path.pop\n end\n while x = tmp.shift\n if x == '..'\n # RFC2396, Section 4\n # a .. or . in an absolute path has no special meaning\n base_path.pop if base_path.size > 1\n else\n # if x == '..'\n # valid absolute (but abnormal) path \"/../...\"\n # else\n # valid absolute path\n # end\n base_path << x\n tmp.each {|t| base_path << t}\n add_trailer_slash = false\n break\n end\n end\n base_path.push('') if add_trailer_slash\n\n return base_path.join('/')\n end",
"def rel_path(path)\n Pathname(path).expand_path.relative_path_from(Pathname(Dir.pwd))\n end",
"def path_from(relative_path)\n path.sub(/^#{Regexp.escape(relative_path)}\\/?/, '')\n end",
"def path_from(relative_path)\n path.sub(/^#{Regexp.escape(relative_path)}\\/?/, '')\n end",
"def relative_path\n @relative_path ||= File.join(@dir, @name)\n end",
"def relative_path\n @relative_path ||= PathManager.join(@dir, @name).delete_prefix(\"/\")\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def relative_pathname\n @relative_pathname ||= Pathname.new(relativize_root_path(pathname))\n end",
"def relroot\n Pathname.new(File.expand_path(path)).\n relative_path_from(Pathname.new(File.expand_path(root))).to_s\n end",
"def absolute_path(relative_path)\n quoted_string(File.expand_path(File.join(File.dirname(options[:filename]), relative_path.value)))\n end",
"def resolve(context, path, base_path)\n paths, root_path = possible_files(context, path, base_path)\n paths.each do |file|\n found_item = resolve_path_with_load_paths(context, path, root_path, file)\n return found_item if !found_item.nil? && asset_requirable?(context, found_item)\n end\n nil\n end",
"def relative_path(path = @pwd, to = @root)\n Pathname.new(path).relative_path_from(Pathname.new(to)).to_s\n end",
"def relative_path(pathname)\n pwd = Pathname.new('.').realpath\n pathname.file_ref.real_path.relative_path_from(pwd)\n end",
"def relative(paths, reference_path = Dir.pwd)\n paths = [paths].flatten.collect do |path|\n path = Pathname.new(File.expand_path(path))\n reference_path = Pathname.new(File.expand_path(reference_path))\n path.relative_path_from(reference_path).to_s\n end\n\n paths.length == 1 ? paths.first : paths\n end",
"def relative_path(options = {})\n @relative_path ||= Pathname.new(filename).relative_path_from(Pathname.new(base)).to_s\n path_with_cache_buster(@relative_path, options)\n end",
"def absolute_paths_for(relative_path)\n base_directories.inject([]) do |acc, dir|\n f = \"#{dir}/#{relative_path}\"\n File.exists?(f) ? acc << f : acc\n end\n end",
"def resolve_path(source, required)\n Pathname.new(source).dirname.join(required.to_str).cleanpath.to_path\n end",
"def resolve(path, base_path)\n possible_files(path, base_path).each do |file|\n context.resolve(file) { |found| return found if context.asset_requirable?(found) }\n end\n\n nil\n end",
"def relativize( path ) # :doc:\n p = Pathname.new( path )\n unless p.relative?\n p = p.relative_path_from( Pathname.pwd ).to_s\n p += '/' if path[-1] == '/'\n path = p if p.length < path.length\n end\n path\n end",
"def create_absolute_url_from_base(potential_base, relative_url)\n begin\n\t\t\t#puts \"Determine the absolute URL from potential base #{potential_base} and relative URL #{relative_url}\" if @verbose\n\t\t\tnaked_base = url_2_site(potential_base).strip.chop \n\t\t\tputs \"Found absolute URL: #{naked_base+relative_url}\" if @verbose\n\t\t\treturn naked_base + relative_url\n rescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n end",
"def relative_path\n @relative_path ||= File.join(@dir, @target)\n end",
"def relative_path\n @relative_path ||= path.sub(\"#{site.collections_path}/\", \"\")\n end",
"def get_relative_path(path)\n Util::path_rel_to_path(path, recipe_file.path).to_s\n end",
"def relativepath(abspath, relativeto)\n path = abspath.split(File::SEPARATOR)\n rel = relativeto.split(File::SEPARATOR)\n while (path.length > 0) && (path.first == rel.first)\n path.shift\n rel.shift\n end\n ('..' + File::SEPARATOR) * (rel.length - 1) + path.join(File::SEPARATOR)\n end",
"def valid_relative_string(relative_pathname)\n if relative_pathname.nil? || relative_pathname.empty? || (relative_pathname.include? ' ')\n raise 'relative_location provided to common_paths must be nonempty and without spaces'\n end\n\n begin\n Pathname.new(CURRENT_DIR).relative_path_from(Pathname.new(relative_pathname)).to_s unless relative_pathname.eql? CURRENT_DIR\n rescue\n raise 'paths provided to CommonPaths must be a relative, subdirectory, and a valid Pathname'\n end\n end",
"def unravel_relative_path(rel_path)\n path_parts = rel_path.split '.'\n \n full_rel_path = \"\"\n defined_path = nil\n counter = path_parts.length\n \n for path_part in path_parts do\n path = defined_path.nil? ? path_part : \"#{defined_path}.#{path_part}\"\n if path_defined? path\n defined_path = path\n else\n break\n end\n counter = counter - 1\n end\n \n full_rel_path << self.defined_path(defined_path).full_rel_path if (not defined_path.nil?)\n if (counter > 0)\n full_rel_path << \".\" if (not defined_path.nil?)\n full_rel_path << path_parts.last(counter).join('.')\n end\n \n return full_rel_path\n end",
"def GetProjectDirectoryRelativeBaseDirectory(projectRelativePath)\n return FormatXmlPath(StripFilenameFromPath(projectRelativePath))\n end",
"def make_absolute(base, relative_url)\n puts \"Determine and return the absolute URL:\\n Base: #{base}, Relative: #{relative_url} \" if @verbose\n\t\tbegin\n\t\t\tabsolute_url = nil;\n\t\t\tif relative_url =~ /^\\//\n\t\t\t\tabsolute_url = create_absolute_url_from_base(base, relative_url)\n\t\t\telse\n\t\t\t\tabsolute_url = create_absolute_url_from_context(base, relative_url)\n\t\t\tend\n\t\t\tputs \"Found absolute URL: #{absolute_url}\" if @verbose\n\t\t\treturn absolute_url\n rescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n end",
"def relative(file)\n if File.directory?(full_path)\n file[full_path.length+1..-1]\n else\n File.basename(file)\n end\n end",
"def relative_to_absolute(path)\n if Pathname.new(path).absolute?\n Pathname.new(path)\n else\n Pathname.new(\"#{Pathname.pwd}/#{path}\")\n end\n end",
"def relative_path\n self.path.sub(File.expand_path(options[:root_dir]) + '/', '')\n end",
"def relativize_path(path)\n path.to_s.gsub(/^\\/?#{Regexp.escape(root_path.to_s)}\\/?/, '')\n end",
"def explicit_relative(path)\n # Paths that do not start with \"/\", \"./\", or \"../\" will be prefixed with ./\n path.sub(%r(^(?!\\.{0,2}/)), './')\n end",
"def realpath(*args)\n unless args.empty?\n warn \"The argument for Pathname#realpath is obsoleted.\"\n end\n force_absolute = args.fetch(0, true)\n\n\t\t# XXX: see http://wiki.rubyonrails.com/rails/pages/Gotcha\n is_absolute = %r{\\A/}\n\t\ttop = '/'\n\t\tif Config::CONFIG['arch'] =~ %r{mswin32}i\n\t\t\tis_absolute = %r{\\A[A-Za-z]:/}\n\t\t\ttop = ''\n\t\tend\n if is_absolute =~ @path\n unresolved = @path.scan(%r{[^/]+})\n elsif force_absolute\n # Although POSIX getcwd returns a pathname which contains no symlink,\n # 4.4BSD-Lite2 derived getcwd may return the environment variable $PWD\n # which may contain a symlink.\n # So the return value of Dir.pwd should be examined.\n unresolved = Dir.pwd.scan(%r{[^/]+}) + @path.scan(%r{[^/]+})\n else\n top = ''\n unresolved = @path.scan(%r{[^/]+})\n end\n resolved = []\n\n until unresolved.empty?\n case unresolved.last\n when '.'\n unresolved.pop\n when '..'\n resolved.unshift unresolved.pop\n else\n loop_check = {}\n while (stat = File.lstat(path = top + unresolved.join('/'))).symlink?\n symlink_id = \"#{stat.dev}:#{stat.ino}\"\n raise Errno::ELOOP.new(path) if loop_check[symlink_id]\n loop_check[symlink_id] = true\n if %r{\\A/} =~ (link = File.readlink(path))\n top = '/'\n unresolved = link.scan(%r{[^/]+})\n else\n unresolved[-1,1] = link.scan(%r{[^/]+})\n end\n end\n next if (filename = unresolved.pop) == '.'\n if filename != '..' && resolved.first == '..'\n resolved.shift\n else\n resolved.unshift filename\n end\n end\n end\n\n if top == '/'\n resolved.shift while resolved[0] == '..'\n end\n \n if resolved.empty?\n Pathname.new(top.empty? ? '.' : '/')\n else\n Pathname.new(top + resolved.join('/'))\n end\n end",
"def resolve_project descriptor_path, conf\n trace { \"trying to resolve project, descriptor_path: #{descriptor_path.inspect}, conf: #{conf.inspect} [AppSpec#resolve_path]\" }\n\n project_path = conf['project_path']\n return File.join File.dirname(descriptor_path), project_path if project_path and valid_path descriptor_path\n\n trace { 'didn\\'t have both a project_path and a descriptor_path that was valid [AppSpec#resolve_project]' }\n return project_path if project_path\n find_first_project descriptor_path\n end",
"def relative_path(from, to); end",
"def find_relative(uri, base, options)\n nil\n end",
"def relative_path(path)\n path[self.prefix.size..-1].gsub(%r{^/}, '').tap do |pth|\n #puts \"self.prefix=#{self.prefix}, path=#{path}, result=#{pth}\"\n end\n end",
"def relative_path_from(from); end",
"def relativize(href, path, absolute_base, root_dir)\n # href = actual href string on page\n # path = actual current location / file path of current page\n # absolute_base = the base url for the site\n\n href_url = URI.join(URI.encode(absolute_base), URI.encode(href))\n path_url = URI.join(absolute_base, URI.encode(path))\n relative_url = path_url.route_to(href_url).to_s\n url_out = test_index(relative_url, href_url, absolute_base, root_dir)\n if href.match(/^#/)\n url_out = href\n end\n url_out\nend",
"def resolve(context, path, base_path)\n possible_files(context, path, base_path).each do |file|\n context.resolve(file) { |found| return found if context.asset_requirable?(found) }\n end\n\n nil\n end",
"def find_relative_git_cookbook_path\n\n cb = Pathname.new(find_local_cookbook).realpath()\n git_root = Pathname.new(find_git_root(cb)).realpath()\n relative = cb.relative_path_from(git_root)\n #puts (\"find cb \\n#{cb} relative to path\\n#{git_root} and it is \\n#{relative}\")\n return relative.to_s\n end",
"def relative_path(path_to, path_from)\n path_from ||= \"\"\n path_to = Pathname.new(path_to)\n dir_from = Pathname.new(path_from).dirname\n\n path_to.relative_path_from(dir_from).to_s\n end",
"def relative_path\n @relative_path ||= absolute_path.sub(/^#{Bookshelf::remote_folder}\\/?/,'')\n end",
"def test_relative_path_from\n assert_relpath('../a', 'a', 'b')\n assert_relpath('../a', 'a', 'b/')\n assert_relpath('../a', 'a/', 'b')\n assert_relpath('../a', 'a/', 'b/')\n assert_relpath('../a', '/a', '/b')\n assert_relpath('../a', '/a', '/b/')\n assert_relpath('../a', '/a/', '/b')\n assert_relpath('../a', '/a/', '/b/')\n\n assert_relpath('../b', 'a/b', 'a/c')\n assert_relpath('../a', '../a', '../b')\n\n assert_relpath('a', 'a', '.')\n assert_relpath('..', '.', 'a')\n\n assert_relpath('.', '.', '.')\n assert_relpath('.', '..', '..')\n assert_relpath('..', '..', '.')\n\n assert_relpath('c/d', '/a/b/c/d', '/a/b')\n assert_relpath('../..', '/a/b', '/a/b/c/d')\n assert_relpath('../../../../e', '/e', '/a/b/c/d')\n assert_relpath('../b/c', 'a/b/c', 'a/d')\n\n assert_relpath('../a', '/../a', '/b')\n #assert_relpath('../../a', '../a', 'b') # fails\n assert_relpath('.', '/a/../../b', '/b')\n assert_relpath('..', 'a/..', 'a')\n assert_relpath('.', 'a/../b', 'b')\n\n assert_relpath('a', 'a', 'b/..')\n assert_relpath('b/c', 'b/c', 'b/..')\n\n assert_relpath_err('/', '.')\n assert_relpath_err('.', '/')\n assert_relpath_err('a', '..')\n assert_relpath_err('.', '..')\n end",
"def relative_path\n File.join(@repo, @bundle)\n end",
"def rel relative_path\r\n return File.dirname(__FILE__) + \"/../\" + relative_path\r\nend",
"def relative\n return self if relative?\n @relativized ||= relative_path_from root\n end",
"def realpath(*args)\n unless args.empty?\n warn \"The argument for Path::Name#realpath is obsoleted.\"\n end\n force_absolute = args.fetch(0, true)\n\n if @path.first == ''\n top = '/'\n unresolved = @path.slice(1..-1) #.scan(%r{[^/]+})\n elsif force_absolute\n # Although POSIX getcwd returns a pathname which contains no symlink,\n # 4.4BSD-Lite2 derived getcwd may return the environment variable $PWD\n # which may contain a symlink.\n # So the return value of Dir.pwd should be examined.\n top = '/'\n unresolved = Dir.pwd.split(%r{/}) + @path\n else\n top = ''\n unresolved = @path.dup #.scan(%r{[^/]+})\n end\n resolved = []\n\n until unresolved.empty?\n case unresolved.last\n when '.'\n unresolved.pop\n when '..'\n resolved.unshift unresolved.pop\n else\n loop_check = {}\n while (stat = File.lstat(path = top + unresolved.join('/'))).symlink?\n symlink_id = \"#{stat.dev}:#{stat.ino}\"\n raise Errno::ELOOP.new(path) if loop_check[symlink_id]\n loop_check[symlink_id] = true\n if %r{\\A/} =~ (link = File.readlink(path))\n top = '/'\n unresolved = link.split(%r{/}) #scan(%r{[^/]+})\n else\n unresolved[-1,1] = link.split(%r{/}) #.scan(%r{[^/]+})\n end\n end\n next if (filename = unresolved.pop) == '.'\n if filename != '..' && resolved.first == '..'\n resolved.shift\n else\n resolved.unshift filename\n end\n end\n end\n\n if top == '/'\n resolved.shift while resolved[0] == '..'\n end\n\n if resolved.empty?\n Path::Name.new(top.empty? ? '.' : '/')\n else\n if top.empty?\n Path::Name.new(resolved)\n else\n Path::Name.new(resolved, true)\n end\n end\n end",
"def convert_path(path)\n base_path = Dir.pwd\n\n begin\n Pathname.new(File.expand_path(path)).relative_path_from(base_path).to_s\n rescue ArgumentError\n path\n end\n end",
"def convert_path(path)\n base_path = Dir.pwd\n\n begin\n Pathname.new(File.expand_path(path)).relative_path_from(base_path).to_s\n rescue ArgumentError\n path\n end\n end",
"def relative_path(target = '.')\n my_path = Pathname.new(path).expand_path\n target_path = Pathname.new(target.to_s).expand_path\n target_path = target_path.dirname if target_path.file?\n\n new_path = my_path.relative_path_from(target_path).to_s\n\n return new_path if new_path.index('.') == 0\n \"./#{new_path}\"\n end",
"def relative_path(target = '.')\n my_path = Pathname.new(path).expand_path\n target_path = Pathname.new(target.to_s).expand_path\n target_path = target_path.dirname if target_path.file?\n\n new_path = my_path.relative_path_from(target_path).to_s\n\n return new_path if new_path.index('.') == 0\n \"./#{new_path}\"\n end",
"def relative_path(p = path)\n anchor = p.ftype == \"directory\" ? @root_path : \"public\"\n p.relative_path_from(Pathname.new(anchor).realpath)\n end",
"def resolve_path(path)\n fail_script_unless_file_exists path\n return path\n end",
"def resolve_path(path)\n fail_script_unless_file_exists path\n return path\n end",
"def relativePath\n #N Without this the path elements won't be joined together with \"/\" to get the relative path as a single string\n return @pathElements.join(\"/\")\n end",
"def gem_expand_file(rel_file)\n if File.exist?(a=File.join(GEM_ROOT, rel_file))\n File.expand_path(a)\n else\n raise Errno::ENOENT, rel_file\n end\n end",
"def replace_relative_references(ts_path, source)\n ts_dir = File.dirname(File.expand_path(ts_path))\n escaped_dir = ts_dir.gsub(/[\"\\\\]/, '\\\\\\\\\\&') # \"\\\"\" => \"\\\\\\\"\", '\\\\' => '\\\\\\\\'\n\n # Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0\n # So we go the long way around.\n (source.each_line.map do |l|\n if l.start_with?('///') && !(m = %r{^///\\s*<reference\\s+path=(?:\"([^\"]+)\"|'([^']+)')\\s*/>\\s*}.match(l)).nil?\n matched_path = m.captures.compact[0]\n l = l.sub(matched_path, File.join(escaped_dir, matched_path))\n end\n next l\n end).join\n end",
"def absolute_path(path, reference = @pwd)\n path = File.expand_path(File.join(reference, path)) unless path.start_with? '/'\n path\n end",
"def relative_path(path)\n path.split('/').drop(5).join('/')\nend",
"def qualify_path(path, root = @app_dir)\n \"$PWD/#{Pathname.new(path).relative_path_from(Pathname.new(root))}\"\n end",
"def absolutify_url(src, base_url, parent_url)\n if src.nil? || src.empty? || src == \"//:\" || src =~ /\\s*http:\\/\\//i\n return src\n end\n \n return \"#{base_url}#{src}\" if src =~ /^\\s*\\//\n return \"#{parent_url}#{src}\" if parent_url\n return src\n end",
"def relative_path\n @local_path.relative_path_from(@platform.local_path)\n end",
"def ovl_expand_file(rel_file)\n if File.exist?(rel_file)\n File.expand_path(rel_file)\n elsif File.exist?(a=File.join(GEM_ROOT, rel_file))\n File.expand_path(a)\n else\n raise Errno::ENOENT, rel_file\n end\n end",
"def ovl_expand_file(rel_file)\n if File.exist?(rel_file)\n File.expand_path(rel_file)\n elsif File.exist?(a=File.join(GEM_ROOT, rel_file))\n File.expand_path(a)\n else\n raise Errno::ENOENT, rel_file\n end\n end",
"def relative_path(path)\n path = destination_root.relative_path(path) || path\n path.empty? ? \".\" : path\n end",
"def replace_relative_references(ts_path, source)\n ts_dir = File.dirname(File.expand_path(ts_path))\n escaped_dir = ts_dir.gsub(/[\"\\\\]/, '\\\\\\\\\\&') # \"\\\"\" => \"\\\\\\\"\", '\\\\' => '\\\\\\\\'\n\n # Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0\n # So we go the long way around.\n (source.each_line.map do |l|\n if l.starts_with?('///') && !(m = %r!^///\\s*<reference\\s+path=(?:\"([^\"]+)\"|'([^']+)')\\s*/>\\s*!.match(l)).nil?\n matched_path = m.captures.compact[0]\n l = l.sub(matched_path, File.join(escaped_dir, matched_path))\n end\n next l\n end).join\n end",
"def replace_relative_references2(ts_path, source, context)\n ts_dir = File.dirname(File.expand_path(ts_path))\n escaped_dir = ts_dir.gsub(/[\"\\\\]/, '\\\\\\\\\\&') # \"\\\"\" => \"\\\\\\\"\", '\\\\' => '\\\\\\\\'\n\n # Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0\n # So we go the long way around.\n (source.each_line.map do |l|\n if l.start_with?('///') && !(m = %r{^///\\s*<reference\\s+path=(?:\"([^\"]+)\"|'([^']+)')\\s*/>\\s*}.match(l)).nil?\n matched_path = m.captures.compact[0]\n if matched_path.start_with? '.'\n abs_path = File.join(escaped_dir, matched_path)\n else\n abs_path = File.expand_path(URI.parse(context.resolve(matched_path)).path)\n end\n\n l = l.sub(matched_path, abs_path)\n end\n next l\n end).join\n end",
"def normalize_path(path, parent_filename = nil)\n if path =~ /^\\.\\.?\\//\n unless parent_filename\n raise TypeError, \"can't normalize relative path without parent: \" +\n path.inspect\n end\n File.expand_path(path, File.dirname(parent_filename))\n else\n path\n end\n end",
"def rebase(base_path)\n path = Pathname.new(filename).relative_path_from(Pathname.new(base_path)).to_s\n\n Juicer::Asset::Path.new(path,\n :base => base_path,\n :hosts => hosts,\n :document_root => document_root)\n end",
"def create_absolute_url_from_context(potential_base, relative_url)\n puts \"Determine the absolute URL from context:\\n Known base: #{potential_base}, Relative path: #{relative_url}\" if @verbose\n\t\tbegin\n\t\t\tabsolute_url = nil\n\t\t\t# make relative URL naked by removing the beginning '/'\n\t\t\trelative_url.sub!(/^\\//,'')\n\t\t\tif potential_base =~ /\\/$/\n\t\t\t\tabsolute_url = potential_base+relative_url.strip\n\t\t\telse\n\t\t\t\tlast_index_of_slash = potential_base.rindex('/')\n\t\t\t\tif potential_base[last_index_of_slash-2, 2] == ':/'\n\t\t\t\t\tabsolute_url = potential_base+relative_url\n\t\t\t\telse\n\t\t\t\t\tlast_index_of_dot = potential_base.rindex('.')\n\t\t\t\t\tif last_index_of_dot < last_index_of_slash\n\t\t\t\t\t\tabsolute_url = potential_base.strip.chop+relative_url\n\t\t\t\t\telse\n\t\t\t\t\t\tabsolute_url = potential_base[0, last_index_of_slash+1] + relative_url\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Found absolute URL: #{absolute_url}\" if @verbose\n\t\t\treturn absolute_url\n rescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n end",
"def absolutify_url(src, base_url, parent_url)\r\n if src.nil? || src.empty? || src == \"//:\" || src =~ /\\s*http:\\/\\//i\r\n return src\r\n end\r\n\r\n return \"#{base_url}#{src}\" if src =~ /^\\s*\\//\r\n return \"#{parent_url}#{src}\" if parent_url\r\n return src\r\n end",
"def get_relative_path(bag_path_string)\n bag_path = Pathname.new bag_path_string\n loc_path = Pathname.new @base_path\n \n return bag_path.relative_path_from(loc_path)\n end",
"def ruby_relative_path\n ruby_pathname = Pathname.new(ruby)\n bindir_pathname = Pathname.new(target_bin_dir)\n ruby_pathname.relative_path_from(bindir_pathname).to_s\n end",
"def normalize_path(test, path)\n Pathname.new(path).relative_path_from(test.project.path.realpath).to_s\n end",
"def GetVsProjectRelativePath(projectRelativePath)\n if(VsPathIsAbsolute(projectRelativePath))\n return projectRelativePath\n end\n \n return JoinXmlPaths([ \"..\", \"..\", projectRelativePath])\n end",
"def relativePath\n return (parentPathElements + [name]).join(\"/\")\n end",
"def relative_to_bucket_path(rel_path)\n raise ArgumentError.new(\"Must provide a non-nil path\") if rel_path.nil?\n \n if @subpath_prefix.nil?\n return rel_path\n end\n \n @subpath_prefix + rel_path\n end",
"def get_absolute_path(file)\n File.expand_path file\nend",
"def path_join(base, path)\n return path if path_is_absolute(path)\n base.gsub(/[\\/]+$/, '') + '/' + path.gsub(/^[\\/]+/, '')\n end",
"def resolve\n file_location = modify_uri\n # Adding doc root if path is not aliased. Handling pathname joining\n if(file_location == @request.uri)\n file_location = File.join(@conf.document_root, file_location)\n end\n # If the path is directory, add dir index to serve index file\n if (!File.file?(file_location) and @request.extension == '')\n file_location = File.join(file_location, @conf.directory_index)\n @request.extension = File.extname(file_location)\n if @request.extension != \"\"\n @request.extension = @request.extension.split('.')[1]\n end\n end\n file_location\n end"
] |
[
"0.67939013",
"0.66590774",
"0.65517515",
"0.6457611",
"0.63275474",
"0.6311323",
"0.6311323",
"0.6248949",
"0.62245446",
"0.62243205",
"0.62130475",
"0.617739",
"0.61402327",
"0.60703576",
"0.60664487",
"0.60357606",
"0.6007003",
"0.5976108",
"0.5955329",
"0.59388083",
"0.5931075",
"0.5931075",
"0.59255534",
"0.5907011",
"0.58831817",
"0.5870731",
"0.58409274",
"0.58242893",
"0.5823598",
"0.5812624",
"0.580345",
"0.5802908",
"0.57944024",
"0.57930696",
"0.5777904",
"0.5776107",
"0.57752776",
"0.5765125",
"0.574456",
"0.57275724",
"0.5719027",
"0.57064784",
"0.570237",
"0.5671207",
"0.56550974",
"0.5646861",
"0.5613707",
"0.561239",
"0.5611616",
"0.56077415",
"0.5607204",
"0.5605701",
"0.5596565",
"0.5590247",
"0.55780226",
"0.5575201",
"0.55751574",
"0.55720603",
"0.5546832",
"0.5542858",
"0.55328983",
"0.55306906",
"0.5527538",
"0.55220175",
"0.5515122",
"0.5514375",
"0.55093205",
"0.55021584",
"0.55021584",
"0.5501813",
"0.5501813",
"0.55008745",
"0.5489178",
"0.5489178",
"0.54758084",
"0.5473644",
"0.5459773",
"0.545841",
"0.545008",
"0.5448139",
"0.5441128",
"0.54374415",
"0.5434019",
"0.5434019",
"0.54267174",
"0.54241717",
"0.54240113",
"0.5421556",
"0.5407918",
"0.5401126",
"0.5395784",
"0.5393831",
"0.53855747",
"0.53827083",
"0.5381874",
"0.5366318",
"0.5359642",
"0.53587025",
"0.5354345",
"0.5334248"
] |
0.78591824
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_item
@inventory = collection.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\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 startcompany(action)\n @done = true\n action.setup\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 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\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\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 init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 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 setup\n #implement in subclass;\n end",
"def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; 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 setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); 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",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] |
[
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] |
0.0
|
-1
|
Called from setup block. Can be overridden to customize behaviour.
|
def define_one_to_many_association(klass, attributes)
belongs_to_id = :"#{belongs_to}_id"
belongs_to_type = :"#{belongs_to}_type"
# Track all attributes for this association, so that we can limit the scope
# of keys for the association to only these attributes. We need to track the
# attributes assigned to the association in case this setup code is called
# multiple times, so we don't "forget" earlier attributes.
#
attrs_method_name = :"#{association_name}_attributes"
association_attributes = (klass.instance_variable_get(:"@#{attrs_method_name}") || []) + attributes
klass.instance_variable_set(:"@#{attrs_method_name}", association_attributes)
klass.one_to_many association_name,
reciprocal: belongs_to,
key: belongs_to_id,
reciprocal_type: :one_to_many,
conditions: { belongs_to_type => klass.to_s, key_column => association_attributes },
adder: proc { |translation| translation.update(belongs_to_id => pk, belongs_to_type => self.class.to_s) },
remover: proc { |translation| translation.update(belongs_to_id => nil, belongs_to_type => nil) },
clearer: proc { send_(:"#{association_name}_dataset").update(belongs_to_id => nil, belongs_to_type => nil) },
class: class_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup\n # override this if needed\n end",
"def setup\n yield self\n self\n end",
"def post_setup\n end",
"def setup\n yield self\n end",
"def setup\n yield self\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 setup &block\n block.try(:call, self)\n end",
"def setup\n #implement in subclass;\n end",
"def setup\n # noop\n end",
"def setup\n yield self\n self\n end",
"def before_setup; end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup(_context)\n end",
"def setup(&block)\n self.setup_blocks << block\n end",
"def setup\n raise NotImplementedError\n end",
"def setup\n # override and do something appropriate\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(&block)\n @setup = block\n end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def setup\n raise \"Unimplemented method #setup\"\n end",
"def before_setup\n # do nothing by default\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \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 setup\n\n end",
"def setup\n\n end",
"def setup()\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def after_setup\n # do nothing by default\n end",
"def setup\r\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup!\n setup_instance_methods!\n self\n end",
"def setup\n self.setup! unless self.setup?\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(options); end",
"def setup(options); end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(&block)\n before(:each, &block)\n end",
"def setup; end",
"def call\n setup_context\n super\n end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n true\n end",
"def post_init\n end",
"def post_initialize\n # raise NotImplementedError\n end"
] |
[
"0.8152407",
"0.7820052",
"0.7755252",
"0.7691046",
"0.7691046",
"0.7658678",
"0.7658678",
"0.76574504",
"0.7641826",
"0.76380664",
"0.76375043",
"0.7626126",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.7479922",
"0.7444528",
"0.7435069",
"0.74346876",
"0.74266523",
"0.74266523",
"0.74266523",
"0.74266523",
"0.74266523",
"0.73970544",
"0.737084",
"0.737084",
"0.73661804",
"0.73253983",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.7271694",
"0.7271694",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.72667795",
"0.7260553",
"0.7260553",
"0.72486836",
"0.7233507",
"0.7201571",
"0.7191534",
"0.7184086",
"0.71769345",
"0.713727",
"0.7104586",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7064993",
"0.7064993",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.70497006",
"0.70420974",
"0.7031712",
"0.70290375",
"0.7019408",
"0.7019408",
"0.7019408",
"0.70116657",
"0.69956106",
"0.6980821"
] |
0.0
|
-1
|
Called from setup block. Can be overridden to customize behaviour.
|
def define_save_callbacks(klass, attributes)
b = self
callback_methods = Module.new do
define_method :before_save do
super()
send(b.association_name).select { |t| attributes.include?(t.__send__(b.key_column)) && Util.blank?(t.__send__(b.value_column)) }.each(&:destroy)
end
define_method :after_save do
super()
attributes.each { |attribute| mobility_backends[attribute].save_translations }
end
end
klass.include callback_methods
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup\n # override this if needed\n end",
"def setup\n yield self\n self\n end",
"def post_setup\n end",
"def setup\n yield self\n end",
"def setup\n yield self\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 setup &block\n block.try(:call, self)\n end",
"def setup\n #implement in subclass;\n end",
"def setup\n # noop\n end",
"def setup\n yield self\n self\n end",
"def before_setup; end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup(_context)\n end",
"def setup(&block)\n self.setup_blocks << block\n end",
"def setup\n raise NotImplementedError\n end",
"def setup\n # override and do something appropriate\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(&block)\n @setup = block\n end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def setup\n raise \"Unimplemented method #setup\"\n end",
"def before_setup\n # do nothing by default\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \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 setup\n\n end",
"def setup\n\n end",
"def setup()\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def after_setup\n # do nothing by default\n end",
"def setup\r\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup!\n setup_instance_methods!\n self\n end",
"def setup\n self.setup! unless self.setup?\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(options); end",
"def setup(options); end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(&block)\n before(:each, &block)\n end",
"def setup; end",
"def call\n setup_context\n super\n end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n true\n end",
"def post_init\n end",
"def post_initialize\n # raise NotImplementedError\n end"
] |
[
"0.8152407",
"0.7820052",
"0.7755252",
"0.7691046",
"0.7691046",
"0.7658678",
"0.7658678",
"0.76574504",
"0.7641826",
"0.76380664",
"0.76375043",
"0.7626126",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.7479922",
"0.7444528",
"0.7435069",
"0.74346876",
"0.74266523",
"0.74266523",
"0.74266523",
"0.74266523",
"0.74266523",
"0.73970544",
"0.737084",
"0.737084",
"0.73661804",
"0.73253983",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.7271694",
"0.7271694",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.72667795",
"0.7260553",
"0.7260553",
"0.72486836",
"0.7233507",
"0.7201571",
"0.7191534",
"0.7184086",
"0.71769345",
"0.713727",
"0.7104586",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7064993",
"0.7064993",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.70497006",
"0.70420974",
"0.7031712",
"0.70290375",
"0.7019408",
"0.7019408",
"0.7019408",
"0.70116657",
"0.69956106",
"0.6980821"
] |
0.0
|
-1
|
Called from setup block. Can be overridden to customize behaviour.
|
def define_after_destroy_callback(klass)
# Clean up *all* leftover translations of this model, only once.
b = self
translation_classes = [class_name, *Mobility::Backends::Sequel::KeyValue::Translation.descendants].uniq
klass.define_method :after_destroy do
super()
@mobility_after_destroy_translation_classes = [] unless defined?(@mobility_after_destroy_translation_classes)
(translation_classes - @mobility_after_destroy_translation_classes).each do |translation_class|
translation_class.where(:"#{b.belongs_to}_id" => id, :"#{b.belongs_to}_type" => self.class.name).destroy
end
@mobility_after_destroy_translation_classes += translation_classes
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup\n # override this if needed\n end",
"def setup\n yield self\n self\n end",
"def post_setup\n end",
"def setup\n yield self\n end",
"def setup\n yield self\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 setup &block\n block.try(:call, self)\n end",
"def setup\n #implement in subclass;\n end",
"def setup\n # noop\n end",
"def setup\n yield self\n self\n end",
"def before_setup; end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup\n yield self\n end",
"def setup(_context)\n end",
"def setup(&block)\n self.setup_blocks << block\n end",
"def setup\n raise NotImplementedError\n end",
"def setup\n # override and do something appropriate\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(&block)\n @setup = block\n end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def setup\n raise \"Unimplemented method #setup\"\n end",
"def before_setup\n # do nothing by default\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \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 setup\n\n end",
"def setup\n\n end",
"def setup()\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def after_setup\n # do nothing by default\n end",
"def setup\r\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup!\n setup_instance_methods!\n self\n end",
"def setup\n self.setup! unless self.setup?\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(options); end",
"def setup(options); end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup(&block)\n before(:each, &block)\n end",
"def setup; end",
"def call\n setup_context\n super\n end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n true\n end",
"def post_init\n end",
"def post_initialize\n # raise NotImplementedError\n end"
] |
[
"0.8152407",
"0.7820052",
"0.7755252",
"0.7691046",
"0.7691046",
"0.7658678",
"0.7658678",
"0.76574504",
"0.7641826",
"0.76380664",
"0.76375043",
"0.7626126",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.75058967",
"0.7479922",
"0.7444528",
"0.7435069",
"0.74346876",
"0.74266523",
"0.74266523",
"0.74266523",
"0.74266523",
"0.74266523",
"0.73970544",
"0.737084",
"0.737084",
"0.73661804",
"0.73253983",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.73247856",
"0.7271694",
"0.7271694",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.7268206",
"0.72667795",
"0.7260553",
"0.7260553",
"0.72486836",
"0.7233507",
"0.7201571",
"0.7191534",
"0.7184086",
"0.71769345",
"0.713727",
"0.7104586",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7084516",
"0.7064993",
"0.7064993",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.7055168",
"0.70497006",
"0.70420974",
"0.7031712",
"0.70290375",
"0.7019408",
"0.7019408",
"0.7019408",
"0.70116657",
"0.69956106",
"0.6980821"
] |
0.0
|
-1
|
Returns translation for a given locale, or initializes one if none is present.
|
def translation_for(locale, **)
translation = model.send(association_name).find { |t| t.__send__(key_column) == attribute && t.locale == locale.to_s }
translation ||= class_name.new(locale: locale, key_column => attribute)
translation
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translation_for(locale, **)\n translation = translations.in_locale(locale)\n translation ||= translations.build(locale: locale)\n translation\n end",
"def get_translate(locale, key)\r\n I18n.t!(key, :locale => locale)\r\n rescue\r\n nil\r\n end",
"def get(locale = Localization.default_locale)\n @locales[locale.to_s]\n end",
"def translation(locale=nil)\n return translation_for(:value, locale)\n end",
"def translation(locale=I18n.default_locale)\n translations.find_by(locale: locale)\n end",
"def lookup(locale, key)\n cache_key = Translation.ck(locale, key)\n if @cache_store.exist?(cache_key) && value = @cache_store.read(cache_key)\n return value\n else\n translations = locale.translations.find_all_by_key(Translation.hk(key))\n case translations.size\n when 0\n value = nil\n when 1\n value = translations.first.value_or_default\n else\n value = translations.inject([]) do |values, t| \n values[t.pluralization_index] = t.value_or_default\n values\n end\n end\n\n @cache_store.write(cache_key, (value.nil? ? nil : value))\n return value\n end\n end",
"def locale_to_translate_into\n multilanguage_site = settings.multilanguage_site\n default_language = settings.default_language\n if multilanguage_site and session[:locale] != default_language\n session[:locale]\n else\n nil\n end\n end",
"def load_localization(locale = nil)\n if locale.blank?\n @current_localization = load_default_localizations\n else\n @current_localization = localizations.where(\"locale_id = ? AND path LIKE ?\", locale.id, \"#{path}%\").first\n end\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def translation_for(locale)\r\n @translation_caches ||= {}\r\n # Need to temporary switch of merging, because #translations uses\r\n # #attributes method too, to avoid stack level too deep error.\r\n @stop_merging_translated_attributes = true\r\n unless @translation_caches[locale]\r\n _translation = translations.find_by_locale(locale)\r\n _translation ||= translations.build(:locale => locale)\r\n @translation_caches[locale] = _translation\r\n end\r\n @stop_merging_translated_attributes = false\r\n @translation_caches[locale]\r\n end",
"def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.story_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.story_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end",
"def find_by_locale(locale)\r\n with_locale(locale.to_s).first\r\n end",
"def translation_for(locale, _options = {})\n translation = translations.find { |t| t.key == attribute && t.locale == locale.to_s }\n translation ||= translations.build(locale: locale, key: attribute)\n translation\n end",
"def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.section_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.section_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end",
"def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.infographic_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.infographic_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end",
"def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end",
"def default_locale\n self.found_locale ||= find_locale\n end",
"def locale\n lang = params.fetch(:language, I18n.default_locale).to_sym\n I18n.available_locales.include?(lang) ? lang : I18n.default_locale\n end",
"def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end",
"def from_i18n_locale(locale)\n I18n.with_locale(locale) { Locale.new(locale, I18n.t('.display_name'), I18n.t('.database_encoding')) }\n end",
"def default_locale\n FastGettext.available_locales.first\n end",
"def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc) ? u_lc : available_locales[0]\n end",
"def set_locale_with_fallback(locale)\n # Loading the default (fallback) locale\n set_locale Locale.find_main_cached.short.to_sym\n\n # Loading the current locale\n current_locale = @loaded_locales.detect { |loc| loc.short.to_sym == locale }\n if current_locale && current_locale != Locale.find_main_cached\n set_locale current_locale.short.to_sym\n @current_locale = current_locale\n else\n @current_locale = Locale.find_main_cached\n end\n end",
"def get_locale_from_params \n return nil unless params[:locale]\n I18n.available_locales.include?(params[:locale].to_sym) ? params[:locale] : nil\n end",
"def lookup(locale, key, scope = [], options = {})\n\n init_translations unless initialized?\n result = nil\n _locale = ::Locale.first(:code => locale)\n key = pluralizer(_locale, key, options[:count])\n value = _locale.translations.first(:code => key)\n result = value.value unless value.nil?\n result = options[:default] if !value.nil? && value.value == key && options[:default]\n return result unless value.nil? || value.value == key\n \n # check devise messages for remaining keys\n result = _locale.translations.first(:code => \"devise.sessions.#{key}\")\n return result.value unless result.nil?\n\n # fall back on yaml file if no object is found in db\n keys = I18n.normalize_keys(locale, key, scope, options[:separator])\n keys.inject(translations) do |result, _key|\n return nil unless result.is_a?(Hash) && result.has_key?(_key)\n result = result[_key]\n result = resolve(locale, _key, result, options.merge(:scope => nil)) if result.is_a?(Symbol)\n result = options[:default] if options[:default] && result.nil?\n result\n end\n \n end",
"def get_locale_from_params \n return nil unless params[:locale]\n I18n.available_locales.include?(params[:locale].to_sym) ? params[:locale] : nil\n end",
"def i18n(locale)\n selected_locale = self.i18ns.select{|i18n| i18n.locale_id == locale.id }\n return selected_locale.first if selected_locale.any?\n\n self.i18ns.first\n end",
"def for_language(locale)\n translations.select { |word| word.locale == locale }\n end",
"def use_and_copy_default_locale_translations_if_they_exist(locale, key)\n default_locale_entry = lookup(Locale.default_locale, key)\n return unless default_locale_entry\n\n if default_locale_entry.is_a?(Array)\n default_locale_entry.each_with_index do |entry, index|\n locale.create_translation(key, nil, index) if entry\n end\n else\n locale.create_translation(key, nil) \n end\n\n return default_locale_entry\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n else\n return nil\n end\n end",
"def locale_in_context(locale)\n return @locale if @locale && @locale.code == locale.to_s\n #Locale.find_by_code(locale.to_s) rescue nil && (raise InvalidLocale.new(locale))\n locale = Locale.find_by_code(locale.to_s)\n raise InvalidLocale.new(locale) unless locale\n locale\n end",
"def fallback_localization(locale, key_without_locale)\n value = nil\n return nil unless fallbacks = ::Rails.application.config.i18n.fallbacks\n keys = fallbacks == true ? @locale_cache.keys : fallbacks\n keys.map(&:to_s).each do |lc|\n if lc != locale.locale && value.nil?\n nk = \"#{lc}.#{key_without_locale}\"\n v = localizations[nk]\n value = v if v.present? && value.nil?\n end\n end\n value\n end",
"def locale_name\n YAML.load(translation || \"{}\").with_indifferent_access[locale] || survey.default_locale_name\n end",
"def lookup(locale, key, scope = [], options = {})\n key = normalize_flat_keys(locale, key, scope, options[:separator])\n\n return if translations.missing?(locale, key)\n\n result = translations.lookup(locale, key, options)\n translations.missing(locale, key, options) if result.nil?\n\n result\n end",
"def locale_language(locale = nil)\n (locale || I18n.locale).to_s.match(/^(\\w{2})/) ? $1.to_sym : nil\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 find_locale\n locale = locales.all.detect(&:default)\n return locale.code if locale\n\n default_locale\n end",
"def translate_with_fallbacks opts, locale = nil\n locale ||= default_locale\n\n opts.each.with_index do |(key, vars), index|\n next unless I18n.exists?(key, locale) || index == opts.count - 1\n\n return I18n.translate(key, vars)\n end # each\n end",
"def locale(locale)\n if default?\n locale.to_s\n else\n \"#{self.name}_#{locale.to_s}\"\n end\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 locale\n if self.language\n LANGUAGE_CODE[self.language]\n end\n end",
"def localize(key, error_msg='__localization_missing__', args={}, locale=nil)\n return if reserved_keys.include? key\n\n # Set a temporary Locale to support the localized_in method\n #\n unless locale.nil?\n @original_locale = Locale.code\n Locale.set_code(locale)\n end\n localized = localizations[key] || error_msg\n # Get translations from another country but in the same language if Globalite can't find a translation for my locale\n #\n if localized == error_msg\n locales.each do |t_locale|\n if t_locale.to_s.include?(\"#{current_language.to_s}-\") && t_locale != Locale.code\n localized = @@locales[t_locale][key] || error_msg\n end\n end\n end\n localized = interpolate_string(localized.dup, args.dup) if localized.class == String && localized != error_msg\n\n # let's handle pluralization if needed\n # the translation must include pluralize{count, singular string} to be translated\n # the translator can also pass the plural form if needed:\n # pluralize{3, goose, geese}\n localized = localized.gsub( /pluralize\\{(.*)\\}/){ |erb| pluralize(Regexp.last_match(1)) } if localized.is_a?(String) && (localized=~ /pluralize\\{(.*)\\}/)\n\n # Set the locale back to normal\n #\n unless locale.nil?\n Locale.code = @original_locale\n end\n\n return localized\n end",
"def translation\r\n translation_for(Mongoid::Globalize.locale)\r\n end",
"def get_locale(locale = nil)\n locale || @_deco_locale || (h.cama_get_i18n_frontend rescue nil) || I18n.locale\n end",
"def locale_from_params\n params[:locale] if (params[:locale] && ['en', 'se'].include?(params[:locale]))\n end",
"def locale\n if !language.nil?\n language.abbreviation\n elsif !org.nil?\n org.locale\n end\n end",
"def locale\n @locale || { :country => \"US\", :language => \"en\", :variant => nil }\n end",
"def translation_class(model, locale: I18n.locale)\n translation_exists?(model, locale: locale) ? nil : 'translation-missing'\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n elsif !self.org.nil?\n return self.org.get_locale\n else\n return nil\n end\n end",
"def locale_from_env\n locale = nil\n # At least one environment valiables should be set on *nix system.\n [ENV[\"LC_ALL\"], ENV[\"LC_MESSAGES\"], ENV[\"LANG\"]].each do |loc|\n\tif loc != nil and loc.size > 0\n\t locale = Locale::Object.new(loc)\n\t locale.charset ||= get_charset(locale)\n\t break\n\tend\n end\n locale\n end",
"def get_locale_from_session\n if (session && session[:language])\n logger.debug \"*** Language from Session '#{session[:language]}'\"\n lang = session[:language]\n else\n lang = default_language\n end\n lang\n end",
"def payment_compatible_locale(locale)\n locale = locale.to_s.split(\"-\").first\n if [\"fr\", \"en\", \"es\", \"it\", \"pt\", \"de\", \"nl\", \"fi\"].include?(locale)\n return locale\n else\n return \"en\"\n end\n end",
"def get_locale_from_session\n if (session && session[:language])\n lang = session[:language]\n else\n lang = default_language\n end\n lang\n end",
"def to_gettext(locale:)\n join_char = Rails.configuration.x.locales.gettext_join_character\n locale = default_locale if locale.blank?\n convert(string: locale, join_char: join_char)\n end",
"def load_locale!(locale)\n @projects.each do |project|\n @adapter.allowed_extensions.each do |extension|\n result = project.export locale, extension, @fallback\n\n if result.nil?\n raise \"Could not load project #{project} with extension #{extension} and locale #{locale}\"\n end\n\n strings, plurals = @adapter.parse result, extension\n\n strings = project.filter strings\n plurals = project.filter plurals\n\n warn \"Did not find any strings or plurals in #{project}\" if strings.empty? && plurals.empty?\n\n @strings[locale] = (@strings[locale] || {}).merge(strings)\n @plurals[locale] = (@plurals[locale] || {}).merge(plurals)\n end\n end\n end",
"def locale_language(locale=nil)\n \"#{locale || I18n.locale}\"[0, 2].to_sym\n end",
"def locale=(_arg0); end",
"def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end",
"def locale\n defined?(I18n) ? I18n.locale : default_locale\n end",
"def set_i18n_locale_from_params\n if params[:locale]\n if I18n.available_locales.map(&:to_s).include?(params[:locale])\n I18n.locale = params[:locale]\n else\n flash.now[:notice] =\n \"#{params[:locale]} translation not available\"\n logger.error flash.now[:notice]\n end\n end\n end",
"def set_i18n_locale_from_params\n if params[:locale]\n if I18n.available_locales.map(&:to_s).include?(params[:locale])\n I18n.locale = params[:locale]\n else\n flash.now[:notice] = \n \"#{params[:locale]} translation not available\"\n logger.error flash.now[:notice]\n end\n end\n end",
"def t(key, default = '')\n c = I18n.t(key)\n if c.match(/translation missing/i)\n c = I18n.t(key, locale: 'en') \n # Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend",
"def with_locale(tmp_locale = T.unsafe(nil), &block); end",
"def extract_locale_from_request\r\n # locale defined in parameters\r\n return params[:locale] if params[:locale]\r\n # get locale from subdomains\r\n parsed_locale = request.subdomains.first\r\n return parsed_locale if I18n.available_locales.map(&:to_s).include?(parsed_locale)\r\n # get locale from http header\r\n return request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE']\r\n # get default locale\r\n return I18n.default_locale\r\n end",
"def t(key, default='')\n c = I18n.t(key)\n if c.match( 'translation missing' )\n c = I18n.t(key, locale: 'en') \n# Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend",
"def set_locale\n session[:locale] = params[:locale] if params[:locale]\n I18n.locale = session[:locale] || I18n.default_locale\n locale_path = \"#{LOCALES_DIRECTORY}#{I18n.locale}.yml\"\n unless I18n.load_path.include? locale_path\n I18n.load_path << locale_path\n I18n.backend.send(:init_translations)\n end\n rescue Exception => err\n logger.error err\n flash.now[:notice] = \"#{I18n.locale} translation not available\"\n I18n.load_path -= [locale_path]\n I18n.locale = session[:locale] = I18n.default_locale\n end",
"def correct_locale\n (locales.select{|loc|loc.locale == I18n.locale.to_s}.first || locales.first)\n end",
"def system\n locale_from_env || default_locale\n end",
"def get_locale\n I18n.locale = session[:i18n] || I18n.default_locale || :en\n end",
"def extract_locale_from_request\r\n # locale defined in parameters\r\n return params[:locale] if params[:locale]\r\n # get locale from subdomains\r\n parsed_locale = request.subdomains.first\r\n return parsed_locale if I18n.available_locales.map(&:to_s).include?(parsed_locale)\r\n # get locale from http header\r\n return request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first if request.env['HTTP_ACCEPT_LANGUAGE']\r\n # get default locale\r\n return I18n.default_locale\r\n end",
"def extract_locale_from_session\n session[:locale] || nil\n end",
"def with_locale(tmp_locale = T.unsafe(nil)); end",
"def translate(attribute, locale_tag)\n if locale = DataMapper::I18n::Locale.for(locale_tag)\n t = resource.translations.first(:locale => locale)\n t ? t.send(attribute) : nil\n else\n nil\n end\n end",
"def get_matching_ui_locale(locale)\n lang = locale[0,2].downcase\n\n # Check with exact matching\n if Globalite.ui_locales.values.include?(local_case(locale))\n local_case(locale)\n end\n\n # Check on the language only\n Globalite.ui_locales.values.each do |value|\n value.to_s =~ /#{lang}-*/ ? value : nil\n end\n end",
"def translate(keyword, language)\n if LOCALES[language.to_sym].nil?\n translations = LOCALES[:en]\n else\n translations = LOCALES[language.to_sym]\n end\n return translations[keyword]\nend",
"def by_locale(locale_name)\n loc = Locale.find_by_name(locale_name)\n page_i18ns.by_locale(loc).first or page_i18ns.first\n end",
"def default_locale\n @default_locale ||= self.languages.get_default.code.to_sym\n end",
"def another_locale\n I18n.available_locales.map(&:to_sym).select {|locale| locale != I18n.locale.to_sym }.first\n end",
"def locale_from_http_header\n language = request.env['HTTP_ACCEPT_LANGUAGE']\n unless language.blank?\n http_locale = language.scan(/^[a-z]{2}-[A-Z]{2}/)\n unless http_locale.blank?\n http_locale = http_locale.first\n else\n http_locale = language.scan(/^[a-z]{2}/).first\n end\n end\n end",
"def load_entry(locale, key)\n locale, key = locale.to_s, key.to_s\n data = self.find_all_by_locale_and_key(locale, key)\n result = {}\n data.each do |row|\n #only return the simple translation if one is set\n return row.text if row.pluralization_index.blank?\n result[row.pluralization_index.to_sym] = row.text\n end\n return result\n end",
"def initialize(locale)\n LOCALES.include?(locale) or raise BadLocale\n @locale = locale\n end",
"def new(locale = :us)\n Request.new(@locales[locale.to_sym])\n end",
"def detect_locale_from(source)\n case source\n when :params\n params[:locale]\n when :session\n logger.debug \"Session: #{session.inspect}\"\n session[:locale]\n when :cookie\n cookies[:locale]\n when :domain\n parse_host_and_port_for_locale[0]\n when :header\n request.env['HTTP_ACCEPT_LANGUAGE']\n when :default\n default_locale\n else\n raise \"unknown source\"\n end\n end",
"def get_language_completion(locale)\r\n @@language_completion ||= {}\r\n locale = locale.to_s\r\n\r\n if @@language_completion.has_key?(locale)\r\n return @@language_completion[locale]\r\n end\r\n\r\n # return nil if we haven't got all of our base translations in\r\n return nil unless File.exists?(\"config/locales/#{locale}.yml\")\r\n\r\n # return the percentage of translations in use\r\n @@language_completion[locale] = _get_language_completion(locale, translation_info(locale))\r\n\r\n end",
"def verify_locale(locale)\n (site_locales.include? locale.to_s) ? locale : preferred_default_locale\n end",
"def default_locale\n (self.locales.first || Locomotive::Mounter.locale).to_sym\n end",
"def read(locale, name)\r\n self[locale][name.to_s]\r\n end",
"def get_locale_from_http_header\n return DEFAULT_LANGUAGE if request.env['HTTP_ACCEPT_LANGUAGE'].nil?\n locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first\n return locale if I18N_ALL_LANGUAGES.include?( locale)\n return DEFAULT_LANGUAGE\n end",
"def verify_locale(locale)\n site_locales.include?(locale.to_s) ? locale : preferred_default_locale\n end",
"def translate(locale)\n translated_text = ''\n parse do |part|\n case part[:type]\n when :paragraph\n translated_text += locale.translate(part[:paragraph])\n when :empty_line\n translated_text += part[:line]\n else\n raise \"should not reach here: unexpected type: #{type}\"\n end\n end\n translated_text\n end",
"def extract_locale_from_tld\n I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil\n end",
"def select_language\n I18n.backend.send(:init_translations) unless I18n.backend.initialized?\n lang = PatientHelper.languages(primary_language)&.dig(:code)&.to_sym || :en\n lang = :en unless %i[en es es-PR so fr].include?(lang)\n lang\n end",
"def locale\n frontmatter_locale = data['locale'] || data['lang']\n filename_locale = path_part('locale') || path_part('lang')\n\n raise \"The locale in #{path}'s filename (#{filename_locale.inspect}) doesn't match the lang in its frontmatter (#{frontmatter_locale.inspect})\" if frontmatter_locale && filename_locale && frontmatter_locale != filename_locale\n\n default_locale = I18n.default_locale if defined? ::I18n\n\n found_locale = frontmatter_locale || filename_locale || default_locale\n found_locale&.to_sym\n end",
"def translate(locale, key, options = {})\n @locale = locale_in_context(locale)\n\n options[:scope] = [options[:scope]] unless options[:scope].is_a?(Array) || options[:scope].blank?\n key = \"#{options[:scope].join('.')}.#{key}\".to_sym if options[:scope] && key.is_a?(Symbol)\n count = options[:count]\n # pull out values for interpolation\n values = options.reject { |name, value| [:scope, :default].include?(name) }\n\n entry = lookup(@locale, key)\n cache_lookup = true unless entry.nil?\n\n # if no entry exists for the current locale and the current locale is not the default locale then lookup translations for the default locale for this key\n unless entry || @locale.default_locale?\n entry = use_and_copy_default_locale_translations_if_they_exist(@locale, key)\n end\n\n # if we have no entry and some defaults ... start looking them up\n unless entry || key.is_a?(String) || options[:default].blank?\n default = options[:default].is_a?(Array) ? options[:default].shift : options.delete(:default)\n return translate(@locale.code, default, options.dup)\n end\n\n # this needs to be folded into the above at some point.\n # this handles the case where the default of the string key is a space\n if !entry && key.is_a?(String) && options[:default] == \" \"\n default = options[:default].is_a?(Array) ? options[:default].shift : options.delete(:default)\n return translate(@locale.code, default, options.dup)\n end\n\n # The requested key might not be a parent node in a hierarchy of keys instead of a regular 'leaf' node\n # that would simply result in a string return. If so, check the database for possible children \n # and return them in a nested hash if we find them.\n # We can safely ignore pluralization indeces here since they should never apply to a hash return\n if !entry && (key.is_a?(String) || key.is_a?(Symbol))\n #We need to escape % and \\. Rails will handle the rest.\n escaped_key = key.to_s.gsub('\\\\', '\\\\\\\\\\\\\\\\').gsub(/%/, '\\%')\n children = @locale.translations.find(:all, :conditions => [\"raw_key like ?\", \"#{escaped_key}.%\"]).select{|child| child.raw_key =~ /^#{key}/}\n if children.size > 0\n entry = hashify_record_array(key.to_s, children)\n @cache_store.write(Translation.ck(@locale, key), entry) unless cache_lookup == true\n return entry\n end\n end\n\n # we check the database before creating a translation as we can have translations with nil values\n # if we still have no blasted translation just go and create one for the current locale!\n unless entry \n pluralization_index = (options[:count].nil? || options[:count] == 1) ? 1 : 0\n translation = @locale.translations.find_by_key_and_pluralization_index(Translation.hk(key), pluralization_index) ||\n @locale.create_translation(key, key, pluralization_index)\n entry = translation.value_or_default\n end\n\n # write to cache unless we've already had a successful cache hit\n @cache_store.write(Translation.ck(@locale, key), entry) unless cache_lookup == true\n\n entry = pluralize(@locale, entry, count)\n entry = interpolate(@locale.code, entry, values)\n entry.is_a?(Array) ? entry.dup : entry # array's can get frozen with cache writes\n end",
"def set_translation\n if params[:locale].blank? && session[:current_locale].present?\n ::I18n.locale = session[:current_locale]\n elsif params[:locale].present? && ::I18n.available_locales.include?(params[:locale].to_sym)\n session[:current_locale] = ::I18n.locale = params[:locale]\n elsif current_alchemy_user && current_alchemy_user.respond_to?(:language) && current_alchemy_user.language.present?\n ::I18n.locale = current_alchemy_user.language\n else\n ::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first) || ::I18n.default_locale\n end\n end",
"def locale\n sys && sys[:locale] ? sys[:locale] : default_locale\n end",
"def locale\n sys && sys[:locale] ? sys[:locale] : default_locale\n end",
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def get_native_locale_attribute attribute, locale = Globalize.locale\n return self.send(attribute) unless translatable?\n\n if globalize.stash.contains?(locale, attribute)\n globalize.stash.read(locale, attribute)\n else\n translation_for(locale).send(attribute)\n end\n end",
"def set_locale_to_best_available\n best_locale = params[:locale] # Locale in URL always takes precedent\n best_locale = find_best_locale if best_locale.blank?\n\n # Assigning a value to I18n.locale *looks* like a\n # global variable setting, and setting a global\n # variable would be bad since we're multi-threaded.\n # However, this is *not* setting a global variable, it's setting a\n # per-Thread value (which is safe). Per the i18n guide,\n # \"The locale can be either set pseudo-globally to I18n.locale\n # (which uses Thread.current like, e.g., Time.zone)...\".\n I18n.locale = best_locale.to_sym\n end"
] |
[
"0.7780166",
"0.727604",
"0.7247916",
"0.72272277",
"0.7226953",
"0.6931552",
"0.6842021",
"0.683636",
"0.6807036",
"0.6772945",
"0.6765306",
"0.67650527",
"0.67630595",
"0.675863",
"0.6719674",
"0.67099804",
"0.6677008",
"0.6658764",
"0.6655869",
"0.66468155",
"0.662237",
"0.6619865",
"0.65903103",
"0.65655035",
"0.6564727",
"0.65629804",
"0.65604675",
"0.65452737",
"0.6527243",
"0.64879483",
"0.6480297",
"0.64633995",
"0.6456746",
"0.64522094",
"0.64407337",
"0.6429947",
"0.6418088",
"0.6395399",
"0.6390058",
"0.6385034",
"0.63702726",
"0.63591635",
"0.63547426",
"0.63543993",
"0.6351182",
"0.6345439",
"0.6321921",
"0.6303038",
"0.62946373",
"0.62877405",
"0.62738043",
"0.6238817",
"0.623199",
"0.62198865",
"0.6212122",
"0.6176665",
"0.61693716",
"0.61629343",
"0.6151451",
"0.61503613",
"0.6131459",
"0.6131184",
"0.6128323",
"0.61276704",
"0.61208737",
"0.6116124",
"0.6113468",
"0.6105452",
"0.6099722",
"0.6097879",
"0.6096846",
"0.6090987",
"0.60884047",
"0.60808396",
"0.60786474",
"0.60758376",
"0.606956",
"0.60694355",
"0.6065241",
"0.6032316",
"0.6026809",
"0.6011137",
"0.600611",
"0.6004099",
"0.599722",
"0.5992387",
"0.59863913",
"0.5979571",
"0.59685385",
"0.5944566",
"0.59320503",
"0.5920929",
"0.5920749",
"0.5918016",
"0.59053373",
"0.5903267",
"0.5903267",
"0.5893205",
"0.589025",
"0.5878055"
] |
0.6766814
|
10
|
Saves translation which have been built and which have nonblank values.
|
def save_translations
cache.each_value do |translation|
next unless present?(translation.__send__ value_column)
translation.id ? translation.save : model.send("add_#{singularize(association_name)}", translation)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save!\n FileUtils.mkdir_p File.dirname(self.file)\n\n File.open(self.file, \"w+\") do |f|\n f << %(#{self.namespace}.translations || (#{self.namespace}.translations = {});\\n)\n self.translations.each do |locale, translations_for_locale|\n f << %(#{self.namespace}.translations[\"#{locale}\"] = #{translations_for_locale.to_json};\\n);\n end\n end\n end",
"def save_translations\n cache.each_translation do |translation|\n next unless translation.value.present?\n translation.id ? translation.save : model.send(\"add_#{association_name.to_s.singularize}\", translation)\n end\n end",
"def save_translations\n return true unless translation_cache\n \n translation_cache.each do |code, attrs|\n switch_language(code) do\n @attributes.update attrs\n update_translation\n end\n end\n true\n end",
"def save filename\n File.open(filename, 'w') { |file| @translated.each {|value| file.write(\"#{value}\") } } \n end",
"def store_original_as_translation\n unless self.original_text.nil?\n self.translations << self.original_text\n end\n end",
"def save!\n if self.file =~ LOCALE_INTERPOLATOR\n I18n.available_locales.each do |locale|\n write_file(file_for_locale(locale), self.translations.slice(locale))\n end\n else\n write_file\n end\n end",
"def after_save_main_object\n if save_default_translation?\n save_default_translation\n end\n end",
"def update_or_create_all_translations(attributes={})\n missing_locales.each { |locale| translations.build :locale => locale }\n translations.each do |translation|\n attrs = attributes[translation.code]\n unless translation.active? or attrs.nil?\n merger = translation.attributes.merge attrs\n translation.attributes = merger\n end\n translation.save!\n end\n end",
"def validate_translations\n# logger.debug \"***** validates question translations\"\n if self.dataset.default_language.present?\n# logger.debug \"***** - default is present; text = #{self.text_translations[self.dataset.default_language]}\"\n if self.text_translations[self.dataset.default_language].blank?\n# logger.debug \"***** -- text not present!\"\n errors.add(:base, I18n.t('errors.messages.translation_default_lang',\n field_name: self.class.human_attribute_name('text'),\n language: Language.get_name(self.dataset.default_language),\n msg: I18n.t('errors.messages.blank')) )\n end\n end\n end",
"def store_translations(locale, data, options = T.unsafe(nil)); end",
"def create_default_language_entries\n self.all.each {|entry| entry.save_default_translation}\n end",
"def create\n @user = current_user\n @project = Project.find(params[:project_id])\n @preferedlang = Language.find_by_id(@project.source_lang_id)\n @slanguages = Language.where(\"id != ?\", @preferedlang.id).order('iso_code asc') \n @slanguages.unshift(@preferedlang)\n #from railsrecipes recipe 22 - refactor\n # @user = current_user\n\n\n @mostpopulartarlang = Language.find_by_id(@project.translations.maximum(\"source_lang_id\"))\n if @mostpopulartarlang\n @tlanguages = Language.where(\"id != ?\", @mostpopulartarlang.id).order('iso_code asc')\n @tlanguages.unshift(@mostpopulartarlang)\n else\n @tlanguages = Language.order('iso_code desc')\n end\n\n\n @translation = @project.translations.build(params[:translation])\n @translation.owner_id = @user.id\n\n# @project = Project.find(params[:id])\n\n# @translation = Translation.new(params[:translation])\n# @translation.owner_id = current_user.id\n# @translation.project_id = Project.find_by_id(params[:project_id]).id\n # @user = User.find(params[:user_id])\n # @project = Project.find(params[:project_id])\n # @translation = Translation.new(params[:translation])\n # @project = current_user.projects.build\n # @translation = @project.translations.build\n # @user = current_user\n # @project = Project.find_by_user_id(@user)\n # @translation = @project.translations.build(params[:translation])\n @languages = Language.all(:order => 'iso_code')\n # #process information from checkbox\n\n if @translation.save\n flash[:notice] = \"Translation was successfully created\"\n # redirect_to user_project_translations_path(@user, @project)\n redirect_to user_project_path(current_user, @project)\n else\n render 'new'\n end\nend",
"def save\n remove_invalid_subjects!\n valid? ? persist! : false\n end",
"def prepare_translations!\r\n stash.each do |locale, attrs|\r\n if attrs.any?\r\n translation = record.translations.find_by_locale(locale)\r\n translation ||= record.translations.build(:locale => locale)\r\n attrs.each{ |name, value| translation[name] = value }\r\n end\r\n end\r\n reset\r\n end",
"def createdtranslation_params\n params.require(:createdtranslation).permit(:totranslate, :translated, :language1, :language2, :title, :creator_id_id)\n end",
"def create_translations\n end",
"def create\n @translation = Translation.new(translation_params(:create))\n @translation.created_manually = true\n if @translation.save\n tflash('create', :success, {:model=>@@model, :count=>1}) \n redirect_to translation_path(@translation.id), notice: \"English translation was successfully created: #{@translation.translation}.\"\n else\n render action: 'new', error: @translation.errors.messages.to_s \n end\n end",
"def store_translation(locale, key, text, count=nil)\n if count.nil?\n data = text\n else\n pluralization_index = pluralizer(locale).call(count)\n data = { pluralization_index => text }\n end\n Translation.create_or_update(locale, key, data)\n # merge the stored translation back to the memory collection\n reload!\n end",
"def store_translations(locale, data)\n data = flatten data\n data.each { |key, data| store_translation(locale, key, data) }\n end",
"def store_translations(locale, data, options = {})\n raise NotImplementedError\n end",
"def write_to_file keys\n init_translations_and_ignore_app_mode_file_dump if self.class.mode == :origin\n # Hash to capture the files updated on origin mode and the keys for each one\n result = {}\n keys.each do |key, value|\n #\n # Search the files where the translation will be applied to\n decide_filenames(key).each do |filename| \n (result[filename] ||= []) << key\n # Apply the current translation to the filenames\n #\n # It will save a key 'ubiquo.categories.index.title' with a value 'Title'\n # mergin the content of $filename with it\n #\n # Load the file\n hash = YAML.load_file(filename)\n # Morph the translation key\n # from: 'ubiquo.categories.index.title'\n # to: { :ubiquo => {\n # :categories => {\n # :index => {\n # :title => 'Title'\n # }\n # }\n # }\n # }\n # }\n branch_hash = Translate::Keys.to_deep_hash({key => value})\n #\n # Cast all the hash keys to String\n #\n branch_hash = Translate::File.deep_stringify_keys({self.locale => branch_hash})\n #\n # Merge the translation with the content of the file\n #\n #\n hash.deep_merge!(branch_hash)\n #\n # Save to file updated to disk\n Translate::File.new(filename).write(hash)\n end \n end\n result\n end",
"def save\n values.save\n end",
"def store_translation_from_xlsx_cell locale, key, cell\n value = cell.nil? ? '' : cell\n\n if locale.present? && key.present?\n translation = Translation.find_or_initialize_by locale: locale, key: key\n if translation.value != value\n translation.value = value\n translation.save\n end\n end\n end",
"def translations; end",
"def write_locale(directory, file, strings, plurals, locale, date); end",
"def empty_column_translation\n @column_translation = {}\n end",
"def save_form(values)\n mp values\n persist\n\n back_to_previous_screen\n end",
"def store_translations(locale, data, options = {})\n super\n ActiveRecord::Base.transaction do\n store_item(locale, data)\n end if store_items? && valid_locale?(locale)\n end",
"def store_translations(locale, data, options = {})\n super\n ActiveRecord::Base.transaction do\n store_item(locale, data)\n end if store_items? && valid_locale?(locale)\n end",
"def translation=(translation)\n @translation.set(translation)\n @transform_dirty = true\n translation\n end",
"def write!\n Dir.mkdir @directory unless File.directory? @directory\n\n @locales.each_with_index do |locale, index|\n strings = @strings[locale]\n plurals = @plurals[locale]\n\n l_directory = locale_directory locale, index.zero?\n\n file = @table.to_s.empty? ? @adapter.default_file_name : @table\n\n date = DateTime.now\n\n Dir.mkdir l_directory unless File.directory? l_directory\n\n @adapter.write_locale(l_directory,\n file,\n strings,\n plurals,\n locale,\n date)\n end\n end",
"def present_translations\n translations.where.not(value: nil).where(\"value <> ''\")\n end",
"def translated\n find_all do |entry|\n entry.translated?\n end\n end",
"def fillin_translations\n collection_types = Hyrax::CollectionType.all\n collection_types.each do |c|\n next unless c.title =~ /^translation missing/\n oldtitle = c.title\n c.title = I18n.t(c.title.gsub(\"translation missing: en.\", ''))\n c.save\n Rails.logger.debug \"#{oldtitle} changed to #{c.title}\"\n end\n end",
"def create_or_update(locale, key, data, pluralization_index=\"\")\n\n locale, key = locale.to_s, key.to_s\n\n # create/update all of the pluralization forms\n if data.is_a? Hash\n data.each do |pluralization_index, text|\n if record = find_by_locale_and_key_and_pluralization_index(locale, key, pluralization_index)\n record.update_attribute(:text, text)\n else\n create :locale => locale, :key => key, :pluralization_index =>pluralization_index.to_s, :text => text\n end\n end\n\n # create/update without pluralization\n else\n if record = find_by_locale_and_key_and_pluralization_index(locale, key, pluralization_index)\n record.update_attribute(:text, data)\n else\n create :locale => locale, :key => key, :text => data, :pluralization_index=>pluralization_index\n end\n end\n\n end",
"def commit\n @translation = Translation.find(params[:id])\n @event = @translation.event\n if !@translation.des_es.nil? && @event.des_es.empty?\n @event.title_es = @translation.title_es\n @event.des_es = @translation.des_es\n end\n if !@translation.des_eu.nil? && @event.des_eu.empty?\n @event.title_eu = @translation.title_eu\n @event.des_eu = @translation.des_eu\n end\n if !@translation.des_fr.nil? && @event.des_fr.empty?\n @event.title_fr = @translation.title_fr\n @event.des_fr = @translation.des_fr\n end\n if !@translation.des_en.nil? && @event.des_en.empty?\n @event.title_en = @translation.title_en\n @event.des_en = @translation.des_en\n end\n @event.save\n @user= @translation.user\n @content = \"5\"\n @translation.committed = true\n @translation.user.translated += 1 \n @translation.user.save\n @translation.save\n redirect_to @event\n end",
"def update_translation( key, value, locale )\n \n # lock file\n filename = File::join RAILS_ROOT, \"config/locales\", File::basename( locale + \".yml\" )\n if( File.exists? filename )\n file = File.new( filename, \"r+\")\n else\n file = File.new( filename, \"w+\" ) \n end\n \n file.flock( File::LOCK_EX )\n \n begin \n # read project locale file\n data = YAML.load( file )\n unless data.is_a? Hash \n I18n.load_path << filename\n data = { locale => {} } unless data \n end\n \n tmp = data\n \n # create middle hash keys as needed\n key = locale + \".\" + key\n keys = key.split(/\\./)\n base_key = keys.pop\n \n while tmpkey = keys.shift\n unless tmp[tmpkey].class == Hash\n tmp[tmpkey] = {}\n end\n tmp = tmp[tmpkey]\n end\n \n # update or create value\n tmp[base_key] = value\n \n # save file\n file.truncate( 0 )\n file.rewind\n file.write( data.to_yaml )\n ensure\n # unlock and close file\n file.flock( File::LOCK_UN )\n file.close\n end\n \n I18n.reload!\n \n end",
"def store_translations(locale, data, options = {})\n locale = locale.to_sym\n translations[locale] ||= {}\n data = data.deep_symbolize_keys\n translations[locale].deep_merge!(data)\n end",
"def clear_translations!\r\n @translation_caches = {}\r\n @stop_merging_translated_attributes = nil\r\n end",
"def store_translations(locale, data)\n flatten_data(locale => data).each do |key, value|\n self[key] = value\n end\n end",
"def save_en\n @disert_theme = DisertTheme.find(params[:disert_theme][:id])\n @disert_theme.update_attribute(:title_en, params[:disert_theme][:title_en])\n end",
"def handle_save(edit_lines, type)\n if validate_inputs edit_lines\n @word = Word.new do |word|\n word.type = type.downcase.to_sym\n edit_lines.each do |k,v|\n word[k] = v.text\n end\n end\n\n puts \"Created #{@word.inf}\"\n\n Words << @word\n File.open Words_File, 'w' do |file|\n file.truncate 0\n file.write Words.to_yaml\n file.close\n end\n\n clear_edit_lines edit_lines.values\n else\n puts 'not valid'\n end\n end",
"def save_lang(resource, resource_language)\n a = ['en','fr','zh']\n if a.include?(resource_language)\n\n language = Language.find_by_code(resource_language)\n resource.language_id = language.id\n if resource.save\n puts \"I saved?\"\n end\n\n else\n resource.language_id = 0\n resource.save\n end\n end",
"def load_vocab_translations\n pp_nl_serialized = File.read(\"#{$filepath_nl}alle danyvertalingen qff export.json\")\n pp_nl = JSON.parse(pp_nl_serialized)\n\n #orgins of words: passaporte (and chapter) or other\n construct_book_origins(pp_nl[\"folders\"])\n \n #saving the words to the database with reference to passaporte_words\n pp_nl[\"words\"].each do |ppnl_line|\n word_pt_raw = ppnl_line[\"word\"]\n word_pt_split = Translation.split_article_front(word_pt_raw)\n word_pt = word_pt_split[:word]\n genre_pt = word_pt_split[:article]\n # puts \"for word_pt_split: #{word_pt_split}\"\n passaporte_found = passaporte_unit?(word_pt_split)\n # puts \"found?:\"\n # puts passaporte_found\n pt_translation = nil\n if !passaporte_found.nil?\n pt_transl = Translation.find_by word_pt:word_pt_split[:word], genre_pt:word_pt_split[:article]\n # puts pt_transl\n end\n # puts \"pt_transl:\"\n # puts pt_transl\n translation_array = ppnl_line[\"translations\"]\n save_nl_translation(word_pt, pt_transl, genre_pt,translation_array, ppnl_line[\"comments\"])\n end\nend",
"def export(translations)\n res = LazyHash.build_hash\n\n translations.each do |e|\n LazyHash.add(res, \"#{e.locale}.#{e.key}\", e.value)\n end\n if res.any? && res.keys.size != 1\n raise IndexError, \"Generated hash must have only one root key. Your translation data in database may be corrupted.\"\n end\n res\n end",
"def upsert(locale, key, value) # rubocop:disable Metrics/MethodLength\n I18n.with_locale(locale) do\n # when an array has to be inserted with a default value, it needs to\n # be done like:\n # I18n.t('foo', default: [['bar', 'baz']])\n # because without the double array, array items are treated as fallback keys\n # - then, the last array element is the final fallback; so in this case we\n # don't specify fallback keys and only specify the final fallback, which\n # is the array\n val = value.is_a?(Array) ? [value] : value\n I18n.t(key, default: val)\n\n # this indicates that this translation already exists\n existing_translation =\n Lit::Localization.joins(:locale, :localization_key)\n .find_by('localization_key = ? and locale = ?', key, locale)\n\n return unless existing_translation\n\n if @raw\n existing_translation.update(default_value: value)\n else\n existing_translation.update(translated_value: value, is_changed: true)\n lkey = existing_translation.localization_key\n lkey.update(is_deleted: false) if lkey.is_deleted\n end\n end\n end",
"def upload_po\r\n\r\n @locales = Dir.entries(\"#{Rails.root}/po\").select do |entry|\r\n File.directory?(File.join(Rails.root, \"po\", entry)) and !(entry =='.' || entry == '..')\r\n end\r\n if request.post?\r\n @errors = {}\r\n @errors[:locale] = \"You must provide a valid locale.\" unless @locales.include?(params[:locale])\r\n if params[:locale_file].nil?\r\n @errors[:locale_file] = \"You must provide a PO file.\"\r\n else\r\n begin\r\n GetPomo::PoFile.parse(File.read(params[:locale_file].tempfile))\r\n rescue\r\n @errors[:locale_file] = \"You must provide a valid PO file.\"\r\n end\r\n end\r\n\r\n # All good move file to the appropriate location and redirect\r\n\r\n if @errors.empty?\r\n FileUtils.mv(params[:locale_file].tempfile, Rails.root.join('po', params[:locale], \"#{Rails.application.class.to_s.split('::').first.downcase}.po\"))\r\n redirect_to locales_path\r\n end\r\n end\r\n end",
"def translations\n @translations ||= {}\n end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def translate\n self.translations.destroy\n\n if auto_translate\n google_translate\n bing_translate\n end\n end",
"def test_multi_xlate\r\n assert @dict.empty?\r\n @dict.add_translation(\"book\", \"boek\")\r\n assert !@dict.empty?\r\n assert_equal \"book\", @dict.translate(\"boek\")\r\n assert_equal \"boek\", @dict.translate(\"book\")\r\n end",
"def validate\n untranslated = self.get_untranslated_keys\n untranslated.each { |key|\n puts \"WARNING: \\\"#{key['id']}\\\" is not translated in #{key['untranslated']} languages\"\n }\n end",
"def save_unknown!\n\t\t @saved = []\n\t end",
"def create\n @translation_key = Multilang::TranslationKey.new translation_key_params\n @translation_key.tap(&:save).create_translations\n respond_to do |format|\n format.html { redirect_to translations_path }\n format.js\n end\n end",
"def translations\n\t\t\tvalues(\"http://scta.info/property/hasTranslation\")\n\t\tend",
"def show\n @translate\n @uploaded_text = ''\n translation_map = []\n end",
"def translation_text_presence\n present = false\n translations.each {|t| present = true if !t.text.blank?}\n unless present\n errors.add 'translations.text', I18n.t(\n 'models.phrase.attributes.translations.min_amount',\n default: 'needs at least one translation'\n )\n end\n end",
"def new\n @translation = @plate.translations.build\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def sync_languages(languages, save_to = \"#{__dir__}\")\n validate\n languages.each { |language|\n self.sync_language(language, save_to)\n }\n end",
"def export_translations!(crowdin)\n print 'Building ZIP archive with the latest translations '\n export_translations = crowdin.export_translations\n if export_translations['success']\n if export_translations['success']['status'] == 'built'\n puts \"- OK\"\n elsif export_translations['success']['status'] == 'skipped'\n puts \"- Skipped\"\n puts \"Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.\"\n end\n end\n end",
"def translate(overwrite_user_edited_translations = false, translate_to = nil)\n translate_to ||= MuckContents.configuration.translate_to\n return if translate_to.blank?\n \n title_translations = Babelphish::Translator.multiple_translate(self.title, translate_to, self.locale)\n body_translations = Babelphish::Translator.multiple_translate(self.body, translate_to, self.locale)\n existing_translations = {}\n self.content_translations.each do |translation|\n existing_translations[translation.locale] = translation\n end\n \n translate_to.each do |language|\n if translation = existing_translations[language]\n if !translation.user_edited || overwrite_user_edited_translations\n translation.update_attributes!(:title => title_translations[language],\n :body => body_translations[language])\n end\n else\n self.content_translations.create!(:title => title_translations[language],\n :body => body_translations[language],\n :locale => language)\n end\n end\n end",
"def save!\n quest = Quest.new\n quest.parent_id = @parent_id\n quest.main_quest_slides = @main_quest_slides.try(:join, \",\")\n quest.rewards = @achievement ? nil : @rewards\n quest.achievement = @achievement\n quest.id = @quest_id\n quest.save!\n\n @objectives.each do |klass, options|\n objective = klass.new(options)\n objective.quest = quest\n objective.save!\n end\n\n quest\n end",
"def save\n if modified? and @entries and !@entries.empty?\n save!\n end\n end",
"def save\n File.open(SaveLocation, 'w') do |file|\n file.puts @value.join(\"\")\n file.puts @progress.join(\"\")\n file.puts @bad_guesses.join(\"\")\n end\n end",
"def texts_translated\n @texts_translated ||= tokens_translated.map do |group|\n group.map { |value, type| type == :text ? value : fix_ascii(value) }.join\n end\n end",
"def translate(src_lang, target_lang, output_file)\n # Check if a non empty output file is present and error out to avoid\n # the danger or overwriting some important file !!\n if File.exists?(output_file) && File.size(output_file) > 0\n raise InvalidInputException.new(\"Output file #{output_file} is not empty.\")\n else\n # Just open the file in writable mode and close it just to ensure that\n # we can write the output file\n File.open(output_file, \"w\") {|f|\n }\n end\n # Check if the file is writable ?\n unless File.writable?(output_file)\n raise InvalidInputException.new(\"Output file #{output_file} not writable.\")\n end\n # Further checks can be done only in caption specific implementations\n # or translation engine specific implementation\n end",
"def create\n @translation = Translation.new(params[:translation])\n\n respond_to do |format|\n if @translation.save\n format.html { redirect_to @translation, notice: 'Translation was successfully created.' }\n format.json { render json: @translation, status: :created, location: @translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n if @translated_word.update_attributes(params[:translation])\n format.json { head :no_content }\n else\n format.json { render :json => @translated_word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def create_yml_file_for_locale_mission(main_language, id, title, instructions)\n File.open(yml_path(main_language), 'w+') do |file|\n write_locale_file_headers(file, main_language)\n write_mission_to_locale(file, id, instructions, title)\n end\nend",
"def export(data, indent=0)\n target = data[@translate.lang]\n xml = <<EOF\n<?xml version=\"1.0\" encoding=\"#{@translate.options[:encoding]}\"?>\n<!DOCTYPE TS>\n<TS version=\"2.0\" language=\"#{@translate.lang}\">\nEOF\n\n keys = I18n::Translate.hash_to_keys(target).sort\n keys.each do |key|\n value = @translate.find(key, target)\n next unless value\n\n if value.kind_of?(String) || value.kind_of?(Array) || value.kind_of?(Integer)\n fuzzy = (value.to_s.empty?) ? %~ type=\"unfinished\"~ : \"\"\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\n <source>#{::CGI.escapeHTML(@translate.find(key, @translate.default).to_s)}</source>\n <translation#{fuzzy}>#{::CGI.escapeHTML(value.to_s)}</translation>\n </message>\n </context>\nEOF\n else\n fuzzy = ((value[\"flag\"] == \"ok\") or value[\"flag\"].to_s.strip.empty?) ? \"\" : (value[\"flag\"] == \"obsolete\") ? %~ type=\"obsolete\"~ : %~ type=\"unfinished\"~\n xml += <<EOF\n <context>\n <name>#{::CGI.escapeHTML(key)}</name>\n <message>\nEOF\n if value[\"file\"] or value[\"line\"]\n xml += <<EOF\n <location filename=\"#{::CGI.escapeHTML(value[\"file\"].to_s)}\" line=\"#{::CGI.escapeHTML(value[\"line\"].to_s)}\" />\nEOF\n end\n xml += <<EOF\n <source>#{::CGI.escapeHTML(value[\"default\"].to_s)}</source>\nEOF\n unless value[\"old_default\"].to_s.empty?\n xml += <<EOF\n <oldsource>#{::CGI.escapeHTML(value[\"old_default\"].to_s)}</oldsource>\nEOF\n end\n unless value[\"extracted_comment\"].to_s.empty?\n xml += <<EOF\n <extracomment>#{::CGI.escapeHTML(value[\"extracted_comment\"].to_s)}</extracomment>\nEOF\n end\n unless value[\"comment\"].to_s.empty?\n xml += <<EOF\n <translatorcomment>#{::CGI.escapeHTML(value[\"comment\"].to_s)}</translatorcomment>\nEOF\n end\n xml += <<EOF\n <translation#{fuzzy}>#{::CGI.escapeHTML(value[\"translation\"].to_s)}</translation>\nEOF\n unless value[\"flag\"].to_s.strip.empty?\n xml += <<EOF\n <extra-po-flags>#{::CGI.escapeHTML(value[\"flag\"].to_s.strip)}</extra-po-flags>\nEOF\n end\n xml += <<EOF\n </message>\n </context>\nEOF\n end\n end\n\n xml += <<EOF\n</TS>\nEOF\n xml\n end",
"def test_add_two_xlates\n @dict.add_translation(\"book\", \"boek\")\n @dict.add_translation(\"house\", \"huis\")\n assert !@dict.empty?\n assert_equal \"book\", @dict.translate(\"boek\")\n assert_equal \"house\", @dict.translate(\"huis\")\n end",
"def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully saved.\"\n\tend",
"def test_adding_xlate\n @dict.add_translation(\"book\", \"boek\")\n assert !@dict.empty?\n end",
"def setup_mass_copy_translations\n end",
"def translatable\n self._translatable[base_name] ||= []\n end",
"def test_adding_xlate\r\n @dict.add_translation(\"book\", \"boek\")\r\n assert !@dict.empty?\r\n end",
"def save_to(path)\n File.open(path, \"w\") do |file|\n I18n.with_locale(meta.locale) do\n file << render\n end\n end\n end",
"def translations_hash; end",
"def test_add_two_xlates\r\n @dict.add_translation(\"book\", \"boek\")\r\n @dict.add_translation(\"house\", \"huis\")\r\n assert !@dict.empty?\r\n assert_equal \"book\", @dict.translate(\"boek\")\r\n assert_equal \"house\", @dict.translate(\"huis\")\r\n end",
"def generate\n I18n.backend.load_translations\n translations = wrap(source_translations)\n I18n.backend.store_translations(destination_locale, translations)\n I18n.available_locales += [destination_locale]\n end",
"def translate_values(values)\n if values.empty?\n nil\n else\n values.join(' ')\n end\n end",
"def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @translation_language = TranslationLanguage.new(translation_language_params)\n\n respond_to do |format|\n if @translation_language.save\n tflash('create', :success, {:model=>@@model, :count=>1})\n format.html { redirect_to(translation_languages_path)} # , :notice => t('messages.create.success', :model=>@@model)) }\n format.xml { render :xml => @translation_language, :status => :created, :location => @translation_language }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @translation_language.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @locale_entry.assign_attributes(update_params)\n\n @locale_entry.translated = true\n @locale_entry.translator = current_user\n\n @locale_entry.save\n respond_with @source_entry, @locale_entry, location: glossary_url\n end",
"def find_all_valid_translations(translations)\n if translations.empty?\n return {:id => self.id, :key => self.key, :label => self.label, :original => true}\n end\n \n # if the first translation does not depend on any of the context rules\n # use it... we don't care about the rest of the rules.\n if translations.first.context.blank?\n return {:id => self.id, :key => self.key, :label => translations.first.label}\n end\n \n # build a context hash for every kind of context rules combinations\n # only the first one in the list should be used\n context_hash_matches = {}\n valid_translations = []\n translations.each do |translation|\n context_key = translation.context || \"\"\n next if context_hash_matches[context_key]\n context_hash_matches[context_key] = true\n if translation.context\n valid_translations << {:label => translation.label, :context => translation.context.dup}\n else\n valid_translations << {:label => translation.label}\n end\n end\n\n # always add the default one at the end, so if none of the rules matched, use the english one\n valid_translations << {:label => self.label} unless context_hash_matches[\"\"]\n {:id => self.id, :key => self.key, :labels => valid_translations}\n end",
"def cont_trans_sentence_english_params\n params.require(:cont_trans_sentence_english).permit(:name, :lesson_id, :sentence, :translation, :answer)\n end",
"def business_params\n params.require(:business).permit(:translations_attributes => [:id, :locale, :name])\n end",
"def work_process_params\n params.require(:work_process).permit(:translations_attributes => [:id, :locale, :name])\n end",
"def init_translations; end",
"def update_associations_translated_cache\n result = Array(translatable_options[:translatable_associations]).all? do |association|\n records = send(association)\n case records\n when ActiveRecord::Base\n # If it's a single record\n send(association).translation_complete?\n else\n # If it's a relation\n send(association).translation_incomplete.empty?\n end\n end\n # Save without triggering callbacks\n self.class.update_all({:associations_translated => result}, :id => self.id) if self.class.column_names.include? 'associations_translated'\n end",
"def after_save_callback\n @changes = [[self.theme_id], self.story.all_published_locales, 1]\n end",
"def create_translation(other)\n end",
"def mass_copy_translations\n errors = ProjectTranslationsMassCopier.find_locale_errors(@project, params[:from_rfc5646_locale], params[:to_rfc5646_locale])\n\n if errors.blank?\n ProjectTranslationsMassCopier.perform_once(@project.id, params[:from_rfc5646_locale], params[:to_rfc5646_locale])\n flash[:success] = t('controllers.projects.mass_copy_translations.success',\n from: params[:from_rfc5646_locale], to: params[:to_rfc5646_locale])\n redirect_to setup_mass_copy_translations_project_url(@project)\n else\n flash.now[:alert] = [t('controllers.projects.mass_copy_translations.failure')] + errors\n render 'setup_mass_copy_translations'\n end\n end",
"def find_all_valid_translations(translations)\n if translations.empty?\n return {:id => self.id, :key => self.key, :label => self.label, :original => true}\n end\n \n # if the first translation does not depend on any of the context rules\n # use it... we don't care about the rest of the rules.\n if translations.first.rules_hash.blank?\n return {:id => self.id, :key => self.key, :label => translations.first.label}\n end\n \n # build a context hash for every kind of context rules combinations\n # only the first one in the list should be used\n context_hash_matches = {}\n valid_translations = []\n translations.each do |translation|\n context_key = translation.rules_hash || \"\"\n next if context_hash_matches[context_key]\n context_hash_matches[context_key] = true\n if translation.rules_definitions\n valid_translations << {:label => translation.label, :context => translation.rules_definitions.dup}\n else\n valid_translations << {:label => translation.label}\n end\n end\n\n # always add the default one at the end, so if none of the rules matched, use the english one\n valid_translations << {:label => self.label} unless context_hash_matches[\"\"]\n {:id => self.id, :key => self.key, :labels => valid_translations}\n end",
"def set_text_node_translation(text_node, language, new_translation)\r\n text_node.xpath(\"./Translation\").each do |translation_node|\r\n if translation_node[\"Language\"] == language\r\n #Remove old translation\r\n translation_node.child.remove if translation_node.child\r\n\r\n translation_node.add_child(Nokogiri::XML::Text.new(new_translation, @xml_doc))\r\n end\r\n end\r\n end",
"def create\n @events_translation = EventsTranslation.new(params[:events_translation])\n\n respond_to do |format|\n if @events_translation.save\n format.html { redirect_to(@events_translation, :notice => 'Events translation was successfully created.') }\n format.xml { render :xml => @events_translation, :status => :created, :location => @events_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @events_translation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def translate\n return nil unless @final_output\n @final_output['vaFileNumber'] = @user.ssn\n @final_output['veteranSocialSecurityNumber'] = @user.ssn\n @final_output['veteranFullName'] = full_name\n @final_output['veteranDateOfBirth'] = @user.birth_date\n @final_output['email'] = @phone_email['emailAddress']\n @final_output['veteranPhone'] = @phone_email['primaryPhone']\n @final_output['veteranSecondaryPhone'] = '' # No secondary phone available in 526 PreFill\n @final_output['veteranServiceNumber'] = '' # No veteran service number available in 526 PreFill\n\n # The pdf creation functionality is looking for a single street address\n # instead of a hash\n @final_output['incidents'].each do |incident|\n incident['incidentLocation'] = join_location(incident['incidentLocation']) if incident['incidentLocation']\n end\n\n @final_output\n end",
"def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.story_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.story_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end"
] |
[
"0.6678037",
"0.66374016",
"0.65838206",
"0.63941294",
"0.6159064",
"0.6127903",
"0.5987292",
"0.58886397",
"0.5859988",
"0.5749931",
"0.5739476",
"0.57113284",
"0.56413764",
"0.55731034",
"0.5547592",
"0.55446863",
"0.5525683",
"0.54671293",
"0.53629845",
"0.5337515",
"0.5333315",
"0.5330848",
"0.5321779",
"0.53134274",
"0.5288909",
"0.5287743",
"0.5282655",
"0.5277343",
"0.5277343",
"0.5270566",
"0.5268734",
"0.5222251",
"0.5211336",
"0.5194785",
"0.5188558",
"0.5183719",
"0.5178532",
"0.51745266",
"0.5174066",
"0.51728565",
"0.51728046",
"0.5166102",
"0.51611644",
"0.51403475",
"0.5133534",
"0.51250046",
"0.51183975",
"0.51100844",
"0.5108766",
"0.5071473",
"0.50711864",
"0.5053097",
"0.50440985",
"0.50008124",
"0.49911317",
"0.49907258",
"0.4983765",
"0.49535865",
"0.4950661",
"0.49481055",
"0.49430227",
"0.49401128",
"0.49327907",
"0.49318513",
"0.4923837",
"0.4910174",
"0.4893132",
"0.48879176",
"0.48863772",
"0.48657358",
"0.48607773",
"0.48560548",
"0.484965",
"0.48362184",
"0.48350367",
"0.4829965",
"0.4821833",
"0.48157018",
"0.48097527",
"0.4801653",
"0.48010388",
"0.47994372",
"0.4798923",
"0.47964254",
"0.47961766",
"0.4791733",
"0.4787868",
"0.47874126",
"0.47803268",
"0.47776806",
"0.47723743",
"0.4766749",
"0.47637466",
"0.47581577",
"0.47556025",
"0.475446",
"0.47527134",
"0.47524",
"0.47505915",
"0.47496536"
] |
0.6576093
|
3
|
Strictly these are not "descendants", but to keep terminology consistent with ActiveRecord KeyValue backend.
|
def descendants
@descendants ||= Set.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def child_keys() []; end",
"def keys_visible_to_children\n keys - nonheritable_keys.to_a\n end",
"def descendants\n @hash.select { |attr, value| value == :undefined }.map do |attr, value|\n attributes[attr].map do |value|\n self.class.new(@hash.merge({ attr => value }))\n end\n end.flatten\n end",
"def descendent_names\n self_and_descendents.map(&:name).flatten \n end",
"def subtree_keys(key)\n raise \"subclass responsibility\"\n end",
"def descendent_keyinfo\n \t self_and_descendents.map{ |f|\n\t\t{ id: f.id, name: f.name, parent: f.parent, level: f.level}\n\t\t}.flatten\n end",
"def descendants\n Base.descendants\n end",
"def self_and_descendants_from_active_record\n [self]\n end",
"def descendants\n ascendants.reverse\n end",
"def self_and_descendants_from_active_record\n [self]\n end",
"def descendants\n @descendants\n end",
"def keys\n\t\tsuper + self.class.keys\n\tend",
"def children_names; @children.keys; end",
"def descendants\n without_self self_and_descendants\n end",
"def models\n children = []\n Mongoid.models.each do |model|\n children << model.to_s\n model.descendants.each do |child|\n inh = [child.to_s]\n sk = child.superclass\n while sk != model\n inh << sk.to_s\n sk = sk.superclass\n raise '!' if sk == Object\n end\n\n children << ' ' + inh.reverse.join(' < ')\n end\n end\n children\nend",
"def descendants\n self.class.descendants_of(self)\n end",
"def descendants\n without_self self_and_descendants\n end",
"def children_table; end",
"def keys\n @children.map(&:title)\n end",
"def descendants\n model_base_class.where(descendant_conditions)\n end",
"def descendents\n ObjectSpace.each_object(Class).select do |object|\n object < self\n end\n end",
"def parent_nonheritable_keys\n if @parent_configuration.respond_to?(:nonheritable_keys)\n @parent_configuration.nonheritable_keys\n else\n []\n end\n end",
"def descendants\n \t descendants = []\n \t self.children.each { |child|\n \t descendants += [child] if child.permitted?\n \t descendants += child.descendants\n \t } unless self.children.empty?\n \t descendants \n \tend",
"def key_coercions; end",
"def class_names\n descendants.map(&:name)\n end",
"def dependees_for(dependent)\n recursive_ancestors_for(dependent, :dependent, :keys)\n end",
"def base_and_descendants\n return descendants_base unless Group.supports_nested_groups?\n\n read_only(base_and_descendants_cte.apply_to(model.all))\n end",
"def descendants\n self.class.hierarchy_descendants(self)\n end",
"def matching_ancestors; end",
"def descendants\n _descendants.flatten.uniq\n end",
"def descendants\n model_base_class.scoped(:conditions => descendant_conditions)\n end",
"def descendants\n _descendants = children(true)\n children.each do |child|\n _descendants = _descendants + child.descendants\n end\n _descendants\n end",
"def rdfs_sub_property_of\n end",
"def symbolize_keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def keys; end",
"def weaker\n descendants\n end",
"def _defensio_keys\n self.class._defensio_keys\n end",
"def symbols_for_association_chain #:nodoc:\n parents_symbols\n end",
"def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end",
"def instance_ancestors_cache; end",
"def get_children()\n {}\n end",
"def key_attributes\n [\n first_and_middle_names,\n family_name,\n date_of_birth,\n place_of_birth,\n parent_first_and_middle_names,\n parent_family_name,\n other_parent_first_and_middle_names,\n other_parent_family_name\n ]\n end",
"def derived_attribute_names\n Module.nesting.first.public_instance_methods - [:derived_attribute_names]\n end",
"def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end",
"def attr_keys\n\t\treturn attr_keys_in @current_node\n\tend",
"def each_ancestor # :nodoc:\n end",
"def objects_and_symbols; end",
"def self_and_descendents\n [self] + descendents\n end",
"def descendants\n without_self(self_and_descendants)\n end",
"def self_and_descendents_from_active_record\n [self]\n end",
"def keys\n Keys[to_attr_list]\n end",
"def cti_all_descendants\n result = []\n block = Proc.new do |klass, descendants|\n result << klass\n descendants.each(&block)\n end\n @cti_descendants ||= {}\n @cti_descendants.each(&block)\n result\n end",
"def pairs_visible_to_children\n to_h.select {|k, v| keys_visible_to_children.include?(format_key(k)) }\n end",
"def subdirectory_keys(key)\n raise \"subclass responsibility\"\n end",
"def self_and_descendants\n # using _left_ for both sides here lets us benefit from an index on that column if one exists\n nested_set_scope.where(\n arel_table[primary_column_name].eq(self.primary_id).or(arel_table[total_order_column_name].gteq(total_order)).\n and(arel_table[total_order_column_name].lt(snumv/denv)))\n end",
"def roots\n nested.filter(self.model_classes[nil].qualified_parent_column => nil)\n end",
"def descendants_affected\n descendants\n end",
"def descendants\n records = fetch_self_and_descendants - [self]\n\n ActsAsOrderedTree::Relation::Preloaded.new(self.class).\n where(:id => records.map(&:id).compact).\n extending(Arrangeable).\n records(records)\n end",
"def self_and_descendants\n records = fetch_self_and_descendants\n\n ActsAsOrderedTree::Relation::Preloaded.new(self.class).\n where(:id => records.map(&:id)).\n extending(Arrangeable).\n records(records)\n end",
"def one_instance_ancestors_cache; end",
"def render_descendants(name_counts)\n\n name_counts.each { |key, value| puts \"\\t<#{key}> = #{value}\"}\n return\n\n end",
"def descendant_conditions\n column = \"#{self.base_class.table_name}.#{self.base_class.ancestry_column}\"\n lookup = if has_parent? then\n \"%/#{id}\"\n else\n \"#{id}\"\n end\n [\"#{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} = ?\", \"#{lookup}\", \"#{lookup}/%\", \"#{lookup},%\", \",#{id}\", \"#{id}\"]\n end",
"def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end",
"def nested_belongs_to_classes\n belongs_to_classes.select{|k| nested_attributes.include?(k)}\n end",
"def hkeys\n self.class.hkeys\n end",
"def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend",
"def descendants\n children + children.map(&:descendants).flatten\n end",
"def key_nonheritable_in_parent?(*key)\n parent_nonheritable_keys.include?(format_key(key.first))\n end",
"def hkeys\r\n self.class.hkeys\r\n end",
"def ancestors; end",
"def ancestors; end",
"def ancestors; end",
"def ancestors; end",
"def namespace_inheritance; end",
"def namespace_inheritance; end",
"def descendants\n Especie.where(\"#{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%,?,%'\", id).where.not(id: id)\n end",
"def key_exprs\n ( [self] + ancestors )\n .reject { |path| path.root? }\n .select { |path| path.segments.last&.key_expr? }\n end",
"def all_questions_descendants\n # source .descendants is very fast with no db hits! why? How can we use it? It's type is ActiveRecord::Association::CollectionProxy\n ([source] + source.descendants)\n end",
"def allowed_children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def remove_nodoc_children\n prefix = self.full_name + '::'\n\n modules_hash.each_key do |name|\n full_name = prefix + name\n modules_hash.delete name unless @store.modules_hash[full_name]\n end\n\n classes_hash.each_key do |name|\n full_name = prefix + name\n classes_hash.delete name unless @store.classes_hash[full_name]\n end\n end"
] |
[
"0.68670523",
"0.6032264",
"0.59837484",
"0.5922664",
"0.5858872",
"0.5787854",
"0.57714003",
"0.5755171",
"0.5750787",
"0.5734562",
"0.5703299",
"0.56742525",
"0.56597453",
"0.5655811",
"0.5655781",
"0.5638693",
"0.56327105",
"0.5613099",
"0.5578368",
"0.556059",
"0.5519804",
"0.5487069",
"0.5474527",
"0.54733104",
"0.54710305",
"0.5467463",
"0.54662764",
"0.5465037",
"0.5453348",
"0.5438262",
"0.54379857",
"0.54184175",
"0.5404056",
"0.54022604",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5370131",
"0.5363761",
"0.5362968",
"0.53421867",
"0.5337263",
"0.5331089",
"0.5328331",
"0.5323046",
"0.53228396",
"0.53121835",
"0.53104645",
"0.53039116",
"0.5295569",
"0.529041",
"0.526336",
"0.5261821",
"0.5259899",
"0.52539057",
"0.52477217",
"0.52307004",
"0.5229061",
"0.52208525",
"0.5218226",
"0.5209198",
"0.52085",
"0.5206622",
"0.5202442",
"0.51937646",
"0.5192543",
"0.51881593",
"0.5186511",
"0.51758516",
"0.51733804",
"0.5158947",
"0.51343656",
"0.51329",
"0.51329",
"0.51329",
"0.51329",
"0.51279646",
"0.51279646",
"0.5127707",
"0.51264906",
"0.51161546",
"0.5113359",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.5102549",
"0.50993335"
] |
0.56262094
|
17
|
get an immediate quote
|
def quote(sym)
throw new DatafeedException("Must be implemented by the vendor class.")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def quote\n %q[(?:\"|')?]\n end",
"def quote(value); end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quoted_string; end",
"def my_quote\n\tend",
"def quote\n fetch('final_space.quotes')\n end",
"def get_single_quote symbol, options = {}\n get_multiple_quotes([symbol], options)[0]\n end",
"def quote( val )\n\t\treturn %q{\"%s\"} % [ val.to_s.gsub(/\"/, '\\\\\"') ]\n\tend",
"def quote(text)\n \"#{quotes[0]}#{text}#{quotes[1]}\"\n end",
"def quote\n quote_of_the_day[0...second_to_last_index(quote_of_the_day, \"~\")].gsub(/(\\A[^a-zA-z0-9\"']*|\\s*\\z)/, \"\")\n end",
"def quote\n %Q{\"#{self}\"}\n end",
"def tex_quote\n to_s.tex_quote\n end",
"def quotes; end",
"def quote\n fetch('simpsons.quotes')\n end",
"def single_quote\n # single quote string here\n 'Hello World and others!'\nend",
"def dequote\n if self.quoted?\n return self[1...-1].strip\n else\n return self #TODO or should this be a false/nil/error?\n end\n end",
"def format_quote(q)\n if q == \"'\"\n '\"\\'\"'\n else\n \"'#{q}'\"\n end\n end",
"def unquote\n match = /\"(.*)\"/.match(self)\n match ? match[1] : self\n end",
"def quote\n fetch('stargate.quotes')\n end",
"def requote(value) return restore_ends(value, '\"') end",
"def marvin_quote; end",
"def quotes\n end",
"def set_quote\n \n end",
"def king_richard_iii_quote; end",
"def quote\n fetch('dumb_and_dumber.quotes')\n end",
"def quote\n fetch('the_office.quotes')\n end",
"def quote\n @quote ||= quote_hash\n end",
"def qq esc = nil\n %[\"#{esc ? self.gsub('\"') { esc } : self}\"]\n end",
"def quote\n fetch('ghostbusters.quotes')\n end",
"def quoted_string\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n text = nil\n string31 = nil\n\n begin\n # at line 189:4: QUOTE string QUOTE\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_quoted_string_1727 )\n @state.following.push( TOKENS_FOLLOWING_string_IN_quoted_string_1729 )\n string31 = string\n @state.following.pop\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_quoted_string_1731 )\n # --> action\n text = ( string31 && @input.to_s( string31.start, string31.stop ) )\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end\n \n return text\n end",
"def quote\n fetch('brooklyn_nine_nine.quotes')\n end",
"def quote\n fetch('rick_and_morty.quotes')\n end",
"def quote(s)\n \"\\\"#{s}\\\"\"\n end",
"def quote(val, column=nil)\n return val unless val.is_a?(String)\n \"'#{val.gsub(/\\'/, \"\\\\\\\\'\")}'\" # \" <= for Emacs font-lock\n end",
"def quote\n fetch('harry_potter.quotes')\n end",
"def quote\n fetch('movie.quote')\n end",
"def single_quoted_expression()\n\n\n\n # 285:7: '\\\\'' ( IDENTIFIER | NUMBER | expression_operator | quoted_operator | '\\\"' )* '\\\\''\n match(:SINGLE_QUOTES)\n # 285:12: ( IDENTIFIER | NUMBER | expression_operator | quoted_operator | '\\\"' )*\n while true\n alt41 = 6\n # ()* loopback of 285:12: ( IDENTIFIER | NUMBER | expression_operator | quoted_operator | '\\\"' )*\n case look_ahead(1)\n when :IDENTIFIER\n alt41 = 1\n when :NUMBER\n alt41 = 2\n when :LEFT_ANGULAR_BRACKET,:RIGHT_ANGULAR_BRACKET,:ECOMMERCIAL,:EQUAL,:LEFT_SQUARE_BRACKET,:RIGHT_SQUARE_BRACKET,:QUESTION_MARK,:PLUS,:MINUS,:TIMES,:MODULUS,:COLON,:PIPE,:WEDGE,:EXCLATION_MARK,:SLASH\n alt41 = 3\n when :SEMICOLON,:COMMA,:LEFT_BRACE,:RIGHT_BRACE,:LEFT_PARENTESIS,:RIGHT_PARENTESIS,:DOT,:BACKSLASH,:DOLLAR,:AT,:TILDE,:HASH,:T59,:T60\n alt41 = 4\n when :DOUBLE_QUOTES\n alt41 = 5\n end\n case alt41\n when 1\n # 285:13: IDENTIFIER\n match(:IDENTIFIER)\n when 2\n # 285:26: NUMBER\n match(:NUMBER)\n when 3\n # 285:35: expression_operator\n expression_operator()\n\n when 4\n # 285:57: quoted_operator\n quoted_operator()\n\n when 5\n # 285:75: '\\\"'\n match(:DOUBLE_QUOTES)\n else\n break\n end\n end\n match(:SINGLE_QUOTES)\n\n\n\n end",
"def quote\n fetch('new_girl.quotes')\n end",
"def format_quote\n\t\t@final_quote = @number.delete('\"\\\">$')\n\t\treturn @final_quote\n\tend",
"def hamlet_quote; end",
"def squote!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n\n type = SQUOTE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 173:10: '\\\\''\n match( 0x27 )\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__, 38 )\n\n end",
"def esc\r\n \"\\\"#{self}\\\"\"\r\n end",
"def quote!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n type = QUOTE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 166:9: '\\\"'\n match( 0x22 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n end"
] |
[
"0.73918986",
"0.72340447",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7169205",
"0.7162046",
"0.71592486",
"0.7052437",
"0.7038906",
"0.694278",
"0.6802244",
"0.67948675",
"0.6759549",
"0.67593765",
"0.67570066",
"0.67164576",
"0.66877395",
"0.6644428",
"0.6623274",
"0.6618654",
"0.66142744",
"0.6613562",
"0.6604507",
"0.66031086",
"0.6577727",
"0.6573703",
"0.65690076",
"0.656476",
"0.6558748",
"0.65552586",
"0.6541641",
"0.6521569",
"0.6492337",
"0.64780396",
"0.6442424",
"0.6406102",
"0.63808244",
"0.6366627",
"0.63464934",
"0.6343281",
"0.63353354",
"0.63086087",
"0.6288169",
"0.6286131",
"0.6255791"
] |
0.0
|
-1
|
register to listen for given list of symbols syms is either a single symbol or an array of symbols to listen for. The block of code gets called with (symbol, ostruct), and the ostruct object will contain the particulars. This method returns the block passed in, so it can be used to unregister later.
|
def registerQuotes(syms, &block)
raise DatafeedException("Block Needed for updates!") if block.nil?
syms = [syms] unless syms.kind_of? Array
syms.each { |sym|
register(:quote, sym.to_sym, &block)
}
puts "\nregistered #{syms.join(' ')} to callback #{block}"
@block_hash[block.hash] = block
block.hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def listen(symbol, &block)\n @listeners << [symbol, block]\n end",
"def each_registered_block(type, &block); end",
"def each() @symbols.each {|s| yield s if block_given? } end",
"def register_block_for(type, &blk); end",
"def register_subscriber(protocol, block)\n @subscribers[protocol] ||= []\n @subscribers[protocol] << block\n end",
"def listen_ticker(pair=\"BTCUSD\", &block)\n raise BlockMissingError unless block_given?\n register_channel pair: pair, channel: \"ticker\", &block\n end",
"def add(name, &block)\n blocks[name.to_sym] = block\n end",
"def __synchromesh_parse_regulator_params(name, block)\n if name.is_a? Hash\n name, block = name.first\n if %i[denied! deny denied].include? block\n block = ->(*_args) { denied! }\n elsif !block.is_a? Proc\n value = block\n block = ->(*_args) { value }\n end\n end\n [name, block || ->(*_args) { true }]\n end",
"def listen( *args, &blok )\n if args[0].kind_of? Symbol\n if args.size == 2\n args[1].each { |match| @procs << [args[0], match, blok] }\n else\n add( [args[0], nil, blok] )\n end\n elsif args[0].kind_of? Array\n if args.size == 2\n args[0].each { |match| add( [nil, match, args[1]] ) }\n else\n args[0].each { |match| add( [ :start_element, match, blok ] ) }\n end\n else\n add([nil, nil, args[0]])\n end\n end",
"def each(&block)\n return to_enum(__method__) unless block\n\n @receivers << block\n block.call io.string.dup unless io.string.empty?\n sync\n\n self\n end",
"def slot(*names)\n names = [names].flatten\n names.each do |name|\n name = valid_signal_name!(name)\n slots << name\n end\n end",
"def each_slot(&blk)\n @slots.each do |slot|\n blk.call(slot)\n end\n end",
"def to_register(compiler, source)\n left = Risc.message_named_reg\n slots = @slots\n while( slots )\n left = left.resolve_and_add( slots.name , compiler)\n slots = slots.next_slot\n end\n return left\n end",
"def register(listener=nil, &block)\n if listener\n listeners << listener\n if block\n begin\n yield\n ensure\n unregister(listener)\n end\n end\n listener\n else\n listeners << block\n block\n end\n end",
"def register(name, &block)\n\n # Create the message decoder and register it to the handler.\n decoder = ProcMessageDecoder.new block\n @handler.register_decoder name, decoder\n end",
"def with_register name = \"temp\"\n reg = register(name)\n yield reg\n release_register reg\n end",
"def createRegister symbol\n s(:send, nil, :register,\n s(:sym, symbol),\n s(:lvar, symbol)\n )\n end",
"def createRegister symbol\n s(:send, nil, :register,\n s(:sym, symbol),\n s(:lvar, symbol)\n )\n end",
"def register(*args, &block)\n h = Unobservable.handler_for(*args, &block)\n @handlers << h\n return h\n end",
"def parse_list(opsym)\n opupdate = ->(f,e1,e2) { f.call(e1) << e2 }\n sof = ->(x) { [x] }\n method(:parse_ginfix).curry.call(opsym, opupdate, sof)\n end",
"def access(sym=nil)\n if block_given?\n raise ArgumentError, \"can't have a sym and a block\" if sym\n @mutex.synchronize { yield }\n else\n @mutex.synchronize { send sym }\n end\n end",
"def register extension = nil, &block\n if block_given?\n registered << block\n elsif extension\n registered << resolve_class(extension)\n end \n end",
"def register_accept_listener &block\n @accept_listeners << block unless @accept_listeners.include? block\n block\n end",
"def to_register(compiler, source)\n type = known_object.get_type\n raise \"not sym for #{known_object}\" if type.is_a?(String)\n last = Risc.load_constant(source, known_object)\n compiler.add_code last\n if slots_length > 1\n last = Risc.slot_to_reg( source , last.register ,slots.name)\n compiler.add_code(last)\n end\n if slots_length > 2\n last = Risc.slot_to_reg( source , last.register , slots.next_slot.name )\n compiler.add_code(last)\n end\n if slots_length > 3\n raise \"3 slots only for type #{slots}\" unless slots.next_slot.next_slot.name == :type\n last = Risc.slot_to_reg( source , last.register , slots.next_slot.name )\n compiler.add_code(last)\n end\n return last.register\n end",
"def initialize(symbol, options, &block)\n @symbol, @options, @block = symbol,options,block\n end",
"def event(name, &block)\n @events[name.to_sym] = block if block_given?\n end",
"def register(&block)\n extend Module.new(&block)\n end",
"def register_service( name, &block )\n EXTERNAL_SERVICES[ name ] = block\n end",
"def add_open_signal(&block)\n @open_signal << block\n end",
"def onupdate_register_once(*a)\n handle = onupdate_register(*a) {\n onupdate_unregister(handle) if yield\n }\n end",
"def onupdate_register_once(*a)\n handle = onupdate_register(*a) {\n onupdate_unregister(handle) if yield\n }\n end",
"def symbols_second_pass(symbol_defs)\n @data.each do |i, byte|\n next unless byte.is_a?(Symbol) || byte.is_a?(Pointer)\n symbol = byte.is_a?(Pointer) ? byte.symbol : byte\n address = symbol_defs[symbol]\n # Check if address needs to be assembled as an indirect memory reference\n address = convert_binary_to_signed_negative(address) if byte.is_a? Pointer\n @data[i] = address\n end\n end",
"def add_open_signal(&block)\n @open_signals << block\n end",
"def register(key, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @items[key] = block\n end",
"def register(owners, event, priority: T.unsafe(nil), &block); end",
"def add(name, &block)\n define_method(name.to_sym) { yield block }\n end",
"def reg(&block)\n r = Registrar.new\n Signal.add_trap(0) { r.safe_release! }\n r.logger = opt.logger if opt.logger\n r.config.instance_eval(&block)\n registrars[r.config.device] = r\n end",
"def on(*events, &block)\n events.each { |event| @events[event].unshift(block) }\n nil\n end",
"def on(*events, &block)\n events.each { |event| @events[event].unshift(block) }\n nil\n end",
"def let(name, &block); end",
"def push(block)\n @names[block.name.to_s] ||= []\n @names[block.name.to_s] << block\n end",
"def rdl_at(sym, &blk)\n RDL.to_do_at[sym] = [] unless RDL.to_do_at[sym]\n RDL.to_do_at[sym] << blk\n end",
"def listen(&block)\n loop do\n block.call receive\n end\n end",
"def each\n _registry.each do |name, s|\n yield name, s\n end\n end",
"def tag!(sym, *args, &block)\r\n method_missing(sym.to_sym, *args, &block)\r\n end",
"def each(&block)\n events.each(&block)\n end",
"def on name, &block\n (callbacks[name] ||= []) << block\n end",
"def register(hook, obj = T.unsafe(nil), &blk); end",
"def sexp_provide_block\n program = sexp[1]\n\n program.each do |s|\n if s[0] == :method_add_block and\n s[1][0] == :command_call and\n s[1][1][0] == :method_add_arg and\n s[1][1][1][0] == :call and\n s[1][1][1][1][0] == :const_path_ref and\n s[1][1][1][1][1][0] == :var_ref and\n s[1][1][1][1][1][1][0..1] == [:@const, \"Puppet\"] and\n s[1][1][1][1][2][0..1] == [:@const, \"Type\"] and\n s[1][1][1][3][0..1] == [:@ident, \"type\"] and\n s[2][0] == :do_block\n\n return s[2][2]\n end\n end\n\n []\n end",
"def each_match(smarts_or_string, uniq=true, &block)\n block or return enum_for(__method__, smarts_or_string, uniq)\n _atoms = self.atoms\n smarts_indices(smarts_or_string, uniq).each do |ar|\n block.call(_atoms.values_at(*ar))\n end\n end",
"def to_register(compiler, source)\n type = known_object.get_type\n raise \"not sym for #{known_object}\" if type.is_a?(String)\n right = compiler.use_reg( type )\n const = Risc.load_constant(source, known_object , right)\n compiler.add_code const\n if slots_length > 1\n # desctructively replace the existing value to be loaded if more slots\n compiler.add_code Risc.slot_to_reg( source , right ,slots.name, right)\n end\n if slots_length > 2\n # desctructively replace the existing value to be loaded if more slots\n index = Risc.resolve_to_index(slots.name , slots.next_slot.name ,compiler)\n compiler.add_code Risc::SlotToReg.new( source , right ,index, right)\n if slots_length > 3\n raise \"3 slots only for type #{slots}\" unless slots.next_slot.next_slot.name == :type\n compiler.add_code Risc::SlotToReg.new( source , right , Parfait::TYPE_INDEX, right)\n end\n end\n return const.register\n end",
"def sw_register\n r = {}\n swregister = SWRegService.new(attributes)\n r[:layout], r[:data] = swregister.send(reg_type)\n r\n end",
"def test_that_symbols_map_correctly\r\n blk = lambda { 42 }\r\n x = @s.add_entry('fubar', :word, block: blk)\r\n z = @s.unmap(x.symbol)\r\n\r\n assert_equal('fubar', x.name)\r\n assert_equal('fubar', z.name)\r\n\r\n assert_equal(x.symbol, z.symbol)\r\n\r\n assert_equal(:word, x.type)\r\n assert_equal(:word, z.type)\r\n\r\n refute(x.immediate?)\r\n refute(z.immediate?)\r\n\r\n assert_equal(42, x.block.call)\r\n assert_equal(42, z.block.call)\r\n end",
"def many(sym, &block)\n _defmetasyntax(\"many\", _intern(sym), block) {|target|\n seq() { [] }\\\n | seq(target, sym) {|list, x| list.push x; list }\n }\n end",
"def symbols_first_pass\n symbol_defs = {}\n @data.each do |address, byte|\n next unless byte.is_a? Hash\n symbol = byte.keys.first\n value = byte.values.first\n # Store the symbol and its address for the second pass\n symbol_defs[symbol] = address\n # Replace the definition with just the value\n @data[address] = value\n end\n symbol_defs\n end",
"def watch(&block)\n instance_eval(&block)\n add_watch_callbacks\n end",
"def incoming(symbol, options = {})\n previous = class_variable_defined?(:@@internal) ?\n class_variable_get(:@@internal) :\n []\n\n attr = { handler: symbol, external_key: symbol }\n\n attr.store(:external_key, options[:as]) if options.has_key?(:as)\n\n class_variable_set(:@@internal, previous.push(attr))\n end",
"def register_spec_type(*args, &block); end",
"def let(callback_name, &block)\n raise ArgumentError, \"Incorrect callback `#{callback_name}'.\" unless [:uuid_scope, :push].include?(callback_name)\n @callbacks[callback_name] = block\n end",
"def each(&block)\n\t\t\t\t@receivers.each(&block)\n\t\t\tend",
"def evt(name, &block)\n if name.is_a? String\n name = name.to_sym\n end\n if @listeners[name].nil?\n @listeners[name] = []\n end\n @listeners[name] << block\n end",
"def register(name, &blk)\n name = name.to_sym\n\n @__storage__[name] = blk\n end",
"def register(event_ids, handler_object = nil, &handler_proc)\n handler = handler_proc || handler_object\n\n if handler.nil? || !handler.respond_to?(:call)\n raise ArgumentError, \"Please pass either an object#call or a handler block\"\n end\n\n Array(event_ids).flatten.each do |id|\n @handlers[\n @resolver.transform(id).to_s\n ] << handler\n end\n\n nil\n end",
"def agregarBLoqueYSym(name,block)\n #Agrega un par de selector y su respectivo bloque a un lista\n par = name,block\n listaDeBloquesYSelector.push(par)\n end",
"def on_add(&block)\n @add_proc = block\n end",
"def many1(sym, &block)\n _defmetasyntax(\"many1\", _intern(sym), block) {|target|\n seq(sym) {|x| [x] }\\\n | seq(target, sym) {|list, x| list.push x; list }\n }\n end",
"def add_spec sym, spec \n SPECS[sym] = spec\n end",
"def add_spec sym, spec \n SPECS[sym] = spec\n end",
"def on_satellites_change(&block)\n\t\t\t@on_satellites_change = block\n\t\tend",
"def add(&block)\n @block_args << block\n end",
"def each(&block)\n @gems.each(&block)\n end",
"def each(&block)\n @gems.each(&block)\n end",
"def register(cb_sym, meth, klass)\n self[klass.to_s.make_key][cb_sym] << meth\n end",
"def unregister(symbol); end",
"def capture_turbo_stream_broadcasts(stream_name_or_object, &block)\n block&.call\n\n stream_name = stream_name_from(stream_name_or_object)\n payloads = broadcasts(stream_name)\n\n payloads.flat_map do |payload|\n html = ActiveSupport::JSON.decode(payload)\n document = Nokogiri::HTML5.parse(html)\n\n document.at(\"body\").element_children\n end\n end",
"def slice(*syms, &block)\n result = {}\n syms.each do |sym|\n result[sym] = self.__send__ sym\n end\n\n # allow a block to be passed in so that it can be sliced using additional logic\n if block_given?\n result.merge!(block.call(self))\n end\n result\n end",
"def listen(format, &block)\n matcher = @@parser.interpret(format)\n raise \"Could not listen for '#{format}'\" unless matcher\n @listeners[matcher] = block\n end",
"def each(&block)\n interfaces_hash.each_value(&block)\n end",
"def each_service(wspace=workspace, &block)\n\t\tservices(wspace).each do |service|\n\t\t\tblock.call(service)\n\t\tend\n\tend",
"def create_block_object(&block)\n block\nend",
"def register(id, &block)\n ref = __get id\n return ref.__getobj__ if ref && ref.weakref_alive?\n item = block.call\n return nil unless item\n __register id, item\n end",
"def given_server(&block)\n @servers.push(Server.new(&block))\n end",
"def on(type, &block)\n callbacks[type.to_sym] ||= []\n callbacks[type.to_sym] << block\n end",
"def register_hook(hook_name, block)\n hooks_for(hook_name).each do |blk|\n # Simple but effective proc compartion\n return nil if blk.source_location == block.source_location\n end\n hooks_for(hook_name) << block\n end",
"def on_track_list_replaced( &block )\n track_list_iface.on_signal @object.bus, 'TrackListReplaced', &block\n end",
"def each_var(&block)\n @parent.each_var(&block) if @parent.respond_to?(:each_var)\n @symbols.each do |key, value|\n block.call((key * '').to_sym, value)\n end\n end",
"def init(&block)\n @inits << block\n end",
"def init(&block)\n @inits << block\n end",
"def each_service(&block)\n\t\tservices.each do |service|\n\t\t\tblock.call(service)\n\t\tend\n\tend",
"def map_systemTs!(&ruby_block)\n @systemTs.map(&ruby_block)\n end",
"def register_codes\n @register_codes ||= @registers.inject({}) do |memo, (_, r)|\n memo[r.opcode] = r\n memo\n end\n end",
"def get_symbol\n token = @tokens.next\n\n case token\n when :symbol then\n [:symbol, *parse_symbol]\n when :symbol_link then\n [:symbol_link, @tokens.next]\n else\n raise ArgumentError, \"expected SYMBOL or SYMLINK, got #{token.inspect}\"\n end\n end",
"def each_hash &block\n @songs.each &block\n end",
"def register(curr); end",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def each_event(&block)\n find_by_terms(:event).each do |node|\n block.call(node['type'], node['who'], Time.parse(node['when']), node.content)\n end\n end",
"def each(&block)\n specs.each(&block)\n end",
"def initialize symbol, *args, &block\n @symbol = symbol.to_sym\n @args = args\n @block = block\n end",
"def with_block(&block)\n end",
"def add_callback(&block)\n @blocks << block\n end"
] |
[
"0.5968555",
"0.59312075",
"0.57577866",
"0.57144195",
"0.5472704",
"0.53074557",
"0.5116038",
"0.50879526",
"0.5086322",
"0.5073798",
"0.49017787",
"0.48971698",
"0.48659536",
"0.4834836",
"0.48323596",
"0.4797704",
"0.47896737",
"0.47896737",
"0.47772986",
"0.4769264",
"0.47645515",
"0.47640955",
"0.47443488",
"0.4741147",
"0.47404286",
"0.47327474",
"0.47258383",
"0.47186637",
"0.47013646",
"0.4689989",
"0.4689989",
"0.46764573",
"0.46741512",
"0.46659115",
"0.46589944",
"0.46533212",
"0.46434748",
"0.4621536",
"0.4621536",
"0.46112892",
"0.4608166",
"0.46063834",
"0.46056578",
"0.45922172",
"0.45770457",
"0.4569775",
"0.4548941",
"0.45445254",
"0.45425504",
"0.45390257",
"0.4538882",
"0.45310614",
"0.45301855",
"0.45295987",
"0.45096835",
"0.45041367",
"0.45002264",
"0.44937444",
"0.4492008",
"0.44914496",
"0.44882646",
"0.4486852",
"0.44822186",
"0.4468596",
"0.44619727",
"0.44560856",
"0.44482666",
"0.44482666",
"0.44458473",
"0.4443112",
"0.44408104",
"0.44408104",
"0.44406047",
"0.44399083",
"0.4438764",
"0.44385692",
"0.4437138",
"0.44314918",
"0.44244438",
"0.44233686",
"0.4419871",
"0.44197354",
"0.44164136",
"0.44118598",
"0.4411687",
"0.44116044",
"0.44078702",
"0.44078702",
"0.44052634",
"0.44047546",
"0.44027176",
"0.43917412",
"0.43909264",
"0.43903366",
"0.43875885",
"0.43870437",
"0.43856317",
"0.43843594",
"0.4384061",
"0.43767154"
] |
0.5906569
|
2
|
Transmit the quote to registered listeners.
|
def transmitQuote(sym, ob)
transmit(:quote, sym.to_sym, ob)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def quote_received(quote)\n @quote = quote\n\n mail to: quote.email, :subject => \"Your Quote Received\"\n end",
"def send_price_quote(price_quote)\n @price_quote = price_quote\n mail to: @price_quote.request.user.email, subject: 'New price quote on Stabstr'\n end",
"def transmit\n @transmitter.transmit @propeller_data\n end",
"def quote_request(quote)\n @quote = quote\n mail( to: TO, subject: \"Quote Request by #{@quote.name.camelcase} #{Time.current.strftime('%b %d, %Y %H:%M %p')}\")\n end",
"def send\n Chain.send_transaction(hex)\n end",
"def accept_quote\n # When the button is clicked, the params contain the quote ID of the accepted quote\n quote = Quote.find(params[:quote_id][:quote_id])\n # get the company of the accepted quote\n company_name = User.find(quote.user_id).company_name\n # get the amount of the accepted quote. This value is used in the flash message below\n quote_amount = number_to_currency(quote.amount)\n\n # Update the quote to status \"Accepted\"\n quote.update(quote_params)\n # Update the quote to status \"Accepted\"\n @service_request.update(service_request_params)\n\n # Send email to the company to inform them that the quote has been accepted.\n UserNotifier.new_quote_notification(User.find(quote.user_id)).deliver\n\n flash[:success] = \"You have accepted #{company_name}'s quote for #{quote_amount}\"\n redirect_to user_service_request_path(quote.service_request.user_id, quote.service_request.id)\n end",
"def quote\n fetch('cowboy_bebop.quote')\n end",
"def send_quote(operator, trip)\n @trip = trip\n @operator = operator\n @emails = Organisation.get_all_emails(trip.organisation)\n mail(\n to: @emails,\n subject: 'JetSetGo - quote created'\n )\n end",
"def quote(params)\n request(Resources::RESOURCE_QUOTE, HTTP_METHOD_POST, params)\n end",
"def new_quote_notice(quote)\n @quote = quote\n mail(subject: \"[team] New Enquiry Received\")\n end",
"def send\n @sent_at = Time.now\n sender.publish(data, meta)\n self\n end",
"def notify_parties\n buyer.add_transaction self\n seller.add_transaction self if seller\n end",
"def quote\n fetch('v_for_vendetta.quotes')\n end",
"def quote\n fetch('hey_arnold.quotes')\n end",
"def save!\n raise Glueby::Contract::Errors::TxAlreadyBroadcasted if @txid\n\n @tx = create_tx(@wallet, @prefix, Tapyrus.sha256(@content), @fee_provider)\n @txid = @wallet.internal_wallet.broadcast(@tx)\n end",
"def send_data\n @propeller.transmit\n end",
"def perform(quote_id)\n quote = Agents::Branches::AssignedAgents::Quote.where(id: quote_id.to_i).last\n property_id = quote.property_id\n details = PropertyDetails.details(property_id)[:_source]\n agent_id = quote.agent_id\n vendor_first_name = details[:vendor_first_name]\n vendor_email = details[:vendor_email]\n address = details[:address]\n\n assigned_agent = Agents::Branches::AssignedAgent.where(id: agent_id).last\n agent_first_name = assigned_agent.first_name\n agent_last_name = assigned_agent.last_name\n agent_branch_name = assigned_agent.branch.name\n\n if quote\n template_data = { vendor_first_name: vendor_first_name, vendor_property_address: address, agent_first_name: agent_first_name,\n agent_last_name: agent_last_name, agent_branch_name: agent_branch_name }\n self.class.send_email(vendor_email, 'vendor_quote_notify', self.class.to_s, template_data)\n end\n\n end",
"def quote\n fetch('harry_potter.quotes')\n end",
"def request_quote\n @title = \"Request a Quote\"\n end",
"def transmit(command, options={})\n client.connection.transmit(command, **options)\n end",
"def quote\n fetch('simpsons.quotes')\n end",
"def send_to_acx\n @result[:sent] = @transaction_class.with_status(:new).with_result(:unreconciled).inject(0) do |count, transaction|\n response = {\"command\"=> \"reconcile_#{transaction_name}\", transaction_name => transaction}\n AMQPQueue.enqueue(response)\n transaction.status = :sent\n transaction.send_times += 1\n transaction.save\n count += 1\n end\n end",
"def quotes(opts={})\n set_opts(opts)\n connection.url = self.route\n\n connection.add_plugin :result_parser unless connection.plugin?(:result_parser)\n connection.add_plugin Parsers::Quote unless connection.plugin?(Parsers::Quote)\n\n connection.perform\n end",
"def send_order(_trade_type, _price, _quantity)\n raise 'self subclass responsibility'\n end",
"def quote(options = {})\n post(\"customers/#{customer_id}/delivery_quotes\", options)\n end",
"def transmit(command, headers = {}, body = '')\n # The transmit may fail so we may need to retry.\n while true\n begin\n used_socket = socket()\n _transmit(used_socket, command, headers, body)\n return\n rescue Stomp::Error::MaxReconnectAttempts => e\n _ = e\n raise\n rescue\n @failure = $!\n raise unless @reliable\n errstr = \"transmit to #{@host} failed: #{$!}\\n\"\n unless slog(:on_miscerr, log_params, \"es_trans: \" + errstr)\n $stderr.print errstr\n end\n # !!! This loop initiates a re-connect !!!\n _reconn_prep()\n end\n end\n end",
"def send_transaction_finished_event\n agent.events.notify(:transaction_finished, payload)\n end",
"def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.valid?\n Quoter.quote_email(@quote).deliver_now\n Quoter.confirm_email(@quote).deliver_now\n format.html { redirect_to root_url, notice: 'Cotización enviada' }\n\n else\n format.html { redirect_to root_url(@quote), notice: 'No se pudo enviar tu cotización'}\n\n end\n end\n end",
"def on_tx(tx)\n log.debug { \">> tx: #{tx.hash} (#{tx.payload.size} bytes)\" }\n @node.queue.push([:tx, tx])\n end",
"def quote\n fetch('new_girl.quotes')\n end",
"def quote\n fetch('dumb_and_dumber.quotes')\n end",
"def quote(*args)\n if args[0].kind_of?(Hash)\n post({:type => \"quote\"}.update(args[0]))\n else\n text, source, dummy = args\n post(:type => \"quote\", :quote => text, :source => source)\n end\n end",
"def on_trade(trade)\r\n warn \"Trade \" + trade.to_s\r\n end",
"def transmission; end",
"def quote\n fetch('stargate.quotes')\n end",
"def enq(*args)\r\n app.enq(self, args)\r\n end",
"def buy(instrument, quantity, options = {}, &blk)\n params = { instrument: instrument, quantity: quantity, price: options[:price] }\n if block_given?\n websocket.subscribe :buy, params: params.merge(auth: true), &blk\n else\n http.post :buy, params\n end\n end",
"def ask_price_quote\n if @order.is_reorder?\n AdministrativeMailer.delay.printer_quote(current_user, @order.number_of_books, @order.order_bw_pages, @order.order_color_pages, @order.ship_zip, @cookbook.book_binding)\n else\n AdministrativeMailer.delay.printer_quote(current_user, @order.number_of_books, @cookbook.num_bw_pages, @cookbook.num_color_pages, @order.ship_zip, @cookbook.book_binding)\n end\n end",
"def send_transaction(tx)\n sendrawtransaction(tx)\n end",
"def send!\n @_sended = true\n self\n end",
"def set_quot\n @quote = Quote.find(params[:id])\n end",
"def quote(params)\n Ciirus::Commands::QuoteFetcher.new(credentials).call(params)\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def set_quote\n @quote = Quote.find(params[:id])\n end",
"def notify_email\n begin\n QuoteMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send quote email notification. #{e.message}\")\n end\n end",
"def send(a)\n\t\t@connection.puts a\n\tend",
"def quote_params\n params.require(:quote).permit(:text, :quoted, :user_id)\n end",
"def send_pending; end",
"def sync_send\n sync_write.putc(\"!\")\n sync_write.flush\n end",
"def quote\n fetch('princess_bride.quotes')\n end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end"
] |
[
"0.6196423",
"0.6081592",
"0.5622751",
"0.5618846",
"0.55836076",
"0.5583138",
"0.5554993",
"0.5489212",
"0.54704297",
"0.5378231",
"0.53777385",
"0.5374911",
"0.5352129",
"0.52698386",
"0.52685434",
"0.5248264",
"0.52461725",
"0.5235718",
"0.5229767",
"0.5194808",
"0.51729524",
"0.5170803",
"0.5166868",
"0.5157942",
"0.50732607",
"0.5069194",
"0.5067241",
"0.5054077",
"0.5023464",
"0.50216925",
"0.50198174",
"0.5019053",
"0.50183606",
"0.5016116",
"0.50001097",
"0.49996835",
"0.49912053",
"0.49882603",
"0.49843642",
"0.49708194",
"0.49680305",
"0.495378",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49499455",
"0.49489585",
"0.494695",
"0.4938675",
"0.49235287",
"0.49222875",
"0.492082",
"0.49162853",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348",
"0.49089348"
] |
0.6076859
|
2
|
Generalized tick fetch. If the block is used, the arrays will be retured in chunks, which should be accumulated. This is to eliminate the problem of passing large arrays across DRb.
|
def fetchTicks(symbol, days=nil, startTime=nil, endTime=nil, eos=true, &block)
brokerFetchTicks(symbol, days, startTime, endTime, eos, &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch!\n fetch0(Array, true)\n end",
"def fetch\n fetch0(Array, false)\n end",
"def loop(num_ticks, tick_time)\n @tick_time = tick_time\n \n (0..num_ticks).each do |tick|\n time = java.lang.System.currentTimeMillis\n\n @tick = tick\n yield tick\n\n sleep_time = @tick_time - (java.lang.System.currentTimeMillis - time)\n java.lang.Thread.sleep(sleep_time) if sleep_time > 0\n end\n end",
"def fetch(&block)\n block.call(true, 20)\n end",
"def tick; end",
"def tick; end",
"def tick; end",
"def fetch_sequential(collection, &block)\n results = []\n engine = @turn_on_engine ? @engine_klass.new(@config.domain, @config.cache_http) : nil\n collection&.each_slice(@config.download_batch_size) do |batch|\n batch.each do |item|\n batch_results = block.call(item, engine)&.flatten\n results += ( batch_results || [])\n end\n end\n results\n end",
"def each_chunk; end",
"def untick; end",
"def query_each_side_has_a_block x, y, z, do_update = false\r\n arr = Array.new(6, false)\r\n arr[0] = get_block_at(x, y - 1, z) == nil #bottom\r\n arr[1] = get_block_at(x, y, z - 1) == nil #sides\r\n arr[2] = get_block_at(x - 1, y, z) == nil #sides\r\n arr[3] = get_block_at(x + 1, y, z) == nil #sides\r\n arr[4] = get_block_at(x, y, z + 1) == nil #sides\r\n arr[5] = get_block_at(x, y + 1, z) == nil #top\r\n \r\n if do_update \r\n chx = (x / Util::Chunk_Size).floor\r\n chy = (y / Util::Chunk_Size).floor\r\n chz = (z / Util::Chunk_Size).floor\r\n \r\n if chy != ((y - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y - 1) / Util::Chunk_Size).floor, chz)\r\n elsif chy != ((y + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y + 1) / Util::Chunk_Size).floor, chz)\r\n end\r\n \r\n if chx != ((x - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x - 1) / Util::Chunk_Size).floor, chy, chz)\r\n elsif chx != ((x + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x + 1) / Util::Chunk_Size).floor, chy, chz)\r\n end\r\n \r\n if chz != ((z + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z + 1) / Util::Chunk_Size).floor)\r\n elsif chz != ((z - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z - 1) / Util::Chunk_Size).floor)\r\n end\r\n \r\n end\r\n\r\n #@called += 1\r\n #puts @called\r\n \r\n return arr\r\n end",
"def get_data\n (mem, w_cache) = get_mem\n [100*mem.to_f/@total, 100*w_cache.to_f/@total]\n end",
"def tick\n defaults\n render\n calc\n process_inputs\n end",
"def tick\n defaults\n render\n calc\n process_inputs\n end",
"def brokerFetchTicks(symbol, days=nil, startTime=nil, endTime=nil, eos=true, &block)\n puts \"brokerFetchTicks() for %s\" % symbol\n soc = dtnsoc\n if days\n soc.puts [HTD, symbol,days, nil, nil, nil,1].join ','\n elsif startTime and endTime\n cmd = [HTT, symbol, \n startTime.strftime(FDT), \n endTime.strftime(FDT), nil, nil, nil, 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(@@TICK).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 tick\n @tick ||= [\"2714\".hex].pack(\"U*\")\n end",
"def each_tick(tpl)\n \n return \"Range not aligned with presets (call round range first)\" if not @lmax \n\n return if @lmax==0\n\t return if tpl==0\n \n lint = @lmax/tpl\n\t return if lint==0\n if @rmin % lint != 0\n v = (@rmin+lint) - (@rmin%lint)\n else\n v = @rmin\n end\n while (v<@rmax) do\n yield v\n v = v+lint\n end\n end",
"def workload\n [@nodeid,@data.count]\n end",
"def tick\n @requests.each do |id,req|\n req.tick\n end\n end",
"def nc_my_each(array, &block)\n array.length.times do |i|\n block.call(array[i])\n end\n array\nend",
"def chunk(array, n)\nend",
"def fetch(*args)\n #FIXME: Refactor this\n start_time_ptr = empty_pointer\n end_time_ptr = empty_pointer\n step_ptr = empty_pointer\n ds_count_ptr = empty_pointer\n ds_names_ptr = empty_pointer\n values_ptr = empty_pointer\n\n argv = to_pointer([\"fetch\"] + args)\n if respond_to?(:rrd_fetch_r)\n file = args[0]\n cf = args[1]\n options = {}\n args[2..-1].each_slice(2) {|v| options[v.first] = v.last}\n start_time = options[\"--start\"]\n end_time = options[\"--end\"]\n step = options[\"--resolution\"]\n start_time_ptr.put_int(0, start_time.to_i)\n end_time_ptr.put_int(0, end_time.to_i)\n step_ptr.put_int(0, step.to_i)\n return false unless rrd_fetch_r(file, cf, start_time_ptr, end_time_ptr, step_ptr, ds_count_ptr, ds_names_ptr, values_ptr) == 0\n else\n return false unless rrd_fetch(args.size+1, argv, start_time_ptr, end_time_ptr, step_ptr, ds_count_ptr, ds_names_ptr, values_ptr) == 0\n end\n\n ds_count = ds_count_ptr.get_int(0)\n start_time = start_time_ptr.get_int(0)\n end_time = end_time_ptr.get_int(0)\n step = step_ptr.get_int(0)\n\n result_lines = (end_time-start_time)/step\n\n ds_names = ds_names_ptr.get_pointer(0).get_array_of_string(0, ds_count)\n values = values_ptr.get_pointer(0).get_array_of_double(0, result_lines * ds_count)\n\n result = [[\"time\"] + ds_names]\n (0..result_lines-1).each do |line|\n date = start_time + line*step\n first = ds_count*line\n last = ds_count*line + ds_count - 1\n result << [date] + values[first..last]\n end\n\n free_in_rrd(*ds_names_ptr.read_pointer.read_array_of_pointer(ds_count))\n free_in_rrd(values_ptr.read_pointer, ds_names_ptr.read_pointer)\n\n result\n ensure\n free_pointers\n end",
"def tick\n if @ticks == @samples\n @ticks = 0\n @current = @samples/(Time.now.to_f - @ref)\n @min = [@current, @min].min\n @max = [@current, @max].max\n @to_s = sprintf(\"%.2f %.2f %.2f\\n\", min, current, max)\n return true\n end\n \n @ref = Time.now.to_f if @ticks == 0\n @ticks += 1\n \n return false\n end",
"def tick\n end",
"def time\n\talltime = Array.new\n\tslices = 10\n\ti = 0\n\twhile i < slices.to_i do\n\t\talltime.push(Time.now)\n\t\ti+=1\n\tend\n\tyield\nend",
"def chunk(array, n)\n\nend",
"def process_group\n slice_size = 0.step(@ids.size - 1, @process_group_chunk).size\n\n @ids.each_slice(slice_size).lazy\n # => [[1, 2, 3, ...], [10, 11, 12, ...], ...]\n end",
"def fetch(params)\n Resque.logger.info \"Requestable.fetch received #{params.inspect}\"\n past = Time.now\n total = api_count(params)\n remain_requests = (total/250.to_f).ceil\n Resque.logger.info \"pages to request total: #{remain_requests}\"\n batch_num = (remain_requests / BATCH_SIZE.to_f).ceil\n Resque.logger.info \"batch number: #{batch_num}\"\n chap_start = 1\n chap_end = 0\n entity = params.fetch(:entity)\n Resque.logger.info \"entity name: #{entity}\"\n cache = $redis\n pages = []\n batch_num.times do\n entity_url = entity.pluralize\n if remain_requests > BATCH_SIZE\n chap_end += BATCH_SIZE\n remain_requests -= BATCH_SIZE\n else\n chap_end += remain_requests\n end\n hydra = Typhoeus::Hydra.new(max_concurrency: 30)\n\n chap_start.upto(chap_end) do |page|\n pages << page\n # queue up current batch\n request = Typhoeus::Request.new(\n \"https://api.rechargeapps.com/#{entity_url}?#{params[:query]}&limit=250&page=#{page}\",\n # followlocation: true,\n headers: HEADER\n )\n # error logging callbacks\n request.on_complete do |res|\n @used = res.headers['x-recharge-limit'].to_i\n if res.success?\n puts \"#{entity.upcase} request queued\"\n elsif res.timed_out?\n Resque.logger.error \"(HYDRA request) TIMED OUT: #{res.response_headers}\"\n elsif res.code.zero?\n Resque.logger.error \"(HYDRA request) Couldnt get an http response #{res.return_message}\"\n else\n Resque.logger.error(\"(HYDRA request) HTTP request failed: #{res.code}\")\n end\n end\n\n request.on_success do |res|\n # @used = res.headers['x-recharge-limit'].to_i\n # Resque.logger.info res.headers['x-recharge-limit']\n key = \"#{entity}_pull:#{Time.now.strftime(\"%Y%m%d\")}#{page.to_s.rjust(3, '0')}\"\n hash_set(cache, key, res.response_body)\n end\n\n hydra.queue(request)\n chap_start = chap_end\n end\n hydra.run\n batch_throttle(@used)\n end\n Resque.logger.info \"Pages iterated: #{pages.inspect}\"\n Resque.logger.info(\"RUN TIME per #{total} records: #{(Time.now - past)}\")\n end",
"def raw_hash_with_cycles\n @raw_hash_with_cycles ||= self.class.fetch_raw_hash_with_cycles block_hash\n end",
"def tick\n 2.times.each do\n sub_components.each(&:tick)\n sub_components.each(&:tock)\n end\n end",
"def batch\n yield if block_given?\n end",
"def gen_binomial_tree_prices\n u = udp[:u]\n d = udp[:d]\n tree = [[initial_per_share]]\n t = 0\n while t < duration - 1e-6\n t += dt\n this_arr = tree.last.collect { |s| s * d }\n this_arr << tree.last.last * u\n tree << this_arr\n end\n tree\n end",
"def my_array(array,&block)\n ret = []\n array.each do |n|\n ret << block.call(n) # ret << n * 10\n end\n ret\nend",
"def free_chunks(grid)\n grid.flat_map do |row|\n row.chunk(&:free?).select(&:first).map(&:last)\n end\n end",
"def tick\n defaults\n render\n input\n calc\n end",
"def next_batch()\n @mutex.lock\n begin\n state_check.slice!(0, state_check.length) + pending.slice!(0,pending.length)\n ensure\n @mutex.unlock rescue nil\n end\n end",
"def run\n\t\t\tresult = [ !limited? ]\n\t\t\tif block_given? && !limited?\n\t\t\t\tupdate\n\t\t\t\tresult << yield\n\t\t\tend\n\t\t\tresult\n\t\tend",
"def send_tick\n msg = Erlang::Encoder.new\n msg.write_4 0\n msg.write ''\n send_data msg\n end",
"def each\n i = limit if limit\n loop do\n if data.length > 0 or refresh > 0\n if limit\n raise StopIteration if i == 0\n i = i - 1\n end\n if lazymap\n yield lazymap.call(data.shift)\n else\n yield data.shift\n end\n else\n raise StopIteration\n end\n end\n end",
"def every_ticks ticks, &block\n @tick_actions << [ticks.to_i, block, ticks.to_i]\n end",
"def run_asap( &block )\n ::EM.next_tick( &block )\n end",
"def loadcpu3( num1, num2 )\n c_mul_add_add_loop(1000000, num1, num2)\nend",
"def fetch!(&block)\n object_versions do |object_version|\n fetch_object(object_version, &block)\n end\n\n @pool.wait(:done)\n end",
"def tick # :nodoc:\n @raindrop[@offset]\n end",
"def fetch_array\n IBM_DB.fetch_array(@stmt) if @stmt\n end",
"def read_blocks(start_block, block_count, nonce)\n data = @disk.read_blocks start_block + @data_start, block_count\n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_leaf start_block + i\n load_data[:ops] <<\n { :op => :sign, :line => load_data[:line], :session_id => @sid,\n :nonce => nonce, :data => data[i * block_size, block_size],\n :block => start_block + i }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n { :data => data, :hmacs => hmacs }\n end",
"def multi(&block); end",
"def coin_array; end",
"def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = @length.times.collect do\n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end",
"def chunk(array, size)\nend",
"def tick\n defaults\n render\n calc\n input\n end",
"def blocks_time\n Benchmark::Tms.new\n end",
"def each\n size.times do |i|\n if endian == :big\n yield @store[size - i - 1]\n else\n yield @store[i]\n end\n end\n end",
"def fetch\n\t\t\t\t[self.[], @args]\n\t\t\tend",
"def run(ticks)\n\t\tfor i in 0..ticks\n\t\t\tputs building.to_s\n\t\t\tbuilding.tick\n\t\tend\n\t\tputs building.to_s\n\tend",
"def calc_queued_jobs_requesting_GPUs\n @queued_jobs_requesting_gpus = 0\n #@queued_jobs_requesting_gpus = 0\n #@oodClustersAdapter.info_all_each { |job| queued_jobs_requesting_gpus_counter(job) }\n #@queued_jobs_requesting_gpus\n end",
"def recv_msgs(t)\n $groups.each do |g|\n $members[g].each do |n|\n $members[g].each do |m|\n $epochs[[g,n]].last[m] += $sent_in_tick[[g, m]]\n end\n end\n end\nend",
"def create_blocks prev_hash, n, opts = {}\n interval = opts[:interval] || 600\n time = opts[:time] || Time.now.to_i\n bits = opts[:bits] || 553713663\n block = @store.get_block(prev_hash)\n n.times do |i|\n block = create_block block.hash, true, [], @key, 50e8, {\n time: time += interval, bits: bits }\n # block = @store.get_block(block.hash)\n # puts \"#{i} #{block.hash[0..8]} #{block.prev_block.reverse_hth[0..8]} #{Time.at(block.time).strftime('%Y-%m-%d %H:%M:%S')} c: #{block.chain} b: #{block.bits} n: #{block.nonce} w: #{block.work}\"\n end\n block\nend",
"def each_byte\n\t\t@array.each { |a| yield a }\n\tend",
"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 batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end",
"def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end",
"def process_one_cycle(data)\n data.each_slice(4) do |m, sec, usec, args|\n process_one_event(m, sec, usec, args)\n end\n end",
"def each_chunk( &block )\n\t\t\tself.validate\n\n\t\t\titer = Enumerator.new do |yielder|\n\t\t\t\tself.bytes.each_slice( self.chunksize ) do |bytes|\n\t\t\t\t\tyielder.yield( bytes.pack('C*') )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn iter unless block\n\t\t\treturn iter.each( &block )\n\t\tend",
"def tick\n\t\t@elevators.each{|elevator| elevator.tick}\n\t\t@floors.each{|floor| floor.tick}\n\tend",
"def tick\n Kernel.sleep(length) if length > 0\n @count += 1\n end",
"def matrix_multiplication_gpu_blocked(a, b, size)\n block_size_x = 15\n block_size_y = 15\n\n # Get it running with GPU_BLOCK 150 first\n # Then measure runtime with GPU_BLOCK 3000\n \n # Create blocked indices\n # For example (2x2): [0, 1, 4, 5, 2, 3, 6, 7 , ...]\n indices = Array.new(size * size)\n\n # TODO (Step 6.1): Generate block indices\n\n unordered_result = indices.to_pa.map do |index|\n x = index % size\n y = index / size\n\n # TODO (Step 6.2): Implement (same as Step 3)\n\n 123.4\n end\n\n correct_order_result = Array.new(size*size)\n\n # TODO (Step 6.3): Restore correct order\n\n return correct_order_result\nend",
"def tick\n Grid.tick\n head :ok\n end",
"def time_slice(usecs)\n @start_time = Time.now.usec\n @time_limit = usecs\n\n @fiber.resume(self)\n end",
"def receive_update buffer\n receive_update_callbacks.each do |callback|\n EM.next_tick do\n callback.call buffer.dup\n end\n end\n end",
"def frame\n while true\n if @binary_size\n s = read_binary @binary_size\n break unless s\n @binary_size = nil\n yield s\n else\n line = read_line\n break unless line\n case line[0..0]\n when '-'\n yield RuntimeError.new line[1..-1]\n when '+'\n yield line[1..-1]\n when ':'\n yield line[1..-1].to_i\n when '*'\n prev_remaining = @remaining\n @remaining = line[1..-1].to_i\n if @remaining == 0\n @remaining = -1\n yield []\n elsif @remaining == -1\n yield nil\n elsif @remaining > @multibulk_limit\n flush\n raise 'invalid multibulk length'\n elsif prev_remaining > 0\n @stack << [@elements, prev_remaining]\n @elements = []\n end\n when '$'\n @binary_size = line[1..-1].to_i\n if @binary_size == -1\n @binary_size = nil\n yield nil\n elsif (@binary_size == 0 and line[1..1] != '0') or @binary_size < 0 or @binary_size > @bulk_limit\n flush\n raise 'invalid bulk length'\n end\n else\n if @remaining > 0\n flush\n raise \"expected \\\"$\\\", got #{line[0].chr.dump}\" \n end\n parts = line.split(' ')\n @remaining = parts.size\n parts.each {|l| yield l}\n end\n end\n end\n end",
"def remainder_as_buffer; end",
"def data_blocks\n return @data_blocks unless @data_blocks.nil?\n @data_blocks = data_blocks_with_io.data\n @data_blocks\n end",
"def compute_ticks\n smallest_interval = chrons.map {|c| c.value}.diffs.min\n nintervals = (top - bottom)/smallest_interval\n interval = smallest_interval\n while (nintervals > @maximum_intervals)\n interval = chron.next_interval_after(interval)\n nintervals = (top - bottom)/interval\n end\n\n if chron == Dataset::Chron::YYYYMM && interval >= 1.0\n @chron = Dataset::Chron::YYYY\n end\n\n if chron == Dataset::Chron::YYYYQ && interval >= 1.0\n @chron = Dataset::Chron::YYYY\n end\n\n tick_values = []\n x = chrons.first.value.round_down(interval)\n while x <= chrons.last.value.round_up(interval) do\n tick_values << x\n x += interval\n end\n tickChrons = tick_values.map do |tv|\n # TODO: clean this up, it's an ugly hack to workaround SchoolYear not having\n # a numeric constructor; there must be a cleaner way to do the initialization\n # stuff in chron.rb\n if chron == Dataset::Chron::SchoolYear\n chron.new(:yyyy => tv)\n else\n chron.new(tv)\n end\n# chron.new(tv)\n end\n\n # adjust the axis so that the first tick is inside the axis\n if tick_values.first < @bottom\n @bottom = tick_values.first - interval_size/2\n end\n\n # adjust the axis so that it extends all the way to the final tick label\n @top = tick_values.last + interval_size/2\n\n # if chron != Dataset::Chron::YYYY then\n # @ticks = chrons.map {|chron| Tick.new(self, chron)}\n # else\n # if chrons.size <= @maximum_intervals then\n # @ticks = chrons.map {|chron| Tick.new(self, chron)}\n # else\n # first_tick = chrons.first.value.round_up(5)\n # last_tick = chrons.last.value.round_down(5)\n # tickChrons = []\n # (first_tick .. last_tick).step(5) do |n|\n # tickChrons << chron.new(n)\n # end\n @ticks = tickChrons.map {|chron| Tick.new(self, chron)}\n # end\n # end\n end",
"def each\n\t\tyield dequeue while @last != 0\n\tend",
"def enqueue_buffer_read(tensor, context)\n buffer = _run(tensor, context)\n if buffer.is_a?(Array)\n buffer.collect do |b|\n next b if b.buffer.size.zero?\n\n b.op = _opencl_queue.enqueue_read_buffer(b.cl_buffer, b.buffer, event_wait_list: build_event_wait_list([b]))\n b\n end\n else\n return buffer.outputs[0] if buffer.is_a?(OutputGroup)\n return buffer if buffer.nil?\n return [] if buffer.buffer.nil?\n return buffer if buffer.buffer.size.zero?\n\n # lazy allocate\n buffer.buffer = OpenCLBuffer.allocate_narray_for_type(buffer.buffer.data_type, buffer.buffer.size) if buffer.buffer.is_a?(OpenCLBuffer::LazyBuffer)\n\n buffer.op = _opencl_queue.enqueue_read_buffer(buffer.cl_buffer, buffer.buffer, event_wait_list: build_event_wait_list([buffer]))\n buffer\n end\n end",
"def fuse(_following_chunk)\n nil\n end",
"def process_blocks(blocks); end",
"def _ta(label)\n $agg[label] ||= { time: 0, num_calls: 0 }\n t = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n ret = yield\n ensure\n $agg[label][:time] += (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t)\n $agg[label][:num_calls] += 1\n ret\n end",
"def samples\n return self.synchronize { @samples.to_a }\n end",
"def block_count; @data[17].to_i; end",
"def mmc_blockinfo\n\n # number of latest block\n @blckhigh = `#{@mmc_path} getblockcount`\n\n # hash of latest block\n blckhash = `#{@mmc_path} getblockhash #{@blckhigh}`\n\n # complete json of latest block\n blckinfo = `#{@mmc_path} getblock #{blckhash}`\n\n # difficulty of latest block\n @blckdiff = `#{@mmc_path} getdifficulty`\n\n # number of 30th latest block\n rcnthigh = @blckhigh.to_i - 30\n\n # hash of 30th latest block\n rcnthash = `#{@mmc_path} getblockhash #{rcnthigh}`\n\n # complete json of 30th latest block\n rcntinfo = `#{@mmc_path} getblock #{rcnthash}`\n\n # timestamp of latest block\n blcktime = JSON.parse(blckinfo)['time'].to_i\n\n # timestamp of 30th latest block\n rcnttime = JSON.parse(rcntinfo)['time'].to_i\n\n # average blocktime of 30 last blocks in seconds\n @blocktime = (blcktime.to_f - rcnttime.to_f) / 30.0\n\n # current hashrate in hashs per minute\n @hashrate = ((2 ** 32) * @blckdiff.to_f) / (@blocktime.to_f / 60.0)\n\n # calculates current block reward and total minted coins\n i = 0\n currweek = ((@blckhigh.to_f / 1680.0) - 0.5).round\n @reward = 280.0 ### @TODO: initial reward was limited, PTS shares\n @minted = 715842.49 ### @TODO: initial reward was limited, PTS shares\n while i < currweek do\n @minted += @reward * 1680.0\n @reward *= 0.95\n i += 1\n end\n @minted += (@blckhigh.to_f - (currweek * 1680.0)) * @reward\n\nend",
"def each_rate(&block); end",
"def get_graph_data\n #check for the amount of data the function needs to return, defualt = 3\n @date_scalar = params.has_key?(:num_months) ? params[:num_months] : 3\n #string -> int\n @date_scalar = @date_scalar.to_i\n #make a float copy\n @date_scalar_float = @date_scalar.to_f\n\n #instantiate YQuotes client to get historical data\n yahoo_client = YQuotes::Client.new\n #retrieve the data\n @graph_data = yahoo_client.get_quote(\n @stock.ticker_symbol, { \n #get one data point for each day\n period: 'd', \n #calculate the first date needed based on the amount of data requested\n #24*60*60*365 converts the fractions of a year into seconds\n start_date: (Time.now - (24*60*60*365*(@date_scalar_float/12))).strftime(\"%Y-%m-%d\"), \n #current date\n end_date: Time.now.strftime(\"%Y-%m-%d\")\n })\n\n @low = @graph_data.adj_close.min\n @max = @graph_data.adj_close.max\n #used to see if more data is requested than exists\n #i.e. request 12 months of data for a 3-month old stock \n @overflow = false;\n #figure out how many data points were returned\n @array_size = @graph_data.index.max+1\n @i = 0\n #the number of points that will be displayed on the graph\n num_points = @array_size/150\n start_time = Time.now\n #initialize empty array\n @array_data = Array.new\n #checks for overflow, first case: no overflow \n if (@array_size > (251*(@date_scalar_float/12))-2)\n (@array_size).times do\n if !(num_points == 0)\n #decide whether or not to add it to data set based on number of points desired\n if @i % num_points == 0\n #add to data set that will be used to make graph\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n #always add the first point\n else\n #add to data set that will be used to make graph\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n @i += 1\n end\n #overflow\n else\n (@array_size).times do\n if !(num_points == 0)\n if @i % num_points == 0\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n else\n @array_data.push([@graph_data.date[@i], @graph_data.adj_close[@i]])\n end\n \n @i += 1\n \n end\n #used to display warning\n @overflow = true\n @array_data.push(@overflow)\n end\n\n #convert to a json string for easy parsing in javascript function\n @json_string = @array_data.to_json \n respond_to do |format|\n #for AJAX call to dynamically update graph\n format.json { render json: @array_data, status: :ok }\n format.html { @json_string }\n end\n end",
"def big_google_call()\n\n number_of_step = 30;\n lat_base = 48.810837;\n lat_step = (0.1 / number_of_step);\n lng_base = 2.241837;\n lng_step = (0.22 / number_of_step);\n\n for lat_index in 0..number_of_step\n for lng_index in 0..number_of_step\n this_lat = lat_base + lat_index * lat_step;\n this_lng = lng_base + lng_index * lng_step;\n\n places = google_radar_call([this_lat,this_lng], nil)\n places.each do |place|\n add_one_to_db(place, db)\n end\n end\n end\nend",
"def real\r\n self.data.map(&:real)\r\n end",
"def fetch(key)\n send(:[], key){return(yield if defined?(yield))}\n end",
"def aggregate_by_chunks\n forward = []\n reverse = []\n chunks.each do |chunk|\n reads=get :chunks, chunk\n forward << (get :side, :left)\n reverse << (get :side, :right)\n end\n [forward,reverse]\n end",
"def each\n\t\t@array.each do |v|\n\t\t\tyield v & 0x0F #Bottom Nibble\n\t\t\tyield (v >> 4) & 0x0F #Top Nibble\n\t\tend\n\tend",
"def scatter\n sum_of_digits = @working_array.inject(:+).to_i\n @working_array = 10.times.collect do \n @working_array.rotate!(spin ^ sum_of_digits).pop\n end\n end",
"def unbufferred(&block)\n bufferring = output.sync\n # Immediately flush output\n output.sync = true\n block[] if block_given?\n ensure\n output.sync = bufferring\n end",
"def benchmark(&block)\n end",
"def tick(events)\n end",
"def at_tick_interval(num_of_ticks)\n yield if sensors.ticks % num_of_ticks == 0\n end",
"def loadcpu2( num1, num2 )\n res = 0.0\n (1..1000000).each do |i|\n res = c_mul_add_add(res, num1, num2,i)\n end\n res\nend",
"def do_spin\n @buffer[-2] = @buffer[0]\n @buffer[-1] = @buffer[1]\n\n (0...@depth).each do |idx|\n tmp = @buffer[idx+2]\n @buffer[idx] = (@buffer[idx+1] + ((tmp >> 1)|(tmp.odd? ? TOP : 0))) & CHOP\n end\n end",
"def fetch(name, options = nil)\n options ||= {}\n name = expanded_key(name)\n\n if block_given?\n unless options[:force]\n entry = instrument(:read, name, options) do |payload|\n payload[:super_operation] = :fetch if payload\n read_entry(name, options)\n end\n end\n\n if !entry.nil?\n instrument(:fetch_hit, name, options) { |payload| }\n entry\n else\n result = instrument(:generate, name, options) do |payload|\n yield\n end\n write(name, result, options)\n result\n end\n else\n read(name, options)\n end\n end",
"def each(&block)\n Fetcher.new(self).each(&block)\n end",
"def written_blocks\n (@real_time_memory + @user_memory).reject(&:nil?).count\n end",
"def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end"
] |
[
"0.50891334",
"0.49669623",
"0.49631178",
"0.4961839",
"0.490971",
"0.490971",
"0.490971",
"0.4906705",
"0.48321116",
"0.48271874",
"0.47950685",
"0.47831956",
"0.47815818",
"0.47815818",
"0.47524658",
"0.4751764",
"0.47227207",
"0.4715458",
"0.46931627",
"0.4640604",
"0.4640282",
"0.46359435",
"0.4623879",
"0.46222132",
"0.46215513",
"0.46207532",
"0.46188307",
"0.4618586",
"0.4607043",
"0.46014896",
"0.45888284",
"0.45864975",
"0.45653814",
"0.45546055",
"0.45492563",
"0.45295188",
"0.45163715",
"0.45109418",
"0.4510398",
"0.44978848",
"0.4494823",
"0.44858956",
"0.44850424",
"0.44774163",
"0.44697884",
"0.44666386",
"0.44623944",
"0.4461027",
"0.44590998",
"0.44458163",
"0.44451818",
"0.44354075",
"0.44343364",
"0.443156",
"0.4430645",
"0.4426956",
"0.44088593",
"0.44081986",
"0.44022533",
"0.44020167",
"0.43950203",
"0.43950203",
"0.43901536",
"0.43890548",
"0.4387801",
"0.43827292",
"0.43768868",
"0.43686265",
"0.4363996",
"0.4361747",
"0.4351452",
"0.43415615",
"0.43393925",
"0.43392804",
"0.43212283",
"0.4321196",
"0.43185806",
"0.43158716",
"0.4312667",
"0.4310177",
"0.4308618",
"0.4306768",
"0.4300974",
"0.42966282",
"0.42962322",
"0.42955115",
"0.42927846",
"0.42896417",
"0.42839795",
"0.42828223",
"0.42802173",
"0.42799184",
"0.4279106",
"0.4276905",
"0.42765042",
"0.4274066",
"0.4268313",
"0.4265253",
"0.4264962",
"0.42626196"
] |
0.50351614
|
1
|
Generalized interval fetch interval may be the number of seconds, or :day for day, :week for week, or :month for month.
|
def fetchInterval(symbol, interval, days=nil, startTime=nil, endTime=nil, eos=true, &block)
brokerFetchInterval(symbol, interval, days, startTime, endTime, eos, &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 interval_param\n \"interval:auto\"\n end",
"def interval ; @options[ :interval ] ; end",
"def interval\n @attributes[:interval]\n end",
"def interval\n config_get('bfd_global', 'interval', @get_args)\n end",
"def interval; end",
"def interval; 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 interval=(_arg0); 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 by_interval\n \"/ #{object.interval == \"month\" ? 'mois' : 'an'}\"\n end",
"def interval(dat)\n\n datum = today - dat\n interval = Date.parse \"#{datum.year}-#{datum.month}-01\"\n end",
"def work(interval = 5.0)\n end",
"def interval(key, default=0.0)\n\t\tstr = self.fetch(key.downcase, nil)\n\t\tif not str.nil?\n\t\t\tret = 0.0;\n\t\t\tstr.split(/:/).each { |str2|\n\t\t\t\tret += (ret * 60.0) + str2.to_f\n\t\t\t}\n\t\t\treturn ret\n\t\tend\n\t\treturn default\n\tend",
"def timeInterval()\n\t\t@duration\n\tend",
"def mk_interval(year: 0, month: 0, day: 0, hour: 0, min: 0, sec: 0, usec: 0)\n Interval.new(\n interval_months: (year * 12) + month,\n interval_days: day,\n interval_micros: (((hour * 3600) + (min * 60) + sec) * 1_000_000) + usec\n )\n end",
"def calc_interval(number_events)\n\tprng = 60.00/number_events # temporal solution, IMPROVE\n\n\treturn (interval)\nend",
"def get_interval_id(time)\n (time.to_i / interval) * interval\n end",
"def prepare_interval(period, &block); end",
"def interval=(val)\n attribute_set(:interval,val.kind_of?(Numeric) ? val : INTERVALS_MAP[val.to_s])\n end",
"def interval0(i)\n rex(:interval0, i,\n /(year|month|week|day|hour|min(ute)?|sec(ond)?)(?![a-z])/i)\n end",
"def span\n return 60.days if interval.zero?\n\n interval.days\n end",
"def perform_in(interval, *args); end",
"def perform_in(interval, *args); end",
"def period; end",
"def period; end",
"def period; end",
"def ff_get_query_interval\n QUEUE_DEFAULT_INTERVAL\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 now_and_every(interval, recur = T.unsafe(nil), &block); end",
"def interval\n (self['resque.interval'] || 5).to_i\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 initialize(expr, interval)\n @expr = expr\n @interval = if interval.is_a?(Hash)\n interval.each_value do |v|\n # Attempt to prevent SQL injection by users who pass untrusted strings\n # as interval values. \n if v.is_a?(String) && !v.is_a?(LiteralString)\n raise Sequel::InvalidValue, \"cannot provide String value as interval part: #{v.inspect}\"\n end\n end\n interval\n else\n h = Hash.new(0)\n interval.parts.each{|unit, value| h[unit] += value}\n Hash[h]\n end\n end",
"def interval\n 30.seconds\n end",
"def monitoring_interval\n data[:monitoring_interval]\n end",
"def monitoring_interval\n data[:monitoring_interval]\n end",
"def interval_units\n if interval.parts.is_a? Array\n interval.parts[0][0]\n else\n interval.parts.keys[0]\n end\n end",
"def to_sec(interval)\n interval / INTERVAL\n end",
"def interval_string\n str = 'None'\n str = 'Weekly' if interval == 7 \n str = '2 Weeks' if interval == 14\n str = '3 Weeks' if interval == 21\n str = '4 weeks' if interval == 28\n str\n end",
"def interval_params\n params.require(:interval).permit(:numerator, :denominator, :description, :name)\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 getIntervalType\n\t\t# get the interval type from settings\n\t\t# currently not implemented. It will useful in future\n\t\tintervalType = 'W'\n\t\tintervalType\n\tend",
"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 refresh_interval_param(seconds)\n return nil unless seconds\n \"refreshInterval:(display:'#{seconds}%20seconds',\" \\\n \"pause:!f,section:1,value:#{seconds * 1000})\"\n end",
"def parse_load_interval(config)\n mdata = /load-interval (\\w+)$/.match(config)\n { load_interval: mdata.nil? ? DEFAULT_LOAD_INTERVAL : mdata[1] }\n end",
"def parse_load_interval(config)\n mdata = /load-interval (\\w+)$/.match(config)\n { load_interval: mdata.nil? ? DEFAULT_LOAD_INTERVAL : mdata[1] }\n end",
"def usage_interval\n\n end",
"def poll_interval\n interval = (\n options[:poll_interval] ||\n rails_config[:poll_interval] ||\n env['GOOD_JOB_POLL_INTERVAL']\n )\n\n if interval\n interval.to_i\n elsif Rails.env.development? && execution_mode.in?([:async, :async_all, :async_server])\n DEFAULT_DEVELOPMENT_ASYNC_POLL_INTERVAL\n else\n DEFAULT_POLL_INTERVAL\n end\n end",
"def poll_intervals\n [0.5, 1, 2, 4, 8, 16]\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 max_interval\n MAX_INTERVAL\n end",
"def time_interval(inter_val_num=15)\n\n require 'rubygems'\n require 'active_support'\n require 'active_support/time'\n\n cur_time = Time.now\n comp_time = cur_time - cur_time.sec - cur_time.min%15*60\n base_time = comp_time + 1.hour\n\n if comp_time < base_time\n comp_time = comp_time + inter_val_num.minutes\n end\n\n return comp_time.strftime(\"%M:%S\")\n\nend",
"def period\n\t\t\t\t5\n\t\t\tend",
"def min_interval\n MIN_INTERVAL\n end",
"def interval_string_to_duration(query)\n if (query_split = query.split(\"_\")).size >= 2\n num = query_split.first.to_i\n case query_split.last\n when \"second\", \"seconds\" then num.seconds.ago\n when \"minute\", \"minutes\" then num.minutes.ago\n when \"hour\", \"hours\" then num.hours.ago\n when \"day\", \"days\" then num.days.ago\n when \"month\", \"months\" then num.months.ago\n when \"year\", \"years\" then num.years.ago\n else nil\n end\n else\n num = query.to_i\n case query[-1..-1]\n when \"s\" then num.seconds.ago\n when \"m\" then num.minutes.ago\n when \"h\" then num.hours.ago\n when \"d\" then num.days.ago\n when \"M\" then num.months.ago\n when \"y\" then num.years.ago\n else nil\n end\n end\n end",
"def interval_function(interval=:week)\n if Rails.env.development?\n \"strftime('%Y%W',#{@date_column}) AS _key\"\n else\n \"YEARWEEK(#{@date_column}) AS _key\"\n end\n end",
"def interval\n (Date.current - limit.days) .. Date.tomorrow\n end",
"def initialize(hour, minute, second, interval)\n @hour = hour\n @minute = minute\n @second = second\n @interval = interval\n end",
"def interval=(arr)\n return if arr == interval\n interval, min_rx, multiplier = arr\n set_args_keys(interval: interval, min_rx: min_rx, multiplier: multiplier,\n state: arr == default_interval ? 'no' : '')\n config_set('bfd_global', 'interval', @set_args)\n end",
"def initialize(interval, pool)\n @interval = interval\n @pool = pool\n end",
"def donation_interval\n # Some donors can have a custom donation interval\n if custom_donation_interval.present?\n return custom_donation_interval\n end\n \n if donations.where(amount: most_typical_amount).count > 2\n span_secs = donations.maximum(:donated_at) - donations.minimum(:donated_at)\n avg_secs = span_secs / (donations.where(amount: most_typical_amount).count - 1)\n (avg_secs / (24 * 60 * 60)).round\n else\n 30\n end\n end",
"def convert_to_sec\n duration = @@fetch_interval.split(' ')\n\n if duration.length != 2\n raise \"Invalid @@fetch_interval(=#{@@fetch_interval}) in config.rb.\"\n end\n\n case duration[1]\n when /seconds?/\n multiply = 1\n when /minutes?/\n multiply = 60\n when /hours?/\n multiply = 3600\n else\n raise \"Invalid @@fetch_interval(=#{@@fetch_interval}) in config.rb.\"\n end\n\n @sec_interval = duration[0].to_i * multiply\n end",
"def initialize(options = {})\n super\n @counters = {}\n self.interval = options[:interval] || 0.01\n end",
"def set_interval\n @interval = Interval.find(params[: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 interval\n @to.to_i - @from.to_i\n end",
"def time_key(time, interval)\n interval && ( time.to_i / interval ) * interval\n end",
"def gm_full_rate(interval)\n @gm_full_rate ||= {}\n return @gm_full_rate[interval] if @gm_full_rate[interval]\n @gm_full_rate[interval] = GmRateFinder.find(:revenue, interval, project: project)\n end",
"def getIntervalValue(intervalType)\n\t\tintervalVal = 1\n\t\tif intervalType == 'W'\n\t\t\tintervalVal = 7\n\t\tend\n\t\tintervalVal\n\tend",
"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 every(interval, unit = :minutes, options = {}, &block)\n raise \"Not a Integer: #{interval}\" unless interval.is_a? Integer\n raise \"Interval less than 1\" if interval < 1\n\n opts = {\n run_at_start: true\n }.merge(options)\n\n case unit\n when :min, :mins, :minute, :minutes\n when :hr, :hrs, :hour, :hours, :horse\n interval *= 60\n else\n raise \"Unknown unit: #{unit}\"\n end\n $bot[:periodic] << {\n interval: interval,\n remaining: opts[:run_at_start] ? 0 : interval,\n block: block\n }\n end",
"def start_of_interval(time)\n case granularity\n when 'second'\n time.change(usec: 0)\n when 'minute'\n time.beginning_of_minute\n when 'fifteen_minute'\n first_fifteen = [45, 30, 15, 0].detect { |m| m <= time.min }\n time.change(min: first_fifteen)\n when 'thirty_minute'\n first_thirty = [30, 0].detect { |m| m <= time.min }\n time.change(min: first_thirty)\n when 'hour'\n time.beginning_of_hour\n when 'day'\n time.beginning_of_day\n when 'week'\n time.beginning_of_week\n when 'month'\n time.beginning_of_month\n when 'quarter'\n time.beginning_of_quarter\n when 'year'\n time.beginning_of_year\n else\n time\n end\n end",
"def selectTimeIntervals(dbQuery)\n\n if dbQuery.nil?\n return\n end\n\n dbQuery = setTimePeriod(dbQuery)\n\n reportTime = params['reportTime'] || \"today\"\n\n fromDate = params['fromDate'] || Date.today.to_s\n begin\n toDate = params['toDate'] || (Date.parse(fromDate, \"YYYY-MM-DD\") + 1.day).to_s\n rescue\n toDate = Date.today.to_s # Just in case someone has meddled with the query string param and sent an invalid FROM date...\n end\n\n case reportTime.downcase\n when \"past_hour\"\n @timeSlot = \"minute\"\n @numTimeSlots = 5\n fromDate = 1.hour.ago\n toDate = Time.now\n dbQuery = dbQuery.select(\"MOD(cast(date_part('minute', timestamp) as INT), #{@numTimeSlots}) as time\")\n when \"past_day\"\n @timeSlot = \"hour\"\n @numTimeSlots = 24\n fromDate = 24.hours.ago\n toDate = Time.now\n dbQuery = dbQuery.select(\"date_part('hour', timestamp) as time\")\n when \"past_week\"\n fromDate = 7.days.ago\n toDate = Time.now\n @timeSlot = \"day\"\n @numTimeSlots = 7\n dbQuery = dbQuery.select(\"EXTRACT(day from timestamp - (current_timestamp - '7 day'::interval)) as time\")\n when \"past_month\"\n fromDate = 1.month.ago\n toDate = Time.now\n @timeSlot = \"week\"\n @numTimeSlots = ((toDate - fromDate)/1.week).ceil + 1\n startingNum = ActiveRecord::Base.connection.select_value(ActiveRecord::Base.send(:sanitize_sql_array, \n [\"select date_part('week', current_timestamp - '1 month'::interval)\"]))\n\n dbQuery = dbQuery.select(\"date_part('week', timestamp) - #{startingNum} as time\")\n when \"date_range\"\n begin\n fromDate = Date.parse(params['fromDate'], 'YYYY-MM-DD').to_time\n rescue\n fromDate = Date.today #if the incoming parameter is an invalid date format, then pick TODAY as the date!\n params['fromDate'] = fromDate.to_s\n end\n begin\n toDate = Date.parse(params['toDate'], 'YYYY-MM-DD').to_time + 1.day # end date should be inclusive in the range\n rescue\n # in case of parsing error, take FROMDATE + 1 as the end date...\n params['toDate'] = (Date.parse(params['fromDate'], 'YYYY-MM-DD') + 1.day).to_s\n toDate = (Date.parse(params['fromDate'], 'YYYY-MM-DD') + 1.day).to_time\n end\n\n numDays = ((toDate - fromDate)/1.day).round\n dbQuery = dbQuery.where(\"timestamp between '#{fromDate.strftime('%F')}' and '#{toDate.strftime('%F')}'\")\n if numDays > 70 then\n @timeSlot = \"month\"\n @numTimeSlots = ((toDate - fromDate)/1.month).ceil + 1\n startingNum = ActiveRecord::Base.connection.select_value(ActiveRecord::Base.send(:sanitize_sql_array, \n [\"select date_part('month', date '#{fromDate}')\"]))\n\n dbQuery = dbQuery.select(\"date_part('month', timestamp) - #{startingNum} as time\")\n elsif numDays > 31 then\n @timeSlot = \"week\"\n @numTimeSlots = ((toDate - fromDate)/1.week).ceil + 1\n startingNum = ActiveRecord::Base.connection.select_value(ActiveRecord::Base.send(:sanitize_sql_array, \n [\"select date_part('week', date '#{fromDate}')\"]))\n\n dbQuery = dbQuery.select(\"date_part('week', timestamp) - #{startingNum} as time\")\n else\n @timeSlot = \"day\"\n @numTimeSlots = numDays\n dbQuery = dbQuery.select(\"EXTRACT(day from timestamp - date '#{fromDate}') as time\")\n end\n else #default is TODAY\n fromDate = Time.mktime(Time.now.year, Time.now.month, Time.now.day)\n toDate = fromDate + 24.hours\n @timeSlot = \"hour\"\n @numTimeSlots = 24\n\n dbQuery = dbQuery.select(\"date_part('hour', timestamp) as time\")\n end\n\n dbQuery = dbQuery.group(:time).order(:time)\n\n return dbQuery\n\n end",
"def initialize(options = {})\n super\n @counters = {}\n @interval = options[:interval] || 0.1\n end",
"def interval_as_min_dot_sec\n seconds = @interval % 60\n if seconds > seconds.to_i\n #mpl3splt takes fractions of a second to hundredths of a second precision\n seconds = seconds.round(2)\n end\n min_dot_sec = \"#{(@interval.to_i / 60).floor}.#{seconds}\"\n end",
"def fractionalseconds\n set_function_and_argument(:fractionalseconds, nil)\n end",
"def sectoral_time_frac(t,interval_duration)\n @sec_prf.collect do |prf|\n h_season = prf[:hourly].keys.include?(:annual) ? :annual : season(t.yday)\n d_season = prf[:daily].keys.include?(:annual) ? :annual : season(t.yday)\n monthly_fraction = prf[:monthly][t.month-1]\n weeks_in_month = weeks_in_month(t.month, t.year)\n daily_fraction = prf[:daily][d_season][t.wday] / weeks_in_month\n hourly_fraction = prf[:hourly][h_season][t.hour-1]\n duration = interval_duration / 3600.0\n hourly_fraction * daily_fraction * monthly_fraction * duration\n end\n end",
"def range_from_interval(interval, number = 1, timezone = nil)\n timezone ||= 'UTC'\n now = ActiveSupport::TimeZone.new(timezone).now\n\n end_point = now.send(\"end_of_#{interval}\").round\n start_point = end_point - number.send(interval)\n\n start_point..end_point\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 refresh_interval\n @refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL\n end",
"def refresh_interval\n @refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL\n end",
"def refresh_interval\n @refresh_interval ||= options[:refresh_interval] || REFRESH_INTERVAL\n end",
"def valid_intervals\n VALID[:interval]\n end",
"def frequency\n interval || 1.year\n end",
"def initialize(options = {})\n @options = options\n @interval = @options.fetch(:interval) { DEFAULT_INTERVAL }\n end",
"def initialize(options = {})\n @options = options\n @interval = @options.fetch(:interval) { DEFAULT_INTERVAL }\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 perform_at(interval, *args); end",
"def perform_at(interval, *args); 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 get_ending_time(start_time, plan, intervals = 1)\n case plan[:interval]\n when \"week\"\n start_time + (604800 * (plan[:interval_count] || 1) * intervals)\n when \"month\"\n (Time.at(start_time).to_datetime >> ((plan[:interval_count] || 1) * intervals)).to_time.to_i\n when \"year\"\n (Time.at(start_time).to_datetime >> (12 * intervals)).to_time.to_i # max period is 1 year\n else\n start_time\n end\n end",
"def next_interval\n next_interval = success? ? interval * 2 : interval / 2\n next_interval < 1 ? 1 : next_interval\n end",
"def send_interval\n @attributes[:send_interval]\n end",
"def send_interval\n @attributes[:send_interval]\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 minimum_interval\n 500\n end",
"def hitimes_duration_i1\n i = Hitimes::Interval.new\n i.start\n i.stop\nend",
"def parse_interval(interval)\r\n alldays = []\r\n alltimeintervals = []\r\n interval.split(\" \").each do |token|\r\n case token\r\n when /^\\D{3}$/\r\n alldays << [DAYNAMES.index(token)]\r\n when /^\\D{3}-\\D{3}$/\r\n days = token.split(\"-\")\r\n alldays << [DAYNAMES.index(days[0]), DAYNAMES.index(days[1])]\r\n when /^\\d{4}-\\d{4}$/\r\n timeintervals = token.split(\"-\")\r\n alltimeintervals << [timeintervals[0] , timeintervals[1]]\r\n end \r\n end\r\n alldays.map { |daysFrame| TimeFrame.new(daysFrame[0], daysFrame[1], alltimeintervals) }\r\n end",
"def to_days; Rational === @val ? @val/60/60/24 : @val/60.0/60/24 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"
] |
[
"0.72452635",
"0.66549474",
"0.64540917",
"0.6380006",
"0.63788915",
"0.63715595",
"0.63715595",
"0.6349416",
"0.6122129",
"0.6097323",
"0.6057489",
"0.6036541",
"0.60301656",
"0.60289913",
"0.59038234",
"0.5896634",
"0.58185697",
"0.58180076",
"0.57938343",
"0.57362056",
"0.5653564",
"0.5653346",
"0.56520987",
"0.56520987",
"0.5604157",
"0.5604157",
"0.5604157",
"0.5598939",
"0.55824536",
"0.5574286",
"0.556855",
"0.55567807",
"0.5545163",
"0.5542326",
"0.5542313",
"0.5542313",
"0.5483952",
"0.54674083",
"0.54643214",
"0.5460149",
"0.5445619",
"0.5442998",
"0.54343516",
"0.5410017",
"0.53938293",
"0.53938293",
"0.5379053",
"0.5370209",
"0.5361941",
"0.53523624",
"0.53460616",
"0.53331536",
"0.53237706",
"0.5271299",
"0.5265658",
"0.52652514",
"0.5264384",
"0.52636266",
"0.5257929",
"0.5257339",
"0.5250649",
"0.52352786",
"0.5232267",
"0.5227966",
"0.52266157",
"0.52255857",
"0.5224295",
"0.5222136",
"0.5208929",
"0.5174751",
"0.51693386",
"0.5163824",
"0.5153967",
"0.51432544",
"0.51304597",
"0.5129209",
"0.512633",
"0.5125202",
"0.51185334",
"0.51171005",
"0.51171005",
"0.51171005",
"0.51094824",
"0.5107459",
"0.5101769",
"0.5101769",
"0.509702",
"0.5090855",
"0.5090855",
"0.5086614",
"0.5083209",
"0.50749046",
"0.5073178",
"0.5073178",
"0.50684994",
"0.50599617",
"0.50479513",
"0.5045468",
"0.5036836",
"0.5025462"
] |
0.62033725
|
8
|
my_min(list) => 5 bubble_sort time complexity => O(n^2) space complexity => O(3) => O(1)
|
def bubble_sort(arr)
sorted = false
while !sorted
sorted = true
(0...arr.length-1).each do |idx|
(idx+1...arr.length).each do |idx2|
if arr[idx2] < arr[idx]
sorted = false
arr[idx],arr[idx2] = arr[idx2],arr[idx]
end
end
end
end
arr.first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend",
"def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend",
"def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend",
"def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend",
"def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend",
"def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend",
"def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend",
"def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend",
"def selection_sort(list)\n (list.size - 1).times do |i|\n min = i # starting min value\n for j in i+1..list.size - 1 # searches all values to right to find min\n min = j if list[j] < list[min] # resets min\n end\n list[min], list[i] = list[i], list[min] # swaps min val with past min val, ignoring already sorted part\n end\n list\nend",
"def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end",
"def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend",
"def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend",
"def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend",
"def my_sort(nums, sorted=[])\n\t# get min\n\t# Remove min from nums\n\t# recursion until nums.size == 0 with new nums and new sorted\n\t# Return sorted\n\n\tmin = nums.min\n\tsorted << min\n\n\tnums.delete_if {|n| n == min}\n\n\tif nums.size > 0\n\t\tmy_sort nums, sorted\n\telse\n\t\tsorted\n\tend\nend",
"def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend",
"def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(arr)\n sorted = false \n while !sorted \n sorted = true \n (0...arr.length-1).each do |i|\n if arr[i] < arr[i+1]\n arr[i], arr[i+1] = arr[i+1], arr[i]\n sorted = false \n end \n end \n end \n arr[-1]\nend",
"def selection_sort(list)\n (0...list.size - 1).each do |i|\n min = i\n (i + 1...list.size).each do |j|\n if list[j] < list[min]\n min = j\n end\n end\n temp = list[min]\n list[min] = list[i]\n list[i] = temp\n end\n list\n end",
"def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend",
"def min_max(lst)\n x = lst.sort\n m = []\n m.push(x.first)\n m.push(x.last)\n m\nend",
"def my_min(arr)\n l = arr.length - 1 # constant\n # min = 0 # is this more efficient than swapping? \n (0...l).each do |i| # n times1\n if arr[i] < arr[i+1] # 1\n arr[i], arr[i+1] = arr[i+1], arr[i] # 1\n end\n end\n\n arr.last # 1\nend",
"def my_min_2(array)\n array.sort!\n array.first\nend",
"def bubble_sort(list)\n\tloop do \n\t\tswapped = false\n\t\t(list.size-1).times do |i|\t\t\t\n\t\t\tif list[i] > list[i+1]\n\t\t\t\tlist[i], list[i+1] = list[i+1], list[i]\n\t\t\t\tswapped = true\t\t\t\t\n\t\t\tend\t\t\t\n\t\tend\n\t\tbreak unless swapped\n\tend \n\tlist \nend",
"def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend",
"def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend",
"def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend",
"def my_min(array)\n sorted = false\n until sorted\n sorted = true\n\n array.each_index do |idx|\n next if idx + 1 == array.length\n if array[idx] > array[idx + 1]\n array[idx], array[idx + 1] = array[idx + 1], array[idx]\n sorted = false\n end\n end\n end\n\n array.first\nend",
"def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend",
"def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend",
"def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend",
"def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend",
"def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def min_max(lst)\n lst.sort!\n [lst.first, lst.last]\nend",
"def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend",
"def stable_sort_by(list); end",
"def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend",
"def bubble_sort(list)\n return list if list.size <= 1\n\n\tloop do\n\t swapped = false\n\t 0.upto(list.size-2) do |n|\n\t if list[n] > list[n+1]\n\t \tlist[n], list[n+1] = list[n+1], list[n]\n\t \tswapped = true\n\t end\n\t end\n\t break unless swapped\n\tend\n\tlist\nend",
"def sort\n limit = array.size - 1\n (0..limit).each do |index|\n min = index\n (index..limit).each do |target|\n min = target if array[min] > array[target]\n end\n array[index], array[min] = array[min], array[index]\n end\n array\n end",
"def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend",
"def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend",
"def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend",
"def check_list(array)\n min = array.first\n i = 0\n while i < array.length\n j = i + 1\n while j < array.length\n min = array[i] if array[i] < array[j] && array[i] < min\n j += 1\n end\n i += 1\n end\n min\n end",
"def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend",
"def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end",
"def sort_heaped_list(list)\n last_pos = list.length - 1\n while last_pos > 0\n remove_max(list, last_pos)\n last_pos -= 1\n end\nend",
"def bubble_sort(list) \n list = list.dup \n for i in 0...list.length \n for j in 0..(list.length - 2) \n list[j], list[j + 1] = list[j + 1], list[j] if list[j + 1] < list[j] \n end \n end \n return list \nend",
"def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index+1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend",
"def bubblesort(list)\n return list if list.size <= 1\n\n els = 1\n loop do\n swapped = false\n 1.upto(list.size - els) do |i|\n if list[i - 1] > list[i]\n list[i], list[i - 1] = list[i - 1], list[i]\n swapped = true\n end\n end\n break unless swapped\n els += 1\n end\n\n list\nend",
"def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend",
"def bubble_sort(list)\n\n loop do\n count = 0\n\n # Go through the list and swap values if needed\n list.each_index do |idx|\n if idx + 1 < list.length && list[idx] > list[idx + 1]\n count += 1\n temp = list[idx + 1]\n list[idx + 1] = list[idx]\n list[idx] = temp\n end\n end\n\n # Loop until there no more values to swap (list is sorted)\n break if count == 0\n end\n\n list\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index + 1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def sort(array, length)\n length.times do |index| # outer loop - n elements\n min_index = index # assume index is where the next minimally value is\n temp_index = index + 1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1 elements\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def custom_sort (unsorted, sorted = [])\n return sorted.uniq if unsorted.length == 0\n smallest = unsorted[0]\n unsorted.each {|x| smallest = x if x <= smallest}\n\n unsorted.each {|x| sorted << x if x <= smallest }\n\n unsorted.delete(smallest)\n custom_sort(unsorted, sorted)\nend",
"def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end",
"def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def bubble_sort(items) # assume 10 items\n n = items.size\n iterations = 0\n loops = 0\n loop do\n swapped = false\n for a in (1..(n - 1)) do # 1 to (number of items - 1)\n if items[a] < items[a - 1] \n tmp = items[a - 1]\n items[a - 1] = items[a]\n items[a] = tmp\n swapped = true\n end\n iterations += 1 # debug: loop counter\n end\n n -= 1 # optimization, halfs the time by doing one less inner loop for each addtinal outer loop\n loops += 1 # debug: loop counter\n break unless swapped\n end\n p \"Total iterations: #{iterations}\"\n p \"loops: #{loops}\"\n items\nend",
"def bubbleSort(list)\n\n # Get the size of the list\n arraySize = list.size\n\n loop do\n\n # Set the default value of swapped to false\n swapped = false\n\n # Go through the list One by One\n (arraySize - 1).times do |i|\n\n # Check if the previous element on the list\n # is greater than the next one\n if (list[i] > list[i+1])\n\n # if the condition is true\n # Swappe the two selected number using\n # Parallel Assignement\n list[i], list[i+1] = list[i+1], list[i]\n\n # Set swapped to true, if there are non checked\n # elements on the list\n swapped = true\n\n end\n\n end\n\n # No swapping left\n break if not swapped\n end\n\n # Return the Sorted Array\n list\n end",
"def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend",
"def minimumSwaps(arr)\r\n swap_cnt = 0\r\n valid_arr = (1..arr.size).to_a\r\n\r\n until arr == valid_arr do\r\n arr.each_with_index do |elem, i|\r\n if elem > valid_arr[i]\r\n target = arr.index(i+1)\r\n\r\n arr[i] = valid_arr[i]\r\n arr[target] = elem\r\n swap_cnt += 1\r\n end\r\n end\r\n end\r\n\r\n swap_cnt\r\nend",
"def bubble_sort(list)\n return list if list.size <= 1 # already sorted\n swapped = true\n while swapped do\n swapped = false\n 0.upto(list.size-2) do |i|\n if list[i] > list[i+1]\n list[i], list[i+1] = list[i+1], list[i] # swap values\n swapped = true\n end\n end\n end\n\n list\nend",
"def heap_sort(list)\n heap_sort = MinHeap.new()\n\n list.each do |number|\n heap_sort.add(number, number)\n end\n\n sorted = Array.new\n until heap_sort.empty?\n sorted << heap_sort.remove\n end\n\n return sorted\nend",
"def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend",
"def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend",
"def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end",
"def min_max(lst)\n return [lst[0], lst[0]] if lst.size < 2\n sorted = lst.sort { |a, b| a - b }\n [sorted.first, sorted.last]\nend",
"def mysort(arr)\n # The computational complexity of this algorithm is O(n^^2), and is similar\n # to selection sort. This is not idiomatically ideal Ruby - I've tried to\n # mostly use language constructs common to many languages.\n\n sorted = []\n\n smallest_index = 0\n while (arr.length > 0) do\n for i in (0..(arr.length - 1))\n if arr[i] < arr[smallest_index]\n smallest_index = i\n end\n end\n sorted.push arr.delete_at(smallest_index) \n smallest_index = 0\n end\n\n return sorted \n\nend",
"def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend",
"def minimumSwaps(arr)\n num_swaps = 0\n index = 0\n min_index = 0\n #while arr.sort != arr\n while index < arr.length-1\n min_index = arr.index(arr[index..arr.length-1].min)\n #if arr[index] > arr[min_index]\n if arr[index] != index+1\n arr.swap(index,min_index)\n num_swaps += 1\n end\n index += 1\n end\n return num_swaps\nend",
"def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n min =1\n a.each{|x|\n if (x==min)\n min = min+1\n end\n }\n return min\nend",
"def bubble(list)\n return nil if list.empty?\n sorted = false \n \n until sorted\n sorted = true \n \n (list.length - 1).times do |idx|\n \n if list[idx] > list[idx + 1]\n list[idx], list[idx + 1] = list[idx + 1], list[idx]\n sorted = false\n end \n end \n end\n \n list[0]\nend",
"def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend",
"def heapsort(list)\n sorted_arr = []\n heap = MinHeap.new()\n list.each do |value|\n heap.add(value, value)\n end \n\nlist.length.times do |i|\n min = heap.remove()\n sorted_arr.push(min)\nend \nreturn sorted_arr\nend",
"def bubble_sort(list)\n\tlast = list.size - 1\n\tlist.size.times do \n\t\tidx = 0\n\t\twhile idx < last #1 < 2\n\t\t\tif list[idx] > list[idx + 1] #2 > 1\n\t\t\t\ttemp = list[idx] #temp = 2\n\t\t\t\tlist[idx] = list[idx + 1] #list[0] = 1\n\t\t\t\tlist[idx + 1] = temp #list[1] = 2\n\t\t\tend\n\t\t\tidx += 1\n\t\tend\n\t\tlast -= 1\n\tend\n\tp list\nend",
"def heapsort(list)\n heap = MinHeap.new\n list.each do |number|\n # apply the .add instance method \n heap.add(number)\n end\n\n list.each_with_index do |number, index|\n list[index] = heap.remove()\n end \n return list\nend",
"def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend",
"def smallest_integer(list_of_nums)\n\tlist_of_nums.each do |n1|\n \t\tlist_of_nums.each do |n2|\n \t\t\tif list_of_nums|n2| < list_of_nums|n1| #check if the the second number pulled out of array is smaller than the first\n \t\t\t\tlist_of_nums|n1| , list_of_nums|n2| = list_of_nums|n2| , list_of_nums|n1| #if it is smaller, it is moved in front of the bigger number\n \t\t\tend\n \t\tend\n\tend\n\nreturn list_of_nums[0] #once the smallest number is moved to the front, it should be the smallest in the array. so I call on it.\nend\n\n#I could not get this solution to work for some reason, because it didnt pass rspec. ",
"def sort(array, length)\n length.times do |index| # outer loop - narray\n min_index = index # assume index is where the next minimally value is\n temp_index = index + 1 # compare with values at index+1 to length-1\n while temp_index < length # inner loop - n-1array\n if array[temp_index] < array[min_index] # found a new minimum, update min_index\n min_index = temp_index\n end\n temp_index += 1 # move to next index\n end\n if min_index != index # next minimum value is not at current index, swap\n temp = array[min_index]\n array[min_index] = array[index]\n array[index] = temp\n end\n end\nend",
"def quick_sort(lst)\n return lst if lst.length <= 1\n pivot = lst.shuffle.shift\n left, right = lst.partition {|val| val < pivot}\n quick_sort(left) + quick_sort(right)\nend",
"def heapsort(list)\n heap = MinHeap.new\n sorted_list = []\n\n list.each do |item|\n heap.add(item)\n end\n\n list.length.times do \n sorted_list << heap.remove()\n end\n\n return sorted_list\nend",
"def min_moves(nums)\n nums.sum - nums.size * nums.min\nend",
"def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend",
"def heapsort(list)\n min_heap = MinHeap.new()\n until list.empty?\n min_heap.add(list.pop)\n end\n\n while !min_heap.empty?\n list << min_heap.remove()\n end\n\n return list\nend",
"def bubble_sort_2(items)\n n = items.size\n iterations = 0\n \n for a in (0...n) do # same as (0...n).each do |a| ..... end\n swapped = false\n for b in (0...(n - a - 1)) do\n if items[b] > items[b + 1] \n tmp = items[b + 1]\n items[b + 1] = items[b]\n items[b] = tmp\n swapped = true\n end\n iterations += 1\n end\n break unless swapped\n end\n p \"Total iterations: #{iterations}\"\n items\nend",
"def heapsort(list)\n heap = MinHeap.new()\n list.each do |num|\n heap.add(num)\n end\n res = []\n list.length.times do \n res << heap.remove()\n end\n return res\nend",
"def my_min_3(list)\n subs = []\n\n list.each_index do |i|\n list.each_index do |j|\n unless i > j\n subs << list[i..j]\n end\n end\n end\n\n subs.map do |sub|\n sub.reduce(:+)\n end.max\nend",
"def heapsort(list)\n min_heap = MinHeap.new()\n list.each do |item|\n min_heap.add(item)\n end\n empty_arr = []\n\n list.length.times do\n empty_arr << min_heap.remove()\n end\n return empty_arr\nend"
] |
[
"0.7644112",
"0.7457935",
"0.7445393",
"0.72094166",
"0.71763396",
"0.7145923",
"0.7111722",
"0.70860785",
"0.70649827",
"0.7056367",
"0.7053715",
"0.7049627",
"0.70383024",
"0.70220256",
"0.70214504",
"0.70082605",
"0.6998128",
"0.6974119",
"0.69708174",
"0.6944229",
"0.69135153",
"0.69079626",
"0.68912333",
"0.6861587",
"0.6855588",
"0.6839966",
"0.6836634",
"0.683139",
"0.6830181",
"0.68106866",
"0.67881453",
"0.6787323",
"0.6778922",
"0.6777673",
"0.6761244",
"0.67611116",
"0.67570317",
"0.675595",
"0.6755714",
"0.67531943",
"0.67522097",
"0.6731724",
"0.673088",
"0.67226887",
"0.67202425",
"0.6713274",
"0.67071545",
"0.6704733",
"0.66992563",
"0.66966146",
"0.6695157",
"0.6694743",
"0.6684198",
"0.6684198",
"0.6684198",
"0.6684198",
"0.6684198",
"0.6684198",
"0.6684198",
"0.668359",
"0.6681883",
"0.66785336",
"0.66770256",
"0.66749316",
"0.6674808",
"0.6674808",
"0.66534173",
"0.6644",
"0.6642707",
"0.6622835",
"0.6585033",
"0.6584525",
"0.6573526",
"0.6573164",
"0.6568014",
"0.65675545",
"0.6566345",
"0.65566903",
"0.65559286",
"0.65501285",
"0.65461034",
"0.6542893",
"0.6533675",
"0.6526734",
"0.65254855",
"0.65225875",
"0.6513742",
"0.651198",
"0.6509574",
"0.65091413",
"0.65008646",
"0.64949554",
"0.648787",
"0.6487589",
"0.6482602",
"0.64824635",
"0.64736515",
"0.6466298",
"0.64621556",
"0.6456435",
"0.64520437"
] |
0.0
|
-1
|
find_min time complexity => O(n), n = number of inputs space complexity => => O(2) => O(1)
|
def find_min(arr)
min = arr.first
(1...arr.length).each do |idx|
min = arr[idx] if arr[idx] < min
end
min
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end",
"def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend",
"def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend",
"def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend",
"def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end",
"def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend",
"def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end",
"def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend",
"def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend",
"def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend",
"def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend",
"def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend",
"def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end",
"def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend",
"def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend",
"def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend",
"def find_min_value(array)\n min_element = 10000000\n array.length.times { |index|\n if min_element > array[index]\n min_element = array[index]\n end\n }\n return min_element# Add your solution here\nend",
"def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend",
"def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend",
"def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend",
"def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend",
"def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend",
"def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def solution(x, a)\n # write your code in Ruby 2.2\n min_occurance = {}\n earliest_time = -1\n\n # loop over a and calculate min occurance\n (0..a.length-1).each do |i|\n if(min_occurance[a[i]].nil?)\n min_occurance[a[i]] = i\n end\n end\n\n\n # loop for x\n (1..x).each do |x_i|\n if(min_occurance[x_i].nil?)\n earliest_time = -1\n break\n else\n if earliest_time.to_i < min_occurance[x_i].to_i\n earliest_time = min_occurance[x_i]\n end\n end\n end\n earliest_time\nend",
"def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end",
"def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend",
"def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend",
"def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend",
"def find_min_value(array)\n return array.min\nend",
"def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend",
"def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend",
"def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend",
"def getMin(arr) \t\n\tminInd = 0\n\tfor i in 1..$n-1 do\n\t\tif (arr[i] < arr[minInd])\n\t\t\tminInd = i\n end \n end \n\treturn minInd\nend",
"def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend",
"def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend",
"def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend",
"def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend",
"def my_min_n2(arr)\n smallest_number = true\n arr.each do |first_el|\n smallest_number = true\n arr.each do |second_el|\n smallest_number = false if second_el < first_el\n end\n return first_el if smallest_number\n end\nend",
"def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend",
"def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend",
"def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend",
"def findMin(temp_set)\n min_n = nil\n min_d = \"INF\"\n $dist.each do |node, dist|\n if isSmaller(dist, min_d) and !(temp_set.include? node)\n min_d = dist\n min_n = node\n end\n end\n return min_n\nend",
"def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend",
"def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend",
"def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend",
"def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend",
"def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend",
"def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend",
"def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend",
"def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend",
"def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend",
"def find_min(array)\n min_difference = nil\n for i in 0..array.length - 1 do\n for j in i + 1..array.length - 1 do\n difference = (array[i] - array[j]).abs\n if min_difference.nil? || difference < min_difference\n min_difference = difference\n end\n end\n end\n min_difference\n end",
"def find_min_value(array)\n min = 0\n array.length.times do |count|\n if count == 0\n min = array[count]\n else\n if array[count] < min\n min = array[count]\n end\n end\n end\n min\nend",
"def smallest_number n1, n2\n [n1, n2].min\nend",
"def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend",
"def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend",
"def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend",
"def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend",
"def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend",
"def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend",
"def solution(a)\n (0..a.size - 2).map { |i| ( a[0..i].inject(:+) - a[i+1..a.size].inject(:+) ).abs }.min\nend",
"def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def find_min(arr)\n smallest_value = arr.first\n for value in arr\n if value <= smallest_value\n smallest_value = value\n end\n end\n smallest_value\nend",
"def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend",
"def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend",
"def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend",
"def first_n_smallest_ms_x(arr, n)\n m = arr.min(n)\n arr.each_with_object([]) {|e,r| r << m.slice!(m.index(e)) if m.include?(e)}\nend",
"def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend",
"def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def smallest(array)\nend",
"def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend",
"def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend",
"def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(arr)\n min = arr.first\n\n arr.each_with_index do |ele1, i| \n arr.each_with_index do |ele2, j|\n next if i == j \n min = ele2 if ele2 < min \n end\n end\n\n min\nend",
"def my_min(array)\n\t\n\tarray.min\n\t\nend",
"def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def find_smallest_int(arr)\n return arr.min\nend",
"def my_min(arr)\n answer = 0\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1 && ele1 < ele2\n answer = ele1 if answer >= ele1\n end\n end\n end\n answer \nend",
"def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend",
"def min_index(a,i)\n\tminimum = 0\n\tfor i in 1..(a.length())\n\t\tif array[i]<array[0]\n\t\t\tminimum = i\n\t\tend\n\tend\nreturn minimum\nend",
"def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend",
"def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend",
"def min() end",
"def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend",
"def my_min2(arr)\n timestart = Time.now\n smallest = arr[0]\n (1...arr.length).each do |idx|\n smallest = arr[idx] if smallest > arr[idx]\n end\n p (Time.now - timestart) * 1000\n smallest\nend",
"def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend",
"def min_cost(cost, m, n)\n if n < 0 || m < 0\n return 100000\n elsif m == 0 && n == 0\n return cost[m][n]\n else\n return cost[m][n] + find_min( min_cost(cost, m-1, n-1),\n min_cost(cost, m-1, n),\n min_cost(cost, m, n-1))\n end\nend",
"def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend",
"def find_min_value(array)\n min_value = array[0]\n array.length.times do |count|\n if array[count] < min_value\n min_value = array[count]\n end\n end\n min_value\nend",
"def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend",
"def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend",
"def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend",
"def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend",
"def my_min(arr)\n arr.each do |num|\n return num if arr.select { |other_num| other_num > num }\n end\nend"
] |
[
"0.7919791",
"0.78667307",
"0.78354055",
"0.78174794",
"0.7806548",
"0.7799494",
"0.7693248",
"0.7590483",
"0.74761957",
"0.74744046",
"0.74281037",
"0.74083525",
"0.7408269",
"0.7391194",
"0.73565954",
"0.7332359",
"0.717463",
"0.71652013",
"0.715451",
"0.7143035",
"0.7121304",
"0.7115371",
"0.71000713",
"0.7097419",
"0.7085498",
"0.708111",
"0.70739496",
"0.7073022",
"0.7069459",
"0.706908",
"0.7060043",
"0.70560586",
"0.70544064",
"0.705401",
"0.7052937",
"0.70523775",
"0.7051491",
"0.70473784",
"0.704177",
"0.7031999",
"0.70290864",
"0.70099366",
"0.7003108",
"0.70007133",
"0.6999179",
"0.6996563",
"0.699634",
"0.6994652",
"0.69847757",
"0.6981846",
"0.6978861",
"0.6975551",
"0.69687635",
"0.696154",
"0.6956395",
"0.6950147",
"0.69285715",
"0.6924596",
"0.69226915",
"0.6921209",
"0.6919541",
"0.69140077",
"0.69107974",
"0.6909493",
"0.690799",
"0.6904423",
"0.68936944",
"0.68830496",
"0.68796897",
"0.6877142",
"0.6876497",
"0.68659836",
"0.6843609",
"0.6838542",
"0.6833524",
"0.68237793",
"0.68223435",
"0.68171525",
"0.68133867",
"0.6808002",
"0.6806545",
"0.679553",
"0.6781182",
"0.67787045",
"0.6775454",
"0.6771918",
"0.6770917",
"0.6761908",
"0.67614794",
"0.6760999",
"0.6757666",
"0.6756631",
"0.6749689",
"0.6748203",
"0.67433983",
"0.6737912",
"0.6733055",
"0.6730823",
"0.67243946",
"0.67209804"
] |
0.7058958
|
31
|
time complexity => O(n^2) space complexity => O(n^3)
|
def largest_contiguous_subsum(arr)
subsets = []
(0...arr.length).each do |idx1|
(idx1...arr.length).each do |idx2|
subsets << arr[idx1..idx2]
end
end
largest_sum = subsets.first.sum
subsets.each do |subset|
if subset.sum > largest_sum
largest_sum = subset.sum
end
end
print subsets
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend",
"def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend",
"def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend",
"def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend",
"def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend",
"def three_sum(nums)\n n = nums.length\n result = []\n for i in 0...n-2\n req_sum = 0\n hsh = Hash.new\n curr_sum = req_sum - nums[i]\n \n for j in (i+1)...n\n num = curr_sum - nums[j]\n if hsh[num]\n elements = [nums[i], num, nums[j]].sort\n result << elements unless result.include?(elements)\n end\n hsh[nums[j]] = true\n end \n end\n result\nend",
"def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend",
"def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend",
"def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend",
"def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend",
"def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend",
"def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend",
"def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend",
"def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend",
"def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend",
"def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend",
"def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend",
"def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend",
"def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend",
"def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend",
"def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend",
"def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend",
"def three_sum2(nums)\n sorted_nums = nums.sort\n\n results = Set.new\n\n sorted_nums[0...sorted_nums.size - 2].each_with_index do |num, index|\n break if num > 0 # 已经排序,并且只看右面,所以大于0就不需要继续了。\n next if index > 0 && num == sorted_nums[index - 1] # 可以减少重复的计算\n\n find_two_sum(index, sorted_nums, results)\n end\n\n results.to_a\nend",
"def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend",
"def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend",
"def sum_upon_sums(array)\n # Step 0: initialize variables => O(1)\n max = -1\n sum = 0\n\n # Step 1: Get Max and Sum => O(n)\n array.each do |num|\n max = num if num >= max\n sum += num\n end\n\n # Step 2: Get summation => O(1)\n summation = max * (max + 1) / 2\n\n # Step 3: Return Missing value by subtracting summation and sum => O(1)\n summation - sum\nend",
"def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend",
"def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend",
"def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend",
"def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend",
"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 largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend",
"def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend",
"def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend",
"def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend",
"def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend",
"def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\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 efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend",
"def sort3(array, length)\n # O(k)\n length.times do |i|\n # clear hash\n hash = {}\n \n # O(n)\n array.each do |str|\n if hash[str[i]].nil?\n hash[str[i]] = [str]\n else\n hash[str[i]] += [str]\n end\n end\n\n array = []\n # O(n)\n hash.values.each do |val|\n array += val \n end\n end\n\n # overall time complexity O(kn)\n array\nend",
"def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend",
"def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def two_sum?(arr, target)\r\n hash = {}\r\n arr.each_with_index do |ele, i| #n\r\n hash[i] = ele\r\n end\r\n arr.each_with_index do |ele, i| #n \r\n value = target - ele\r\n if hash.has_value?(value) && hash.key(value) != i\r\n return true\r\n end\r\n # all the keys in has except i\r\n # if any of the value = value\r\n end\r\n false\r\nend",
"def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def solution(a)\n a.uniq.count\nend",
"def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend",
"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 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 largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time = Time.now\n str1.each_char {|char| hash1[char]+=1}#O(n)\n str2.each_char {|char| hash1[char]-=1}#O(n)\n hash1.all? {|_, v| v.zero?}#O(n)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend",
"def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend",
"def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend",
"def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend",
"def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend",
"def three_sum(nums)\n return [] if !nums || nums.size < 3\n ans = []\n i = 0 \n size = nums.size\n nums = nums.sort\n while i < size do \n if nums[i] == nums[i - 1] && i > 0 \n i += 1\n next\n end\n\n a = nums[i]\n target = -1 * a\n two_sum(nums[(i + 1)...size], target, a, ans)\n i += 1\n end\n ans\nend",
"def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend",
"def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n arr =[]\r\n a.each_with_index{|el,i|\r\n \r\n if !arr.index(el) \r\n arr << el\r\n end\r\n \r\n }\r\n arr.count\r\nend",
"def solution(string) # \"ABCA\",\n # TIME O(N) + O(N) = O(2N) ~~ O(N)\n # SPACE O(N)\n\n array = string.split(\"\") # w[A B C A], O(N)\n array_exist = [] # [B C]\n array.each do |s| # O(N), N= 1000_000\n if array_exist.include?(s)\n array_exist.delete(s)\n else\n array_exist.push(s)\n end\n end\n array_exist[0]\nend",
"def two_sum?(arr, target_sum)\n hash = {}\n arr.each do |ele|\n diff = target_sum - ele\n return true if hash.has_key?(diff) # O(1), or constant time\n hash[ele] = 0\n end\n false\nend",
"def solution2\n n = 1000\n\n hsh = Hash.new([])\n\n (1..n).each do |x|\n (1..n).each do |y|\n hsh[x**3 + y**3] += [x, y]\n end\n end\n\n hsh.values\nend",
"def second_anagram?(word_1, word_2) #O(n^2)\n matching_word = word_2.split(\"\")\n\n word_1.each_char do |ele|\n if matching_word.index(ele) #evaluating the conditional\n matching_word.delete_at(matching_word.index(ele)) #n many times, do this\n end\n end\n\n matching_word.empty? #constant O(1)\nend",
"def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend",
"def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort.each_cons(3) { |e| return 1 if e[0] + e[1] > e[2] }\n return 0\nend",
"def largest_contiguous_subsum(arr)\n\n\nend",
"def bad_contig_subsum(arr)\n # n! || n^3 ?\n sub_arrays = []\n arr.each_index do |i|\n (i...arr.length).each do |j|\n sub_arrays << arr[i..j]\n end\n end\n\n # above * n^2 ? << bottleneck\n max = sub_arrays.first.inject(&:+)\n sub_arrays.each do |sub_arr|\n sub_sum = sub_arr.inject(&:+)\n max = sub_sum if sub_sum > max\n end\n max\nend",
"def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend",
"def solution(n, a)\n # write your code in Ruby 2.2\n arr = [0] * n\n max_c = 0\n \n a.each_with_index do |value,index|\n if value == n + 1\n arr = [max_c] * n\n else\n arr[value - 1] = arr[value - 1] + 1\n max_c = (arr[value -1] > max_c ? arr[value -1] : max_c)\n end\n end\n arr\nend",
"def two_sum(integers, target)\n # O(n)\n integers_with_index = integers.each_with_index.to_a\n # O(n*log(n))\n integers_with_index = integers_with_index.sort_by { |(n, _)| n }\n\n front, back = 0, integers_with_index.count - 1\n\n until front == back\n sum = integers_with_index[front][0] + integers_with_index[back][0]\n if sum == target\n return [integers_with_index[front][1], integers_with_index[back][1]].sort\n elsif sum > target\n back -= 1\n else\n front += 1\n end\n end\nend",
"def third_anagram?(word, goal)\n word = word.split('') # O(n)\n goal = goal.split('') # O(n)\n # O(n^2) + O(n^2) || O(n log(n)) + O(n log(n))\n word.sort == goal.sort\nend",
"def collisions(arr)\n new_arr = []\n result = []\n arr.each do |i|\n if i > 0\n new_arr << i\n else\n if new_arr.empty?\n result << i\n else\n if new_arr[-1] == -(i)\n new_arr.pop\n else\n while !new_arr.empty? && new_arr[-1] < -(i)\n new_arr.pop\n end\n if new_arr.empty?\n result << i\n end\n end\n end\n end\n end\n return (result.concat(new_arr))\nend",
"def solution_slow_2(n, p, q)\n sieve = sieve_of_erathosteneses(n)\n # puts \"sieve:#{sieve}\"\n semi = semiprimes(n, sieve)\n # puts \"sp:#{semi}\"\n prefix = [0,0,0,0,1]\n 5.upto(n) do |x|\n if semi.include? x \n prefix << prefix.last + 1\n else\n prefix << prefix.last\n end\n end\n # puts \"prefix:#{prefix}\"\n\n queries = [p,q].transpose\n\n\n res = queries.map do |query|\n prefix[query.last] - prefix[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end",
"def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend",
"def josephus_survivor(n,k)\n arr = (1..n).to_a\n\n while arr.length > 1\n idx = k % arr.length\n\n if arr.length > k\n arr = arr.drop(k) + arr.take(k - 1)\n elsif arr.length == k \n arr = arr[0...-1]\n else\n arr = arr.drop(idx) + arr.take(idx - 1)\n end\n end\n \n arr[0]\nend",
"def solution(a)\n return 0 if a.count < 3\n \n a.sort!\n for i in (2...a.count)\n x = a[i - 2]\n y = a[i - 1]\n z = a[i]\n \n return 1 if x + y > z && x + z > y && z + y > x\n end\n \n return 0\nend",
"def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend",
"def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend",
"def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"def move_zeros(array)\n zero_count = 0\n # O(n)\n array.each do |num|\n\n zero_count += 1 if num == 0\n end\n\n # O(n)\n array = array.select { |num| num != 0 }\n \n # O(1)\n zero_count.times do\n array += [0]\n end\n\n array\nend",
"def arrayManipulation(n, queries)\n arr = Array.new(n + 2, 0)\n\n queries.each do |a, b, k|\n arr[a] += k\n arr[b + 1] -= k\n end\n\n max_sum = 0\n sum = 0\n arr.filter { |diff| diff != 0 }.each do |diff|\n sum += diff\n max_sum = [max_sum, sum].max\n end\n\n max_sum\nend"
] |
[
"0.6873727",
"0.67022043",
"0.6699853",
"0.6250622",
"0.62420523",
"0.619073",
"0.6177757",
"0.6155271",
"0.61480576",
"0.6124618",
"0.61172706",
"0.61075157",
"0.6079605",
"0.60767865",
"0.6074992",
"0.60698587",
"0.6057346",
"0.6043837",
"0.60178995",
"0.60108644",
"0.600074",
"0.5991775",
"0.5987017",
"0.59847724",
"0.59669685",
"0.5942325",
"0.5935832",
"0.5935377",
"0.5928698",
"0.592713",
"0.59247106",
"0.59197384",
"0.5907431",
"0.5907408",
"0.5904504",
"0.5891062",
"0.58886284",
"0.5886218",
"0.58800125",
"0.58733475",
"0.5850741",
"0.58415574",
"0.5832184",
"0.58296984",
"0.5821697",
"0.58168435",
"0.5814955",
"0.58106947",
"0.58024657",
"0.5801679",
"0.57979417",
"0.578644",
"0.5776275",
"0.5770591",
"0.5768846",
"0.57627654",
"0.576129",
"0.57592225",
"0.5757073",
"0.5754545",
"0.5753754",
"0.5750038",
"0.574972",
"0.5739965",
"0.57379705",
"0.57273716",
"0.572351",
"0.5723198",
"0.5722959",
"0.57225984",
"0.5719267",
"0.5710043",
"0.5707677",
"0.56914747",
"0.56866384",
"0.5679264",
"0.56753385",
"0.56748265",
"0.5674164",
"0.56682813",
"0.5666598",
"0.5662359",
"0.5657319",
"0.56509894",
"0.56481034",
"0.56449807",
"0.5641905",
"0.56414527",
"0.5641108",
"0.56396586",
"0.5639122",
"0.5636968",
"0.56366074",
"0.56356215",
"0.5634528",
"0.56340265",
"0.5633627",
"0.5630062",
"0.5626658",
"0.5624276",
"0.5622199"
] |
0.0
|
-1
|
list = [2, 3, 6, 7, 6, 7] p largest_contiguous_subsum(list) => 8 (from [7, 6, 7]) O(3) => O(1)
|
def better_largest_contiguous_subsum(arr)
largest_sum = 0
current_sum = 0
i = 0
while i < arr.length
if arr[i] + current_sum >= 0
current_sum += arr[i]
else
current_sum = 0
end
largest_sum = current_sum if current_sum > largest_sum
i += 1
end
largest_sum
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def largest_contiguous_subsum(list)\n # debugger\n results = [] # O(1)\n\n list.each_with_index do |el1, idx1| # O(n)\n list.each_with_index do |el2, idx2| # O(n) => O(n^2)\n next if idx2 < idx1 # O(1)\n results << list[idx1..idx2] # O(1)\n end\n end\n\n results.map! { |subsum| subsum.reduce(:+) } # O(n^2)\n results.max # O(1)\nend",
"def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend",
"def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend",
"def largest_contiguous_subsum_1(list)\n subs = []\n (0...list.length).each do |idx| #O(n)\n (idx...list.length).each do |idx_2| #O(n)\n subs << list[idx..idx_2] #O(n)\n end\n end\n max = list.first\n subs.each do |subarr|\n if subarr.sum > max\n max = subarr.sum\n end\n end\n max\nend",
"def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend",
"def largest_contiguous_subsum1(list)\n arr = []\n (0...list.length).each do |i|\n (i...list.length).each { |j| arr << list[i..j] }\n end\n largest_sum = arr.first.sum\n arr.each do |sub_arr|\n largest_sum = sub_arr.sum if sub_arr.sum > largest_sum\n end\n largest_sum\nend",
"def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end",
"def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend",
"def largest_contiguous_subsum(list)\n subs = [] \n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map {|el| el.sum}.max\nend",
"def largest_contiguous_subsum(list)\n subs = []\n list.each_with_index do |ele1, idx1|\n (idx1..list.length-1).each do |idx2|\n subs.push(list[idx1..idx2])\n end\n end\n subs_sum = subs.map{|sub_arr| sub_arr.sum}\n subs_sum.flatten.max\nend",
"def largest_contiguous_subsum(list)\n new_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n new_arr << list[i..j]\n end\n end\n new_arr.map { |sub_arr| sub_arr.sum }.max\nend",
"def largest_contiguous_subsum_one(list)\n sub_arr = []\n sum = 0\n list.each_with_index do |ele, i|\n (i...list.length).each do |i2|\n sub_arr << list[i..i2]\n end\n end\n sub_arr.each do |arr|\n if arr.sum > sum\n sum = arr.sum\n end\n end\n sum\nend",
"def largest_contiguous_subsum(list)\n curr_sum = list[0]\n max_sum = list[0]\n (1...list.length).each do |idx|\n # debugger\n curr_sum += list[idx]\n if curr_sum < list[idx] \n curr_sum = list[idx]\n end\n if curr_sum > max_sum\n max_sum = curr_sum\n end\n end\n max_sum\nend",
"def largest_contiguous_subsum(list) # O(n^2)\n subs_sums = []\n\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n subs_sums << list[i..j]\n end\n end\n\n highest_array_sum = nil\n subs_sums.each do |array|\n array_sum = array.reduce(:+)\n if highest_array_sum == nil || array_sum > highest_array_sum\n highest_array_sum = array_sum\n end\n end\n\n highest_array_sum\nend",
"def largest_contiguous_subsum(list)\n arr = []\n list.length.times do |id|\n arr << [list[id]]\n id2 = id + 1\n while id2 < list.length\n arr << list[id..id2]\n id2 += 1\n end\n end\n sum_arr = arr.map{ |el| el.reduce(:+)}\n arr[sum_arr.find_index{|el| el == sum_arr.max}]\nend",
"def largest_contiguous_subsum(list)\n # l = list.length # 1\n # result = [] # 1\n # hash = Hash.new(0) # 1\n\n # (0...l).each do |i1| # n\n # (0...l).each do |i2| # n\n # result << list[i1..i2] if i2 >= i1 # 1\n # end\n # end\n\n # result.each do |sub_arr| # n\n # hash[sub_arr] = sub_arr.sum # 1\n # end\n\n # sorted_by_val = hash.sort_by { |k, v| v } # n, \n # sorted_by_val[-1][1] # \nend",
"def largest_contiguous_subsum(list)\n helper_arr = [list.first]\n (1...list.length).each do |idx|\n if helper_arr[-1] + list[idx] > list[idx]\n helper_arr << helper_arr[-1] + list[idx]\n else\n helper_arr << list[idx]\n end\n end\n helper_arr.max\nend",
"def largest_contiguous_subsum1(list)\n subs = []\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map(&:sum).max\nend",
"def largest_contiguous_subsum(list)\n sub_arr = []\n \n (0...list.length).each do |idx|\n (idx...list.length).each do |jdx|\n sub_arr << list[idx..jdx]\n end\n end\n\n sub_arr.map! {|ele| ele.sum}.max\nend",
"def largest_contiguous_subsum(list)\n # O(N*M) ==> Time\n # O(N*M) ==> Space\n sub_arrs = sub_arrays_of(list) # O(N^3)\n sums = []\n sub_arrs.each do |sub_arr| ## O(N*M)\n sums << sub_arr.sum\n end\n # Get the max of the sums array\n sums.max # O(N)\nend",
"def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend",
"def largest_contiguous_subsum(list) \n subs = []\n\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n sub = list[i..j]\n subs << sub\n end\n end\n \n max = nil\n\n subs.each do |sub|\n sum = sub.sum \n if max == nil || sum > max\n max = sum\n end\n end\n max\nend",
"def largest_contiguous_subsum(list)\n answer=[]\n list.each_with_index do |ele,index|\n list.each_with_index do |ele2,index2|\n if index2 >= index \n answer.push(list[index..index2])\n end\n end\n end\n answer.map {|array| array.sum}.max\nend",
"def largest_contiguous_subsum1(list)\n greatest_sum = -1.0/0.0\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n greatest_sum = list[i..j].sum if greatest_sum < list[i..j].sum\n end\n end\n greatest_sum\nend",
"def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend",
"def largest_contiguous_subsum2(int_list)\n largest_sum = int_list.first\n curr_sum = int_list.first\n\n (1...int_list.length).each do |idx|\n curr_sum = (int_list[idx] > curr_sum + int_list[idx]) ? int_list[idx] : curr_sum + int_list[idx]\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n\n largest_sum\nend",
"def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend",
"def largest_contiguous_subsum(list)\n largest_sum = 0\n current_sum = list[0]\n (1...list.length).each do |i|\n current_sum = 0 if current_sum < 0 #we need to reset current sum if we hit a negative number\n current_sum += list[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend",
"def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend",
"def largest_contiguous_subsum(list)\n max = nil\n subarrays = []\n\n list.each_with_index do |el1, idx1|\n (idx1...list.length).each do |idx2|\n subarrays << list[idx1..idx2]\n end\n end\n\n sums = []\n subarrays.each do |array|\n sums << array.inject(:+)\n end\n\n sums.max\nend",
"def largest_contiguous_subsum1(list)\n sums = []\n\n list.each_with_index do |el1, i1|\n list.each_with_index do |el2, i2|\n if i1 == i2\n sums << el1\n else\n sums << el1 + el2\n end\n end\n end\n\n result = sums.first\n\n sums.each do |sum|\n result = sum if sum > result\n end\n\n result\nend",
"def largest_contiguous_subsum(list)\n max_sum = list.first\n current_sum = list.first\n \n (1...list.length).each do |i| \n current_sum = 0 if current_sum < 0 \n current_sum += list[i]\n max_sum = current_sum if current_sum > max_sum\n end\n max_sum\nend",
"def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend",
"def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend",
"def largest_contiguous_subsum(list)\n max_sum = 0\n i = 0\n while i < list.size\n curr_sum = list[0..i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[0..i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n i += 1\n end\n max_sum\nend",
"def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend",
"def largest_contiguous_subsum(list)\r\n \r\n largest = -1*Float::INFINITY\r\n current_sum = 0\r\n\r\n list.each do |num|\r\n if (current_sum += num ) < 0\r\n current_sum = 0\r\n if largest < num\r\n largest = num\r\n end\r\n else\r\n largest = current_sum if largest < current_sum\r\n end\r\n end\r\n largest\r\n # last_idx = 0\r\n # list.each_with_index do |e, i|\r\n # if current_sum < 0 || (current_sum += e) > largest\r\n # last_idx = i \r\n # largest = current_sum > 0 ? current_sum : e\r\n # end\r\n # end\r\n # p largest\r\n # p last_idx\r\n # largest = -1*Float::INFINITY\r\n # current_sum = 0\r\n\r\n # last_idx.downto(0).each do |i|\r\n # if current_sum < 0 || (current_sum += list[i]) > largest\r\n # largest = current_sum > 0 ? current_sum : list[i]\r\n # end\r\n # end\r\n\r\n # largest\r\nend",
"def largest_contiguous_subsum_1(list)\r\n subarrays = [] #1\r\n list.each_with_index do |ele1, i| #n\r\n list[i...list.length].each_with_index do |ele2,i2| #(n-1)\r\n subarrays << list[i..i2+i] #k \r\n end\r\n end # n^2\r\n subarrays.map { |subarray| subarray.sum}.max # n^x\r\nend",
"def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend",
"def largest_contiguous_subsum2(array)\n # return [list[0]] if list.count == 1\n #\n # start_num = list.shift\n # large_sum = start_num\n #\n # other_list = list.dup\n #\n # idx = 0\n # while idx < list.count\n # sum = list[0..idx].inject(:+)\n # if large_sum < start_num + sum\n # large_sum = start_num + sum\n # end\n # idx += 1\n # end\n #\n # [large_sum] + largest_contiguous_subsum2(other_list)\n\n largest = nil\n current = 0\n\n array.each do |el|\n current += el\n if largest.nil? || current > largest\n largest = current\n end\n current = 0 if current < 0\n end\n\n largest\n\nend",
"def better_largest_contiguous_subsum(list)\n total_sum = list.first\n current_sum = list.first\n\n list.each_index do |idx| \n current_sum = [list[idx], current_sum + list[idx]].max\n total_sum = [total_sum, current_sum].max\n end\n\n return total_sum\nend",
"def largest_contiguous_subsum(list)\n max_sum = list[0]\n\ttemp_sum = list[0]\n\tdebugger\n #0(n) #note: only n^2 if nested\n \n return list.max if list.all? { |ele| ele < 0 } \n #need to add O(1) return case\n # Write a new function using O(n) time with O(1) memory. Keep a running tally of the largest sum.\n\n list_2 = list.drop(1)\n list_2.each do |ele|\n\t\ttemp_sum = [ele, temp_sum + ele].max #O(1) operation, should refactor \n #temp_sum = ele = 4, temp_sum = 1+3, [4, 8].max\n # [3, -7]\n #[3, 5 + 3] = > 3, 8 = > 8 max = 5\n #[-7, 8 - 7] => 1, 1 = > 1 max = 8\n max_sum = temp_sum if temp_sum > max_sum\n\tend\n\t\n\tmax_sum\nend",
"def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend",
"def largest_contiguous_subsum(list)\n length = 1\n sub_arrays = []\n until length == list.length\n sub_arrays += list.each_cons(length).to_a\n length += 1\n end\n sub_arrays.map! { |el| el.reduce(:+) }.max\n\n # sub_arrays = []\n #\n # list.each_with_index do |ele, idx1|\n # list.each_with_index do |ele2, idx2|\n # sub_arrays << list[idx1..idx2] unless list[idx1..idx2].length < 1\n # end\n # end\n # sub_arrays.map! { |el| el.reduce(:+) }.max\n\nend",
"def largest_contiguous_subsum(list)\n all_subarrays = Array.new \n i = 0 \n j = 0\n\n while j < list.length \n while i < list.length \n all_subarrays << list[j..i]\n i += 1 \n end \n j += 1 \n i = j \n end\n\n sums = Array.new\n\n all_subarrays.each do |arr|\n sum = 0\n\n arr.each { |n| sum += n }\n\n sums << sum\n end\n\n sums.max\nend",
"def largest_contiguous_subsum(arr) # n^2\n subs = []\n (0...arr.length).each do |start_i|\n (start_i...arr.length).each do |end_i|\n subs << arr[start_i..end_i]\n end\n end\n\n subs.map { |sub| sub.inject(:+) }.max\nend",
"def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend",
"def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend",
"def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend",
"def largest_contiguous_subsum(array)\n sums_list = []\n sums = []\n\n idx1 = 0\n\n while idx1 < array.length #O(n)\n idx2 = idx1 #O(1)\n while idx2 < array.length #O(n)\n sums_list << array[idx1..idx2] #O(n)\n idx2 += 1\n end\n idx1 += 1\n end\n\n sums_list.each do |list| #O(n)\n sums << list.reduce {|sum, num| sum + num} #O(n)\n end\n sums.max\nend",
"def largest_contiguous_subsum_fast(list)\n start = Time.now\n max_sum = list[0]\n cur_sum = list[0]\n list[1..-1].each do |el|\n if el >= cur_sum && cur_sum < 0\n cur_sum = el\n else\n cur_sum += el\n end\n max_sum = cur_sum if cur_sum > max_sum\n end\n finish = Time.now\n puts \"Runtime: #{finish - start}\"\n return max_sum\nend",
"def largest_contiguous_subsum2(list)\n sum = 0 # keeps track of current sum\n largest_sum = list.first # evaluates to the largest sum\n list.each do |ele|\n sum += ele \n largest_sum = sum if sum > largest_sum\n sum = 0 if sum < 0\n end\n largest_sum\nend",
"def largest_contiguous_subsum_v2(list)\n largest_sum = list.first\n sum = list.first # but the first element can be a negative number\n\n (1...list.length).each do |i|\n # a negative number + a postive number always less than pos number on its own\n sum = 0 if sum < 0 # if we add to a negative sum, then result is less than pos number on its own\n sum += list[i]\n largest_sum = sum if largest_sum < sum\n end\n\n largest_sum\nend",
"def largest_contiguous_subsum2(list)\n largest_sum = list[0]\n current_sum = 0\n# list = [2, 3, -6, 7, -6, 7]\n list.each do |number|\n current_sum += number\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend",
"def largest_contiguous_subsum(arr)\n sum = arr.first\n\n (0...(arr.length - 1)).each do |idx1|\n (idx1..(arr.length - 1)).each do |idx2|\n if idx1 == idx2\n ss = arr[idx1]\n else\n ss = arr[idx1..idx2].reduce(:+)\n end\n sum = ss if ss > sum\n end\n end\n sum\nend",
"def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend",
"def largest_contiguous_subsum(arr)\n result = []\n\n arr.each_with_index do |el1, idx1|\n i = idx1\n while i < arr.length\n result << arr[idx1..i]\n i += 1\n end\n end\n\n largest_sum = result.first.inject(:+)\n result.each do |sub_arr|\n curr_sum = sub_arr.inject(:+)\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n largest_sum\nend",
"def largest_contiguous_subsum_v1(arr)\n subs = [] # ( +2 )\n\n (0...arr.length).each do |idx1| # ( n )\n (idx1..arr.length - 1).each do |idx2| # ( n )\n subs << arr[idx1..idx2].sum # ( n * ( 1 + ))\n end\n end\n\n subs.max # ( n )\nend",
"def better_largest_contiguous_subsum(list)\n current_largest_sum = 0\n current_sum = 0\n return list.max if list.all? {|ele| ele < 0}\n\n (0...list.length).each do |i |\n # debugger\n #add current element to current sum\n current_sum += list[i]\n\n #if current sum is less than 0 ignore it and reset to move on to next number\n if ( current_sum < 0 ) \n current_sum = 0\n end \n # if current sum is greater than our current largest sum, we want to keep it\n if current_sum > current_largest_sum\n current_largest_sum = current_sum\n end\n end\n current_largest_sum\nend",
"def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend",
"def largest_contiguous_subsum_v2(arr) # O(n)\n\n largest_sum = arr[0]\n current_sum = arr[0]\n \n (1...arr.length).each do |i|\n if current_sum < 0\n if current_sum < arr[i]\n current_sum = arr[i]\n end\n else\n current_sum += arr[i]\n end\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend",
"def largest_contiguous_subsum(arr)\n sums = []\n\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n sums << arr[idx1..idx2].sum\n end\n end\n\n sums.max\nend",
"def largest_contiguous_subsum(arr)\n\n\nend",
"def largest_contiguous_subsum(arr)\n subs = []\n l = arr.length\n (0...l).each do |i|\n (0...l).each do |j| \n subs << arr[i..j] if arr[i..j].length > 0 # n*n *( n) == n^3 + n\n end\n end\n subs.map(&:sum).max\nend",
"def largest_contiguous_sub_sum(arr)\n subarrs = [] #O(1)\n\n (0...arr.length).each do |idx| #O(n)\n (idx...arr.length).each do |jdx| #O(n/2)\n subarrs << arr[idx..jdx] #O(n)\n end\n end \n\n subarrs.map! do |array| #O(n)\n array.reduce(:+) #O(n)\n end \n\n subarrs.max #O(n)\nend",
"def largest_contiguous_subsum1(int_list)\n sub_arrays = []\n\n (0...int_list.length).each do |idx1|\n (idx1...int_list.length).each do |idx2|\n sub_arrays << int_list[idx1..idx2]\n end\n end\n\n sub_arrays.each_with_index do |arr, idx|\n sum_arr = arr.sum\n sub_arrays[idx] = sum_arr\n end\n\n sub_arrays.max\nend",
"def largest_contiguous_subsum(arr)\r\n all_sub_arrays = [] # space : O(n^2)\r\n\r\n (0...arr.length).each do |i|\r\n (i...arr.length).each do |i2|\r\n all_sub_arrays << arr[i..i2] # slice makes n^3\r\n end\r\n end\r\n\r\n all_sub_arrays.map { |sub_arr| sub_arr.sum }.max # O(n^2)\r\nend",
"def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend",
"def largest_contiguous_subsum(arr)\n max_sum = arr.first\n\n (0...arr.length).each do |start|\n (start...arr.length).each do |ending|\n sum = arr[start..ending].sum\n max_sum = sum if sum > max_sum\n end\n end\n\n max_sum\nend",
"def largest_contiguous_subsum_1(arr)\n res = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n res << arr[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n res.max\nend",
"def largest_contiguous_subsum_slow(arr)\n res = arr.first\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n tmp_sum = arr[i..j].reduce(:+)\n res = tmp_sum if tmp_sum > res\n end\n end\n return res\nend",
"def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend",
"def largest_contiguous_subsum1(array)\n sub_array = []\n\n array.each_index do |i|\n array.each_index do |j|\n next if i > j\n sub_array << array[i..j]\n end\n end\n sum = sub_array.first.inject(:+)\n sub_array.each do |el|\n sum = el.inject(:+) if el.inject(:+) > sum\n end\n sum\nend",
"def largest_contiguous_subsum(arr)\n answer = []\n arr.each_with_index do |ele1,idx1|\n arr.each_with_index do |ele2,idx2|\n answer << arr[idx1..idx2].sum \n end\n end\n answer.sort[-1]\nend",
"def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend",
"def largest_contiguous_subsum(arr)\n max = arr.first\n arr.each_index do |idx1|\n (idx1+1..arr.length).each do |idx2|\n sub_arr = arr[idx1...idx2]\n sum = sub_arr.reduce(:+)\n max = sum if max < sum \n end\n\n end\n max\nend",
"def largest_con_subsum_2(list)\n largest = list.first\n contiguous_sum = list.first\n\n i = 1\n \n while i < list.length\n current = list[i]\n contiguous_sum += current\n if contiguous_sum > largest\n largest = contiguous_sum \n elsif current > largest\n largest = current\n \n end\n contiguous_sum = 0 if contiguous_sum < 0\n i += 1 \n \n end\n return largest\nend",
"def largest_contiguous_subsum(arr)\n i = 0\n subs = []\n while i < arr.length\n j = i\n\n while j < arr.length\n subs << arr[i..j]\n\n j += 1\n end\n\n i += 1\n end\n\n\n return (subs.max {|a, b| a.sum <=> b.sum}).sum\n\nend",
"def largest_contiguous_subsum_n_2(arr)\n subs = []\n arr.each_with_index do |el1, i|\n arr.each_with_index do |el2, j|\n if j > i \n subs << arr[i..j]\n end\n end\n end\n subs\n x = subs.max_by {|arr| arr.sum}\n x.sum\nend",
"def largest_contiguous_subsum(array)\n previous_sum = 0\n current_sum = 0\n array.each_with_index do |el, i|\n\n current_sum = previous_sum + el\n if previous_sum < 0\n if el < previous_sum\n current_sum = previous_sum\n else\n current_sum = el\n end\n end\n\n previous_sum = current_sum\n end\n\n current_sum\nend",
"def largest_contiguous_subsum(array)\n current_sum = array.first\n largest_sum = array.first\n array.each do |num|\n current_sum += num\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend",
"def largest_contiguous_subsum_n(list2)\n large = 0\n \n list2.inject do |sum, n|\n if (sum + n) > sum\n sum += n \n large = sum if sum > large\n sum\n else\n sum = 0\n end\n end\n\n large\nend",
"def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend",
"def largest_contiguous_subsum(array)\n sub_arrs = []\n array.each_index do |ind1|\n array[ind1..-1].each_index do |ind2|\n sub_arrs.push(array[ind1..ind2+ind1])\n end\n end\n max_sum = sub_arrs.first.sum\n sub_arrs.each {|sub| max_sum = sub.sum if sub.sum >= max_sum }\n return max_sum\nend",
"def largest_contiguous_subsum(arr)\n max = arr[0]\n current = 0\n (0...arr.length).each do |i|\n current += arr[i]\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend",
"def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend",
"def largest_contiguous_subsum(array)\n arr = []\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n arr << array[i] + array[j] \n end\n end\n arr.max\n \nend",
"def largest_contiguous_subsum(arr)\n current_sum = arr.first \n max_sum = arr.first \n (0...arr.length-1).each do |i|\n if current_sum < 0 \n current_sum = [current_sum, arr[i+1]].max\n max_sum = current_sum\n else \n current_sum += arr[i+1]\n max_sum = [current_sum, max_sum].max\n end \n end \n max_sum\nend",
"def largest_contiguous_subsum_fast(arr)\n global_max = arr.first\n prev_max = arr.first\n\n arr.drop(1).each do |el|\n curr_max = (prev_max + el > el) ? (prev_max + el) : el\n prev_max = curr_max\n global_max = curr_max if curr_max > global_max\n end\n global_max\nend",
"def largest_contiguous_subsum(arry)\n sums = 0\n size = arry.length\n\n (0..size - 1).each do | i|\n sub = []\n (i + 1..size).each do |j|\n sub = arry[i..j]\n if sub.sum > sums\n sums = sub.sum \n end\n end\n end\n sums\nend",
"def largest_contiguous_subsum2(arr)\n max = arr[0]\n current = arr[0]\n arr.drop(1).each do |num|\n current += num\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend",
"def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend",
"def best_largest_contiguous_subsum(arr)\n return arr.max if arr.max < 0\n largest = 0\n current = 0\n\n\n (0..(arr.length-1)).each do |idx1|\n if current + arr[idx1] < 0\n current = arr[idx1]\n else\n current += arr[idx1]\n end\n\n largest = current if current > largest\n end\n largest\nend",
"def largest_contiguous_subsum(array)\r\n max = array.first \r\n current_sum = 0\r\n array.each do |ele|\r\n current_sum += ele\r\n max = current_sum if current_sum > max\r\n current_sum = 0 if current_sum < 0\r\n end\r\n max\r\nend",
"def largest_contiguous_sub_sum3(arr)\n\n largest_sum = arr.first\n current_sum = arr.first\n\n (1...arr.length).each do |index|\n current_num = arr[index]\n prev_num = arr[index-1]\n\n if largest_sum < current_num\n largest_sum = current_num\n end\n\n current_sum = current_sum + current_num\n prev_sum = prev_num + current_num\n\n if prev_sum > current_sum\n current_sum = prev_sum\n end\n\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend",
"def largest_contiguous_subsum(arr)\n \n curr_sum = arr.first\n largest_sum = arr.first\n (1...arr.length).each do |i| \n if curr_sum < 0\n curr_sum = 0 #reset\n end\n\n curr_sum += arr[i] \n \n if curr_sum > largest_sum \n largest_sum = curr_sum\n end\n end\n largest_sum\nend",
"def largest_contiguous_subsum(array)\n sub_arrays = []\n i = 1\n until i == array.length + 1\n array.each_cons(i) do |sub|\n sub_arrays << sub\n end\n i += 1\n end\n sub_arrays.map {|sub| sub.reduce(:+)}.max\nend",
"def largest_contiguous_subsum1(array)\r\n subset = []\r\n array.each_index do |i| # make subets, store into 'subset' array\r\n (i...array.length).each do |j| # o(n^2)\r\n subset << array[i..j] # o(n^3) cause slicing\r\n end\r\n end\r\n\r\n subset_sum = []\r\n subset.each do |ele|\r\n subset_sum << ele.sum\r\n end\r\n subset_sum.max\r\nend",
"def largest_contigous_subsum_ii(list)\n current_sum = list.first\n max = list.first\n (1..-1).each do |i|\n current_sum += list[i]\n current_sum = 0 if current_sum < 0\n max = current_sum if max < current_sum\n end\n current_sum\nend",
"def largest_contiguous_subsum(arr)\n global_sum = arr.first\n # p \"global = #{global_sum}\"\n i = 0\n pot = 0\n while i < arr.length\n pot += arr[i]\n global_sum = pot if global_sum < pot\n pot = 0 if pot < 0\n i += 1\n end\n global_sum\nend",
"def largest_contiguous_subsum_2(arr)\n (1...arr.length).each do |i|\n if arr[i] + arr[i - 1] > 0\n arr[i] = arr[i] + arr[i - 1]\n elsif arr[i] < 0 && arr[i-1] < 0\n arr[i] = [arr[i-1], arr[i]].max\n else\n arr[i] = 0\n end\n end\n\n arr.max\nend"
] |
[
"0.93374616",
"0.933168",
"0.9298666",
"0.92411894",
"0.92378217",
"0.9217345",
"0.9188184",
"0.91436994",
"0.9129251",
"0.9118206",
"0.91158617",
"0.90972686",
"0.90844226",
"0.9083572",
"0.9082254",
"0.9057543",
"0.90487903",
"0.9016314",
"0.9013195",
"0.9004385",
"0.89880526",
"0.898003",
"0.8979358",
"0.8976437",
"0.89624476",
"0.8960214",
"0.89587975",
"0.8951278",
"0.89485294",
"0.894652",
"0.8943369",
"0.8941277",
"0.89385784",
"0.8934664",
"0.89255154",
"0.89120924",
"0.8905494",
"0.88904697",
"0.8888529",
"0.88740164",
"0.8862878",
"0.88590604",
"0.8857841",
"0.88514465",
"0.8821497",
"0.8819146",
"0.88084733",
"0.87924784",
"0.8790912",
"0.8769809",
"0.87609655",
"0.8732647",
"0.8714127",
"0.8711904",
"0.87047267",
"0.86735725",
"0.8665607",
"0.86624587",
"0.86606395",
"0.86537975",
"0.86528194",
"0.8635707",
"0.86350197",
"0.8629786",
"0.86296505",
"0.8614722",
"0.8613267",
"0.8608875",
"0.86073035",
"0.8588194",
"0.85648894",
"0.85636985",
"0.8560728",
"0.85596263",
"0.8548287",
"0.8547966",
"0.8543206",
"0.8541414",
"0.8537835",
"0.85363424",
"0.8531091",
"0.85219467",
"0.8517896",
"0.85061365",
"0.8492317",
"0.8488329",
"0.84735733",
"0.8471552",
"0.8467261",
"0.8457089",
"0.84329766",
"0.8415445",
"0.84036154",
"0.83873457",
"0.8384912",
"0.83637923",
"0.83634406",
"0.83603376",
"0.83522666",
"0.83520925",
"0.8344177"
] |
0.0
|
-1
|
get all primes < n
|
def sieve(n)
primes = []
a = Array.new(n, true)
2.step(Math.sqrt(n).to_i) do |i|
if a[i]
primes.push(i)
i.step(n-1, i) do |k|
a[k] = false
end
end
end
Math.sqrt(n).to_i.step(n-1) do |i|
if a[i]
primes.push(i)
end
end
return primes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def primes_to_n n\n non_primes = []\n non_primes[1] = 1\n (2..(n/2)).each do |factor|\n ((factor*2)..n).step(factor).each do |multiple_of_factor|\n non_primes[multiple_of_factor] = 1\n end\n end\n (1..n).reject {|i| non_primes[i]}\nend",
"def prime_set(n)\n\t\tprimes_arr =[]\n\t\ti = 1\n\t\t# keep inserting prime numbers into array until its length is equal to 'n'\n\t\tuntil primes_arr.count == n\n\t\t\tif is_prime(i) == true \n\t\t\t\tprimes_arr << i \n\t\t\tend \n\t\t\ti+=1\n\t\tend \n\t\tp primes_arr\n\tend",
"def primes_under(n)\n candidates = (3..n).step(2).to_a\n primes = [2]\n\n until primes.last > n ** 0.5\n primes << candidates.shift\n candidates.reject! {|candidate| candidate % primes[-1] == 0}\n end\n\n primes + candidates\nend",
"def primes_less_than(n)\n primes = [2,3]\n (5..n).each do |i|\n if i%2 == 1\n primes << i if is_prime?(i, primes)\n end\n end\n primes\n end",
"def get_n_primes(n)\n return [] if n < 1\n primes = [2]\n candidate = 3\n\n while primes.length < n\n is_prime = true # default assume the number is prime\n primes.each do |prime|\n if candidate % prime == 0\n is_prime = false\n break\n end\n\n break if prime >= Math.sqrt(candidate)\n end\n\n primes << candidate if is_prime\n candidate += 2\n end\n\n primes\nend",
"def primes_up_to(n)\n raise \"Need an integer >= 2 to find primes\" unless n.is_a?(Integer) && n >= 2\n primes = (0..n).to_a\n primes[0..1] = [nil, nil]\n p = 2\n while true do\n (p .. n/p).each do |i|\n primes[i*p] = nil\n end\n break unless p = primes.index { |x| !x.nil? && x > p }\n end\n primes.compact!\n end",
"def sieve(n)\n primes = nil\n\n OpenTracing.global_tracer.start_active_span(\"sieve\") do |scope|\n # don't really want the first two, but matching index to value makes it easier\n primes = [*0..n]\n primes[0] = nil\n primes[1] = nil\n\n for x in primes do\n next if x.nil? # already marked as composite, skip to the next one\n\n # find all the composites from this number and make them nil\n (2*x..n).step(x) do |c|\n primes[c] = nil\n end\n end\n\n # remove the nils from the array\n primes = primes.compact\n\n # tag the number of primes found\n scope.span.set_tag(\"primes.count\", primes.count)\n end\n\n primes\nend",
"def primes (n)\n return (1..n).select { |x| x.prime? }\nend",
"def all_primes(number)\n primes = []\n (2...number).each do |num|\n if prime?(num)\n primes << num \n end\n end\n primes\nend",
"def primes(n)\n return (2..n).select {|x| factors(x).size() == 2}\nend",
"def primes(n)\n result = []\n i = 2\n while i <= n\n j=2\n prime = true\n while j<=i**0.5\n (prime = false) if i%j==0\n j += 1\n end\n (result << i) if prime\n i +=1\n end\n return result\nend",
"def get_primes(n)\n primes = [2]\n pp = 0\n i = 3\n while pp < n do\n if i%2 != 0\n counter = 0\n prime = 1\n while counter < primes.length do\n if (i%primes[counter] == 0)\n prime = 0\n break;\n end\n counter += 1\n end\n if prime == 1\n primes.push(i)\n pp +=1\n end\n end\n i+=1\n end\n return primes[n-1]\nend",
"def primes_upto(n)\n primes = (2..n).to_a\n\n primes.each do |prime|\n primes.keep_if { |x| x % prime != 0 || x == prime }\n end\n\n return primes\nend",
"def prime_number(n)\n res = []\n prime = Array.new(n + 1, true)\n (2..n).each do |x|\n num = x * x\n break if num > n\n\n if prime[x]\n (num..n).step(x).each do |multiples|\n prime[multiples] = false\n end\n end\n end\n \n (2..n).each do |primes|\n res << primes if prime[primes]\n end\n res\nend",
"def first_n_primes(n)\n\t return \"n must be an integer.\" unless n.is_a? Integer\n\t return \"n must be greater than 0.\" if (n<=0)\n\n prime_array||=[]\n\tprime = Prime.new\n\tn.times {prime_array << prime.next } \n\tprime_array\nend",
"def primes (n)\n return (1..n).select {| x | factors(x).length == 2}\nend",
"def primes()\n return [] if @number < 2\n # build Boolean array to use for sieve with buffer to align indices\n sieve_array = Array.new(2, false) + Array.new(@number-1, true)\n # perform Sieve of Eratosthenes eliminations\n (2..Math.sqrt(@number).to_i).each do |i|\n (i**2..@number).step(i) {|j| sieve_array[j] = false} if sieve_array[i] == true\n end\n # return numbers by corresponding index that are still true\n (2..@number).collect {|index| index if sieve_array[index] == true}.compact\n end",
"def primes (n)\r\n primes = Array.new(n) { |index| index+=1 }\r\n return primes.select { |x| factors(x).length == 2 }\r\nend",
"def primes(n) \n max = Math::sqrt(n).truncate\n (2..max).each {|val|\n if n % val == 0 then\n p val\n primes(n/val)\n return\n elsif val == max then\n p n\n return\n end\n }\nend",
"def get_primes limit\n\tnums = (1...limit).select { |n| n.prime? }\n\n\tp nums\nend",
"def primes(n)\nend",
"def collect_primes(number)\n \n sieve = [nil, nil] + (2 .. number).to_a\n \n (2 .. Math.sqrt(number)).each do |n|\n next unless sieve[n]\n (n*n).step(number, n) do |num|\n sieve[num] = nil\n end\n end\n \n primes = []\n sieve.each do |x|\n if x != nil\n primes << x\n end\n end\n return primes\nend",
"def getPrimes()\n oldlimit = $primelimit + 1\n $primelimit *= 2\n\n for i in oldlimit...$primelimit\n isPrime = true\n $primes.each do |p|\n if i % p == 0\n isPrime = false\n break\n end\n end\n if isPrime\n $primes << i\n end\n end\n\nend",
"def get_primes\n j = 0\n\n while j < @limit \n prime_number = is_prime\n if prime_number\n @prime_numbers.push(prime_number)\n j += 1\n end\n @count += 1\n end\n\n return @prime_numbers\n end",
"def primes\n range = (min..max).to_a\n primes = (min..max).to_a\n\n range.each do |mod|\n primes.delete_if do |num| \n composite?(num, mod) unless num == mod\n end\n range = primes\n end\n primes\n end",
"def primes_less_than(n)\n arr = []\n n-=1\n while n>1 do\n if is_prime?(n)\n arr << n\n end\n n-=1\n end\n arr.sort\nend",
"def nth_prime(n)\n primes = []\n x = 2\n while primes.size < n\n primes << x if (2..Math.sqrt(x)).all? {|i| x % i != 0 }\n x += 1\n end\n primes\nend",
"def primes\n\t\t# primes = []\n\t\t# primes << 2\n\t\tprimes = [2] # combined previous two lines\n\t\tx = 3\n\n\t\tloop do\n\t\t\tbreak if primes.length == @n_primes # End loop when desired number has been calculated\n\t\t# while primes.length < @n_primes # Alternative 1 to loop do, break\n\t\t# until primes.length == @n_primes # Alternative 2 to loop do, break\n\t\t\ty = 3\n\t\t\ty += 2 until x % y == 0 # Loop to test if x is divisible by any odd number below it, y\n\t\t\tprimes << x if x == y # If the (odd) number was not divisible by any (odd) below itself, it is a prime\n\t\t\tx += 2\n\t\tend\n\n\t\treturn primes\n\tend",
"def primes_to_n(n)\n (2..n).select { |num| is_prime?(num) }\nend",
"def distinct_primes(n)\n 2.step do |i|\n nums = []\n tuples = [] # Each element is a 2-tuple of [prime, factor]\n j = i\n n.times do \n nums << j\n tuples << j.prime_division \n j += 1\n end\n next unless digits_equal(tuples, n)\n return nums if distinct_factors(tuples)\n end\nend",
"def get_primes(limit)\n primes = []\n (2...limit).each do |number|\n primes << number if is_prime?(number)\n end\n primes\nend",
"def find_primes(n)\n # use the Sieve of Eratosthenes method\n # http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes\n\n # 1. \"create a list of consecutive integers from 2 to n\"\n # an empty hash will do\n sieve = {}\n\n # 2. \"initially, let p equal 2, the first prime number\"\n p = 2\n\n while true\n # 3. \"starting from p, count up in increments of p and mark each of these numbers \n # greater than p itself in the list.\"\n # optimization: can start from p*p\n i = p * p\n while i <= n\n sieve[i] = true\n i += p\n end\n\n # 4. \"find the number greater than p in the list that is not marked. if there was no such\n # number, stop. otherwise, let p now equal this number (which is the next prime) and repeat\n # from step 3.\"\n old_p = p\n new_p = nil\n for i in (old_p + 1)..n\n if not sieve[i]\n new_p = i\n break\n end\n end\n if not new_p\n break\n end\n p = new_p\n end\n\n # everything not marked is prime.\n primes = []\n for i in 2..n\n if not sieve[i]\n primes.push(i)\n end\n end\n\n primes\nend",
"def primeSieve(n)\n s = (0..n).to_a\n s[0] = s[1] = nil\n s.each do |p|\n next unless p\n break if p * p > n\n (p*p).step(n, p) { |m| s[m] = nil }\n end\n s.compact\n end",
"def sieve1(n)\n\tprimes = []\n\ta = Array.new(n, true)\n\t2.step(Math.sqrt(n).to_i) do |i|\n\t\tif a[i]\n\t\t\tprimes.push(i)\n\t\t\t\n\t\t\ti.step(n-1, i) do |k|\n\t\t\t\ta[k] = false\n\t\t\tend\n\t\tend\n\tend\n\n\tMath.sqrt(n).to_i.step(n-1) do |i|\n\t\tif a[i]\n\t\t\tprimes.push(i)\n\t\tend\n\tend\n\n\treturn primes\nend",
"def eratosthenes(n)\n a = Array.new(n)\n a.each_index do |i|\n a[i] = {i: i, prime: true}\n end\n (2..Math.sqrt(n)).each do |i|\n if a[i][:prime] == true\n j = i * i\n while j < n\n a[j][:prime] = false\n j += i\n end\n end\n end\n a.select {|h| h[:prime] == true}\nend",
"def sieve_of_erastothenes3(n)\n primes = (0..n).to_a\n\n (2..n).each do |number|\n if primes[number]\n multiples(number, n).each do |multiple|\n primes[multiple] = nil\n end\n end\n end\n\n primes.compact.select { |num| num > 1 }\nend",
"def get_primes num\n primes = []\n for i in 0 ... num do\n if check_prime?(i) == true\n primes.push(i)\n end\n end\n p primes\nend",
"def primes_below(n)\n a = 2\n output_array = []\n while a < n\n if is_prime?(a)\n output_array.push(a)\n end\n a = a + 1\n end\n return output_array\nend",
"def prime(n)\n return 2 if n == 1\n return 3 if n == 2\n primes = [2,3]\n (3..n).each do \n last = primes.last\n a = last + 2\n prime = false\n while prime == false\n prime = true\n primes.each do |p|\n if a % p == 0\n a = a + 1\n prime = false\n break\n end\n end\n end\n primes << a\n end\n primes.last\n end",
"def primes_up_to(num)\n\n\tcross_limit = Math.sqrt(num).floor\n\n\t# create a new array with num number of elements, each set as true\n\tprime_bools = Array.new(num, true)\n\n\tprime_bools.each_with_index do |is_prime, i|\n\t\t# we can stop once our steps are at the square root of the limit\n\t\tbreak if i >= cross_limit\n\n\t\t# skip first step (0+0+1 steps over everything) and\n\t\t# non-prime steps, as they're redundant\n\t\tnext if i == 0 || !is_prime\n\n\t\t# set each bool we step over to false, starting at i+i+1, which\n\t\t# ensures we keep the first primes true \n\t\t(i+i+1 .. num).step(i+1) { |i| prime_bools[i] = false }\n\t\t# puts \"removed #{i+1}s #{prime_bools.each_index.select { |i| prime_bools[i] }.map { |j| j+1 }.drop(1)}\"\n\tend\n\n\t# select all the remaining trues from prime_bools\n\tprime_bools = prime_bools.each_index.select { |i| prime_bools[i] }\n\n\t# map the prime_bools to their index/number and drop the 1 (not a prime)\n\tprimes = prime_bools.map { |i| i+1 }.drop(1)\n\nend",
"def primeNumber(n)\n\tall = [0, 0] + (2..12*n).to_a\n\t(2..Math.sqrt(12*n).to_i).to_a.each do |i|\n\t\t(i**2..12*n).step(i) { |nonprime| all[nonprime] = 0 } if all[i].nonzero?\n\tend\n\tprime_list = all.find_all { |candidate| candidate.nonzero? }\n\tprime_list[n-1]\nend",
"def primes\n Prime::EratosthenesGenerator.new.take_while {|i| i <= @base}\n end",
"def sieve2(n)\n\tprimes = []\n\ta = Array.new(n, true)\n\t2.step(n-1) do |i|\n\t\tif a[i]\n\t\t\tprimes.push(i)\n\t\t\t\n\t\t\ti.step(n-1, i) do |k|\n\t\t\t\ta[k] = false\n\t\t\tend\n\t\tend\n\tend\n\n\treturn primes\nend",
"def first_n_primes(n)\n\n \"n must be an integer.\" unless n.is_a? Integer\n\n \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times { prime_array << prime.next }\nend",
"def prime_list(number_of_primes)\n return [] if number_of_primes < 1\n prime_numbers = Array.new\n for num in 2..9999999 do\n if is_prime_num(num, prime_numbers)\n prime_numbers.push(num)\n break if prime_numbers.length == number_of_primes\n end\n end\n return prime_numbers\n end",
"def first_n_primes(n)\n\n return \"n must be an integer.\" unless n.is_a? Integer\n return \"n must be greater than 0.\" if n <= 0\n \n prime_array ||= []\n \n prime = Prime.new\n n.times {\n prime_array << prime.next \n }\n prime_array\nend",
"def first_n_primes(n)\n\n unless n.is_a? Integer\n return \"n must be an integer.\"\n end\n\n if n <= 0\n return \"n must be greater than 0.\"\n end\n \n prime_array = [] if prime_array.nil?\n \n prime = Prime.new\n for num in (1..n)\n prime_array.push(prime.next)\n end\n return prime_array\nend",
"def approx_primes_in_range( n )\n\n end",
"def primes_less_than(num)\n res = []\n (2...num).each do |i|\n res.push(i) if is_prime?(i) == true\n end\n res\nend",
"def pretentious_primes(a, n)\n a.map do |ele|\n if n > 0\n nth_prime_greater_than(ele, n)\n else\n primes = primes_upto(ele-1)\n primes[n]\n end\n end\nend",
"def primes_less_than number\n ps = (2..number).each\n primes_so_far = []\n enum = Enumerator.new do |y|\n loop do\n p = ps.next\n non_prime = false\n\n p_root = (p**0.5).floor\n # Filter for primes using an inverted version of the sieve of\n # Eratosthenes--a number is prime if it's not divisible by the primes\n # less than it's square root.\n primes_so_far.each {|prime|\n if prime > p_root\n # if p has no divisors in primes_so_far less than p^0.5\n # then p must be prime\n break\n elsif p % prime == 0\n # the current p is not prime\n non_prime = true\n break\n end\n }\n\n unless non_prime\n primes_so_far.push p\n y.yield p\n end\n end\n end\n\n enum.to_a\n\nend",
"def prime(n)\n primes = (0..n).to_a\n primes[0] = nil\n primes[1] = nil\n\n primes.each do |current_num|\n next if current_num.nil?\n break if current_num > Math.sqrt(n)\n (current_num**2).step(n, current_num) { |current_interval| primes[current_interval] = nil }\n end\n\n primes.compact\nend",
"def primes\n return [] if self == 0\n return \"don't do that\" if self < 0\n list = [2]\n test = 3\n until list.length == self\n list << test if test.is_prime?\n test += 2\n end\n list\n end",
"def eratosthenes_sieve(nth_prime)\n top = nth_prime * 10\n # this is really kludgy, you might have to increase 10 if you want\n # nth primes above 10k. It seems to work fine for all numbers under\n # 10k. I need to read up on prime number theory to find out when this fails.\n sieve = []\n (2..top).each { |i| sieve[i] = i }\n for i in 2 .. Math.sqrt(top)\n next unless sieve[i]\n (i*i).step(top, i) do |j|\n sieve[j] = nil\n end\n end\n sieve.compact[nth_prime]\nend",
"def pretentious_primes(arr, n)\n pretentious_primes = []\n\n if n > 0\n arr.each do |x|\n primes = []\n i = (x + 1)\n while primes.length <= n\n primes << i if prime?(i)\n i +=1\n end\n pretentious_primes << primes[n-1]\n end\n elsif n < 0\n arr.each do |x|\n primes = []\n i = (x - 1)\n while primes.length <= -n\n if i <= 1\n primes << nil\n else\n primes << i if prime?(i)\n end\n i -=1\n end\n pretentious_primes << primes[(-n)-1]\n end\n else\n pretentious_primes = arr\n end\n pretentious_primes\nend",
"def primes(num)\n\twhole_array = (2..num).to_a\n\tprime_array = [whole_array.shift]\n\n\tuntil whole_array == []\n\t\twhole_array.delete_if { |x| x % prime_array.last == 0 }\n\t\tprime_array << whole_array.shift\n\tend\n\tprime_array\nend",
"def bc_get_prime_numbers(size)\n n = 1\n primes = []\n notprime = Hash.new\n\n until primes.size > size do\n\n n+=1\n\n # if I am known not prime, continue\n if notprime[n] then next end\n\n # check to see if I'm prime (abort instantly on finding divisor)\n (2..Math.sqrt(n)+1).each{|i| print \"Checking #{n} vs #{i}\\n\"; if n%i==0 then notprime[n]=1; print \"NOT A PRIME!\\n\"; next; end}\n\n # I'm prime, so add me to array + mark my multiples as being not\n # prime, but the fewer primes I need to get, the fewer multiples I\n # mark\n\n primes.push(n)\n (2..(size-primes.size())).each{|i| notprime[i*n] = 1}\n end\n primes\nend",
"def count_primes(n)\n mark = [false] * (n + 1)\n counter = 0\n for i in 2...n\n next if mark[i] == true\n counter += 1\n (i * i).step n, i do |j| mark[j] = true end\n end\n counter\nend",
"def sieve(n) # quickly makes array of all primes from 2 to n\n s = 3.step(n, 2).to_a # make array of odd integers from 3 to n. Skip evens. \n s.each do |p|\n next if p.nil? # go to next element if p has been marked empty\n break if p * p > n # p only needs to go up to sqrt(n)\n\n k, pval = 0, 0\n\n while pval < n\n pval = p * (p + k) # jump forward 2p at a time: p*p, p*p + 2p, p*p + 4p, etc.\n\n # Set all those multiples to nil. i = (pval - 3)/2 translates pvals to index i\n\n s[(pval - 3) / 2] = nil \n k += 2 \n end\n\n end\n s.compact! # removes all nil elements from array\n s.unshift(2).sort # adds 2 as 1st element\nend",
"def primes_less_than(num)\n arr = []\n (2...num).each do |el|\n if is_prime?(el)\n arr << el\n end\n end\n arr\nend",
"def prime_sieve(limit)\n \n limitn = limit+1\n primes = []\n \n # Fill in prime truth table\n for i in 0..limitn do\n primes[i] = true\n end\n \n primes[0] = false\n primes[1] = false\n \n primes.each_with_index{|prime,i|\n unless i < 2\n range = Range.new(i*i,limitn)\n range.step(i) {|index| primes[index] = false}\n end\n }\n \n true_primes = []\n primes.each_with_index{|value,i|\n true_primes << i if value == true\n }\n \n return true_primes\n \nend",
"def first_n_primes(n)\n\n #unless n.is_a? Integer\n # return \"n must be an integer.\"\n #end\n return \"n must be an integer.\" unless n.is_a? Integer\n\n #if n <= 0\n # return \"n must be greater than 0.\"\n #end\n return \"n must be greater than 0.\" if n <= 0\n \n #prime_array = [] if prime_array.nil?\n prime_array ||= []\n \n prime = Prime.new\n #for num in (1..n)\n # prime_array.push(prime.next)\n #end\n # n.times { prime_array.push(prime.next) }\n n.times { prime_array << prime.next }\n \n #return prime_array\n prime_array # implicit return!\n\nend",
"def circular_primes(n)\n circular_primes = Set.new\n Prime.each(n) do |prime|\n circular = true\n rotations = prime.to_s.length - 1\n digits = prime.to_s.chars.map(&:to_i)\n rotations.times do # For an n-digit number, there are n-1 rotations.\n digits << digits.shift # 'Rotate' the digits. Ex: 197 -> 971\n circular = false unless digits.reduce { |ac, i| ac*10 + i }.prime?\n end\n circular_primes << prime if circular\n end\n return circular_primes\nend",
"def primes\n return [] if max_prime < 2\n\n candidates.each do |prime,_|\n # skip numbers we already know NOT to be prime (from previous iterations)\n next if candidates[prime] != :prime\n\n # find the prime number candidates greater than the current prime number\n candidates.select { |n,_| candidates[n].eql?(:prime) && n > prime }\n .each do |num,_|\n # mark numbers evenly divisible by the current prime as NOT PRIME\n @candidates[num] = :not_prime if (num % prime) == 0\n end\n end\n\n # convert numbers still marked as prime to an array of numbers\n candidates.map { |num,value| num if value.eql? :prime }.compact\n end",
"def primes_less_than(num)\n\toutput = []\n\t(2...num).each do |n|\n\t\toutput << n if is_prime?(n)\n\tend\n\toutput\nend",
"def prime_numbers\n s = (0..self).to_a\n s[0] = s[1] = nil\n s.each do |p|\n next unless p\n break if p * p > self\n (p*p).step(self, p) { |m| s[m] = nil }\n end\n s.compact\n end",
"def pretentious_primes(arr, n) \n arr.map { |ele| nth_prime(ele,n) }\nend",
"def specific_prime(n)\n\na = (2..n) # list of integers 2 through \nprimes = Array.new\n\nprimes = a.select { |x| (2..Math.sqrt(x)).none? { |d| (x % d).zero? }}\n\nputs primes[10000]\n# answer => 104,743\n\nend",
"def primes\n Enumerator.new do |y|\n result = 0\n n = 3\n loop do\n candidates = (0..n).to_a\n candidates[0] = candidates[1] = nil\n candidates.each do |c|\n next unless c\n break if c * c > n\n (c*c).step(n, c){|m| candidates[m] = nil}\n end\n candidates.compact!\n if candidates[-1] != result\n y.yield candidates[-1]\n result = candidates[-1]\n end\n n+=1\n end\n end\nend",
"def prime_sieve(n)\n\tarr = (0..n).to_a\n\tfor idx1 in 2..n\n\t\tnext if arr[idx1] == nil\n\t\tidx2 = idx1 ** 2\n\t\twhile idx2 < n\n\t\t\tarr[idx2] = nil\n\t\t\tidx2 += idx1\n\t\tend\n\tend\n\tarr.compact[2..-2]\nend",
"def prime_sieve(n)\n\tarr = (0..n).to_a\n\tfor idx1 in 2..n\n\t\tnext if arr[idx1] == nil\n\t\tidx2 = idx1 ** 2\n\t\twhile idx2 < n\n\t\t\tarr[idx2] = nil\n\t\t\tidx2 += idx1\n\t\tend\n\tend\n\tarr.compact[2..-2]\nend",
"def eratosthenes_sieve(max_number)\n numbers = (0..max_number+1).to_a\n bound = Math.sqrt(max_number).to_i\n\n (2..bound+1).each do |current|\n if numbers[current]\n (current+current..max_number+1).step(current).each do |j| numbers[j] = nil end\n end\n end\n\n return numbers.compact![2..-1]\nend",
"def find_primes\n canidates = (0..@max_num).to_a\n k=2\n while(k<= canidates.size/2)\n j=2\n while(j<= canidates.size/2)\n prod = k*j\n if prod <= @max_num\n canidates[prod] = nil\n end\n j+=1\n end\n k+=1\n end\n res = canidates.compact\n res.shift(2)\n res\n end",
"def primes_up_to(max)\n repository = (0..max).collect{true} #=> Create flag array\n limit = (max ** 0.5) #=> establish search limit\n\n for index in 2..limit #=> search through flag aray\n next if !repository[index]\n num = (index * 2)\n while num <= max #=> unflag multiples of primes\n repository[num] = false\n num += index\n end\n end\n\n # => convert numbers into arrays\n primes = repository.collect.with_index do |flag, value|\n value if flag\n end\n\n # return cleaned array\n primes.shift\n primes.shift\n primes.compact\nend",
"def prime_numbers(range)\n ar = range.to_a\n ar2 = [nil, nil] + [true] * ar.size\n\n i = 2\n while i <= Math.sqrt(ar.max).to_i\n if ar2[i]\n z = i * i\n while z <= ar.max\n ar2[z] = false\n z += i\n end\n end\n i += 1\n end\n ar.delete_if { |e| ar2[e] == nil || ar2[e] == false }\nend",
"def sieve(n)\n (primes = [*2..n]).each do |k|\n next unless k\n (k*k..n).step(k) { |m| primes[m-2] = nil }\n end\n\n primes.compact\nend",
"def sieve(n)\n table = [false, false] + [true]* (n-1) \n # [0(not prime), 1(not prime), 2 (not sure yet)..]\n for i in (1..n)\n if table[i]\n upto = n/i\n for j in (i..upto)\n table[i*j] = false\n end\n end\n end # I don't like all the end-s written down like this.\n\n # now making a list of primes out of those trues and falses. \n list_of_primes = []\n for i in (1..n)\n if table[i]\n list_of_primes.push(i)\n end\n end \n\n return list_of_primes\nend",
"def eratosthenes(n)\n\tp_set = (3..n).step(2).to_a\n\tp = 3\n\ti = 0\n\twhile p && p ** 2 <= n \n\t\tD 'set is...'\n\t\tD p_set.inspect\n\n\t\tc = 2\n\n\t\twhile (mul = p * c) <= n \n\t\t\tD \"value is #{mul}, value position #{mul/2-1}\"\n\t\t\tD \"value setting to nil #{p_set[mul/2-1]}\"\n\t\t\tif mul.odd?\n\t\t\t\tp_set[mul/2 - 1] = nil\n\t\t\tend\n\t\t\tc += 1\n\t\tend\n\n\t\tD 'picking next p..'\n\t\ti += 1\n\t\t\n\t\twhile p_set[i].nil? && i < n\n\t\t\ti += 1 \n\t\t\tD \"Start index #{i}\"\n\t\t\tD p_set.inspect\n\t\tend\n\n\t\tif i < n\n\t\t\tp = p_set[i]\n\t\t\tD \"next p is #{p}\"\n\t\telse\n\t\t\tD \"finish\"\n\t\t\tbreak\n\t\tend\n\tend\n\n\tI p_set.compact.join(',')\n\tputs p_set.compact.size\n\t# + 1 because 2 was excluded\nend",
"def nth_prime(n)\n nums = (0..10000).to_a\n result = []\n\n nums.each do |i| \n if prime?(i) == true\n result.push(i)\n end\n end\n\n\n return result[n]\nend",
"def nth_prime(n)\n result = []\n i = 2\n while result.length < n\n result << i if is_prime?(i)\n i += 1\n end\n result[-1]\nend",
"def mersenne_prime(n)\n mprimes = []\n\n i = 3\n while mprimes.count < n\n if prime? i\n mprimes << i if mersenne? i\n end\n i += 1\n end\n\n mprimes[-1]\nend",
"def count_primes(n)\n primes = (0..n).to_a\n primes[0] = nil\n primes[1] = nil\n\n primes.each do |current_num|\n next if current_num == nil\n break if current_num > Math.sqrt(n)\n (current_num**2).step(n, current_num) { |interval| primes[interval] = nil }\n end\n\n primes.compact.take_while { |num| num < n }.size\nend",
"def prime_numbers(limit = 1_000_000)\n all_numbers = Hash[(2..limit).map { |v| [v, 0] }]\n\n border = Math.sqrt(limit).to_i\n\n next_prime = 1\n while next_prime < border\n next_prime = all_numbers.find { |_, v| v.zero? }[0]\n\n all_numbers[next_prime] = -1\n\n all_numbers.each do |key, value|\n all_numbers.delete key if value.zero? && (key % next_prime).zero?\n end\n end\n all_numbers.keys\nend",
"def [](n)\n # TODO: handle negative +n+ properly\n succ until n < @primes.size\n @primes[n]\n end",
"def find_prime_numbers(num)\n\tarr =[]\n (2..num).each{|x| arr.push(x)}\n\n i = 0\n p = arr[i]\n\n while p != arr[-1]\n\t arr.delete_if{|n| n%p == 0 && n != p}\n\t i+= 1\n\t p = arr[i]\n end\n return arr\nend",
"def pretentious_primes(arr, n)\n arr.map { |num| replace_with_prime(num, n) }\nend",
"def p10\n\tprimes = []\n\tPrime.each do |prime|\n\t\tbreak if prime >= 2000000\n\t\tprimes << prime\n\tend\n\t# puts primes\n\tprimes.reduce(:+)\nend",
"def prime_series\n t = self\n limit = Math.sqrt(t)\n a = (2..t).to_a\n n = 2\n while (n < limit) do\n x = n*2\n begin\n a[x-2]=2\n x+=n\n end until (x > t )\n begin\n n+=1\n end until ( a[n-2] != 2 )\n end\n a.uniq!\n end",
"def prime(n)\n\tif $primes[n] then\n\t\t$primes[n]\n\telse\n while n - $primes.length > 100\n prime (n + $primes.length) / 2\n end\n\t\tc = prime(n-1) + 2\n\t\ti = 1\n\t\twhile $primes[i]**2 <= c\n\t\t\tif c % $primes[i] == 0\n\t\t\t\tc += 2\n\t\t\t\ti = 1\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\t$primes[n] = c\n\tend\nend",
"def eratosthenes(n)\n a = Hash.new\n 2.upto(n) do |i|\n a[i] = true\n end\n 2.upto(Math.sqrt(n)) do |i|\n if a[i]\n x = 0\n loop do\n j = i * i + x * i\n break if j > n\n a[j] = false\n x = x + 1\n end\n end\n end\n a.select{|k,v| k if v}.keys\nend",
"def primes_from_2( x )\n # primes have no factors except for 1 and self\n primes = [ 2 ]\n i = 2\n while primes.size < x\n i += 1\n is_prime = true\n primes.each do |p|\n #( 2..( i ** 0.5 ).floor ).each do |p|\n #break if p > ( i / 2 )\n break if p > ( i ** 0.5 )\n if 0 == ( i % p )\n is_prime = false\n break\n end\n end # p\n primes << i if is_prime\n i += 1 # skip the next integer (it's even)\n end # while\n return primes[ -1 ]\nend",
"def compute_primes\n nums = (@max_checked..@max_checked * 2).map { |x| x.odd? ? x : nil }.to_a\n 1.upto(@primes.index { |p| p * p > @max_checked * 2 }) do |i|\n start_idx = -@max_checked % @primes[i] # prime[i]'s 1st multiple's index\n\n (start_idx..nums.size).step(@primes[i]) { |x| nums[x] = nil }\n end\n @max_checked *= 2\n @primes += nums.compact\n end",
"def prime (n)\n\n\t#create an Array\n\tprime_num = []\n\n\tfor num in (2..n)\n\t\tis_prime = factors(num)\n\t\tif (is_prime.length ==2)\n\t\t\tprime_num.push(num)\n\t\tend\n\tend\n\treturn prime_num\nend",
"def prime(number)\n prime_numbers = []\n (2..number).each do |current_number|\n if is_prime? current_number\n prime_numbers << current_number\n end\n end\n return prime_numbers\nend",
"def primes_less_than n4\n prhyme = []\n (2..(n4-1)).each do |i|\n if is_prime?(i)\n prhyme.push(i)\n end\n end\n return prhyme\n end",
"def nth_prime(n)\n\n arry_prime = []\n value = 2\n\n while arry_prime.size < n\n if is_prime?(value)\n arry_prime << value\n end\n value += 1\n end\n arry_prime[-1]\nend",
"def print_prime\n @n_primes = get_n_primes\n return [] if @n_primes == 0\n p_arr_len = @prime_numbers.length\n return @prime_numbers[0..@n_primes] if p_arr_len >= @n_primes\n (p_arr_len > 1) ? (n = @prime_numbers.last) : (n = 3)\n until @prime_numbers.length == @n_primes do\n @prime_numbers.push(n) if @prime_cache[n]\n (@prime_numbers.push(n) && @prime_cache[n] = true) if is_prime(n)\n n += 1\n end\n @prime_numbers\n end",
"def pick_primes(numbers)\n\tprimes = []\n \tnumbers.each do |num| \n \tif isPrime(num) \n \tprimes.push(num)\n end\n end\n \treturn primes\nend",
"def eratosthenes(n)\r\n array = Array.new((n), true);\r\n index = 2\r\n primes_sum = 0\r\n\r\n until index >= n\r\n j = 0\r\n if array[index]\r\n ((index*2)..(n)).step(index+j) do |j|\r\n array[j] = false;\r\n end\r\n primes_sum += index\r\n end\r\n index += 1\r\n end\r\n primes_sum\r\nend",
"def primes_upto( xmax )\n # primes have no factors except for 1 and self\n primes = [ 2 ]\n ( 3..xmax ).each do |i|\n puts i if 0 == ( i % 1000 )\n is_prime = true\n primes.each do |p|\n break if p > ( i / 2 )\n if 0 == ( i % p )\n is_prime = false\n break\n end\n end # p\n primes << i if is_prime\n end # i\n return primes\nend"
] |
[
"0.7922111",
"0.7906795",
"0.7886934",
"0.78534544",
"0.7810002",
"0.76985395",
"0.76866746",
"0.7658129",
"0.7637938",
"0.76033574",
"0.7594692",
"0.7573855",
"0.75184184",
"0.7511612",
"0.75033766",
"0.7495162",
"0.7492114",
"0.74821246",
"0.74722934",
"0.74686134",
"0.74513006",
"0.7438075",
"0.74166673",
"0.74086106",
"0.7405573",
"0.7403271",
"0.7394035",
"0.7374859",
"0.73311496",
"0.7308475",
"0.7305915",
"0.72858655",
"0.7266516",
"0.72663724",
"0.7232977",
"0.7230168",
"0.71852076",
"0.7183496",
"0.71819484",
"0.71758735",
"0.7171005",
"0.71589524",
"0.71490115",
"0.7146912",
"0.713066",
"0.7130449",
"0.71277744",
"0.71211004",
"0.7102269",
"0.7098849",
"0.7088013",
"0.70704323",
"0.7068809",
"0.70464426",
"0.7043503",
"0.70419735",
"0.7039437",
"0.7037904",
"0.70298624",
"0.7024403",
"0.70215154",
"0.7006375",
"0.6996979",
"0.6996835",
"0.6978693",
"0.6975785",
"0.69651884",
"0.6963236",
"0.6937765",
"0.6934088",
"0.6934088",
"0.69236124",
"0.6922062",
"0.69101065",
"0.69045687",
"0.6901813",
"0.68804973",
"0.68761355",
"0.68728817",
"0.68659574",
"0.68626076",
"0.6861422",
"0.6857055",
"0.6853628",
"0.68460697",
"0.6841682",
"0.6836241",
"0.6834728",
"0.6833114",
"0.68212914",
"0.68159574",
"0.6814488",
"0.6813423",
"0.6809265",
"0.6803763",
"0.6786547",
"0.6786228",
"0.6785373",
"0.6780244",
"0.6769224"
] |
0.7414597
|
23
|
Don't run it until you've attempted to answer.
|
def meal
return 'Breakfast'
'Dinner'
puts 'Dinner'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ask(question)\n while true\n\n ### Fill in with your code ###\n\n end\nend",
"def serve_dish\n puts \"You've added all ingredients in the correct way, well done!\"\n puts \"You can now enjoy your meal!\"\n puts \"Good bye!!\"\n sleep 2\n puts \"Do you want to try my other programme?\"\n puts \"Yes, no or restart\"\n answer = gets.chomp.downcase\n if answer.include? \"yes\"\n puts \"Welcome to Oracle\"\n question\n elsif answer.include? \"restart\"\n count = 0\n what_to_do(count)\n else\n exit\n end\nend",
"def ASK question\n while true\n puts question\n reply = gets.chomp.downcase\n if reply == \"yes\"\n return true\n end\n if reply == \"no\"\n return false\n end\n puts \"Please answer yes or no !\"\n end\nend",
"def run\n puts \"------------------ NEW TURN ------------------\"\n ask_question\n get_answer\n validate_answer\n end",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n return true if reply == 'yes'\n return false if reply == 'no'\n puts 'Please answer \"yes\" or \"no\".'\n end\nend",
"def program_loop\n while(input = ask_user) do\n \tif input == \"quit\"\n save_and_quit\n \telsif input == \"Add a response\"\n \t\tadd_response\n \telse\n \t bot_response(\"#{get_response(input)}\")\n end\n end\nend",
"def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true \t\t\t #I like to state return values explictly\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\"'\n\t\tend\n\tend\nend",
"def ask question\n\twhile true\n\tputs question\n\treply = gets.chomp.downcase\n\tif reply == 'yes'\n\t\treturn true\n\tend\n\tif reply == 'no'\n\t\treturn false\n\tend\n\tputs 'Please answer \"yes\" or \"no\".'\n\tend\nend",
"def proceed!; end",
"def proceed!; 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 ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\t\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\tend\n\n\t\t if reply == 'no'\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\tend\nend",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n\n answer\nend",
"def ask questions\n\twhile true\n\t\tputs questions\n\t\treply = gets.chomp.downcase\n\t\tif reply == \"yes\"\n\t\t\treturn true\n\t\tend\n\t\tif reply == \"no\"\n\t\t\treturn false\n\t\tend\n\t\tputs \"plans answer with yes or no\"\n\tend\nend",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n \n answer # This is what we return (true or false).\nend",
"def ask question\r\n\twhile true\r\n\t\tputs question\r\n\t\treply = gets.chomp.downcase\r\n\t\tif reply == 'yes'\r\n\t\t\t\treturn true\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\tif reply == 'no'\r\n\t\t\t\treturn false\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\t#else - I had an \"else\" in here, which doesn't belong. Need to remove and just 'Puts' if neither of the two above are included.\r\n\r\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\r\n\t\tend\r\n\t\r\nend",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer by either \"yes\" or \"no\".'\n end\n end\n\n answer # this is what we return (true or false)\nend",
"def done?; true end",
"def q\r\n @_done = true\r\n puts\r\n \"Bye bye for now!\"\r\n end",
"def ask\n end",
"def wait_for_answer(opts = {})\n receive_trying({optional: true}.merge opts)\n receive_ringing({optional: true}.merge opts)\n receive_progress({optional: true}.merge opts)\n receive_answer opts\n end",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply || 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\n\tanswer #this is what is returned\nend",
"def will_answer?\n return true\n end",
"def ask_the_question(question, valid_response)\n loop do\n answer = ask(question + \"? [Y/N] \") { |yn| yn.limit = 1, yn.validate = /[yn]/i }\n return answer if answer.downcase == valid_response.downcase || valid_response == ''\n end\nend",
"def ask_if_animal_lover\n puts \"Yes or no: are you an animal lover?\"\n animal_lover_response = gets.chomp\n downcase_animal_lover_response = animal_lover_response.downcase\n\n if downcase_animal_lover_response == \"no\"\n puts \"Maybe there are better things you could be doing? Bye!\"\n exit!()\n elsif downcase_animal_lover_response == \"yes\"\n downcase_animal_lover_response\n else\n puts \"Please answer with 'yes' or 'no'.\"\n sleep(0.5)\n ask_if_animal_lover()\n end\nend",
"def try_again\n puts \"Would you like to try again? \"\n response = gets\n response = response.chomp.upcase\n \n if @yes_options.include?(response)\n find_name\n elsif @no_options.include?(response)\n puts \"Thank you for your time.\"\n else\n puts \"I did not understand your response.\"\n try_again\n end \n end",
"def run_guessing_game\n\n player_guess = ''\n\n until player_guess == 'exit'\n welcome\n player_guess = get_player_guess\n check_guess(player_guess)\n end\nend",
"def ask_user\n\tmessages = [\"You will get it!\", \"Sorry it won't happen\", \"You bet\", \"No way\", \"Maybe\", \"It depends on you\", \"I believe in you\", \"The odds are against you\"]\n\tquestion = puts \"This is magic 8-Ball. Do you want to shake the eight ball? Y/N\"\n\tuser_response = gets.chomp.capitalize\n\twhile(true)\n\t\tif user_response == \"Y\" || user_response == \"Yes\"\n\t\t\tputs messages[rand(0..7)]\n\t\t\task_user\n\t\t\tbreak\n\t\telsif user_response == \"N\" || user_response == \"No\"\n\t\t\tputs \"Bye!\"\n\t\t\tbreak\n\t\telse\n\t puts \"Type Y/N please\"\n\t ask_user\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def ask_question\n\n end",
"def result\n system(\"clear\")\n puts \"##############################\"\n puts \"# Congratulations #{@@name}! \" \n puts \"# #\"\n puts \"# You got #{@count} answers correct! #\"\n puts \"# #\"\n puts \"# Check the leaderboard #\"\n puts \"# to see if you made #\"\n puts \"# the top 10! #\"\n puts \"# #\"\n puts \"##############################\"\n any_key\n send_to_leaderboard\n send_to_file\n end",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == \"yes\" || reply == \"no\")\n\t\t\tif reply == \"yes\"\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"Please answer 'yes' or 'no'.\"\n\t\tend\n\tend\n\n\tanswer # this will return (true or false).\nend",
"def ask_again\n\n end",
"def run\n\n while @players[0].lives > 0 && @players[1].lives > 0\n puts \"Player 1: #{@players[0].lives}/3 vs Player 2: #{@players[1].lives}/3\"\n \n question = Question.new(@players[@current_player].name)\n response = question.get_answer\n if response == false\n @players[@current_player].bad_answer\n end \n change_player\n end\n puts \"#{@players[@current_player].name} you lost.\"\n\n end",
"def infinite_loop?; end",
"def test\n\t\t#load a QA pair into current\n\t\t@qa_pairs = @qa_pairs.shuffle\n\t\ttemp = @qa_pairs.pop\n\t\t@current_question = temp[0]\n\t\t@current_answer = temp[1]\n\t\t#ask question\n\t\tputs \"Question: #{@current_question[0]}\"\n\t\t#prompt and assess guess\n\t\tis_correct = false\n\t\twhile is_correct == false do\n\t\t\tguess = []\n\t\t\tputs \"Please type your answer:\"\n\t\t\tguess << gets.chomp\n\t\t\tif guess[0] == \"EXIT\"\n\t\t\t\t@shutdown = true\n\t\t\t\tputs @shutdown_msg\n\t\t\t\tis_correct = true\n\t\t\telsif guess[0] == \"SKIP\"\n\t\t\t\t@qa_pairs << temp\n\t\t\t\tputs @skip_msg\n\t\t\t\tis_correct = true\n\t\t\telsif self.assess(guess)\n\t\t\t\tputs @correct_msg\n\t\t\t\tis_correct = true\n\t\t\telse\n\t\t\t\tputs @incorrect_msg\n\t\t\t\tputs \"...\"\n\t\t\tend\n\t\tend\n\t\tputs \"--------------------\"\n\t\treturn nil\n\tend",
"def done?; end",
"def wait_for_prompt\n while !@prompted do\n sleep(0.2)\n end\n end",
"def ask_questions\n until game_over?\n ask_question\n end\n end",
"def endless_loop?; end",
"def player_response\n\n if compare_answer\n return puts \"#{@current_asker.name}: YES! You are correct.\"\n end\n\n puts \"#{@current_asker.name}: Seriously? No!\"\n\n end",
"def play\n puts \"Let's play 'Bulls and Cows'! (if you are stuck enter 'resign' or 'quit')\"\n loop do \n prompt()\n @user_try = gets.chomp()\n if @user_try == 'resign'\n @result = :resign\n puts \"Number was #{@guess_num.join}\"\n break\n end\n if @user_try == 'quit'\n @result = :quit\n puts \"Number was #{@guess_num.join}\"\n break\n end\n @result = test() if correct?\n end\n return @result\n end",
"def ask()\n puts 'Do you like eating tacos? (y or n)'\n input = gets.chomp\n if input == 'y'\n print 'We can be friends!'\n return\n end\n if input == 'n'\n print 'Get out of my sight!'\n return\n end\n puts 'Try again'\n ask()\nend",
"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 first_answer( )\n @first_answer\n ensure\n @first_answer = nil\n end",
"def ask_again\n @answer = nil\n until @answer == \"NO\" || @answer == \"YES\"\n print \"Would you like to do another transaction? (YES/NO) \"\n @answer = gets.chomp.upcase\n if @answer == \"YES\"\n give_choices\n elsif @answer == \"NO\"\n puts \"Thank you for choosing E-Corp Bank.\"\n else\n puts \"Error, invalid input. Please try again.\"\n ask_again\n end\n end\n end",
"def waiting; end",
"def waiting; end",
"def ask(msg)\n request(\"#{msg} [yn] \") == 'y'\n end",
"def beetroot_initial\n runner = 2\n puts \".....................................\"\n puts \".......Beetroot! Great choice!!......\"\n puts \".....................................\"\n puts \"....My mother always told me that....\"\n puts \".all one needs in life is a beetroot.\"\n puts \".....................................\"\n puts \".....................................\"\n sleep(7)\n system(\"clear\")\n\n while runner == 2\n beetroot_option\n answer_two = gets.chomp.to_i\n if answer_two == 1\n system(\"clear\")\n beetroot_second_fire\n runner = 3\n elsif answer_two == 2\n system(\"clear\")\n beetroot_second_tree\n runner = 3\n else\n error_message\n end\n end\nend",
"def deffered(&block)\n progressbar.show\n thread = Thread.new do\n Thread.current[:result] = suppress { block.call }\n end\n\n loop do\n progressbar.increment\n break if thread.status === false\n\n if thread.status.nil?\n progressbar.erase_line\n say red { Manager.locale.error(self, 'execution_failed') }\n\n exit 102\n end\n\n sleep 0.3\n end\n\n case thread[:result]\n when Octokit::OneTimePasswordRequired\n progressbar.erase_line\n otp_interview\n\n return deffered(&block)\n when NilClass\n progressbar.erase_line\n say red { Manager.locale.error(self, 'empty_response') }\n\n exit 103\n when Exception\n progressbar.erase_line\n say red { thread[:result].message }\n\n exit 104\n else\n # no-op\n end\n\n thread[:result]\n end",
"def levitation_quiz\n loop do \n puts \"What is the spell that enacts levitation?\"\n answer = gets.chomp\n break if answer == \"Wingardium Leviosa\"\n end\n puts \"You passed the quiz!\"\n\t#your code here\nend",
"def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end",
"def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend",
"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 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 nextstep\n puts \"Input 't' to try again or 'q' to end program: \"\n try = gets.chomp\n\n if try == \"t\" \n run\n elsif try == \"q\"\n exit\n else\n puts \"Invalid response.\"\n nextstep\n end\nend",
"def get_response\r\n response = ''\r\n until response == 'yes' || response == 'no'\r\n puts \"please answer yes or no.\"\r\n response = gets.chomp\r\n end\r\n response\r\n end",
"def are_you_sure? # Define a method. Note question mark!\n while true # Loop until we explicitly return\n print \"Are you sure? [y/n]: \" # Ask the user a question\n response = gets # Get her answer\n case response # Begin case conditional\n when /^[yY]/ # If response begins with y or Y\n return true # Return true from the method\n when /^[nN]/, /^$/ # If response begins with n,N or is empty\n return false # Return false\n end\n end\nend",
"def retry_game\n user_retry = $prompt.select(\"Would you like to try again?\", [\"Yes\", \"No\"])\n puts user_retry\n if user_retry == \"Yes\"\n reset_vars\n start_app\n else\n puts \"Come back to fight another day...\"\n end\nend",
"def knife_initial\n runner = 2\n puts \".....................................\"\n puts \"Really a knife, thats pretty useless!\"\n puts \".....................................\"\n puts \"....Oh the handle has a name on it...\"\n puts \"..Jon...mmmm...maybe thats our name..\"\n puts \".....................................\"\n puts \".I should find something to us it on.\"\n puts \".....................................\"\n sleep(8)\n system(\"clear\")\n\n while runner == 2\n knife_option\n answer_two = gets.chomp.to_i\n if answer_two == 1\n system(\"clear\")\n knife_second_hair\n runner = 3\n elsif answer_two == 2\n system(\"clear\")\n knife_second_beard\n runner = 3\n else\n error_message\n end\n end\nend",
"def continue_browsing\n puts \"Would you like to keep learning more about COVID-19 spread?\".green\n user_input = gets.strip.downcase\n\n until user_input == \"yes\" || user_input == \"no\"\n puts \"I didn't understand that command.\".red\n puts \"Please enter YES or NO\".green\n user_input = gets.strip.downcase\n end\n\n user_input == \"yes\" ? program_run : sign_off\n end",
"def greet_again\n puts \"Hello!\"\n print \"Greet Again? (y/n)\"\n answer = gets.chomp\n case answer\n when \"n\"\n puts \"Ok, Goodbye!\"\n when \"y\"\n greet_again\n else\n \"Ok, Goodbye!\"\n end\nend",
"def what_to_do(count)\n puts \"What do you want to do?\"\n sleep 0.5\n puts \"Type help for available commands!\"\n answer = gets.chomp.downcase\n if answer.include? \"help\"\n help(count, answer)\n end\n if answer.include? \"scrape\" and count == 0\n scrape_potatoes(count)\n elsif answer.include? \"cut\" and count == 1\n cut_potatoes(count)\n elsif answer.include? \"add\" and count == 2 and answer.include? \"potatoes\"\n add_potatoes_to_pan(count)\n elsif answer.include? \"stir\" and count == 3\n stir(count)\n elsif answer.include? \"break\" and count == 4\n break_eggs(count)\n elsif answer.include? \"salt\" and count > 4\n add_salt(count)\n elsif answer.include? \"pepper\" and count > 4\n add_pepper(count)\n elsif answer.include? \"exit\"\n exit\n elsif answer.include? \"serve\" and count > 4\n serve_dish\n else\n puts \"Thats not the right order! Try again\"\n sleep 2\n try_again(count)\n end\nend",
"def answer_prompt(answer)\n\tputs \"The answer to your problem is: #{answer}\"\nend",
"def meets_challenge?\n true\n end",
"def prompt( ask = \"\" )\n answer = nil\n\n puts ask\n begin\n until %w( k ok y yes n no ).include?(answer = $stdin.gets.chomp.downcase)\n puts \"(psst... please type y or n)\"\n puts ask\n end\n rescue Interrupt\n return false\n end\n\n return false if answer =~ /n/\n\n return true\nend",
"def ask question\n while question != \" \"\n puts question\n reply = gets.chomp.downcase\n if reply == \"yes\"\n return true\n elsif reply == \"no\"\n return false\n end\n puts \"Please put 'yes' or 'no'.\"\n end\nend",
"def another_calculation?\n answer = ' '\n loop do\n prompt(MESSAGES['another_loan'])\n answer = Kernel.gets().chomp().downcase()\n if YES_ANSWERS.include?(answer)\n answer = 1\n break\n elsif NO_ANSWERS.include?(answer)\n answer = 2\n break\n else\n prompt(MESSAGES['exit_error'])\n end\n end\n answer\nend",
"def input(answer, tried_again)\n\n\tputs \"\\nGuess a number between 1 and 100 correctly.\"\n\tguess = gets.chomp.to_i\n\n\tif guess < 101 && guess > 0 \n\t\tprompt(guess, answer, tried_again)\n\telse\n\t\tputs \"The cowboy with wise old eyes sighs.. you lost your chance for free admission.\" \n\t\treturn false\n\tend\n\n\nend",
"def on_ask(ask)\r\n warn \"Ask \" + ask.to_s\r\n end",
"def contact\n sleep(5)\n return false\n end",
"def run\n until halted?\n step\n end\n end",
"def say_hello\n return\n puts \"Hello!\" #this code will never be reached\nend",
"def runner\n welcome\n deal_card\n display_card_total\n prompt_user\n get_user_input\nend_game\ninitial_round\nhit\ninvalid_command\nend",
"def run!\n run\n die\n end",
"def need_three_wins\n\n counter = 0\n\n until counter == 3\n random_q = Question.all.sample #this gets us a random question\n question = random_q.question #this is the random question objects's question string\n answer_array_of_strings = random_q.answers.map { |answer_obj| answer_obj.answer} #mapping over our random question's answer objects and returning an array containing their answers as strings\n\n puts question.yellow\n user_input = gets.chomp.downcase\n\n if answer_array_of_strings.include?(user_input) #if our array of answer strings includes the user_input\n counter += 1 #add a point to the counter\n puts \"\\nCorrect! You have answered #{counter} questions correctly. Answer 3 correctly to win!\\n\\n\"\n else\n puts \"\\nTry again!\\n\\n\".red\n end #end if..else statement\n end #end until loop\n\n if counter == 3 #meaning user_input was correct...\n puts \"You win!\"\n exec \"giphy '#{user_input}'\" #YES!!!! show user a random gif related to their correct answer\n #open_gif\n end\n end",
"def _pause_if_needed\n return unless Nenv.cuke_step?\n\n STDOUT.puts \"\\n\\nPress enter to continue\"\n STDIN.gets\n end",
"def pending?; end",
"def finish_turn\n waiting_to_confirm_done = true\n invalid_confirmation = nil\n\n while waiting_to_confirm_done\n DisplayManager.prepare_ingame_display\n show_state\n puts 'Done! Your turn is now over.'\n puts InputManager.input_options({ affirmative: 'Hide my Rack'}, invalid_confirmation)\n invalid_confirmation = nil\n \n response = InputManager.get\n\n if InputManager.affirmative?(response)\n waiting_to_confirm_done = false\n elsif InputManager.negative?(response)\n # do nothing, wait\n else\n invalid_confirmation = response\n end\n end \n\n DisplayManager.prepare_ingame_display\n end",
"def prompt\n command = ask_for_command\n unless command.empty?\n # Give the command to nickbot\n response = @nickbot.execute(command)\n if response\n # Print nickbot's response\n say coloured(\"#{response}\", :GREEN)\n else\n # Print nickbot's status if response is nil\n say coloured(\"ERROR: #{@nickbot.status}\", :RED)\n end\n end\n\n # Unless nickbot is shutting down, ask for another command\n @nickbot.shutting_down? ? shutdown : prompt\nend",
"def levitation_quiz\n loop do\n puts \"What is the spell that enacts levitation?\"\n answer = gets.chomp\n break if answer == \"Wingardium Leviosa\"\n end\n puts \"You passed the quiz!\"\nend",
"def answer_on_next_prompt answer\r\n command 'answerOnNextPrompt', answer\r\n end",
"def answer_on_next_prompt answer\r\n command 'answerOnNextPrompt', answer\r\n end",
"def confirm(ask_string, redo_string)\n\n confirm_status = false\n until confirm_status == true\n puts ask_string.green\n puts \"Please put Yes, or No\"\n\n answer = ask_user\n\n if answer == \"yes\"\n return 1\n confirm_status = true\n elsif answer == \"no\"\n puts redo_string.green\n confirm_status = true\n return 0\n else\n no_understand\n end\n\n end\n\nend",
"def start_new_game?\n begin\n puts \"Would you like to play again? (Y/N)\"\n continue_answer = gets.chomp.upcase\n end until [\"Y\",\"N\"].include?(continue_answer)\n continue_answer == \"Y\"\n end",
"def ask\n puts \"do you have everything? (y/n)\"\n @answer = gets.chomp\nend",
"def ask(question)\n ui.ask question\n end",
"def coming_soon_message\n puts \"Feature coming soon!\"\n puts \"Return to main? (y)es (e)xit Votersim\"\n\n @input = gets.chomp.downcase\n\n case @input\n when \"y\"\n prompt_user_for_initial_choices\n when \"e\"\n exit\n else\n coming_soon_message\n end\n end",
"def option_to_continue\n puts \"Would you like to continue? yes/no\"\n continue?\nend",
"def do_math_1\r\n puts \"Let's do some simple arithmetic! How much is 1 + 1?\"\r\n answer = gets.chomp.to_i\r\n\r\n if answer == 2\r\n puts \"Great job!\"\r\n\r\n else\r\n puts \"Buzz! Let's try that again.\"\r\n do_math_1\r\n end\r\n\r\nend",
"def execute\n if inquisition.buff_remaining == 0\n guardian_of_ancient_kings.attempt\n inquisition.attempt\n end\n\n # Cast Crusader Strike if we dont have 3 HP\n if holy_power < 3\n crusader_strike.attempt\n end\n\n # If I have less than 3 seconds of Inquisition left, refresh regardless\n # of current level of holy power\n if inquisition.buff_remaining < 3\n guardian_of_ancient_kings.attempt\n inquisition.attempt\n end\n\n # Cast TV if we can\n if has_holy_power(3)\n use_trinkets\n avenging_wrath.attempt \n if(zealotry.usable?)\n zealotry.attempt\n heroism.attempt\n end\n templars_verdict.attempt\n end\n\n # If Crusader Strike will be up shortly, just wait for it\n return if crusader_strike.cooldown_remaining <= 0.1\n\n exorcism.attempt\n hammer_of_wrath.attempt \n\n # If Crusader Strike will be up shortly, just wait for it\n return if crusader_strike.cooldown_remaining <= @delay\n\n judgement.attempt \n holy_wrath.attempt\n consecration.attempt if @consecrate\n end",
"def mock_me(response)\n while (response != \"quit\")\n puts response\n response = gets.chomp\n end\nend",
"def player_turn\r\n answer = nil\r\n puts \"#{player.name} has #{player.total_for_hand}\"\r\n loop do\r\n puts \"Do you want to hit or stay? (enter 'h' or 's') \"\r\n loop do\r\n answer = gets.chomp.downcase\r\n break if ['h', 's'].include? answer\r\n puts \"Please enter h or s\"\r\n end\r\n if answer == 's'\r\n player.show_hand\r\n break\r\n elsif answer == 'h'\r\n player.add_to_hand(deck)\r\n puts \"#{player.name} has #{player.total_for_hand}\"\r\n end\r\n break if player.busted?\r\n end\r\n end",
"def are_you_sure?\n while true\n print \"are you sure? [y/n]:\"\n response = gets\n case response\n when /^[yY]/\n return true\n when /^[nN]/, /^$/\n return false\n end\nend\nend",
"def continue?; end",
"def run_guessing_game\n #guess = nil\n random_number = rand\n puts \"Guess a number between 1 and 6.\"\n while true\n response = gets.chomp\n if response == \"exit\"\n puts \"Goodbye!\"\n return\n end\n guess = response.to_i\n #binding.pry\n if guess == random_number\n puts \"You guessed the correct number!\"\n else\n puts \"The computer guessed #{random_number}.\"\n #binding.pry\n end\n end\nend",
"def deaf_aunty\n\n\tn = 0\n\t\n\twhile true\n\tputs \"What do you want to say to your aunty?\"\n\tsandra_speak = gets.chomp\n\n\tif sandra_speak == \"\"\n\tn +=1\n\tbreak if n ==2\n\telsif sandra_speak == \"I love ya, aunty, but I've got to go\"\n\texit\n\telsif sandra_speak == sandra_speak.downcase\t\n\tputs \"HUH?! SPEAK UP, SANDRA!\"\n\telse sandra_speak == sandra_speak.upcase\n\tputs \"NO, WE CAN'T DO THAT!\"\n\tend\n\tend\nend",
"def start(score)\n until winner?(score)\n begin\n ques = @@trivia_db.get_first_row('SELECT question, answer FROM trivia WHERE id=?', 1 + rand(@@trivia_db.get_first_value('SELECT Count(*) FROM trivia')))\n rescue SQLite3::Exception\n @event.respond('Unable to query database!')\n return open_channel\n end\n @event.respond(ques['question']) # Ask the question\n answer = @event.channel.await!(timeout: 60)\n if answer # Was there an answer before the timeout?\n cleanans = answer.content.gsub(/\\W/, '').downcase # Clean up the answer by removing caps and non [a-z] [0-9] chars\n if cleanans == ques['answer'] # There was an answer! You guessed right!\n @event.respond('You got it!')\n sleep 3\n @players[answer.user] += 1\n elsif cleanans == 'stop' # There was an answer! It was stop\n @event.respond('Exiting...')\n return open_channel\n else # There was an answer! It was wrong!\n @event.respond('Nope! The correct answer was: ' + ques['answer'].capitalize)\n sleep 3\n end\n else # No answer\n @event.respond('Well, alright then. Exiting...')\n return open_channel\n end\n end\n end",
"def continue\n puts \"Would you like more information about another job posting? (yes/no)\"\n choice = gets.chomp\n if choice == 'yes' || choice == 'list'\n main\n elsif choice == 'no'\n goodbye\n exit\n elsif choice == 'exit' || choice == ''\n exit\n else\n print_error\n sleep 1\n continue\n end\n end",
"def submit\n solution = @entry.text\n return self.retry() if solution.empty?\n self.solved(solution)\n end",
"def ready_player\n waiting_for_next_player = true\n invalid_ready = nil\n\n while waiting_for_next_player\n DisplayManager.prepare_ingame_display\n show_state(true)\n puts \"It's #{@current_player.name}'s turn! Are you #{@current_player.name}?\"\n puts InputManager.input_options({ affirmative: 'Yes! Display my Rack'}, invalid_ready)\n invalid_ready = nil\n\n response = InputManager.get\n\n if InputManager.affirmative?(response)\n waiting_for_next_player = false\n elsif InputManager.negative?(response)\n # do nothing\n else\n invalid_ready = response\n end\n end \n\n DisplayManager.prepare_ingame_display\n end"
] |
[
"0.6832916",
"0.6705427",
"0.6659139",
"0.66144544",
"0.65732825",
"0.65438634",
"0.6540016",
"0.6535206",
"0.6520224",
"0.6520224",
"0.6490427",
"0.64826244",
"0.6474503",
"0.64708143",
"0.64344907",
"0.64245856",
"0.6366567",
"0.63441664",
"0.6341052",
"0.6331784",
"0.63280135",
"0.63205266",
"0.6307222",
"0.6271002",
"0.62625664",
"0.6261259",
"0.62545884",
"0.6251916",
"0.62379944",
"0.6233979",
"0.6219591",
"0.61961585",
"0.61717963",
"0.61624414",
"0.61553067",
"0.61485976",
"0.6142514",
"0.611317",
"0.6100443",
"0.60979265",
"0.60944915",
"0.6078343",
"0.60673857",
"0.60640633",
"0.6053626",
"0.60527617",
"0.60527617",
"0.60476553",
"0.6041054",
"0.6035105",
"0.6033858",
"0.59972584",
"0.59900826",
"0.5985145",
"0.5976601",
"0.59742355",
"0.59704506",
"0.5961947",
"0.59514743",
"0.5934325",
"0.59315455",
"0.59310937",
"0.59224194",
"0.59052515",
"0.58948606",
"0.58905673",
"0.5889588",
"0.5887561",
"0.58872944",
"0.58854944",
"0.5874306",
"0.58698183",
"0.58627534",
"0.5856668",
"0.5855842",
"0.5853219",
"0.5850995",
"0.58499634",
"0.5846003",
"0.5843666",
"0.58427864",
"0.5842578",
"0.5842578",
"0.58376616",
"0.58303505",
"0.58288646",
"0.5817888",
"0.58169705",
"0.5814929",
"0.58108884",
"0.58090216",
"0.5807229",
"0.5804087",
"0.58022034",
"0.5797643",
"0.57899517",
"0.57861066",
"0.5784827",
"0.57763124",
"0.57752085",
"0.577322"
] |
0.0
|
-1
|
Returns formatted and highlighted code fragments
|
def markdown(text)
renderer = HTMLwithPygments.new(hard_wrap: true, filter_html: false, with_toc_data: false)
options = {
autolink: true,
no_intra_emphasis: true,
fenced_code_blocks: true,
lax_html_blocks: true,
tables: true,
strikethrough: true,
superscript: true,
xhtml: true
}
Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def highlight(code, options = T.unsafe(nil)); end",
"def render_code(code)\n render_block(Pygments.highlight(code, formatter: 'terminal256', lexer: 'ruby', options: {style: 'bw'}))\nend",
"def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); 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 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 pygmentize(file_name, code, lexer = nil)\n if lexer.present?\n Gitlab::Highlight.highlight(file_name, code)\n else\n \"<pre>#{Rack::Utils.escape_html(code)}</pre>\"\n end\n end",
"def highlight_code(options={})\n require 'uv'\n\n wrap_with = options[:wrap_with] || ['','']\n text = @modified_string\n\n languages_syntax_list = File.readlines(\n File.expand_path(File.dirname(__FILE__) + '/../config/languages_syntax_list')\n ).map { |l| l.chomp }\n\n text.gsub!(/<code(\\s*?lang=[\"']?(.*?)[\"']?)?>(.*?)<\\/code>/) do\n if languages_syntax_list.include?($2)\n lang = $2\n else\n lang = 'ruby'\n end\n unless $3.blank?\n result = Uv.parse($3.gsub('<br/>', \"\\n\").gsub('<', '<').gsub('>', '>').gsub('"', '\"'), 'xhtml', lang, false, 'active4d')\n \"#{wrap_with[0].gsub('$lang', lang)}#{result}#{wrap_with[1]}\"\n end\n end\n\n # TODO: split string longer than 80 characters\n\n @modified_string = text\n self\n\n end",
"def highlight(code, lang, options = T.unsafe(nil)); end",
"def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end",
"def highlight(blocks)\n puts \"Highlight code now\"\n\n ret = []\n for block in blocks\n doc, code = block\n\n # Process the code\n code = code.join(\"\\n\")\n unless code =~ /\\A\\s*\\z/\n code = Pygmentize.process(code, @options[:language])\n end\n\n doc = @md.render(doc.join(\"\\n\"))\n\n ret << {\n doc: doc,\n code: code\n }\n end\n\n puts \"Hello\"\n\n ret\n end",
"def syntax_highlight(html)\n line_numbers = config.line_numbers ? :table : nil\n opts = { css: :style, wrap: nil, line_numbers: line_numbers }\n html.gsub(/\\<code class=\"(.+?)\"\\>(.+?)\\<\\/code\\>/m) do\n lang, code = $1, $2\n code = CGI.unescapeHTML code\n CodeRay.scan(code, lang).html opts\n end\n end",
"def pygment_code_block(block)\n write_data block, 'code.rb', false\n system 'pygmentize -o block.html code.rb'\n File.open('block.html', 'r').read\n end",
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def highlight_codeblock(el)\r\n #puts highlight_code(el.value, el.attr['class'], :span)\r\n #h = ::Kramdown::Converter.syntax_highlighter(@options[:syntax_highlighter])\r\n #puts h.call(self, el.value, el.attr['class'], :span)\r\n #puts syntax_highlighter(self, el.value, el.attr['class'], :span)\r\n puts \"SB #{el.inspect}\"\r\n nil # until it's ready for Shoes to eval it. \r\n end",
"def markup_code\n return '' unless @token_stream\n\n src = RDoc::TokenStream.to_html @token_stream\n\n # dedent the source\n indent = src.length\n lines = src.lines.to_a\n lines.shift if src =~ /\\A.*#\\ *File/i # remove '# File' comment\n lines.each do |line|\n if line =~ /^ *(?=\\S)/\n n = $&.length\n indent = n if n < indent\n break if n == 0\n end\n end\n src.gsub!(/^#{' ' * indent}/, '') if indent > 0\n\n add_line_numbers(src) if options.line_numbers\n\n src\n end",
"def to_s\n return unless filename\n\n result = []\n result << \"%= lang:#{language}#{highlight}\"\n result << '\\begin{code}'\n result.concat(raw_code)\n result << '\\end{code}'\n\n rescue CodeInclusionException => e\n code_error(e.message)\n end",
"def html_syntax_highlight(source, type = T.unsafe(nil)); end",
"def highlight\n return unless Config.live_highlight\n\n code = CodeRay.scan(line, :ruby).html\n\n cursor = text_cursor\n\n pos = cursor.position\n cursor.move_position Qt::TextCursor::End\n cursor.set_position @min_position, Qt::TextCursor::KeepAnchor\n cursor.remove_selected_text\n\n cursor.insert_html \"<code>#{code}</code>\"\n cursor.position = pos\n\n self.text_cursor = cursor\n end",
"def block_code(code, language)\n \n lines=code.split(\"\\n\")\n lines.map! do |line|\n\n line=line.gsub(/\\&.squo;/, \"'\")\n line=line.gsub(/\\&.dquo;/, '\"')\n line=line.gsub(/</, \"<\")\n line=line.gsub(/>/, \">\")\n\n # Adding my own special coloring scheme for comments and outputs\n # (for which I've added my own special markup sequence, -->\n line=line.gsub(/(\\# .*$)/, \"<span.ps.class='comment'>\\\\1</span>\")\n line=line.gsub(/\\=\\=> (.*$)/, \"<span.ps.class='output'>\\\\1</span>\")\n\n # Kludgy way of only replacing spaces outside the HTML tags I'm adding to get comments\n # to be in a span of their own\n line=line.gsub(/ /, \" \")\n line=line.gsub(/\\.ps\\./, \" \")\n\n if /lt;/.match(line)\n puts \">>> #{line}\"\n end\n\n line\n end\n html_inner = lines.join(\"<br/>\\n\")\n\n html=\"<div class=mycode>\\n#{html_inner}\\n</div>\\n\"\n end",
"def formatted_body\n code_blocks = _get_code_blocks(self.body)\n red_clothed = RedCloth.new(body.gsub(REGEX, '${code_block}')).to_html\n\n code_blocks.each { |c|\n c = Syntaxi.new(c).process\n red_clothed.sub!(/\\$\\{code_block\\}/, c)\n }\n\n red_clothed\n end",
"def highlight(code)\n CodeRay.scan(code, :ruby).div(:css => :class)\n end",
"def pygmentize(code, lang)\n url = URI.parse 'http://pygments.simplabs.com/'\n options = {'lang' => lang, 'code' => code}\n begin\n Net::HTTP.post_form(url, options).body\n rescue\n \"<pre>#{code}</pre>\"\n end\n end",
"def codespan(code)\n \"{{#{code}}}\"\n end",
"def highlight_code(text, lang, type, opts = T.unsafe(nil)); end",
"def backtick_codeblock(input)\n input.gsub /<p>`{3}\\s(\\w+)<\\/p>\\n\\n<pre><code>([^<]+)<\\/code><\\/pre>\\n\\n<p>`{3}<\\/p>/m do\n lang = $1\n str = $2.gsub('<','<').gsub('>','>')\n highlight(str, lang)\n end\n end",
"def html_highlight\n language, code = *values\n require 'coderay'\n language = 'nitro_xhtml' if language == 'ezamar'\n\n case language\n when *%w[ruby c delphi html nitro_xhtml plaintext rhtml xml]\n tokens = CodeRay.scan(code, language)\n html = tokens.html(:wrap => :div)\n when *%w[diff]\n require 'uv'\n Uv.parse(code, output = 'xhtml', syntax_name = language, line_numbers = false, render_style = 'amy', headers = false)\n else\n code = language if not code or code.strip.empty?\n html = tag(:pre, code)\n end\n end",
"def highlight(code, opts={})\n # If the caller didn't give us any code, we have nothing to do,\n # so return right away.\n return code if code.nil? || code.empty?\n\n # Callers pass along options in the hash\n opts[:options] ||= {}\n\n # Default to utf-8 for the output encoding, if not given.\n opts[:options][:outencoding] ||= 'utf-8'\n\n # Get back the string from mentos and force encoding if we can\n str = mentos(:highlight, nil, opts, code)\n str.force_encoding(opts[:options][:outencoding]) if str.respond_to?(:force_encoding)\n str\n end",
"def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end",
"def code_snippet(source_file, source_line) #exception\n ##backtrace = exception.backtrace.reject{ |bt| bt =~ INTERNALS }\n ##backtrace.first =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #caller =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #source_file, source_line = $1, $2.to_i\n\n source = source(source_file)\n\n radius = 3 # number of surrounding lines to show\n region = [source_line - radius, 1].max ..\n [source_line + radius, source.length].min\n\n # ensure proper alignment by zero-padding line numbers\n format = \" %2s %0#{region.last.to_s.length}d %s\"\n\n pretty = region.map do |n|\n format % [('=>' if n == source_line), n, source[n-1].chomp]\n end #.unshift \"[#{region.inspect}] in #{source_file}\"\n\n pretty\n end",
"def code(lang, &block)\n source_code = capture(&block).strip\n eval('_erbout', block.binding).concat %Q(<pre class=\"CodeRay\"><code class=\"language-#{lang}\">#{html_escape source_code}</code></pre>)\nend",
"def syntax_highlighter(html)\n doc = Nokogiri::HTML(html)\n doc.search(\"//pre[@lang]\").each do |pre|\n pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])\n end\n doc.to_s\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 highlight(text, options = {})\n options = translate(DEFAULT.merge(options))\n args = options.values_at(:output, :syntax, :line_numbers, :style, :headers)\n \n Uv.parse(text, *args)\n rescue => ex\n \"<pre>#{Rack::Utils.escape(text)}</pre>\"\n end",
"def prettify\n @code.gsub(/(.{4})/, '\\1 ').strip\n end",
"def replace_code_blocks(contents)\n info = find_post_content_block(contents, '<p class=\"code\">', '</p>')\n while info\n formatted_block = pygment_code_block(info[:block])\n formatted_block = wrap_block_in_syntax_tags(formatted_block)\n contents = contents.split(\"\\n\")\n contents[info[:front]..info[:back]] = formatted_block\n contents = contents.join(\"\\n\")\n info = find_post_content_block(contents, '<p class=\"code\">', '</p>')\n end\n contents\n end",
"def parse(text)\n text.split(/(<code.*?>.*?<\\/code>)/m).inject(\"\") do |result, piece|\n if piece =~ /^<code/\n result << highlight(piece.gsub(/<code.*?>|<\\/code>/, \"\"), parse_lang(piece)).chomp\n else\n result << format(piece)\n end\n end\n end",
"def block_code(code, language)\n if language.present?\n CodeRay.scan(code, language).div\n else\n \"<pre><code>#{code}</code></pre>\"\n end\n end",
"def escape_code_html(text)\n text.gsub(/<code[^>]*>(.*?)<\\/code>/m) do |t|\n \"<code>\" + h($1) + \"</code>\"\n end.gsub(/<pre[^>]*>(.*?)<\\/pre>/m) do |t|\n \"<pre>\" + h($1) + \"</pre>\"\n end\n end",
"def code_snippet(source_file, source_line) #exception\n ##backtrace = exception.backtrace.reject{ |bt| bt =~ INTERNALS }\n ##backtrace.first =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #caller =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #source_file, source_line = $1, $2.to_i\n\n source = source(source_file)\n\n radius = @radius # number of surrounding lines to show\n region = [source_line - radius, 1].max ..\n [source_line + (radius + 2), source.length].min\n\n # ensure proper alignment by zero-padding line numbers\n #format = \" %6s %0#{region.last.to_s.length}d %s\"\n #pretty = region.map do |n|\n # format % [('=>' if n == source_line), n, source[n-1].chomp]\n #end #.unshift \"[#{region.inspect}] in #{source_file}\"\n #pretty\n\n # create an ordered hash of line => code\n region.map do |n|\n {n => source[n-1].rstrip}\n end\n end",
"def block_code(code, language)\n sha = Digest::SHA1.hexdigest(code)\n Rails.cache.fetch ['code', language, sha].join('-') do\n Pygments.highlight(code, lexer:language)\n end\n end",
"def highlighter; end",
"def highlighter; end",
"def print_code(snippet)\n COLOR.send(:green, snippet)\n end",
"def format_code strip = true\n format_ruby self.code, strip\n end",
"def content_for(code_object)\n Code.new(render_doc_markup_for(code_object),\n start_line_for(code_object), :text).\n with_line_numbers(use_line_numbers?).to_s\n end",
"def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end",
"def process_code text\n # the first line is the lang identifier\n lang = text.lines.first.scan(/^#!+[\\s+]?(\\w+)/).flatten.first\n\n # if found remove first line from text\n if lang\n lang.downcase!\n text = text.lines.to_a[1..-1].join\n else\n lang = 'text'\n end\n\n # highlight and put into a `div` element\n html = CodeRay.scan(text, lang).div(:css => :class)\n end",
"def thru_coderay #:nodoc:\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n elem, atts, code = $1, $2, CGI.unescapeHTML($3).sub(/\\A\\r?\\n/, '')\n\n lang_regexp = /\\blang=('|\")(.*?)\\1/io\n lang = atts[lang_regexp, 2]\n lang = :ruby if lang !~ /\\S/\n atts.sub! lang_regexp, %{lang=\"#{lang}\"}\n\n body = CodeRay.scan(code, lang).html(:css => :style)\n\n if code =~ /\\n/\n span = :para\n head = \"<ins><pre\"\n tail = \"</pre></ins>\"\n\n else\n span = :line\n head = \"<#{elem}\"\n tail = \"</#{elem}>\"\n end\n\n unless atts.sub!(/\\b(class=('|\"))(.*?\\2)/){ $1 + span + ' ' + $3 }\n atts << %{ class=\"#{span}\"}\n end\n\n %{#{head}#{atts}>#{body}#{tail}}\n end\n end",
"def parse_codeblocks(html); end",
"def format_code(text)\n simple_format( truncate( Sanitize.clean(markdown(text)).html_safe, escape: false, length: 299, separator: ' ', omission: ' …' ))\n end",
"def get_code_fragment(str)\n $document\n .at_css('#tryruby-content code')\n &.inner_html\n .to_s\n .strip\n .gsub(\"<\", \"<\")\n .gsub(\">\", \">\")\n .gsub(\"&\", \"&\")\n end",
"def parse_codespan; end",
"def colorize(code, lang)\n if can_pygmentize?\n Albino.colorize(code, lang)\n else\n require 'net/http'\n Net::HTTP.post_form(URI.parse('http://pygments.appspot.com/'),\n {'code'=>code, 'lang'=>lang}).body\n end\n end",
"def block_code(code, language)\n\n # --- Extract file name ---------------------- #\n filename = ''\n regx = Regexp.new(/(<!--\\s?filename:(\\s?.{1,}\\s?)-->\\n?)/)\n if !(code =~ regx).nil?\n code.match(regx)\n filename = $2.try(:strip) || ''\n code.gsub!(regx, '')\n end\n # -------------------------------------------- #\n\n lexer = Rouge::Lexer.find_fancy(language, code) || Rouge::Lexers::PlainText\n if lexer.tag == 'make'\n code.gsub! /^ /, \"\\t\"\n end\n formatter = rouge_formatter(lexer)\n result = formatter.format(lexer.lex(code))\n\n return result if language.blank? && filename.blank?\n\n # --- Compose language and filename section --- #\n\n info_inner_html = [filename, language].select(&:present?).map.with_index { |text, i|\n i == 0 ? \"<span class='highlight-info__inner'>#{text}</span>\" : nil\n }.compact.join('')\n\n %(<div class='highlight-info'>\n #{info_inner_html}\n </div>\n #{result}\n )\n # -------------------------------------------- #\n end",
"def coderay(text = \"\")\n text.gsub(/\\<code( lang=\"(.+?)\")?\\>\\s*(.+?)\\<\\/code\\>/m) do \n CodeRay.scan($3, $2).div( :css => :class,\n :line_numbers => :inline,\n :tab_width => 2\n ) \n end\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 to_html_code(code)\n \"<figure class=\\\"highlight\\\"><pre><code class=\\\"language-resolve\\\" data-lang=\\\"#resolve\\\">\"\\\n \"#{code.chomp}</code></pre></figure>\"\n end",
"def bob_code(options={}, &block)\n # if the only string is give, it must be filename by default\n if options.is_a? String\n f = options\n options = {}\n options[:filename] = f \n end\n if block_given?\n code = capture(&block)\n options[:brush] ||= :plain\n else\n unless options[:brush]\n # determine the brush from the filename\n if options[:filename]\n options[:brush] = case File.extname(options[:filename]).downcase\n when '.rb'\n :ruby\n when '.sh', '.ksh', '.csh'\n :shell\n when '.as3'\n :as3\n when '.cf'\n :cf\n when '.c#'\n :csharp\n when '.cpp', '.c'\n :cpp\n when '.css'\n :css\n when '.pas'\n :pascal\n when '.diff'\n :diff\n when '.erl'\n :elang\n when '.js'\n :javascript\n when '.java'\n :java\n when '.pl'\n :perl\n when '.php', '.php3'\n :php\n when '.txt'\n :plain\n when '.ps'\n :powershell\n when '.py', '.jy'\n :python\n when '.scala'\n :scala\n when '.sql'\n :sql\n when '.vb', '.vbs'\n :vb\n when '.xml', '.xhtml', '.xslt', '.html', '.xhtml'\n :xml\n else \n :plain # default value\n end\n end\n end\n code = raw File.read(Rails.root.join('code', options[:filename]))\n end\n s = raw \"<pre class=\\\"brush: #{options[:brush]}; highlight: #{options[:highlight_lines]}\\\">\"\n s += code\n s += raw '</pre>'\n end",
"def to_s # {{{\n c = wrap( self.content.to_s.chomp )\n t = wrap( self.title.to_s.chomp )\n\n<<EOS\n|^\\___________________ [ #{self.source.to_s } ] _________________________________/^|\n\n\\t'#{t}'\n\n\\t#{c}\n\n|/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\|\n\nEOS\n end",
"def code_highlighting_stylesheet\n Sass::Engine.new(<<STYLESHEET, syntax: :sass).render\npre\n background-color: #ccd\n margin: 0px\n padding: 0.75em\n .hll\n background-color: #ffffcc\n // Error\n .err\n border: 1px solid #FF0000\n .c\n color: #60a0b0\n font-style: italic /* Comment */\n .k\n color: #007020\n font-weight: bold /* Keyword */\n .o\n color: #666666 /* Operator */\n .cm\n color: #60a0b0\n font-style: italic /* Comment.Multiline */\n .cp\n color: #007020 /* Comment.Preproc */\n .c1\n color: #60a0b0\n font-style: italic /* Comment.Single */\n .cs\n color: #60a0b0\n background-color: #fff0f0 /* Comment.Special */\n .gd\n color: #A00000 /* Generic.Deleted */\n .ge\n font-style: italic /* Generic.Emph */\n .gr\n color: #FF0000 /* Generic.Error */\n .gh\n color: #000080\n font-weight: bold /* Generic.Heading */\n .gi\n color: #00A000 /* Generic.Inserted */\n .go\n color: #888888 /* Generic.Output */\n .gp\n color: #c65d09\n font-weight: bold /* Generic.Prompt */\n .gs\n font-weight: bold /* Generic.Strong */\n .gu\n color: #800080\n font-weight: bold /* Generic.Subheading */\n .gt\n color: #0044DD /* Generic.Traceback */\n .kc\n color: #007020\n font-weight: bold /* Keyword.Constant */\n .kd\n color: #007020\n font-weight: bold /* Keyword.Declaration */\n .kn\n color: #007020\n font-weight: bold /* Keyword.Namespace */\n .kp\n color: #007020 /* Keyword.Pseudo */\n .kr\n color: #007020\n font-weight: bold /* Keyword.Reserved */\n .kt\n color: #902000 /* Keyword.Type */\n .m\n color: #40a070 /* Literal.Number */\n .s\n color: #4070a0 /* Literal.String */\n .na\n color: #4070a0 /* Name.Attribute */\n .nb\n color: #007020 /* Name.Builtin */\n .nc\n color: #0e84b5\n font-weight: bold /* Name.Class */\n .no\n color: #60add5 /* Name.Constant */\n .nd\n color: #555555\n font-weight: bold /* Name.Decorator */\n .ni\n color: #d55537\n font-weight: bold /* Name.Entity */\n .ne\n color: #007020 /* Name.Exception */\n .nf\n color: #06287e /* Name.Function */\n .nl\n color: #002070\n font-weight: bold /* Name.Label */\n .nn\n color: #0e84b5\n font-weight: bold /* Name.Namespace */\n .nt\n color: #062873\n font-weight: bold /* Name.Tag */\n .nv\n color: #bb60d5 /* Name.Variable */\n .ow\n color: #007020\n font-weight: bold /* Operator.Word */\n .w\n color: #bbbbbb /* Text.Whitespace */\n .mb\n color: #40a070 /* Literal.Number.Bin */\n .mf\n color: #40a070 /* Literal.Number.Float */\n .mh\n color: #40a070 /* Literal.Number.Hex */\n .mi\n color: #40a070 /* Literal.Number.Integer */\n .mo\n color: #40a070 /* Literal.Number.Oct */\n .sb\n color: #4070a0 /* Literal.String.Backtick */\n .sc\n color: #4070a0 /* Literal.String.Char */\n .sd\n color: #4070a0\n font-style: italic /* Literal.String.Doc */\n .s2\n color: #4070a0 /* Literal.String.Double */\n .se\n color: #4070a0\n font-weight: bold /* Literal.String.Escape */\n .sh\n color: #4070a0 /* Literal.String.Heredoc */\n .si\n color: #70a0d0\n font-style: italic /* Literal.String.Interpol */\n .sx\n color: #c65d09 /* Literal.String.Other */\n .sr\n color: #235388 /* Literal.String.Regex */\n .s1\n color: #4070a0 /* Literal.String.Single */\n .ss\n color: #517918 /* Literal.String.Symbol */\n .bp\n color: #007020 /* Name.Builtin.Pseudo */\n .vc\n color: #bb60d5 /* Name.Variable.Class */\n .vg\n color: #bb60d5 /* Name.Variable.Global */\n .vi\n color: #bb60d5 /* Name.Variable.Instance */\n .il\n color: #40a070 /* Literal.Number.Integer.Long */\nSTYLESHEET\nend",
"def block_code(text, lang=\"\")\n lang ||= lang.to_s\n result = \"```#{lang}\\n\"\n if lang.match RUBY_LANG\n result << ColorCode::Ruby.new(text).colorize\n else\n result << ColorCode::Unknown.new(text).colorize\n end\n result << \"```\\n\"\n result\n end",
"def convert_to_ruby (src)\n rb = \"\"\n # dunno how to deal with only leading declarations of ruby code,\n # so replace it with the other markings\n src.gsub!(/-%>/,\"%>\")\n while\tsrc.index(Embedded_ruby_line) != nil\n src.sub!(Embedded_ruby_line) { |match|\n match[match.index '%'] = \" \"\n \"<% \" + match + \" %>\"\n }\n end\n lines = src.split(Embedded_ruby_flag)\n\n is_ruby_line = false\n lines.each { |line|\n if (line.strip != \"\" and line.strip != nil)\n if is_ruby_line\n if line[0,1] == '='\n # line[0] = \" \"\n # rb += \"puts \" + line.strip\n rb+=\"gr_html_puts \"+line.strip\n else\n rb += line.strip\n end\n else\n rb += \"gr_html( \" + line.inspect + \" )\"\n end\n rb += \"\\n\"\n end\n is_ruby_line = (not is_ruby_line)\n }\n #puts rb\n return rb\n end",
"def html_markup_pre(text); end",
"def inline_code; end",
"def insert_highlighting(new_code, vars)\n string_indexes = scan_for_index_start_and_end(new_code, regex_find_strings) +\n scan_for_index_start_and_end(new_code, /\\d+\\.\\d+/)\n # scan also for floating point numbers to prevent wrong\n # handling of the \".\"\n string_indexes\n operation_indexes = scan_for_index_start_and_end(new_code, regex_find_operations)\n # Set the array of tracing variables to empty, if there only is\n # the underscore, which by default in erlang is undefined.\n vars = [] if vars.length == 1 && vars[0] == '_'\n\n unless vars.empty?\n # fill array for operation_indexes with indexes of given variables\n vars.each do |var|\n if var != '_'\n operation_indexes += scan_for_index_start_and_end(new_code, Regexp.new(\"\\\\b#{var}\\\\b\"))\n end\n end\n operation_indexes = operation_indexes.sort_by { |hsh| hsh[:starts] }\n end\n\n unless string_indexes.empty? && operation_indexes.empty?\n new_code = insert_prefix(new_code, operation_indexes, string_indexes)\n end\n\n # insert information of line numbers\n new_code = change_prefix_2_line_number(new_code)\n\n # insert debugging functionality\n new_code = change_prefix_2_debug(new_code, vars) unless vars.empty?\n\n # delete all for processing inserted prefixes\n new_code.gsub!(regex_lineprefix, '')\n\n new_code\nend",
"def smooth_offtags( text )\n unless @pre_list.empty?\n ## replace <pre> content\n text.gsub!(/<redpre#(\\d+)>/) do\n content = @pre_list[$1.to_i]\n if content.match(/<code\\s+class=\"(\\w+)\">\\s?(.+)/m)\n content = \"<code class=\\\"#{$1} syntaxhl\\\">\" + \n Redmine::SyntaxHighlighting.highlight_by_language($2, $1)\n end\n content\n end\n end\n end",
"def erbify(code)\n # First gather all the ERb-related derived styles\n remaining = code\n styles = {'Ruby_20_Code' => 'Code', 'Ruby_20_Value' => 'Value',\n 'Ruby_20_Block' => 'Block', 'Ruby_20_Literal' => 'Literal'}\n re_styles = /<style:style style:name=\"([^\"]+)\"[^>]* style:parent-style-name=\"Ruby_20_(Code|Value|Block|Literal)\"[^>]*>/\n\n while remaining.length > 0\n md = re_styles.match remaining\n if md\n styles[md[STYLE_NAME]] = md[STYLE_TYPE]\n remaining = md.post_match\n else\n remaining = \"\"\n end\n end\n \n remaining = code\n result = String.new\n \n # Then make a RE that includes the ERb-related styles.\n # Match positions:\n # \n # 1. ROW_START Begin table row ?\n # 2. ITEM_START Begin list item ?\n # 3. PARA_START Begin paragraph ?\n # 4. SPAN_END Another text span ends immediately before ERb ?\n # --5. SPACE (possible leading space)\n # 5. TYPE ERb text style type\n # 6. ERB_CODE ERb code\n # 7. (ERb inner brackets)\n # 8. SPAN_START Another text span begins immediately after ERb ?\n # 9. PARA_END End paragraph ?\n # 10. ITEM_END End list item ?\n # 11. ROW_END End table row (incl. covered rows) ?\n #\n # \"?\": optional, might not occur every time\n# re_erb = /(<table:table-row[^>]*>\\s*<table:table-cell [^>]+>\\s*)?(\\s*<text:list-item>\\s*)?\\s*(<text:p [^>]+>\\s*)?(<\\/text:span>)?<text:span text:style-name=\"(#{styles.keys.join '|'})\">(([^<]*|<text:line-break\\/>|<text:tab\\/>)+)<\\/text:span>(<text:span [^>]+>)?(\\s*<\\/text:p>\\s*)?(<\\/text:list-item>\\s*)?(<\\/table:table-cell>\\s*(<table:covered-table-cell\\/>\\s*)*<\\/table:table-row>)?/\n re_erb = /(<table:table-row[^>]*>\\s*<table:table-cell [^>]+>\\s*)?(<text:list-item>\\s*)?(<text:p [^>]+>\\s*)?(<\\/text:span>\\s*)?<text:span text:style-name=\"(#{styles.keys.join '|'})\">(([^<]*|<text:line-break\\/>|<text:tab\\/>)+)<\\/text:span>(<text:span [^>]+>)?(\\s*<\\/text:p>)?(\\s*<\\/text:list-item>)?(\\s*<\\/table:table-cell>(\\s*<table:covered-table-cell\\/>)*\\s*<\\/table:table-row>)?/\n\n # Then search for all text using those styles\n while remaining.length > 0\n\n md = re_erb.match remaining\n \n if md\n result += md.pre_match\n \n match_code = false\n match_row = false\n match_item = false\n match_para = false\n match_span = false\n\n if styles[md[TYPE]] == 'Code'\n match_code = true\n delim_start = '<% ' ; delim_end = ' %>'\n if md[PARA_START] and md[PARA_END]\n match_para = true\n if md[ITEM_START] and md[ITEM_END]\n match_item = true\n end\n if md[ROW_START] and md[ROW_END]\n match_row = true\n end\n end\n elsif styles[md[TYPE]] == 'Block'\n delim_start = '<%= ' ; delim_end = ' %>'\n if md[PARA_START] and md[PARA_END]\n match_para = true\n end\n else # style is Value or Literal\n if styles[md[TYPE]] == 'Literal'\n delim_start = '<%= ' ; delim_end = ' %>'\n else\n delim_start = '<%= ERB::Util.h(' ; delim_end = ') %>'\n end\n \n if md[SPAN_END] and md[SPAN_START]\n match_span = true\n end\n end\n \n if md[ROW_START] and not match_row\n result += md[ROW_START]\n end\n\n if md[ITEM_START] and not match_item\n result += md[ITEM_START]\n end\n \n if md[PARA_START] and not match_para\n result += md[PARA_START]\n end\n \n # Text formatting before ERb\n if match_code\n if md[SPAN_END]\n result += md[SPAN_END]\n end\n else\n #if md[SPACE]\n # result += md[SPACE]\n #end\n if md[SPAN_START] and not md[SPAN_END]\n result += md[SPAN_START]\n end\n end\n \n result += \"#{delim_start}#{self.unnormalize md[ERB_CODE]}#{delim_end}\"\n \n # Text formatting after ERb\n if match_code\n if md[SPAN_START]\n result += md[SPAN_START]\n end\n else\n if md[SPAN_END]\n result += md[SPAN_END]\n if md[SPAN_START]\n result += md[SPAN_START]\n end\n end\n end\n\n if md[PARA_END] and not match_para\n result += md[PARA_END]\n end\n\n if md[ITEM_END] and not match_item\n result += md[ITEM_END]\n end\n \n if md[ROW_END] and not match_row\n result += md[ROW_END]\n end\n \n remaining = md.post_match\n \n else # no further matches\n result += remaining\n remaining = \"\"\n end\n end\n \n return result\n end",
"def render(context)\n # Sanitize the code inside the block\n resolve_code = super.to_s.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n \n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n \n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end",
"def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def code_format_print(code)\n indent = 0\n l = 1\n code.each_line do |ln|\n ln = ln.strip\n if(ln.match(/^end/))\n indent -= 4\n end\n indent = 0 if indent < 0\n ll = \" \"\n if(l<10)\n ll = \"00#{l} \"\n elsif(l<100)\n ll = \"0#{l} \"\n else\n ll = \"#{l} \"\n end\n l += 1\n\n puts ll + \" \"*indent + ln\n\n if(ln.match(/^class/))\n indent += 4\n elsif(ln.match(/^def/))\n indent += 4\n elsif(ln.match(/do$/))\n indent += 4\n end\n\n if(ln.match(/end$/) && !ln.match(/^end/))\n indent -= 4\n end\n end\nend",
"def final_pretty_code_listing(lines, caption=nil, ruby_filename=nil)\n # remove trailining white space\n lines.each_with_index {|r,i| lines[i]=r.rstrip}\n # make a string\n raw = lines.join(\"\\r\\n\") # windows friendly?\n # pretty print does not like <> brackets\n raw = process_angle_brackets_and_ampersands(raw)\n s = \"\"\n add_line(s, \"<pre class='prettyprint'>#{raw}</pre>\")\n if !caption.nil?\n caption = post_process_text(caption) # process text\n add_line(s, \"<div class='caption'>#{caption}</div>\") \n end \n if !ruby_filename.nil?\n\t add_line(s, \"<div class='download_src'>Download: <a href='#{ruby_filename}'>#{ruby_filename}</a>. Unit test available in the <%=machinelearning_dev_url(\\\"github project\\\")%></div>\")\n\tend\n return s\nend",
"def highlight(node, show_sexp: false, colorize: true)\n output =\n if node.respond_to?(:loc) && !show_sexp\n wrap_source_range(node).source\n else\n node\n end\n return output unless colorize\n\n CodeRay.scan(output, :ruby).term\n end",
"def parse_codespan\n start_line_number = @src.current_line_number\n result = @src.scan(CODESPAN_DELIMITER)\n simple = (result.length == 1)\n saved_pos = @src.save_pos\n\n if simple && @src.pre_match =~ /\\s\\Z|\\A\\Z/ && @src.match?(/\\s/)\n add_text(result)\n return\n end\n\n # assign static regex to avoid allocating the same on every instance\n # where +result+ equals a single-backtick. Interpolate otherwise.\n if result == '`'\n scan_pattern = /`/\n str_sub_pattern = /`\\Z/\n else\n scan_pattern = /#{result}/\n str_sub_pattern = /#{result}\\Z/\n end\n\n if (text = @src.scan_until(scan_pattern))\n text.sub!(str_sub_pattern, '')\n unless simple\n text = text[1..-1] if text[0..0] == ' '\n text = text[0..-2] if text[-1..-1] == ' '\n end\n @tree.children << Element.new(:codespan, text, nil, {\n codespan_delimiter: result,\n location: start_line_number\n })\n\n else\n @src.revert_pos(saved_pos)\n add_text(result)\n end\n end",
"def render\n source_line = @location.source_line\n highlight_line = ' ' * source_line.length\n\n @highlights.each do |hilight|\n range = hilight.column_range\n highlight_line[range] = '~' * hilight.size\n end\n\n range = @location.column_range\n highlight_line[range] = '^' * @location.size\n\n [\n \"#{@location.to_s}: #{@level}: #{@message}\",\n source_line,\n highlight_line,\n ]\n end",
"def source_str(program)\n languages = program.languages\n language_str = languages.map { |l| l.value }.join(', ')\n if language_str.length.nonzero?\n raw(\n content_tag(:span, class: \"has-tip\", title: \"Source code: #{language_str}\") do\n tag(:i, class: [\"fas\", \"fa-code\"])\n end\n )\n end\n end",
"def call(tag, body, context)\n \n if param('fuse.pygmentize.eval_tags')\n body = website.blackboard.invoke(:content_processor, 'tags').call(context.clone(:content => body)).content\n end\n \n # figure out the indent level of the tag\n lines = body.split(/\\r?\\n/);\n last_line = lines.last\n tag_indent = \"\"\n if( last_line.match(/^[ \\t]+$/) ) \n tag_indent = last_line\n end\n \n # Strip off the tag_indent... and figure out the sections...\n state = 0\n\n for i in (0 .. (lines.size-1) )\n if( tag_indent.size > 0 ) \n lines[i] = lines[i].sub(/^[ \\t]{#{tag_indent.size}}/, \"\")\n end\n if state==0 \n if (!lines[i].strip.empty?) \n if( lines[i].match(/\\s*------+\\s*/) ) \n state=1\n else\n raise Exception, \"expecting 1st seperator: ------\"\n end\n end\n \n elsif state==1 \n m = lines[i].match(/\\s*([^:\\s]+)\\s*:\\s*(.+)/)\n raise Exception, \"left heading section expected.\" unless m\n leftlang = m[1]\n leftheading = m[2]\n leftcode =\"\"\n state=2\n\n elsif state==2\n if( lines[i].match(/\\s*------+\\s*/) ) \n state=3\n else\n raise Exception, \"expecting 2nd seperator: ------\"\n end\n \n elsif state==3\n if( lines[i].match(/\\s*------+\\s*/) ) \n state=4\n else\n leftcode += lines[i]+\"\\n\"\n end\n \n elsif state==4\n m = lines[i].match(/\\s*([^:\\s]+)\\s*:\\s*(.+)/)\n raise Exception, \"right heading section expected.\" unless m\n rightlang = m[1]\n rightheading = m[2]\n rightcode = \"\"\n state=5\n\n elsif state==5 \n if( lines[i].match(/\\s*------+\\s*/) ) \n state=6\n else\n raise Exception, \"expecting 4th seperator: ------\"\n end\n \n elsif state==6\n rightcode += lines[i]+\"\\n\"\n end\n end\n \n raise Exception, \"did not get all the sections: state: #{state}\" unless state==6\n \n # Execute the pygmentize tool\n lines = param('fuse.pygmentize_and_compare.lines') ? \",linenos=1\" : \"\"\n \n leftresult = pygmentize(leftlang, lines, leftcode)\n rightresult = pygmentize(rightlang, lines, rightcode)\n \n # Format the result\n result = \"#{tag_indent}<div class=\\\"compare\\\"><div class=\\\"compare-left\\\"><h3>#{leftheading}</h3><div class=\\\"syntax\\\">#{leftresult}</div></div><div class=\\\"compare-right\\\"><h3>#{rightheading}</h3><div class=\\\"syntax\\\">#{rightresult}</div></div><br class=\\\"clear\\\"/></div>\\n\"\n \n rescue Exception => e\n raise RuntimeError, \"Error processing the pygmentize_and_compare tag <#{context.ref_node.absolute_lcn}>: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def ansi_to_bbcode(string); end",
"def thru_coderay\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n atts, code = $2, CGI.unescapeHTML($3)\n\n lang =\n if $2 =~ /lang=('|\")(.*?)\\1/i\n $2\n else\n :ruby\n end\n\n tag =\n if code =~ /\\n/\n :pre\n else\n :code\n end\n\n html = CodeRay.scan(code, lang).html(:css => :style)\n\n %{<#{tag} class=\"code\"#{atts}>#{html}</#{tag}>}\n end\n end",
"def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end",
"def textile_ruby( tag, atts, cite, content )\n %(<pre><code class=\"ruby\">#{content}</pre></code>)\n end",
"def block_code(code, language)\n # highlight some code with a given language lexer \n # and formatter: html or terminal256 \n # and block if you want to stream chunks\n # github.com/jayferd/rouge/blob/master/lib/rouge.rb#L17\n Rouge.highlight(code, language || 'text', 'html') \n # watch out you need to provide 'text' as a default, \n # because when you not provide language in Markdown \n # you will get error: <RuntimeError: unknown lexer >\n end",
"def highlight!\r\n highlights_on proc { true }\r\n end",
"def imitate_code(txt)\n \"%#{txt};;\"\n end",
"def to_code\n if @sexp\n \"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}\"\n else\n @code\n end\n end",
"def html\n HtmlFormatter.new(self, options.merge(:highlight_words => true)).to_s\n end",
"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 highlighter_prefix; end",
"def highlighter_prefix; end",
"def to_s\n lines = @lines.map(&:dup)\n\n if Pry.color\n lines.each do |l|\n l[0] = CodeRay.scan(l[0], @code_type).term\n end\n end\n\n if @with_line_numbers\n max_width = lines.last.last.to_s.length if lines.length > 0\n lines.each do |l|\n padded_line_num = l[1].to_s.rjust(max_width)\n l[0] = \"#{Pry::Helpers::BaseHelpers.colorize_code(padded_line_num.to_s)}: #{l[0]}\"\n end\n end\n\n if @with_marker\n lines.each do |l|\n if l[1] == @marker_line_num\n l[0] = \" => #{l[0]}\"\n else\n l[0] = \" #{l[0]}\"\n end\n end\n end\n\n if @with_indentation\n lines.each do |l|\n l[0] = \"#{' ' * @indentation_num}#{l[0]}\"\n end\n end\n\n lines.map { |l| \"#{l.first}\\n\" }.join\n end",
"def highlighted_body(class_names = { :attributes => 'highlight', :conditionals => 'conditional highlight', :conditional_results => 'result highlight' })\n t = body.to_s.gsub(ATTRIBUTE_REGEXP) { |a| \"<span class='#{class_names[:attributes]}'>#{a}</span>\" }\n t = t.gsub(CONDITIONAL_REGEXP) { |c| \"<span class='#{class_names[:conditional_results]}'><span class='#{class_names[:conditionals]}'><strong>IF</strong> #{c[$2]}:</span>#{c[$3]}</span>\" }\n end",
"def colorize(content, color_code)\n \"\\e[#{color_code}m#{content}\\e[0m\"\n end",
"def codeblock\n H[:pre, attr, H[:code, value]]\n end",
"def framed(code)\n \"\\\\begin{framed_shaded}\\n#{code}\\n\\\\end{framed_shaded}\"\n end",
"def accept_verbatim verbatim\n text = verbatim.text.rstrip\n\n klass = nil\n\n content = if verbatim.ruby? or parseable? text then\n begin\n tokens = RDoc::Parser::RipperStateLex.parse text\n klass = ' class=\"ruby\"'\n\n result = RDoc::TokenStream.to_html tokens\n result = result + \"\\n\" unless \"\\n\" == result[-1]\n result\n rescue\n CGI.escapeHTML text\n end\n else\n CGI.escapeHTML text\n end\n\n if @options.pipe then\n @res << \"\\n<pre><code>#{CGI.escapeHTML text}\\n</code></pre>\\n\"\n else\n @res << \"\\n<pre#{klass}>#{content}</pre>\\n\"\n end\n end",
"def call(tag, body, context)\n \n if param('fuse.pygmentize.eval_tags')\n body = website.blackboard.invoke(:content_processor, 'tags').call(context.clone(:content => body)).content\n end\n \n # figure out the indent level of the tag\n last_line = body.split(/\\r?\\n/).last\n tag_indent = \"\"\n if( last_line.match(/^[ \\t]+$/) ) \n tag_indent = last_line\n end\n \n # Strip off the tag_indent...\n if( tag_indent.size > 0 ) \n buffer = \"\"\n for i in body.split(/\\r?\\n/)\n buffer += i.sub(/^[ \\t]{#{tag_indent.size}}/, \"\")+\"\\n\"\n end\n body = buffer.chomp\n end\n \n # Execute the pygmentize tool\n lang = param('fuse.pygmentize.lang')\n lines = param('fuse.pygmentize.lines') ? \",linenos=1\" : \"\"\n \n result = pygmentize(lang, lines, body)\n \n # Format the result\n result = \"#{tag_indent}<div class=\\\"syntax\\\">#{result}</div>\\n\"\n \n rescue Exception => e\n raise RuntimeError, \"Error processing the pygmentize tag <#{context.ref_node.absolute_lcn}>: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def textile_code( tag, atts, cite, content )\n %(<pre><code>#{content}</pre></code>)\n end",
"def extract_code_blocks\n body.match /```([a-z]+)?\\n(.*)\\n```/\n end",
"def content\n return @content if @content\n rc = RedCloth.new(syntax_highlight(File.read(content_file)))\n rc.hard_breaks = false\n rc.no_span_caps = true\n @content = rc.to_html\n end",
"def parse_codeblock_fenced; end"
] |
[
"0.7659844",
"0.76062167",
"0.7587745",
"0.7522093",
"0.74182373",
"0.7362476",
"0.7346485",
"0.73151934",
"0.72900045",
"0.7274319",
"0.71643126",
"0.70952666",
"0.7092259",
"0.7092259",
"0.7092259",
"0.7054929",
"0.70209813",
"0.7004703",
"0.6998386",
"0.6971673",
"0.69331354",
"0.69209987",
"0.6917894",
"0.685908",
"0.68428665",
"0.6831495",
"0.6831325",
"0.6751277",
"0.6698721",
"0.6678208",
"0.6646404",
"0.66248465",
"0.6596731",
"0.65882593",
"0.65800816",
"0.6563505",
"0.65383554",
"0.6528154",
"0.6490421",
"0.6485024",
"0.64841753",
"0.64803725",
"0.6474869",
"0.6474869",
"0.6455843",
"0.6443703",
"0.64334804",
"0.6428016",
"0.64219445",
"0.63820696",
"0.63733846",
"0.6353935",
"0.6324382",
"0.6303766",
"0.6294138",
"0.62768936",
"0.62527174",
"0.6242876",
"0.62275225",
"0.62224054",
"0.62211305",
"0.61957353",
"0.6183595",
"0.6161989",
"0.61614287",
"0.6146924",
"0.61352605",
"0.6123172",
"0.61169213",
"0.6105322",
"0.60896355",
"0.60816634",
"0.6060983",
"0.60581934",
"0.6052332",
"0.6051299",
"0.60388803",
"0.60381675",
"0.6031668",
"0.60291296",
"0.60290736",
"0.6016178",
"0.60131466",
"0.60108304",
"0.60060847",
"0.59993434",
"0.5991464",
"0.59832716",
"0.5978066",
"0.5978066",
"0.59745234",
"0.5974289",
"0.5965257",
"0.59596586",
"0.5952789",
"0.59432745",
"0.5943067",
"0.59415776",
"0.59384",
"0.592977",
"0.59269273"
] |
0.0
|
-1
|
Returns links in active or inactive state for highlighting current page
|
def nav_link(link_text, link_path)
recognized = Rails.application.routes.recognize_path(link_path)
class_name = recognized[:controller] == params[:controller] ? 'active' : ''
content_tag(:li, class: class_name) do
link_to link_text, link_path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def link_actived?(link_path)\n \"active\" if current_page?(link_path)\n end",
"def active_navigation(link_path)\n\t current_page?(link_path) ? 'active' : ''\n\tend",
"def css_class\n (page.link_to.split('/')[1] == @href.split('/')[1] || page.link_to?(@href)) && \"active\"\n end",
"def active_class(link_path)\n current_page?(link_path) ? \"active\" : \"\"\n end",
"def active_class(link_path)\n current_page?(link_path) ? 'active' : ''\n end",
"def is_active?(link_path)\n current_page?(link_path) ? \"active\" : \"\"\n end",
"def active_in_page(path)\n \"active\" if current_page?(path)\n end",
"def highlight_if_clicked(url)\n current_page?(url) ? \"hilite\" : \"\"\n end",
"def is_active(*links)\n links.each { |link| return 'active' if params[:active_tab] == link }\n end",
"def is_active?(link_path)\n\t if current_page?(link_path)\n\t \"active\"\n\t else\n\t \"\"\n\t end\n end",
"def is_active?(link_path)\n if current_page?(link_path)\n 'active'\n else\n ''\n end\n end",
"def active_link(text,link)\n content_tag(:li) do\n link_to text, link, :class => 'active', remote: true\n end\n end",
"def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end",
"def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end",
"def nav_active(url)\n active_nav_class = \"current\"\n\n if (url.instance_of? String)\n current_resource.url == url_for(url) ? {class: active_nav_class} : {}\n elsif (url.instance_of? Array)\n url.map { |url| url_for(url) }.include?(current_resource.url) ? {class: active_nav_class} : {}\n else\n {}\n end\n end",
"def active_pages\n %w(users background sources) # translations not working at the moment, templates not ready for generic use\n end",
"def link_with_active(text, url)\n if url == \"/\" then\n if request.fullpath == \"/\" then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n else\n if request.fullpath.include? url then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n end\n end",
"def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end",
"def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end",
"def active_page(active_page)\n @active == active_page ? \"active\" : \"\"\n end",
"def active_retailer_links\n @active_retailer_links ||= self.online_retailer_links.includes(:online_retailer, :product).select{|orl| orl if orl.online_retailer.active}\n end",
"def link_to_if_current(text, page, active_class: \"active\")\n if page == current_page\n link_to text, page.request_path, class: active_class\n else\n link_to text, page.request_path\n end\n end",
"def is_page_active(page)\n current_page.url == page\n end",
"def nav_bar_links\n curr_path = request.path\n base_path = curr_path.sub(%r{^(/[^/]*)/.*$}, '\\1')\n curr_prm = url_parameters.except(:limit)\n curr_path += '?' + url_query(curr_prm) if curr_prm.present?\n html_div(class: 'links') do\n first = true\n NAV_BAR_CONTROLLERS.map do |controller|\n if controller == :home\n # Special entry for the dashboard/welcome screen.\n path = dashboard_path\n base = (base_path == '/account')\n label = DASHBOARD_CONFIG[:label]\n tip = DASHBOARD_CONFIG[:tooltip]\n hidden = !current_user\n else\n # Entry for the main page of the given controller.\n path = get_path_for(controller)\n base = (base_path == path)\n label = CONTROLLER_LABEL[controller]\n tip = CONTROLLER_TOOLTIP[controller]\n hidden = (controller == :org) && !current_user\n end\n\n primary = PRIMARY_CONTROLLERS.include?(controller)\n if primary && production_deployment?\n primary &&= !UNRELEASED_CONTROLLERS.include?(controller)\n end\n\n current = (path == curr_path)\n active = current || base\n disabled = current\n\n classes = []\n classes << 'secondary' unless primary\n classes << 'active' if active\n classes << 'disabled' if disabled\n classes << 'hidden' if hidden\n\n # The separator preceding the link.\n sep_css = %w[separator]\n sep_css << 'hidden' if first\n separator = html_span('|', class: css_classes(*classes, *sep_css))\n\n # The link (inactive if already on the associated page).\n tip &&= \"#{tip}\\n\" if disabled\n tip += '(Current_page)' if disabled # TODO: I18n\n opt = { class: css_classes(*classes), title: tip }\n link = disabled ? html_span(label, opt) : link_to(label, path, opt)\n first = false unless hidden\n\n separator << link\n end\n end\n end",
"def is_active?(path)\n \tpaths = []\n \tif not path.is_a?(Array)\n \t\tpaths << path\n \telse\n \t\tpaths = path\n \tend\n \tpaths.each { |p| return \"active\" if current_page?(p) }\n end",
"def nav_inactive(paths)\n cls = \"no-active\"\n paths.each do |path|\n if current_page.path.start_with?(path)\n cls = \"\"\n end\n end\n cls\n end",
"def selected_by_condition?\n is_active_nav_link?(url, highlights_on)\n end",
"def active? path \n \"active\" if current_page? path\n end",
"def is_active?(link_path)\n link_path.include?(request.path) ? \"active\" : \"\"\n end",
"def is_active?(link_path)\n link_path.include?(request.path) ? \"active\" : \"\"\n end",
"def active? path\n \"active\" if current_page? path\n end",
"def active? path\n \"active\" if current_page? path\n end",
"def mark_active_page(pages)\n pages.each_with_index do |page, i| \n next unless page['id'] == self.context[:page]['id']\n active_page = page.dup\n active_page['is_active_page'] = true\n pages[i] = active_page\n end\n pages\n end",
"def mark_active_page(pages)\n pages.each_with_index do |page, i| \n next unless page['id'] == self.context[:page]['id']\n active_page = page.dup\n active_page['is_active_page'] = true\n pages[i] = active_page\n end\n pages\n end",
"def active\n return @all_active if @all_active\n @all_active = all.find_all{ |enum| enum.active? }.freeze\n end",
"def active\n @active.flatten.compact\n end",
"def tab(body, url_options, html_options = {})\n if current_page?(url_options)\n html_options[:class] ||= ''\n html_options[:class] << ' active'\n end\n link_to body, url_options, html_options\n end",
"def active_tab_class(*paths)\n active = false\n # originally used current_page? but it did not work when update button was called.\n paths.each { |path| active ||= path == request.path }\n active ? 'active' : ''\n end",
"def active_link_to(*args, &block)\n if block_given?\n active_link_to(capture(&block), args.first || {}, args.second)\n else\n active = false\n html_options = args.third || {}\n active_paths = html_options.delete(:active_paths)\n active_controllers = html_options.delete(:active_controllers)\n if active_paths.nil? && active_controllers.nil?\n active = true if request.fullpath == args.second\n else\n active_paths.to_a.each do |url_object|\n next if url_object.nil?\n next if url_object.respond_to?(:second) && !url_object.try(:second).try(:persisted?)\n active = request.path == url_for(url_object)\n break if active\n end\n active_controllers.to_a.each do |controller|\n active = params[:controller] == controller.to_s\n break if active\n end\n end\n content_tag :li, active ? { class: 'active' } : nil do\n link_to(*args)\n end\n end\n end",
"def active_class(link_path)\n if request_path_active?(link_path)\n \"active\"\n else\n \"\"\n end\n rescue ActionController::UrlGenerationError\n \"\"\n end",
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def activepage?(path)\n \t\t\"active\" if current_page?(path)\n \tend",
"def get_astronomy_pages()\n\treturn @archive_doc.css('body b a').map { |page| @base_url + page[\"href\"] }\nend",
"def breadcrumbs(pages)\n klass = ->(total, index) {\n total == index ? 'is-active' : 'u-underline-on-hover is-hidden-mobile'\n }\n\n max_index = pages.length - 1\n\n pages.map.with_index do |(page, link), index|\n content_tag('li', class: klass.call(max_index, index)) do\n link_to(page, link)\n end\n end.join('').html_safe\n end",
"def page_active?(symbol); selected_page == symbol; end",
"def page_active? page\n @breadcrumb ||= breadcrumb(@page)\n @breadcrumb.include? page\n end",
"def routes_highlighted\n return Array.new\n end",
"def haml_activate text, *active\n \n return haml_partial text if active.empty? or active.nil?\n \n h = get_haml(text.to_s).split(\"\\n\")\n \n #\n # We need to search for the 'active' terms by line and\n # make them active via CSS\n #\n h.count.times do |n|\n active.each do |a|\n if h[n].include? a.to_s\n \n #\n # Try to make prev list item active\n #\n \n success = false\n \n (n-1).times do |x|\n m = (n-1) - x\n if h[m].include? '%li' \n h[m].gsub! /%li/, '%li.active'\n success = true\n break\n end\n end\n \n if success == false\n puts \"Failed to activate element #{a.to_s}!\"\n else\n next\n end\n end\n end\n end\n haml h.join(\"\\n\").to_s\n end",
"def list_item_with_link_if_not_active (text, link, active)\n html = \"<li>\"\n if active\n html += \"<a href='#{link}'>#{text}</a>\"\n else\n html += \"<span>#{text}</span>\"\n end\n html += \"</li>\"\nend",
"def nav_active(path)\n (current_page.path.start_with? path) ? \"active\" : \"\"\n end",
"def nav(name, url, pages = nil, active = false)\n content_tag :li, link_to(name, url), :class => (active || (pages && active_page?(pages)) ? 'act' : nil)\n end",
"def get_all_pages()\n a_links = self.xpath('//tr[1]/td/table/tr/td/a/@href')\n a_links.map {|a_link| a_link.value}\n end",
"def output_nav(items)\n html = Array.new\n items.each do |text, path|\n item_path = Rails.application.routes.recognize_path(path)\n current_path = {:action => params[:action], :controller => params[:controller]}\n class_name = text.downcase\n if item_path[:controller] == current_path[:controller] && item_path[:action] == current_path[:action]\n class_name << \" active\"\n end\n html << content_tag(:li, link_to(text, path), :class => class_name)\n end\n html.join(\"\\n\").html_safe\n end",
"def nav_link(text, *paths)\n attrs = paths.any? { |p| current_page?(p) } ? { :class => \"active\" } : {}\n content_tag(:li, attrs) { link_to text, paths.first }\n end",
"def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end",
"def links\n @links ||= %w{ a area }.map do |tag|\n search(tag).map do |node|\n Link.new(node, @mech, self)\n end\n end.flatten\n end",
"def navigation_link_to(txt, url)\n\t\tpage_index = request[\"path\"].gsub(\"index.html\",\"\")\n\t\t\n\t\tif url == \"/#{page_index}\"\n\t\t\treturn link_to(txt, url, :class => \"active\")\n\t\tend\n\t\tlink_to(txt,url)\n\tend",
"def navigation\n [IndexHtmlUnit.new.link] + ModelHtmlUnitCollection.links_by_make(make)\n end",
"def active_navbar_class(page_path)\n current_page?(page_path) ? \"active\" : \"\"\n end",
"def active_link_to(text = nil, path = nil, **opts, &block)\n link = block ? text : path # because positional\n content = block ? capture(&block) : text\n opts[:class] = class_names(opts[:class], { active: current_page?(link) })\n\n link_to(link, opts) { content }\n end",
"def active_class(rendered_page, current_page)\n if rendered_page[:shortname] == current_page[:shortname]\n return 'active'\n elsif (current_page.page_type == \"country\" && !current_page.parent.nil? && rendered_page[:shortname] == current_page.parent[:shortname])\n return 'active'\n end\n return '' \n end",
"def aboutusActive?(page_title)\n 'class=\"active\"' if page_title == \"About Us\"\n end",
"def current_locale_links\n if @available_locale\n link = link_to(@available_locale.name, [:cms, @available_locale])\n if current_page?(cms_available_locale_path(@available_locale))\n content_tag(:li, link, class: 'current hide-for-small')\n else\n content_tag(:li, link) + translatable_items_links + other_items_links\n end\n end\n end",
"def active_link_to_class(url, options = {})\n if is_active_link?(url, options[:active])\n options[:class_active] || 'active'\n else\n options[:class_inactive] || ''\n end\n end",
"def print_aside(links)\n s = \"<ul>\"\n for link in links\n s += \"<li><a href='\" + link[0] + \"'\"\n\n if link[0].include? params[:action]\n s += \" class='active'\"\n end\n\n s += \">\" + link[1] + \"</a></li>\"\n end\n s += \"</ul>\"\n\n return s.html_safe\n end",
"def active_link_class(item)\n active_class = 'active_menu_link'\n found = false\n case item.class.to_s\n when 'Project'\n found = true if (@project && @project == item) && (@stage.blank?)\n when 'Host'\n found = true if @host && @host == item\n when 'Recipe'\n found = true if @recipe && @recipe == item\n when 'User'\n found = true if @user && @user == item\n when 'Stage'\n found = true if @stage && @stage == item\n end\n \n if found\n active_class\n else\n ''\n end\n end",
"def active_class(url, options = {})\n if is_active_link?(url, options)\n options[:active_class] || 'active'\n else\n options[:inactive_class] || ''\n end\n end",
"def program_links\n content_tag :span do\n links = Program.all.collect do |prg|\n link_to(prg.name, \"?metrics_by_program=#{prg.id}\", class: \"#{prg.id == options[:program_id].to_i ? 'active' : ''}\")\n end\n ([link_to('all', '?', class: \"#{options[:program_id] ? '' : 'active'}\")] + links).join(' ')\n end\n end",
"def new_nav_helper style, tag_type\n nav_links = ''\n\n nav_items.each do |item|\n nav_links << \"<#{tag_type}><a href='#{item[:url]}' class='#{style} #{active? item[:url]}'>#{item[:title]}</a></#{tag_type}>\"\n end\n\n nav_links.html_safe \n end",
"def browse_all_link\n $tracer.trace(__method__)\n return ToolTag.new(section.id(create_ats_regex_string(\"browse_all\")).find.a, __method__, self)\n end",
"def guides_allpages_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"sort-options\").a(\"/All Pages/\"), __method__)\n end",
"def site_page_navigation_item(text, path, link_html_opts={}, li_html_opts={})\n li_class = current_page?(path) ? \"active\" : \"\"\n content_tag :li, li_html_opts.merge(:class=>li_class) do\n link_to text.html_safe, path, link_html_opts\n end\n end",
"def links\n each_link.to_set\n end",
"def index\n pagination = pagination_params\n\n @highlights = Highlight.ordered_by_index.page(pagination[:page]).per(pagination[:quantity])\n end",
"def nav_link_to(text, url, options = {})\n is_active = url_for(url.split(\"#\")[0], relative: false) ==\n url_for(current_page.url, relative: false)\n options[:class] ||= \"\"\n options[:class] << \" active\" if is_active\n link_to(text, url, options)\n end",
"def all_active_paths\n all_active_states.map(&:path)\n end",
"def active_nav\n @active = \"user\"\n end",
"def pagination_page_list(pager)\n links = []\n window = (pager.current_page - 2)..(pager.current_page + 2)\n\n window = Range.new(0, window.end - window.begin) if window.begin.negative?\n window = Range.new(window.begin, pager.pages - 1) if window.end >= pager.pages\n\n first_link = pagination_navigate_link(pager, 0, '«')\n previous_link = pagination_navigate_link(pager, pager.current_page - 1, '‹')\n last_link = pagination_navigate_link(pager, pager.pages - 1, '»')\n next_link = pagination_navigate_link(pager, pager.current_page + 1, '›')\n\n if pager.previous_page?(window.begin)\n links << pagination_non_link('…', 'disabled')\n end\n\n window.each do |number|\n links << pagination_page_link(number, pager)\n end\n\n if pager.next_page?(window.end)\n links << pagination_non_link('…', 'disabled')\n end\n\n links.unshift(first_link, previous_link)\n links << next_link\n links << last_link\n\n return content_tag(:div, links.reduce(&:+), class: 'btn-group')\n end",
"def active_on(*pairs)\n pairs.each do |pair|\n @nav.add_active_match(pair, @item)\n end\n\n self\n end",
"def active_cells; @cells.select(&:active?) end",
"def get_all_pages\n list_of_pages = Array.new\n list_of_pages[0] = @current_page\n pos = 1\n while @agent.page.links.find { |l| l.text == \"Next →\" } == nil ? false : true\n list_of_pages[pos] = @agent.page.links.find { |l| l.text == \"Next →\" }.click\n pos += 1\n end\n list_of_pages\n end",
"def active?\n head.active?\n end",
"def highlight_links(text)\n text = '' if text.nil?\n begin\n new_text = text.dup\n while new_text =~ /([\\s\\r\\n]+|^)[^\"]*(http[s]{0,1}:\\/\\/[^\\s\\r\\n<]*)/u\n link = $2\n new_text.gsub!(link, \"<a href=\\\"#{link}\\\" rel=\\\"nofollow\\\" target=\\\"_blank\\\">#{link}</a>\")\n end\n new_text\n rescue\n text\n end\n end",
"def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end",
"def links; end",
"def links; end",
"def clickable\n @clickable ||= %i[a link button]\n end",
"def findActive(locationsToggleOld)\n arrActive = []\n locationsToggleOld.each do |arr|\n arrActive.push(arr[0]) if arr[1] === 'active'\n end\n return arrActive\n end",
"def pi_j_a(j, a)\n @classes[j].select{|state| !state.back_links.select{|link| link[0] == a}.empty?}\n end",
"def item title, link\n unless current_page? link\n content_tag :li, link_to(title, link)\n else\n content_tag(:li, :class => :active){\n content_tag :strong, title\n }\n end\n end",
"def job_links\n links = []\n loop do\n links << listing_page.links_with(class: 'ovalbuttondetails')\n break unless next_link\n @listing_page = next_link.click\n end\n links.flatten\n end",
"def page_links(collection, padding = 3)\n current = collection.current_page\n pages = collection.pages\n \n tag(:div, :class => 'pageLinks') do\n html = ''\n if current == 1\n html << tag(:span, '«', :class => 'pageDisabled pagePrevious')\n else\n html << tag(:a, '«', :href => url_for_pagination(current - 1), :class => 'pagePrevious')\n end\n \n page_set(current, pages, padding).each do |page|\n case page\n when 0\n html << tag(:span, \"...\", :class => 'pageSpacer')\n when current\n html << tag(:span, page, :class => 'pageCurrent')\n else\n html << tag(:a, page, :href => url_for_pagination(page), :class => 'pageNumber')\n end\n end\n \n if current == pages\n html << tag(:span, '»', :class => 'pageDisabled pageNext')\n else\n html << tag(:a, '»', :href => url_for_pagination(current + 1), :class => 'pageNext')\n end\n html\n end\n end",
"def all_a\n result = []\n @pages.each do |page|\n next unless page.page_a_tags\n page.page_a_tags.compact.each do |tag|\n tag[0] = '-' unless tag[0]\n tag[1] = '-' unless tag[1]\n tag[2] = '-' unless tag[2]\n result << [page.page_url, tag[0], tag[1], tag[2]]\n end\n end\n result.compact\n end",
"def show_pagination\n previous_link = ''\n next_link = ''\n page_num_links = ''\n\n if show_current_page > 1\n previous_page = show_current_page - 1\n previous_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{previous_page.to_s})\") + '\">« Previous</a></li>'\n else\n previous_link = '<li class=\"disabled\"><a href=\"\">« Previous</a></li>'\n end\n\n if (show_current_page * show_results_per_page) < show_total_hits\n next_page = show_current_page + 1\n next_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{next_page.to_s})\") +'\">Next »</a></li>'\n else\n next_link = '<li class=\"disabled\"><a href=\"\">Next »</a></li>'\n end\n\n if show_current_page >= 4\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(1)\") + '\">1</a></li>'\n end\n if show_current_page >= 5\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n # show links to the two pages the the left and right (where applicable)\n bottom_page = show_current_page - 2\n if bottom_page <= 0\n bottom_page = 1\n end\n top_page = show_current_page + 2\n if top_page >= show_total_pages\n top_page = show_total_pages\n end\n (bottom_page..top_page).each do |i|\n unless i == show_current_page\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{i.to_s})\") + '\">' + i.to_s + '</a></li>'\n else\n page_num_links << '<li class=\"disabled\"><a href=\"\">' + i.to_s + '</a></li>'\n end\n end\n\n if show_total_pages >= (show_current_page + 3)\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n pagination_links = previous_link + next_link + page_num_links\n return pagination_links.html_safe\n end",
"def active\n where(:state => \"new\")\n #actions = Action.arel_table\n #where(actions[:state].eq('new').or(actions[:state].eq('copied')))\n end",
"def get_course_links(page)\n page.links.each do |link|\n return link.click.links if link.href == \"/courses\"\n end\n end",
"def draw_link(href, label, current_path = \"\")\n active = active_path?(href, current_path)\n\n l = \"<li\"\n l += active ? ' class=\"active\">' : \">\"\n l += %Q(<a href=\"#{href}\">#{label})\n l += active ? ' <span class=\"sr-only\">(current)</span>' : \"\"\n l += \"</a></li>\"\n end",
"def active(basename)\n basename == Pathname.new(current_page.destination_path).basename.to_s.sub(/\\..*/, '') ? {'class' => 'ui-btn-active'} : {}\n end",
"def linked\n select(&:linked?)\n end"
] |
[
"0.64624894",
"0.63613015",
"0.6321796",
"0.626717",
"0.6240386",
"0.6238003",
"0.62308353",
"0.62029403",
"0.617763",
"0.61372536",
"0.61217487",
"0.6096431",
"0.60955954",
"0.60955954",
"0.6036149",
"0.5947694",
"0.5893371",
"0.5801775",
"0.5801775",
"0.5801775",
"0.5799032",
"0.579821",
"0.576917",
"0.5765828",
"0.57377404",
"0.5718896",
"0.5700054",
"0.56971747",
"0.5688556",
"0.5688556",
"0.56872326",
"0.56872326",
"0.5676041",
"0.5676041",
"0.56471294",
"0.5626446",
"0.5604218",
"0.55888534",
"0.55733573",
"0.55682623",
"0.5562872",
"0.5562872",
"0.5562872",
"0.555979",
"0.5541835",
"0.5515159",
"0.55143327",
"0.5508231",
"0.55034685",
"0.5497221",
"0.5485147",
"0.5482061",
"0.54739726",
"0.54591715",
"0.5452822",
"0.5449652",
"0.5435981",
"0.5435981",
"0.5412609",
"0.5383432",
"0.53725946",
"0.5370651",
"0.5367464",
"0.53453404",
"0.5342725",
"0.5334347",
"0.53303224",
"0.5329348",
"0.53247726",
"0.5317518",
"0.53070605",
"0.53024983",
"0.5294121",
"0.52862513",
"0.527422",
"0.52706254",
"0.5265604",
"0.5259801",
"0.5256362",
"0.52537864",
"0.52511406",
"0.5247136",
"0.5244845",
"0.52334666",
"0.5232923",
"0.5231259",
"0.52256817",
"0.52256817",
"0.5218059",
"0.520232",
"0.51925147",
"0.5189176",
"0.51842314",
"0.5181359",
"0.5178821",
"0.517444",
"0.51677775",
"0.5165335",
"0.5163447",
"0.5160464",
"0.515983"
] |
0.0
|
-1
|
Returns HTML with all authors of an article
|
def display_article_authors(article, with_info=false)
authors = article.authors.map{|author| author.gplus_profile.blank? ? author.name : link_to(author.name, author.gplus_profile)}.to_sentence(two_words_connector: " & ", last_word_connector: " & ").html_safe
if with_info
authors += (" — " + article.authors.map{|author| content_tag(:span, "#{author.description}", class: 'author_description') }.join(" — ")).html_safe
end
authors
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_all_article_titles_with_authors\n @all = all_article_titles_with_authors\n @all.each do |title, author|\n puts \"#{author} - #{title}\"\n end\n return @all\n end",
"def authors\n document.search(\"[@id='bookAuthors']/[@itemprop='author']/a/span\").map { |elem| elem.innerHTML.strip } rescue []\n end",
"def show_authors(result)\n author_array = []\n if result['Items'].present?\n flag = 0\n authorString = []\n result['Items'].each do |item|\n if item['Group'].present?\n if item['Group'] == \"Au\"\n # let Don and Michelle know what this cleaner function does\n newAuthor = processAPItags(item['Data'].to_s)\n # i'm duplicating the semicolor - fix\n newAuthor.gsub!(\"<br />\", \"; \")\n authorString.push(newAuthor)\n flag = 1\n end\n end\n end\n if flag == 1\n return truncate_article authorString.join(\"; \").html_safe\n end\n end\n contributors = result.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibRelationships', {}).fetch('HasContributorRelationships', [])\n if not contributors.empty?\n contributors.each do |contributor|\n namefull = contributor.fetch('PersonEntity', {}).fetch('Name', {}).fetch('NameFull', nil)\n if namefull\n url_vars = {\"q\" => '\"' + namefull.gsub(\",\", \"\").gsub(\"%2C\", \"\").to_s + '\"', \"search_field\" => \"author\"}\n link2 = generate_next_url_newvar_from_hash(url_vars)\n author_link = '<a href=\"' + request.fullpath.split(\"?\")[0] + \"?\" + link2 + '\">' + namefull.to_s + '</a>'\n author_array.push(author_link)\n end\n\n end\n return author_array.join(\"; \").html_safe\n end\n return ''\n end",
"def show_all_authors\n @all = []\n search_techcrunch[\"articles\"].each do |article|\n @all << article[\"author\"]\n end\n unique_array = @all.uniq!.sort\n puts \"#{dashes}\\n\"\n unique_array.each_with_index do |author, index| puts \"#{index+1}. #{author}\"\n end\n return nil\n end",
"def render_authors_list\n parts = []\n\n first_three = self.authors.slice(0,3)\n\n first_three.each_with_index do |author, index|\n parts << _h.content_tag(\"span\", :class => \"author\") do\n self.author_display(author)\n end\n if (index + 1) < first_three.length\n parts << \"; \"\n end\n end\n\n if self.authors.length > 3\n parts << I18n.t(\"bento_search.authors_et_al\")\n end\n\n return _h.safe_join(parts, \"\")\n end",
"def authors()\n authors_or_editors(@text[:author].to_names) if @text[:author]\n end",
"def all_article_titles_with_authors\n @all = {}\n search_techcrunch[\"articles\"].each do |hash|\n author = hash[\"author\"]\n title = hash[\"title\"]\n @all[title] = author\n end\n return @all\n end",
"def get_related_authors\n tag = params['query']\n\n @articles = get_articles(tag) # gets all articles of this author\n # puts 'ARTICLES'\n # ap @articles\n\n @related_articles = []\n @authors = []\n\n # for each of the author's articles, get 1st degree articles and their respective authors\n @articles.each do |article|\n puts \"ARTIClE ID \"\n puts article.arxiv_id\n getRelatedPapers(article.arxiv_id, -1).each do |related|\n\n authors = related.authors\n authors.each do |author|\n\n if !@authors.include?(author)\n @authors << author\n end\n\n end\n end\n end\n \n\n @found = 1\n if @authors == []\n @msg = \"None found, try again...\"\n @found = 0\n end\n\n render \"authors\"\n end",
"def authors\n @authors\n end",
"def authors\n author\n end",
"def show_authors\n tag = params['query']\n\n @article = Article.where('arxiv_id = ?', tag).first\n @authors = @article.authors\n # puts authors\n\n @found = 1\n if @authors.nil?\n @msg = \"None found, try again...\"\n @found = 0\n @authors = []\n end\n\n render \"authors\"\n end",
"def authors\n ret = {}\n @doc.css('map authors').children.each do |ch|\n uuid = ch.attr('uuid')\n role = ch.attr('role')\n next if uuid.blank?\n ret[uuid.gsub('-', '')] = ''\n if !role.blank?\n ret[uuid] = \" <i>(#{role})</i>\"\n end\n end\n ret\n end",
"def authors\n nodes = @node.xpath(\"atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end",
"def author\n @author ||= Readability::Document.new(@html).author\n end",
"def authors\n nodes = @doc.xpath(\"atom:feed/atom:author\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomPerson.new(node) }\n end",
"def getAuthors(metaEls, role)\n result = metaEls.map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif %w{author editor advisor}.include?(el.name)\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n text = sub.text.strip\n next if text.empty?\n data[(sub.name == \"identifier\") ? (sub.attr('type') + \"_id\").to_sym : sub.name.to_sym] = text\n }\n data && !data[:name].nil? ? data : nil\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }.select{ |v| v }\n role != \"author\" and result.each { |data| data[:role] = role }\n return result\nend",
"def authors\n if self.channel.generator == 'Twitter'\n return [@item.title.split(':')[0]]\n end\n [@item.author, ((@item.dc_creators.empty?) ? nil : @item.dc_creators.collect{|c| c.content})].flatten.uniq.compact.reject{|au| au == '' || au.match(/^\\s+$/)}\n end",
"def authors\n\t\t\t@db.js('musicthoughts.top_authors(NULL)')\n\t\tend",
"def authors\n return [] if @feed.channel.managingEditor.nil? && @feed.channel.dc_publishers.empty?\n [@feed.channel.managingEditor, ((@feed.channel.dc_publishers.empty?) ? nil : @feed.channel.dc_publishers.collect{|dcp| dcp.content})].flatten.uniq.compact.reject{|au| au == '' || au.match(/^\\s+$/)}\n end",
"def authors authorlist, style = {}\n authors = split_bib_authors(authorlist)\n num = authors.size\n max=5\n max=style[:max_authors] if style[:max_authors]\n if style[:etal] and num > max\n aunum = 1\n aunum = style[:etal_num] if style[:etal_num]\n text = comma(authors[0..aunum-1].join(', '))\n text = text.chop.chop\n text += if style[:etal] == :plain\n ' et al.'\n else\n ' <i>et al.</i>'\n end\n\n else\n if num > 1\n # p [num,authors]\n text = comma(authors[0..num-2].join(', ')+' & '+authors[num-1])\n else\n text = comma(authors[0])\n end\n # strip final comma\n text = text.chop.chop\n end\n text\n end",
"def authored_articles\n Article.where(author: self)\n end",
"def author_names\n\t\treturn self.authors.map do |author|\n\t\t\tauthor[ /^(.*?) </, 1 ]\n\t\tend\n\tend",
"def authors\n read_property 'Authors'\n end",
"def getAuthors(indexMeta, rawMeta)\n # If not UC-Ingest formatted, fall back on index info\n if !rawMeta.at(\"/record/authors\")\n return indexMeta.multiple(\"creator\").map { |name| {name: name} }\n end\n\n # For UC-Ingest, we can provide more detailed author info\n rawMeta.xpath(\"/record/authors/*\").map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif el.name == \"author\"\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n if sub.name == \"identifier\"\n data[(sub.attr('type') + \"_id\").to_sym] = sub.text\n else\n data[sub.name.to_sym] = sub.text\n end\n }\n data\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }\nend",
"def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n ['http://www.w3.org/2005/Atom', 'http://purl.org/atom/ns#'].each {|xmlns|\n each_child {|top|\n next unless top.elem?\n if top.name == \"{#{xmlns}}feed\"\n if feed_author = find_element(\"{#{xmlns}}author\")\n feed_author.traverse_element(\"{#{xmlns}}name\") {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n end\n }\n }\n\n nil\n end",
"def authors_list\n self.authors.split(\"\\n\").delete_if { |a| a.blank? }.map { |a| a.strip }\n end",
"def page_author(author)\n content_for_layout :meta_author, author\n end",
"def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n } \n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n nil\n end",
"def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end",
"def listAuthors\n @items = Author.all(:conditions => [\"name LIKE ?\", params[:query].downcase + '%' ], \n :order => :name,\n :select => :name)\n @items += Author.all(:conditions => [\"name LIKE ?\", '%' + params[:query].downcase + '%'],\n :order => :name,\n :select => :name)\n render :text => @items.collect { |x| x.name }.uniq.join(\"\\n\") \n end",
"def index\n @authors = Author.all\n end",
"def get_authors(authors)\n Array(authors).map { |author| get_one_author(author) }\n end",
"def find_article_titles_by_author(author)\n @titles = []\n search_techcrunch[\"articles\"].each do |article|\n if article[\"author\"].include?(author)\n @titles << article[\"title\"]\n end\n end\n @titles.each_with_index do |title, index| puts \"#{index+1}. #{title}\"\n end\n return nil\n end",
"def authors\n @authors ||= []\n end",
"def author\n if @author.nil?\n @author = FeedTools::Author.new\n author_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:author\",\n \"atom03:author\",\n \"atom:author\",\n \"author\",\n \"managingEditor\",\n \"dc:author\",\n \"dc:creator\"\n ])\n unless author_node.nil?\n @author.raw = FeedTools::XmlHelper.try_xpaths(\n author_node, [\"text()\"], :select_result_value => true)\n @author.raw = FeedTools::HtmlHelper.unescape_entities(@author.raw)\n unless @author.raw.nil?\n raw_scan = @author.raw.scan(\n /(.*)\\((\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\)/i)\n if raw_scan.nil? || raw_scan.size == 0\n raw_scan = @author.raw.scan(\n /(\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b)\\s*\\((.*)\\)/i)\n unless raw_scan.size == 0\n author_raw_pair = raw_scan.first.reverse\n end\n else\n author_raw_pair = raw_scan.first\n end\n if raw_scan.nil? || raw_scan.size == 0\n email_scan = @author.raw.scan(\n /\\b[A-Z0-9._%-\\+]+@[A-Z0-9._%-]+\\.[A-Z]{2,4}\\b/i)\n if email_scan != nil && email_scan.size > 0\n @author.email = email_scan.first.strip\n end\n end\n unless author_raw_pair.nil? || author_raw_pair.size == 0\n @author.name = author_raw_pair.first.strip\n @author.email = author_raw_pair.last.strip\n else\n unless @author.raw.include?(\"@\")\n # We can be reasonably sure we are looking at something\n # that the creator didn't intend to contain an email address\n # if it got through the preceeding regexes and it doesn't\n # contain the tell-tale '@' symbol.\n @author.name = @author.raw\n end\n end\n end\n if @author.name.blank?\n @author.name = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:name/text()\",\n \"atom03:name/text()\",\n \"atom:name/text()\",\n \"name/text()\",\n \"@name\"\n ], :select_result_value => true)\n )\n end\n if @author.email.blank?\n @author.email = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:email/text()\",\n \"atom03:email/text()\",\n \"atom:email/text()\",\n \"email/text()\",\n \"@email\"\n ], :select_result_value => true)\n )\n end\n if @author.url.blank?\n @author.url = FeedTools::HtmlHelper.unescape_entities(\n FeedTools::XmlHelper.try_xpaths(author_node, [\n \"atom10:url/text()\",\n \"atom03:url/text()\",\n \"atom:url/text()\",\n \"url/text()\",\n \"atom10:uri/text()\",\n \"atom03:uri/text()\",\n \"atom:uri/text()\",\n \"uri/text()\",\n \"@href\",\n \"@uri\",\n \"@href\"\n ], :select_result_value => true)\n )\n end\n if @author.name.blank? && !@author.raw.blank? &&\n !@author.email.blank?\n name_scan = @author.raw.scan(\n /\"?([^\"]*)\"? ?[\\(<].*#{@author.email}.*[\\)>].*/)\n if name_scan.flatten.size == 1\n @author.name = name_scan.flatten[0].strip\n end\n if @author.name.blank?\n name_scan = @author.raw.scan(\n /.*#{@author.email} ?[\\(<]\"?([^\"]*)\"?[\\)>].*/)\n if name_scan.flatten.size == 1\n @author.name = name_scan.flatten[0].strip\n end\n end\n end\n @author.name = nil if @author.name.blank?\n @author.raw = nil if @author.raw.blank?\n @author.email = nil if @author.email.blank?\n @author.url = nil if @author.url.blank?\n if @author.url != nil\n begin\n if !(@author.url =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@author.url)\n @author.url = FeedTools::UriHelper.resolve_relative_uri(\n @author.url, [author_node.base_uri, self.base_uri])\n end\n rescue\n end\n end\n if FeedTools::XmlHelper.try_xpaths(author_node,\n [\"@gr:unknown-author\"], :select_result_value => true) == \"true\"\n if @author.name == \"(author unknown)\"\n @author.name = nil\n end\n end\n end\n # Fallback on the itunes module if we didn't find an author name\n begin\n @author.name = self.itunes_author if @author.name.nil?\n rescue\n @author.name = nil\n end\n end\n return @author\n end",
"def get_authors(authors, options={})\n Array(authors).map { |author| get_one_author(author, options) }\n end",
"def generate_author_pages(item_set = nil)\n item_set ||= published_weblog\n authors(item_set).each do |author|\n @items.create(\n %(<%= render('/blog/author.*', author: '#{author}') %>),\n { title: \"Weblog postings by #{author}\", kind: 'author-page', is_hidden: true, description: \"All posts written by #{author}\" },\n \"#{@config[:static_root]}#{@config[:blog][:authors_path]}/#{author.to_slug}/index.erb\",\n binary: false,\n )\n end\n end",
"def author\n @title_pages.each { |tp| tp.author and return tp.author }\n nil\n end",
"def get_authors(authors)\n Array.wrap(authors).map { |author| get_one_author(author) }.compact\n end",
"def get_authors(authors)\n Array.wrap(authors).map { |author| get_one_author(author) }.compact\n end",
"def get_authors(authors, options = {})\n Array(authors).map { |author| get_one_author(author, options) }\n end",
"def story_author_names\n self.authors.map{|x| x.name}.to_sentence\n end",
"def get_articles(author_id)\n\n @author = Author.find(author_id)\n\n @articles = []\n @author.creations.each do |creation|\n temp = Article.find(creation.article_id)\n\n if !@articles.include? temp\n @articles << Article.find(creation.article_id)\n end\n\n end\n # puts \"ARTICLES\"\n\n # ap @articles\n\n return @articles\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def index\n @authors = Author.all\n end",
"def authors\n authors = []\n @pubmed['AU'].strip.split(/\\n/).each do |author|\n name = author.split(/\\s+/)\n suffix = \"\"\n if name.length > 2 && name[-2] =~ /^[A-Z]+$/\n suffix = name.pop\n end\n initials = name.pop\n author = {\n \"last_name\" => name[0] || \"\", \n \"fore_name\" => initials || \"\", \n \"initials\" => initials || \"\", \n \"suffix\" => suffix || \"\",\n }\n authors.push(author)\n end\n fau = @pubmed['FAU'].strip.split(/\\n/)\n fau.each_index do |index|\n last = authors[index][\"last_name\"]\n suffix = authors[index][\"suffix\"]\n fore = fau[index].gsub(/^#{last},\\s+/, \"\").gsub(/\\s+#{suffix}$/, \"\")\n authors[index][\"fore_name\"] = fore || \"\"\n end\n return authors\n end",
"def\n get_author()\n @author\n end",
"def authors\n bib_authors || get_item_data_by_name('Author')\n end",
"def items\n authors\n end",
"def get_author()\n @author\n end",
"def author_link(news_article,full_date=false)\n html_block = \"<div class='author_link right'>Posted by \"\n html_block << link_to(h(news_article.user.display_name), user_path(news_article.user_id), :style => \"color:rgb(100,149,237);\")\n html_block << \" on <span style='color:rgb(60,60,60);'>#{news_article.created_at.strftime('%b %d, %Y')}</span>\" if full_date\n html_block << \" at #{news_article.created_at.strftime('%I:%M %p')}\"\n html_block << \"</div>\"\n \n return html_block\n end",
"def authors_top\n\t\t\t@db.js('musicthoughts.top_authors($1)', [20])\n\t\tend",
"def author_info\n self.authors.map(&:full_name).join(', ')\n end",
"def by_mixed_authors\n my_stories = @user ? StorySearch.new( @user, :author, { :time_span => 24.hours.to_i, :per_page => 13 } ).results : []\n top_author_stories_count = ( 20 - my_stories.size )\n conditions = params[:language_id].blank? ? {} : { :language_id => params[:language_id] }\n pagination_options = { :page => 1, :per_page => top_author_stories_count }\n skip_ids = my_stories.collect( &:id )\n @stories = Story.by_top_authors.skip_ids( skip_ids ).paginate( pagination_options.merge( :conditions => conditions, :include => [ :authors, :source ] ) )\n my_stories.inject( @stories ){ |s,x| s.push( x ) }\n @stories.sort!{ |a,b| b.created_at <=> a.created_at }\n @stories.total_entries = @stories.size\n rxml_stories\n end",
"def author\n @node.at_xpath(\"author\").try(:content)\n end",
"def citation_author\n surname = authors.first.last_name\n initials = authors.first.initials\n\n if authors.size > 1\n return \"#{surname} et al.\"\n else\n return \"#{surname}, #{initials}\"\n end\n end",
"def author_links(author_display)\n p = params.dup\n p.delete :page\n p.delete :action\n p.delete :q\n p.delete :search_field\n p.delete :f\n p.delete :id\n p[:f] = {}\n authors = author_display.split(\"■\")\n authors.collect { |author|\n p[:f][\"author_facet\"] = []\n p[:f][\"author_facet\"].push(author.strip)\n link_url = catalog_index_path(p)\n link_to(author, link_url)\n }\n end",
"def show_full_list_of_articles(author)\n puts Rainbow(\"Would you like to read the article(s)?(y/n)\").white.bright\n user_input = gets.chomp\n case user_input\n when \"y\"\n author_articles = all_article_titles_with_authors.select do |title, name|\n name.split(' ')[0] == author\n end\n hay = all_article_titles_with_content\n array = []\n author_articles.each do |title, name|\n if hay.keys.include?(title)\n array << hay[title]\n end\n end\n array.each_with_index do |article, index| puts \"\\n#{dashes}\\n#{index+1}. #{article}\\n#{dashes}\\n\"\n end\n when \"n\"\n puts Rainbow(\"Sorry to hear that, we'll take you back to the menu now!\").white.bright\n menu\n menu_choice\n end\n end",
"def get_author()\n return @author\n end",
"def authors_highlight_affiliates(authors, affiliateAuthors)\n affiliates = affiliate_authors_parse_json(affiliateAuthors)\n authors_linked = []\n authors.each_with_index do |a, idx|\n # Match author position from affiliateAuthors to full authors array by index\n # and create links for matches\n if affiliates[idx]\n authors_linked << link_to(a, controller: 'authors', action: 'show', internet_id: affiliates[idx]).html_safe\n else\n authors_linked << a\n end\n end\n authors_linked.to_sentence\n end",
"def author_tag(text); end",
"def author\n return '' if self.authors.empty?\n self.authors.join(', ')\n end",
"def authors(library)\nend",
"def author_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end",
"def authors\n\t#params[:diff] = params[:diff].eql?\"true\"\n \trespond_in_format Marginalia.authors(params[:id],params[:diff])\n end",
"def author_count\n revisions = Marginalia.revisions(params[:id])\n authors = []\n revisions.collect {|rev| authors << rev['user']}\n authors.uniq!\n render :text => authors.length\n end",
"def authorstring\n @authorstring ||= self.authors.collect { |a| a.last }.sort.to_sentence(:last_word_connector => ' и ')\n @authorstring\n end",
"def get_all_authors(record)\n translator_code = \"trl\"; editor_code = \"edt\"; compiler_code = \"com\"\n primary_authors = []; translators = []; editors = []; compilers = []\n record.find_all {|f| f.tag === \"100\"}.each do |field|\n primary_authors << field[\"a\"] if field[\"a\"]\n end\n record.find_all {|f| f.tag === \"700\"}.each do |field|\n if field[\"a\"]\n relators = []\n relators << clean_end_punctuation(field[\"e\"]) if field[\"e\"]\n relators << clean_end_punctuation(field[\"4\"]) if field[\"4\"]\n if relators.include?(translator_code)\n translators << field[\"a\"]\n elsif relators.include?(editor_code)\n editors << field[\"a\"]\n elsif relators.include?(compiler_code)\n compilers << field[\"a\"]\n else\n primary_authors << field[\"a\"] unless primary_authors.include?(field[\"a\"])\n end\n end\n end\n {:primary_authors => primary_authors, :translators => translators, :editors => editors, :compilers => compilers}\n end",
"def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end",
"def map_authors_names(authors_list)\n authors_list.map do |author|\n if author =~ /^<.*>$/\n users = User.filter(\"`email`=?\", author.gsub(/^<|>$/,\"\")).limit(10).all\n next users[0].name if users.length > 0\n end\n author\n end\n end",
"def author\n authors.first\n end",
"def author\n authors.first\n end",
"def author\n @author\n end",
"def derive_authors_year\n add_author_year(author_year_string) \n end",
"def index\n @authors = Author.all\n respond_with(@authors)\n end",
"def author\n (self.authors.empty?) ? '' : self.authors.join(', ')\n end",
"def authors_block\n <<-XML.strip_heredoc\n <Authors>\n <Author>\n <LastName>#{author_attributes.name.last}</LastName>\n <FirstName>#{author_attributes.name.first}</FirstName>\n <MiddleName>#{author_attributes.name.middle}</MiddleName>\n #{author_attributes.institution.address.to_xml}\n <Version>1</Version>\n </Author>\n </Authors>\n <DocumentCategory>#{category}</DocumentCategory>\n XML\n end",
"def atom_entry_author(atom_entry, content)\n atom_entry.author do |author|\n entry_author = content.author_for(current_agent)\n\n author.name(sanitize(entry_author.name))\n if entry_author.respond_to?(:openid_uris) && entry_author.openid_uris.any?\n author.uri(entry_author.openid_uris.first)\n end\n end\n\n end",
"def index\n conditions = { :block => false }\n conditions.merge!( :is_opinion => true ) if params[:opinion] == '1'\n conditions.merge!( :is_agency => true ) if params[:agency] == '1'\n unless params[:author_id].blank? && params[:author_ids].blank?\n author_ids = scan_multiple_value_param( :author_id, :first ) || scan_multiple_value_param( :author_ids )\n conditions.merge!( :id => author_ids )\n end\n params[:top] == '1' ? top() : ( !params[:q].blank? ? search( conditions ) : list( conditions ) )\n @authors.delete_if{ |a| a.story_authors.count < 2 } if params[:cf] == '1'\n rxml_data( @authors, :root => 'authors', :with_pagination => true )\n end",
"def authors\n map { |comment| comment.author.to_s }.uniq.sort\n end",
"def author_name\n if author\n author.full_name\n else\n 'No Author Found'\n end\n end",
"def author; @author; end",
"def author; @author; end",
"def authors\n @authors ||= pairs.keys.sort\n end",
"def the_author(content=nil)\n if node = content || @content || Content.get(params[:id]) \n author = node.author\n end\n end",
"def author\n @author ||=\n convert_content(item_attributes!.author) ||\n convert_content(item_attributes!.creator) ||\n \"\"\n end",
"def author_index\n @comments.authors.index(author)\n end",
"def author\n @author ||= get_author\n end",
"def first_author_publications_cnt()\n self.investigator_abstracts.first_author_abstracts.length\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 authors\n space_users.all({ :role.not => :member }).collect { |m| m.user }\n end",
"def author_cleanup( authors )\n\n res = []\n authors.each do | p |\n ix = p.index\n ix = ix.to_i if ix.instance_of? String\n res << Author.new(\n index: ix,\n first_name: p.first_name,\n last_name: p.last_name )\n end\n return res.uniq { |p| p.index }\n end",
"def construct_author_list(post, is_apa = false)\n author_names = []\n author_list = ''\n\n for author in post.authors\n author_names.push(author.name)\n end\n\n if is_apa\n author_names.sort!\n\n author_names.each_with_index do |name, index|\n author_names[index] = last_name_first_name(name)\n end\n else\n #reverse the first name only\n author_names[0] = last_name_first_name(author_names[0])\n end\n\n number_of_authors = author_names.length\n\n author_list = place_author_in_list(author_names)\n\n return author_list\n end",
"def get_hashed_authors(authors)\n Array(authors).map { |author| get_one_hashed_author(author) }\n end",
"def get_hashed_authors(authors)\n Array(authors).map { |author| get_one_hashed_author(author) }\n end",
"def forfatter(*arg)\n self.get_authors.map{ |a| a[\"sn\"] + \", \" +a[\"gn\"] }\n end",
"def chicago_citation(record)\n # more than 10, only the first seven should be listed in the bibliography, followed by et al.\n ## less than four, list all, first author: last name, first name, others first name last name\n # and before the last author ##\n authors = get_all_authors(record)\n author_text = \"\"\n unless authors[:primary_authors].blank?\n if authors[:primary_authors].length > 10\n authors[:primary_authors].each_with_index do |author, index|\n if index < 7\n if index == 0\n author_text << \"#{author}\"\n if author.ends_with?(\",\")\n author_text << \" \"\n else\n author_text << \", \"\n end\n else\n author_text << \"#{name_reverse(author)}, \"\n end\n end\n end\n author_text << \" et al.\"\n elsif authors[:primary_authors].length > 1\n authors[:primary_authors].each_with_index do |author, index|\n if index == 0\n author_text << \"#{author}\"\n if author.ends_with?(\",\")\n author_text << \" \"\n else\n author_text << \", \"\n end\n elsif index + 1 == authors[:primary_authors].length\n author_text << \"and #{name_reverse(author).gsub(/\\,.$/, '')}\"\n else\n author_text << \"#{name_reverse(author)}, \"\n end\n end\n else\n author_text << authors[:primary_authors].first.gsub(/\\,.$/, '')\n end\n else\n temp_authors = []\n authors[:translators].each do |translator|\n temp_authors << [translator, \"trans.\"]\n end\n authors[:editors].each do |editor|\n temp_authors << [editor, \"ed.\"]\n end\n authors[:compilers].each do |compiler|\n temp_authors << [compiler, \"comp.\"]\n end\n\n unless temp_authors.blank?\n if temp_authors.length > 10\n temp_authors.each_with_index do |author, index|\n if index < 7\n author_text << \"#{author.first} #{author.last} \"\n end\n end\n author_text << \" et al.\"\n elsif temp_authors.length > 1\n temp_authors.each_with_index do |author, index|\n if index == 0\n author_text << \"#{author.first} #{author.last}, \"\n elsif index + 1 == temp_authors.length\n author_text << \"and #{name_reverse(author.first)} #{author.last}\"\n else\n author_text << \"#{name_reverse(author.first)} #{author.last}, \"\n end\n end\n else\n author_text << \"#{temp_authors.first.first} #{temp_authors.first.last}\"\n end\n end\n end\n\n unless author_text.blank?\n author_text = author_text.gsub(/\\,$/, \"\")\n if author_text[-1, 1] != \".\"\n author_text += \". \"\n else\n author_text += \" \"\n end\n end\n # Get Pub Date\n pub_date = setup_pub_date(record) unless setup_pub_date(record).nil?\n\n # Get volumes\n\n # setup title info\n title = setup_title_info(record)\n\n\n if !authors[:primary_authors].blank? and (!authors[:translators].blank? or !authors[:editors].blank? or !authors[:compilers].blank?)\n additional_title << \"Translated by #{authors[:translators].collect {|name| name_reverse(name)}.join(\" and \")}. \" unless authors[:translators].blank?\n additional_title << \"Edited by #{authors[:editors].collect {|name| name_reverse(name)}.join(\" and \")}. \" unless authors[:editors].blank?\n additional_title << \"Compiled by #{authors[:compilers].collect {|name| name_reverse(name)}.join(\" and \")}. \" unless authors[:compilers].blank?\n end\n\n edition = \"\"\n edition << setup_edition(record) unless setup_edition(record).nil?\n\n pub_info = setup_pub_info(record) unless setup_pub_info(record).nil?\n\n\n citation = \"\"\n citation << \"#{author_text}\" unless author_text.blank?\n\n citation << \"<i>#{title}</i> \" unless title.blank?\n citation << \"#{edition} \" unless edition.blank?\n\n # add volumes information if not null\n volumes = volumes_info(record) unless volumes_info(record).blank?\n volumes = volumes.gsub(\"volumes\", \"vols. \") unless volumes.nil?\n citation << volumes unless volumes.blank?\n\n is_sound = is_sound_disc(record)\n sound_info = physical_description_sound(record)\n\n\n citation << \"#{pub_info}\" unless pub_info.blank? || is_sound\n citation << \"#{sound_info}\" unless sound_info.nil?\n if pub_date.blank? && (!pub_info.blank? || !sound_info.nil?)\n citation << \".\"\n elsif !pub_date.blank? && (!pub_info.blank? || !sound_info.nil?)\n citation << \", #{pub_date}.\"\n elsif !pub_date.blank? && pub_info.blank? && sound_info.nil?\n citation << \"#{pub_date}.\"\n end\n unless citation.blank?\n if citation[-1, 1] != \".\"\n citation += \".\"\n end\n end\n citation\n end",
"def retrieve_articles(articles)\n str = String.new\n articles.each_with_index do |article, i|\n str << \"<tr class='#{ i % 2 == 1 ? 'rowodd' : 'roweven' }'>\"\n str << format_article(article)\n str << \"</tr>\"\n end\n return str\n end"
] |
[
"0.7708442",
"0.7538625",
"0.7473535",
"0.7401987",
"0.73058116",
"0.71103686",
"0.7078655",
"0.7023631",
"0.6996439",
"0.6994805",
"0.6988791",
"0.69733304",
"0.69548464",
"0.69210076",
"0.6910337",
"0.68971044",
"0.6881655",
"0.68402195",
"0.67442596",
"0.6728819",
"0.6662885",
"0.6646486",
"0.66385776",
"0.6627739",
"0.65869665",
"0.6564698",
"0.6557086",
"0.65504175",
"0.6550182",
"0.65370834",
"0.64994615",
"0.6496402",
"0.6488329",
"0.6478752",
"0.6436632",
"0.63858175",
"0.63605094",
"0.6356932",
"0.63503164",
"0.63503164",
"0.633229",
"0.63198006",
"0.63180417",
"0.63179517",
"0.63179517",
"0.63179517",
"0.63179517",
"0.63170743",
"0.62619585",
"0.62585557",
"0.62519187",
"0.6251666",
"0.6248006",
"0.62420285",
"0.6211016",
"0.6207842",
"0.61909914",
"0.6181964",
"0.6172851",
"0.61545324",
"0.6153692",
"0.611087",
"0.60841984",
"0.6079632",
"0.60693395",
"0.60683936",
"0.60522515",
"0.6038989",
"0.6025826",
"0.60143775",
"0.60107076",
"0.6007333",
"0.59918994",
"0.59918994",
"0.5975839",
"0.5970229",
"0.5968023",
"0.5942283",
"0.593581",
"0.5933753",
"0.59181213",
"0.5912098",
"0.5908309",
"0.59057355",
"0.59057355",
"0.58893985",
"0.5888799",
"0.58886385",
"0.58633083",
"0.5862755",
"0.58608544",
"0.5855516",
"0.5855076",
"0.5852467",
"0.5847844",
"0.5845574",
"0.5845574",
"0.5836701",
"0.58323145",
"0.58312654"
] |
0.77495617
|
0
|
Renders the navigation bar for logged in users
|
def render_navbar(&block)
action_link = get_action_link
if !action_link
action_link = CONFIG[:title_short]
end
html = content_tag(:div, id: 'navbar') do
content_tag(:div, class: 'navbar-inner') do
if current_lines_user
content_tag(:span, class: 'buttons', &block) + "<div class='btn-menu'><div class='stripes'></div></div>".html_safe +
"<div class='submenu'>
<div class='submenu-inner'>
<ul>
<li>#{link_to("Dashboard", admin_articles_path)}</li>
<li>#{link_to(t('activerecord.models.lines/author', count: 1).html_safe, admin_authors_path)}</li>
</ul>
<ul>
<li class='small'>#{t('lines.logged_in_as').html_safe} #{current_lines_user.email}</li>
<li>#{link_to(t('lines.buttons.logout').html_safe, logout_path)}</li>
</ul>
<ul>
<li>#{link_to(t('lines.buttons.formating_help').html_safe, "#", class: "btn-cheatsheet")}</li>
<li>#{link_to(t('lines.buttons.about').html_safe, "http://lines.opoloo.com")}</li>
</ul>
</div>
</div>".html_safe
else
content_tag(:span, link_to('', root_path), class: 'backlink') + content_tag(:span, action_link, class: 'actionlink')
end
end
end
html
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def navbar\n if logged_in\n render 'layouts/logged_in_navbar'\n else\n render 'layouts/logged_out_navbar'\n end\n end",
"def navbar\n if logged_in?\n render 'layouts/logged_in_navbar'\n else\n render 'layouts/logged_out_navbar'\n end\n end",
"def user_nav\n if @current_user\n items = {'Home' => root_path, 'My Account' => account_path, 'My Submissions' => current_user_submissions_path}\n else\n if ApplicationSettings.config['user_registration']\n end\n items = {'Home' => root_path, 'Signup' => signup_path}\n end\n output_nav(items)\n end",
"def user_links_for_navigation_bar\n content_tag(:div, class: 'ml-auto') do\n content_tag(:ul, class: 'navbar-nav ml-auto') do\n # User is not signed in.\n if current_user.nil?\n concat(content_tag(:li, class: 'nav-item active') do\n link_to new_user_session_path, class: 'nav-link' do\n icon('person-check') + ' Log In'\n end\n end)\n concat(content_tag(:li, class: 'nav-item active') do\n link_to new_user_registration_path, class: 'nav-link' do\n icon('person-plus') + ' Sign Up'\n end\n end)\n # User is signed in.\n else\n concat(content_tag(:li, class: 'nav-item active') do\n link_to edit_user_registration_path, class: 'nav-link' do\n icon('gear') + ' Edit Profile'\n end\n end)\n concat(content_tag(:li, class: 'nav-item active') do\n link_to destroy_user_session_path, method: :delete, class: 'nav-link' do\n icon('person-dash') + ' Logout'\n end\n end)\n end\n end\n end\n end",
"def index\n if current_user\n @links = current_user.links \n @bottom_bar_header = \"My Links\"\n end\n end",
"def admin_nav\n items = {'Home' => admin_root_path, \n 'Users' => admin_users_path,\n 'Submissions' => admin_submissions_path}\n output_nav(items)\n end",
"def admin_links_for_navigation_bar\n unless current_user.nil?\n if current_user.admin?\n content_tag(:li, class: 'nav-item active') do\n link_to admin_path, class: 'nav-link' do\n icon('clipboard-data') + ' Admin Dashboard'\n end\n end\n end\n end\n end",
"def nav_bar(nav_body_content = false)\n nbc = nav_body_content || Settings.default_nav_body\n render :partial=>\"layouts/nav_bar\", :locals=>{content: full_name, nav_body_content: nbc}\n end",
"def show_user\n if user_signed_in?\n container = %()\n container << \"<div id='navTop'>\"\n container << \"<div id='tools'>\"\n if flash[:notice]\n container << \"<div class='information'>\"\n container << \"<span id='notice'><span> </span><h1>#{flash[:notice]}</h1></span>\"\n container << \"</div>\"\n end\n container << \"<div class='logged'>\"\n container << \"<span>#{image_tag avatar_url(current_user)}</span>\"\n container << \"<div>\"\n container << \"<h2>#{current_user.name}</h2>\"\n container << \"</div>\"\n container << \"<ul>\"\n container << \"<li>#{link_to('sair do sistema',destroy_user_session_path,:method => :delete,:title => 'efetuar logout')}</li>\"\n container << \"<li>.</li>\"\n container << \"<li>\"\n container << link_to('meus dados',\"javascript:createSearchPopup('/admin/users/#{current_user.id}',740,500);\",:title => 'ver meus dados')\n container << \"</li>\"\n container << \"</ul>\"\n container << \"</div>\"\n container << \"</div>\" #tools\n container << \"<span class='clear'> </span>\"\n container << \"</div>\" #navTop\n end\n container.html_safe\n end",
"def index\n if current_user\n @buttons = Button.where(family_id: @current_user.family_id)\n set_hamburger_menu\n else\n render template: \"home/about\"\n end\n end",
"def header_menu\n\t\tif logged_in?\n\t\t\toutput = []\n\t\t\toutput << link_to(image_tag(\"/images/logged/my_classes.png\"), {:controller => 'classrooms'}) \n\t\t\toutput << link_to(image_tag(\"/images/logged/class_diary.png\"), {:controller => 'diario_de_classe_posts'})\n \n if is_admin?\n output << link_to(image_tag(\"/images/logged/class_diary.jpg\"), {:controller => 'admin'})\n end\t\t\t\n return output.join(\"\\n\")\n\n\t\telse\n\t\t \treturn image_tag(\"/images/unlogged/top.jpg\") \n\t\tend\n\tend",
"def user_menu_button\n if user_signed_in?\n render 'shared/user_menu_box'\n else\n signup_button +\n login_button\n end\n end",
"def nav_bar\n path_array = self.current_page.split(\"/\").drop(1)\n path_count = path_array.count\n params = self.request_params_display\n \n if URI.unescape(self.current_page) == \"/\"\n nav_bar = \"Index of /\"\n else\n nav_bar = \"Index of <a href=\\'/#{params}'>/</a>\"\n end\n \n previous_path = \"\"\n 0.upto(path_array.count - 1) do |a|\n \n ##\n # Get escaped versions of this path and previous path\n \n escaped_path = path_array[a].gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n escaped_previous = previous_path.gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n \n ##\n # If this is the last directory in the path, it shouldn't have a link\n \n if a == path_array.count - 1\n href = \"\"\n else\n href = \"<a href=\\'/#{escaped_previous}#{escaped_path}#{params}\\'>\"\n end\n \n ##\n # If this is the first directory above the root, don't prepend a slash\n \n if a == 0 \n nav_bar << \" #{href}#{path_array[a]}</a>\"\n else\n nav_bar << \" / #{href}#{path_array[a]}</a>\"\n end\n \n previous_path << path_array[a] + \"/\"\n end\n \n @nav_bar = nav_bar\n \n end",
"def nav_link(linkname1, logged_in_path, linkname2, nonlogged_path)\n if logged_in?\n\tlink_to linkname1, logged_in_path\n\telse\n\tlink_to linkname2, nonlogged_path\n\tend\nend",
"def active_nav\n @active = \"user\"\n end",
"def canvas_user_navigation!(params = {})\n set_canvas_ext_param(:user_navigation, params)\n end",
"def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end",
"def render_nav( current_user, params, nav ) \n # nav blocks is array of blocks' navigation element (without the divider yet)\n nav_blocks = []\n nav_blocks_string = \"\"\n @is_nav_active = false \n \n nav[:blocks].each do |nav_block|\n # nav block has_many nav elements \n puts \"the nav[:header] = #{nav[:header]}, gonna render nav block\"\n result = render_nav_block( current_user, params, nav_block) \n nav_blocks << result if not result.nil? and not result.length == 0\n end\n \n return nil if nav_blocks.length == 0 \n \n \n nav_blocks_count = nav_blocks.length \n counter = 0\n \n nav_blocks.each do |nav_block|\n nav_blocks_string << nav_block\n if counter != nav_blocks_count - 1 \n nav_blocks_string << draw_block_divider \n end\n counter += 1 \n end\n \n \n # <li class=\"dropdown active\">\n nav_blocks_string = draw_nav( nav_blocks_string, @is_nav_active , nav)\n \n return nav_blocks_string \n \n end",
"def nav_login_button\r\n \r\n end",
"def index\n # If someone is signed in on the browser\n if signed_in?\n # Take the user to their profile page\n redirect_to \"/#{@current_user.name}\"\n # Abort execution\n return\n end\n \n # Don't use an application layout.\n render layout: false\n end",
"def add_navbar_widgets\n view_context.render \"shared/widgets\", :context => 'mainlist', :position => 'navbar'\n end",
"def header_user_link\n @current_user ||= current_user\n get_edit_user_link @current_user, dashboard_path\n end",
"def profile\n if(current_user)\n render 'layouts/loggedin'\n else\n render \"layouts/guest\"\n end\n end",
"def index\n \tif current_user\n\t\tredirect_to home_profile_path\n\tend\n end",
"def home\n if logged_in?\n redirect_to user_path(current_user) # Redirect to user show page if logged in\n else\n render layout: 'welcome' # Render home view with welcome layout\n end\n end",
"def nav_bar_links\n curr_path = request.path\n base_path = curr_path.sub(%r{^(/[^/]*)/.*$}, '\\1')\n curr_prm = url_parameters.except(:limit)\n curr_path += '?' + url_query(curr_prm) if curr_prm.present?\n html_div(class: 'links') do\n first = true\n NAV_BAR_CONTROLLERS.map do |controller|\n if controller == :home\n # Special entry for the dashboard/welcome screen.\n path = dashboard_path\n base = (base_path == '/account')\n label = DASHBOARD_CONFIG[:label]\n tip = DASHBOARD_CONFIG[:tooltip]\n hidden = !current_user\n else\n # Entry for the main page of the given controller.\n path = get_path_for(controller)\n base = (base_path == path)\n label = CONTROLLER_LABEL[controller]\n tip = CONTROLLER_TOOLTIP[controller]\n hidden = (controller == :org) && !current_user\n end\n\n primary = PRIMARY_CONTROLLERS.include?(controller)\n if primary && production_deployment?\n primary &&= !UNRELEASED_CONTROLLERS.include?(controller)\n end\n\n current = (path == curr_path)\n active = current || base\n disabled = current\n\n classes = []\n classes << 'secondary' unless primary\n classes << 'active' if active\n classes << 'disabled' if disabled\n classes << 'hidden' if hidden\n\n # The separator preceding the link.\n sep_css = %w[separator]\n sep_css << 'hidden' if first\n separator = html_span('|', class: css_classes(*classes, *sep_css))\n\n # The link (inactive if already on the associated page).\n tip &&= \"#{tip}\\n\" if disabled\n tip += '(Current_page)' if disabled # TODO: I18n\n opt = { class: css_classes(*classes), title: tip }\n link = disabled ? html_span(label, opt) : link_to(label, path, opt)\n first = false unless hidden\n\n separator << link\n end\n end\n end",
"def show\n render layout: \"sin_menu\" unless user_signed_in? \n end",
"def display_menu\n if project?\n content_tag(:div, :id => 'menu') do\n render :partial => 'layouts/menu_nav'\n end\n end\n end",
"def show_header_buttons\n session[:header_shown] = 1\n if user_signed_in?\n html = link_to(\"\", destroy_user_session_path, method: :delete, class: \"fa fa-sign-out fa-3x icon\", \"data-turbolinks\": false, title: \"Kirjaudu ulos\")\n html += link_to(\"\", settings_path, class: \"fa fa-child fa-3x icon\")\n if !current_user.confirmed?\n html += link_to(\"\", confirm_path, class: \"fa fa-paw fa-3x icon\", title: \"Vahvista tunnus\")\n end\n else\n html = link_to(\"\", new_user_session_path(locale: locale), class: \"fa fa-sign-in fa-3x icon\", \"data-turbolinks\": false, title: \"Kirjaudu sisään\")\n html += link_to(\"\", instruction_path, class: \"fa fa-info-circle fa-3x icon\", title: \"Ohje\")\n end\n\n html += link_to(\"\", vote_proposals_path, class: \"fa fa-list fa-3x icon\", \"data-turbolinks\": false, title: \"Takaisin listaukseen\")\n \n html += '<a href=\"#\" class=\"fa fa-close fa-3x icon button-action\" title=\"Sulje\"></a>'.html_safe\n end",
"def nav_bar_render(title, urls)\n\n render :partial => \"course/shared/title_nav_header\", \n :locals => {:nav_title => title, \n :nav_urls => urls\n } \n\n end",
"def index\n if logged_in\n redirect_to profile_path\n end\n end",
"def home\n if current_user\n redirect_to '/dashboard'\n else\n render 'home'\n end\n end",
"def nav_bar( navigation_menu, id=\"primary_navigation\" )\n # THIS IS DEPRECATED OCT 16 2013 !!!\n navigation_html = %|<ul id=\"#{id}\" class=\"navigation inline_list\">|\n navigation_menu.each do |menu_item|\n if Navigation_properties[menu_item]\n item_title = Navigation_properties[menu_item][0].to_s.gsub ' ', ' '\n if Navigation_properties[menu_item][1]\n href = Navigation_properties[menu_item][1]\n else\n href = menu_item.to_s + '.html'\n end \n else\n href = menu_item.to_s + '.html'\n item_title = menu_item.to_s.gsub( '_', ' ' ).capitalize\n end \n navigation_html << %{<li><a class=\"#{menu_item.to_s}\" href=\"#{href}\">#{item_title}</a></li>\\n} # NOTE the \\n\n end \n navigation_html << '</ul>'\n end",
"def index\n\t\tredirect_to dashboard_users_path if current_user\n\tend",
"def index\n session[:current_user_id] = ''\n render 'layouts/application'\n\n end",
"def navigation_helper style, tag\nnav_links = <<NAV\n <#{tag}><a href=\"#{root_path}\" class=\"#{style} #{active? root_path}\">Home</a></#{tag}>\n <#{tag}><a href=\"#{about_path}\" class=\"#{style} #{active? about_path}\">About</a></#{tag}>\n <#{tag}><a href=\"#{contact_path}\" class=\"#{style} #{active? contact_path}\">Contact</a></#{tag}>\n <#{tag}><a href=\"#{blogs_path}\" class=\"#{style} #{active? blogs_path}\">Blog</a></#{tag}>\n <#{tag}><a href=\"#{content_news_path}\" class=\"#{style} #{active? content_news_path}\">Twitter</a></#{tag}>\n <#{tag}><a href=\"#{folios_path}\" class=\"#{style} #{active? folios_path}\">Folio</a></#{tag}>\nNAV\n nav_links.html_safe\n end",
"def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end",
"def active_admin_navigation_bar( context )\n # do not display navigation if both previous and next are not available\n return if (!@prev_item && !@next_item)\n prev_id = @prev_item != nil ? @prev_item.id.to_s : \"\"\n next_id = @next_item != nil ? @next_item.id.to_s : \"\"\n prev_id += \"?page=#{@prev_page}\" if @prev_page != 0\n next_id += \"?page=#{@next_page}\" if @next_page != 0\n \n # Build the back to index path function\n model = self.resource_class.to_s.pluralize.underscore.downcase\n index_link_function = \"admin_#{model}_path\"\n \n context.div class: :table_tools do\n context.ul class: :table_tools_segmented_control do\n context.li class: :scope do\n if @prev_item != nil\n context.a href: prev_id, class: :table_tools_button do context.text_node \"Previous\" end\n else\n context.a class: \"table_tools_button disabled\" do context.text_node \"Previous\" end\n end\n end\n context.li class: :scope do\n context.a href: \"#{send(index_link_function)}\", class: :table_tools_button do context.text_node \"Back to the list\" end\n end\n context.li class: :scope do\n if @next_item != nil\n context.a href: next_id, class: :table_tools_button do context.text_node \"Next\" end\n else\n context.a class: \"table_tools_button disabled\" do context.text_node \"Next\" end\n end\n end\n end\n end\n end",
"def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end",
"def show\n update_navbar(@user)\n # 是访客而非页面的主人\n if session[:user_id] != params[:id].to_i\n @user.is_visitor = true\n else\n @user.is_visitor = false\n # 个人主页三大功能之一:创建新的任务\n @mission = Mission.new\n @mission.user_id = session[:user_id]\n @mission.user_token= session[:user_id]\n end\n\n render\n end",
"def index\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def index\n if user_signed_in?\n redirect_to home_path\n end\n end",
"def login_status\n if !logged_in?\n return link_to 'Login', authenticated_system_login_path\n else\n s = \"#{current_user.login}\"\n if self.current_user.shibboleth_id.blank?\n s << \" (#{link_to 'Associate to UVa account', shibboleth_url(:protocol => 'https')}) | \"\n else\n s << ' | '\n end\n s << \"#{link_to('Logout', authenticated_system_logout_path)} | \"\n s << \"#{link_to 'Admin', authenticated_system_root_path} | \" if authorized? hash_for_authenticated_system_root_path\n s\n end\n end",
"def main_navigation\n nodes_stack = RailsAdmin::Config.visible_models(:controller => self.controller)\n node_model_names = nodes_stack.map{ |c| c.abstract_model.model_name }\n\n nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|\n\n nodes = nodes.select{ |n| n.parent.nil? || !n.parent.to_s.in?(node_model_names) }\n li_stack = navigation nodes_stack, nodes\n\n li_a_home = link_to localizing_path(dashboard_path), class: 'pjax' do\n content_tag(:i, '', class: 'icon icon-home') + content_tag(:span, t('admin.actions.dashboard.menu'))\n end\n %{<li class=\"homelink\">#{li_a_home}</li>#{li_stack}} if li_stack.present?\n end.join.html_safe\n end",
"def nav(options = {}, &block)\n @nav_link = true\n nav = content_tag :ul, nav_options(options), &block\n nav.tap{ @nav_link = false }\n end",
"def index\n @loggedin_user=current_user.name\n @users = User.all\n end",
"def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end",
"def index\n\n\n # if ( !current_user || !current_user.isAdmin )\n # render :text => \"You are not authorized to see this page\", :layout => true\n #\n # return\n # end\n\n @users = User.all\n end",
"def home\n render 'users/homepage'\n end",
"def show\n #breadcrumbs\n add_crumb \"My Profile\", user_path, links: false\n @user = current_user\n #breadcrumbs\n add_crumb \"My Profile\", user_path\n add_crumb \"My Saved Searches\", save_search_path, links: false\n @showsearches = Search.all.where(users_id: current_user)\n end",
"def refreshLogout\r\n loggedOutNavigation\r\n end",
"def index\n\t\t# Logs user in if session cookie is present\n\t\tif @user = User.find_by_id(session[:user]) \n\t\t\tredirect_to user_dash_path(@user) \n\t\tend\n\tend",
"def show\n\n @user = User.get(params[:id])\n \n if signed_in? && @user.id == current_user.id\n @menu = \"home\"\n @board = \"user\"\n @section = \"show\"\n \n render 'user'\n else\n redirect_to '/'\n end\n end",
"def show_sign_in(user_id)\n unless user_id\n content_tag :li do\n link_to 'Sign in', new_session_path\n end\n end\n end",
"def index\n @barns = current_user.barns\n\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barns }\n end\n end",
"def navbar_active\n # reset in controller for active navbar menu item\n @navbar_active = :collection\n end",
"def show_nav_bar(message_dir_name)\n if message_dir_name\n index = Index.new\n before = index.entry_before(message_dir_name)\n after = index.entry_after(message_dir_name)\n else\n before = after = nil\n end\n\n\n res = '<p><table align=\"center\"><tr>'\n \n res += %{<td align=\"right\" width=\"40%\">} \n if before\n res += \"<a href=\\\"display.cgi?ms=#{before}\\\">\" +\n \"<< Previous </a>\"\n else\n res += \" \"\n end\n res += \"</td>\\n\"\n\n res += \"<td align=\\\"center\\\" width=\\\"20%\\\">\" +\n \"<a href=\\\"display.cgi\\\">Index</a></td>\\n\"\n\n res += %{<td align=\"left\" width=\"40%\">} \n if after\n res += \"<a href=\\\"display.cgi?ms=#{after}\\\"> Next >></a>\"\n else\n res += \" \"\n end\n res += \"</td>\\n\"\n \n res + \"</tr></table>\\n\"\nend",
"def home_link\n if logged_in? \n\t\t\ttext = \"my home\"\n\t\t\tlink = user_path(current_user) \n\t\telse\n\t\t\ttext = \"home\"\n\t\t\tlink = root_path\n\t\tend\n\t\tlink_to_unless_current \"<span>\" + text + \"</span>\", link\n end",
"def index\n @page_title = \"Song Titles\"\n\n # @titles = Title.order(\"void\").order(\"title\")\n if @logged_in_user\n @titles = @logged_in_user.titles.order(\"void\").order(\"title\")\n else \n admin_user = User.where({ :username => \"admin1357\" }).first\n @titles = admin_user.titles.order(\"void\").order(\"title\")\n end\n render :index\n end",
"def index\n @guitars = current_user.guitars if user_signed_in?\n end",
"def development_info\n status = current_usuario.nil? ? \"Usuário deslogado\" : \"Usuário logado\"\n\n raw('<div class=\"navbar navbar-fixed-top\">\n <div class=\"navbar-inner\">\n <div class=\"container\">\n <a class=\"brand\" href=\"#\">' + status + '</a>\n\n <ul class=\"nav\">\n <li><a href=\"\">Página inicial</a></li>\n <li><a href=\"/usuarios/sign_in\">Página de login</a></li>\n <li><a href=\"/usuarios/sign_out\">Página de logout</a></li>\n </ul>\n </div>\n </div>\n </div>')\n\n end",
"def index\n @current_user ||= User.find_by(id: session[:user_id])\n if current_user.is_admin?\n @users = User.all\n else\n redirect_to '/home'\n end\n end",
"def admin_main_navigation\n entries = \"\"\n alchemy_modules.each do |alchemy_module|\n entries << alchemy_main_navigation_entry(alchemy_module)\n end\n entries.html_safe\n end",
"def index\n if current_user\n if !request.referer || (request.env['HTTP_REFERER'] && !(URI(request.env['HTTP_REFERER']).path == dashboard_path))\n redirect_to :controller => 'dashboards', :action => 'show'\n end\n end\n @title = 'Home'\n end",
"def show\n @title = 'Users Management'\n @breadcrumb = 'Users > Show'\n end",
"def index\n @current_user = current_user if signed_in?\n end",
"def link_to_profile_if_logged_in_else_community\n\t\tif current_user && !current_user.guest?\n link_to content_tag(:li, current_user.fullname), user_path(current_user.id) \n else \n link_to content_tag(:li, \"Community\"), users_path \n end \n\tend",
"def index\n # FIXME: if logged in as an author, only show own user's crUd stuff; for\n # admins, show all CRUD operations for all users\n if logged_in?\n @users = User.order(:name)\n else\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Cannot view all users.' }\n end\n end\n end",
"def nav(content = nil, options = {}, html_options = nil, &block)\n @items << UiBibz::Ui::Core::Component.new(Nav.new(content, options).tap(&block).render, {}, html_options)\n end",
"def workshop_navigation_links(workshop)\n content_tag :h3 do\n if ((current_user.role? \"SeniorCommittee\") || (current_user.role? \"TechManager\"))\n [\n link_to('<i class=\"icon-circle-arrow-left\"></i> Back'.html_safe,workshops_path),\n \"|\",\n link_to('<i class=\"icon-edit-sign\"></i> Edit'.html_safe,edit_workshop_path(workshop)) ,\n \"|\" ,\n link_to('<i class=\"icon-trash\"></i> Delete'.html_safe,workshop, :method => :delete, :data => { :confirm => 'Are you sure?'})\n ].join(' ').html_safe\n else\n [link_to('<i class=\"icon-circle-arrow-left\"></i> Back'.html_safe,workshops_path)].join(' ').html_safe\n end\n end\n end",
"def index\n if current_user\n if current_user.role == 2\n redirect_to users_adminhome_path\n else\n redirect_to home_user_path(current_user)\n end\n else\n redirect_to new_session_path\n end\n #@users = User.all\n\n end",
"def landing\n render text: '<h3>You logged in!</h3>', layout: true\n end",
"def index\n if !session[:token].nil?\n if (session[:user_id] == 'superadmin')\n redirect_to admin_companies_path\n else\n redirect_to dashboard_path\n end\n else\n render layout: false\n end\n end",
"def authorized\n if logged_in?\n return View(\"sessions/page_requires_login\"); \n end\n return View(\"Index\")\n end",
"def index\n redirect_to user_path(current_user)\n end",
"def index\n @header_navs = HeaderNav.all\n end",
"def index\n @links = current_user.links\n end",
"def nav\n 'nav_admin'\n end",
"def page_header_user\n return \"\" if @user.blank? || @user.nickname.blank?\n icon = <<-HTML\n <i class=\"icon-user\"></i>\n HTML\n unless @user.icon_url.blank?\n icon = <<-HTML\n <img src=\"#{@user.icon_url}\">\n HTML\n end\n html = <<-HTML\n <div class=\"page-header\">\n <h2><a href=\"#{user_path(@user.id)}\">#{icon} #{@user.nickname}</a><small> - #{t(\"#{controller_name}.#{action_name}.title\")}</small></h2>\n </div>\n HTML\n html.html_safe\n end",
"def index\n return check_logged_in unless current_user\n @pages = current_user.pages\n end",
"def nav(name=\"\", path=root_path, active='')\n active_class = active == controller.controller_name ? 'activelink' : ''\n markaby do #=> Markaby template.\n li :class => active_class do\n link_to(name, path)\n end\n end\n end",
"def home\n if user_signed_in?\n\n if current_user.connection_valid?\n @favorites = current_user.favorites\n @queries = current_user.queries\n @keytech_username = current_user.keytech_username\n # Load Dashboard async in javascript\n render 'home'\n else\n render 'invalid_login'\n end\n else\n\n # User is not signed in in platform\n render 'landing_page'\n end\n end",
"def output_nav(items)\n html = Array.new\n items.each do |text, path|\n item_path = Rails.application.routes.recognize_path(path)\n current_path = {:action => params[:action], :controller => params[:controller]}\n class_name = text.downcase\n if item_path[:controller] == current_path[:controller] && item_path[:action] == current_path[:action]\n class_name << \" active\"\n end\n html << content_tag(:li, link_to(text, path), :class => class_name)\n end\n html.join(\"\\n\").html_safe\n end",
"def index\n if user_signed_in?\n redirect_to dashboard_path\n else\n render :index\n #redirect_to new_user_session_url(subdomain: ENV[\"SUBDOMAIN\"])\n end\n end",
"def index\n if current_user.type == \"Passenger\"\n render :layout => 'passenger'\n elsif current_user.type == \"Driver\"\n render :layout => 'driver'\n elsif current_user.type == \"Company\"\n render :layout => 'company'\n end \n\tend",
"def test_navigation_logged_in\n authorize @valid_user\n get :index\n assert_tag \"a\", :content => /Logout/,\n :attributes => { :href => \"/user/logout\"}\n assert_no_tag \"a\", :content => /Register/\n assert_no_tag \"a\", :content => /Login/\n end",
"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 show\n if current_user.access == 2\n redirect_to \"/users/indexU\"\n end\n end",
"def index\n if signed_in?\n redirect_to current_user\n else\n redirect_to new_user_path\n end\n end",
"def render_custom_navigation\n if lookup_context.template_exists?('admin/shared/_custom_navigation')\n render 'admin/shared/custom_navigation'\n end\n end",
"def scope_nav\n return unless boolean_scopes.count > 0\n \n if default_scopes.any?\n result = []\n else\n result = [scope_link]\n end\n \n boolean_scopes.each do |name, s|\n result << scope_link(s)\n end\n \n content_tag :ul, result.join(\"\\n\").html_safe, :class => 'nav nav-pills'\n end",
"def navigation\n @rendered_nav ||= @formatter.new(\n Octant.get(:test), @formatter_options).to_html\n end",
"def index\n if params[:manage]\n session[:current_tab] = \"Manage\" \n session[:current_sub_tab] = \"Users\"\n @users = User.find(:all)\n elsif params[:space_id] && params[:space_id] != \"Public\"\n session[:current_tab] = \"People\" \n session[:current_sub_tab] = \"\"\n @users = @space.actors \n elsif params[:space_id] && params[:space_id] == \"Public\"\n session[:current_tab] = \"People\" \n session[:current_sub_tab] = \"\"\n @users = User.find(:all)\n else\n @users = User.find(:all)\n end\n \n @users.sort\n @users = @users.paginate(:page => params[:page],:per_page => 10)\n respond_to do |format|\n format.html\n format.xml { render :xml => @users }\n format.atom\n end\n end",
"def navbar_active\n # reset in controller for active navbar menu item\n @navbar_active = :shopping_cart\n end",
"def index\n if user_signed_in?\n @wants = current_user.wants\n render layout: \"layouts/twoColumn\"\n else\n redirect_to new_user_session_path\n end\n end",
"def user\n users_tasks = current_user.tasks\n @main_list = users_tasks.where(:done => false).order(\"deadline ASC\")\n @main_list_header = \"Not done\"\n @done_unbilled_tasks = users_tasks.where(:done => true, :billed => 0).order(\"deadline ASC\")\n @active_subnavi = \"USER\";\n render :index\n end",
"def show_nav_bar?(...)\n true\n end",
"def index\n redirect_to @current_user if current_user\n end",
"def render_menus \n# student_menu = add_menu('#{@studentb.full_name}')\n student_menu = add_menu('#{image_tag(@studentb.thumb_image,:style=>\";float:left;height:25px;margin-right:10px;\") + \" \" + @studentb.full_name + \" \"}',:action=>'profile')\n student_menu.add_submenu('Profile',:action=>'profile')\n student_menu.add_submenu('Photos',:action=>'photo',:if=>\"@studentb.visible_album_counts(@me) > 0\") \n student_menu.add_submenu('Binder',:action=>'show_notes',:if=>\"@studentb.notes.not_anonymous.size > 0\") \n \n end"
] |
[
"0.80729604",
"0.7991006",
"0.77432674",
"0.7552554",
"0.7259378",
"0.6888242",
"0.6786213",
"0.66048086",
"0.65513957",
"0.64602655",
"0.633531",
"0.6228377",
"0.6198695",
"0.61848515",
"0.61843866",
"0.61781484",
"0.61545825",
"0.61456376",
"0.6070461",
"0.6028583",
"0.6025634",
"0.6020926",
"0.6003493",
"0.5983979",
"0.59831",
"0.59680086",
"0.5967265",
"0.59663564",
"0.59566057",
"0.5937252",
"0.5931975",
"0.5924772",
"0.59224004",
"0.58958",
"0.5865274",
"0.5849982",
"0.584957",
"0.58260006",
"0.58152735",
"0.5778151",
"0.57663035",
"0.57663035",
"0.57620597",
"0.5758621",
"0.5749405",
"0.5737859",
"0.57245415",
"0.5705199",
"0.5696327",
"0.56946796",
"0.56897837",
"0.5687626",
"0.5687351",
"0.56792283",
"0.56789374",
"0.56770796",
"0.5668364",
"0.565613",
"0.5651506",
"0.5649055",
"0.56463665",
"0.56404257",
"0.5631764",
"0.5626182",
"0.5624804",
"0.56144005",
"0.5608463",
"0.5605301",
"0.5596073",
"0.5595985",
"0.5593157",
"0.5592622",
"0.55883926",
"0.5579584",
"0.55494475",
"0.5536831",
"0.55278796",
"0.5515084",
"0.5513723",
"0.55066496",
"0.55039376",
"0.55032825",
"0.54851866",
"0.54846615",
"0.5481901",
"0.54772186",
"0.5471599",
"0.5471599",
"0.5469749",
"0.5466314",
"0.5466209",
"0.54648656",
"0.54641134",
"0.5463319",
"0.54589057",
"0.5455408",
"0.54510236",
"0.54482657",
"0.54461074",
"0.54386955"
] |
0.66066456
|
7
|
Returns site name for actionbar, dependend on current site
|
def get_action_link
if controller_path == 'admin/articles'
case action_name
when 'index' then t('buttons/all_articles').html_safe
when 'new' then t('buttons/new_article').html_safe
when 'edit' then t('buttons/edit_article').html_safe
when 'show' then t('buttons/preview').html_safe
end
elsif controller_path == 'admin/authors'
case action_name
when 'index' then t('buttons/all_authors').html_safe
when 'new' then t('buttons/new_author').html_safe
when 'edit' then t('buttons/edit_author').html_safe
when 'show' then t('buttons/author').html_safe
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def site_name\n SITE_NAME\n end",
"def site_title\n if content_for?(:title)\n \"#{content_for(:title)} - \"\n elsif ['static'].include?(controller_name)\n if action_name == 'home'\n ''\n else\n \"#{action_name.humanize} - \"\n end\n elsif @breadcrumbs && @breadcrumbs.any?\n \"#{@breadcrumbs.last[:name]} - \"\n elsif controller_name\n \"#{controller_name.humanize} - \"\n else\n ''\n end + \"PaN Training Catalogue\"\n end",
"def apphelp_site_name\n t( :'uk.org.pond.canvass.site_name' )\n end",
"def determine_site\n @current_site.nil? ? nil : @current_site.name\n end",
"def name_site\n \"#{Site.name}\"\n end",
"def site_name\n\t\treturn get_configuration['sa_application_name']\n\tend",
"def site_name\r\n site.name rescue nil\r\n end",
"def site_title\n @site.title\n end",
"def site_title\n 'Intranet'\n end",
"def get_site\n controller.send(:current_site)\n end",
"def current_site; end",
"def site_name\n begin\n site_name = @nokogiri.title.split(/#{WebStat::Configure.get[\"regex_to_sprit_title\"]}/, 2).last\n rescue\n site_name = @nokogiri.title\n end\n if site_name.nil?\n \"No Sitename\"\n else\n site_name.strip\n end\n end",
"def theme_name\n if params[:action] == \"home\"\n @theme_name = ThemeOption.where(user_id: current_user.id).first.template.downcase\n else\n \"application\"\n end\n end",
"def current_site\n Site.current\n end",
"def page_title\n if controller.controller_name == \"dashboards\" && params.key?(\"id\")\n \"Nifty #{Dashboard.get(params[:id]).name}\"\n elsif controller.controller_name == \"widgets\" && params.key?(\"dashboard_id\")\n \"Nifty #{Dashboard.get(params[:dashboard_id]).name} Widgets\"\n else\n \"Nifty Monitoring Dashboard\"\n end\n end",
"def sidebar_view_site\n if Typus.link_to_view_site\n { :message => Typus::I18n.t(\"View Site\"),\n :url => Typus.admin_title_link,\n :link_to_options => { :target => '_blank' },\n :icon => \"share\" }\n end\n end",
"def friendly_current_page\n begin\n params[\"controller\"] + \"-\" + params[\"action\"]\n rescue\n \"example-app\"\n end\n end",
"def sourcename\n site ? site.name : \"Entity #{self.class.to_s} ##{id} has no site\"\n end",
"def theme_name\n \n if params[:action] == \"home\"\n @theme_name = ThemeOption.where(user_id: current_user.id).first.template.downcase\n else\n \"application\"\n end\n end",
"def theme_name\n if request.subdomain != \"www\" && request.subdomain.present?\n @subdomain = request.subdomain\n @site = Site.where(subdomain: request.subdomain).first\n @user = User.where(id: @site.user_id).first\n @theme_name = ThemeOption.where(site_id: @site.id).first.template\n @theme = ThemeName.where(id: @theme_name).first.name.downcase\n if params[:action] == \"home\"\n @theme\n elsif params[:action] == \"leasing\"\n @theme + \"leasing\"\n end\n else\n \"test\"\n end\n end",
"def site_layout\n if params[:action].to_s.in?(gift_actions)\n \"gift_application\"\n else\n \"application\"\n end\n end",
"def fb_page_title\n site_title\n end",
"def site_title\n \"#{settings.site_name} #{t('titles.docs')}\".titleize\n end",
"def site_url\n get_url(:site)\n end",
"def action_controller_title\n return \"#{action_name.camelize} #{controller_name.singularize.camelize}\"\n end",
"def default_base_title\n Rails.application.class.to_s.split('::').first\n end",
"def page_title\n if controller_name == 'pages'\n title = t \"#{action_name}_page\"\n \"#{app_name} | #{title}\" # e.g.: 'Ror4 | Home'\n else\n if @page_title.nil?\n \"#{app_name} | #{t controller_name}-#{t action_name}\" # e.g.: 'Ror4 | groups-index'\n else\n \"#{app_name} | #{t @page_title}\" # e.g.: 'Ror4 | Show group Manager'\n end\n end\n end",
"def navbar_brand_title\n t('.menus.brand.title', name: @studio.try(:name))\n end",
"def get_opera_beta_app_name()\n app_name = \"Opera Beta\"\n return app_name\nend",
"def title\n if detail_page?\n \"#{resource.name} - #{menu.name} - #{website_tag.name}\"\n else\n \"#{menu.name} - #{website_tag.name}\" \n end \n end",
"def page_title\n return \"#{this_webapp.webapp_name} - #{@page_title}\" if @page_title\n return \"#{this_webapp.webapp_name}\"\n end",
"def autotitle\n [:controller, :action].map { |e| params[e].to_s.singularize.titleize }.join(\" · \").html_safe\n end",
"def screen_name\n controller_name = t(\"controllers.#{params[:controller]}\").upcase\n action_name = t(\"actions.controllers.#{params[:action]}\").upcase\n \"#{controller_name} / #{action_name}\"\n end",
"def apphelp_title( ctrl = controller )\n \"#{ apphelp_site_name }: #{ apphelp_heading( ctrl ) }\"\n end",
"def site_url\n SITE_URL\n end",
"def app_name\n if CurrentUser.safe_mode?\n \"Safebooru\"\n else\n \"Danbooru\"\n end\n end",
"def default_controller_name\n @object.class == ApplicationController ? \"Home\" : @object.controller_name.titlecase\n end",
"def action_name\n name = self.request.route_obj.instance_variable_get('@named').to_s\n name.gsub!(/^#{controller_name}_?/, '')\n name = 'index' if name == ''\n name\n end",
"def get_application_name\r\n root_info = get_rails_root_info\r\n root_info.split('/').last.capitalize\r\n end",
"def get_satellite_eyes_app_name()\n app_name = \"Satellite Eyes\"\n return app_name\nend",
"def render_page_title\n @page_title ? \"#{@page_title}_#{SiteName}\" : SiteName rescue \"SITE_NAME\"\n end",
"def site_path\n settings.site_path\n end",
"def page_title\n @page_title || TaliaCore::SITE_NAME\n end",
"def discover_current_site\n site_from_host\n end",
"def title\n base_title = app_name \n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def app_name\n return @app_name\n end",
"def app_name\n return @app_name\n end",
"def tenant_name\n url_shortcut\n end",
"def page_title( this_title = nil )\n content_for( :title ) { \"#{ SITE_ID }: #{ this_title.nil? ? I18n.t( controller.controller_name + '.title' ) : this_title }\" }\n end",
"def controller_name; end",
"def controller_name; end",
"def user_page name\n\t\t@t[:title] = _var(:title, :www) if @t[:title] == nil\n\t\t_tpl name, _var(:layout, :www).to_sym, :www\n\tend",
"def app_name\n c.application\n end",
"def site\n @site ||= ::Shop.find_by_name(\"#{ request.env['HTTP_HOST'].split('.').first() }.myshopify.com\").api_url\n end",
"def site_name\n name = @doc.xpath(\"//div[@id='map']//h1/span/text()\").to_s\n sanitize name\n end",
"def load_resource\n current_site\n end",
"def title\n base_title = \"My Site\"\n unless @title.nil?\n \"#{base_title} | #{@title}\"\n else\n base_title\n end\n\n end",
"def title\n return params[:controller].camelize\n end",
"def slug\n @global_page.slug\n end",
"def navbar_facebook_name\n if Rails.env.development?\n if current_user_facebook\n t('.menus.facebook.sign_out.name')\n end\n else\n ''\n end\n end",
"def get_page_name\n if controller_name == \"profiles\"\n \"About\"\n else\n controller_name.titleize\n end\n end",
"def titler\n if @title.nil?\n $application_name\n else\n \"#{$application_name} : #{@title}\"\n end\n end",
"def app_name\n @app_name || Sapience.app_name\n end",
"def title\n @global_page.title\n end",
"def get_page_name\n controller_name == \"profiles\" ? \"About\" : controller_name.titleize\n end",
"def controller_name\n self.class.controller_name\n end",
"def i18n_library_title_key\n current_request.origin\n end",
"def current_site\n @current_site ||= Site.find_for_host(request.host)\n end",
"def app_name_slogan\n \"#{app_name} - #{slogan}\"\n end",
"def application_title\n t('application.title_html')\n end",
"def appname\n fetch(:appname) || script_name\n end",
"def current_company_name\n begin\n Client.find(current_subdomain).webname\n rescue\n \"\"\n end\n end",
"def appname\n @appname = \"Jazzify\"\n end",
"def app_display_name\n return @app_display_name\n end",
"def app_display_name\n return @app_display_name\n end",
"def app_display_name\n return @app_display_name\n end",
"def current_title\n evaluate(\"window.top.document.title\")\n end",
"def page_title(title = nil)\n if title\n content_for(:page_title) { title }\n else\n content_for?(:page_title) ? content_for(:page_title) : APP_CONFIG[:site_name] # or a hard-coded default\n end\n end",
"def current_site\n @site = Site.first\n end",
"def application_name\n @application_name ||= t('application.name')\n end",
"def global_name\n @appl_settings[:global_dir]\n end",
"def app_title\n title = ENV[\"APPLICATION_TITLE\"] ? ENV[\"APPLICATION_TITLE\"] : 'TransAM Application'\n return title.html_safe\n end",
"def page_name\n return params[:controller].singularize\n end",
"def format_name\n @site_name ? @site_name : \"\"\n end",
"def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end",
"def controller_name\n \"#{self.class.app_namespace}::#{@controller_name}\"\n end",
"def current_action\n self.controller.action_name.to_sym\n end",
"def app_name\n @app_name ||= Rails.app_class.module_parent_name.demodulize.underscore.dasherize\n end",
"def site_from_host\n Site.find_for_host(request.host)\n end",
"def app_name\n @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)\n end",
"def name\n self.class.to_s.gsub(/controller$/i, \"\")\n end",
"def full_title(page_title = '')\n base_title = app_name\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def controller_name\n self.request.route_obj.instance_variable_get('@controller')\n end",
"def full_title(page_title)\n if page_title.empty?\n app_name\n else\n \"#{page_title} | #{app_name}\"\n end\n end",
"def full_title(page_title)\n \t\tif page_title.empty?\n \t\t\tsite_name\n \t\telse\n \t\t\t\"#{page_title} | #{site_name}\"\n \t\tend\n \tend",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end",
"def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end"
] |
[
"0.7467426",
"0.7223307",
"0.715887",
"0.7113593",
"0.7081",
"0.7034416",
"0.698488",
"0.69227564",
"0.69054407",
"0.6782017",
"0.66539085",
"0.65367424",
"0.64602864",
"0.6431634",
"0.63876444",
"0.63821167",
"0.6381091",
"0.63328344",
"0.63316774",
"0.6323689",
"0.63007426",
"0.62651545",
"0.62480116",
"0.62080055",
"0.6203806",
"0.61970764",
"0.6192362",
"0.61564785",
"0.61467695",
"0.6128878",
"0.6126533",
"0.61147755",
"0.6105508",
"0.608875",
"0.60786915",
"0.60777",
"0.6066358",
"0.60619915",
"0.60491514",
"0.60467315",
"0.6030697",
"0.60085505",
"0.59871686",
"0.5978587",
"0.5970655",
"0.59558874",
"0.59558874",
"0.59460026",
"0.5940861",
"0.593928",
"0.593928",
"0.59360176",
"0.59209114",
"0.59200835",
"0.59195656",
"0.59144264",
"0.59119517",
"0.5911389",
"0.5907692",
"0.59066844",
"0.5887839",
"0.5887273",
"0.58863187",
"0.58810544",
"0.5868795",
"0.58687305",
"0.58548695",
"0.5841881",
"0.58407176",
"0.5834605",
"0.5833651",
"0.5829497",
"0.58291626",
"0.5827031",
"0.5827031",
"0.5827031",
"0.5824077",
"0.58019155",
"0.5794704",
"0.57862294",
"0.57839805",
"0.5759016",
"0.5755753",
"0.57528734",
"0.57361704",
"0.5734127",
"0.57295996",
"0.57243305",
"0.5718605",
"0.5709495",
"0.5706365",
"0.57051843",
"0.56880236",
"0.5685352",
"0.56844944",
"0.56812525",
"0.56812525",
"0.56812525",
"0.56812525",
"0.56812525",
"0.56812525"
] |
0.0
|
-1
|
Returns HTML for code blocks formatted with Pygment
|
def format_code(text)
simple_format( truncate( Sanitize.clean(markdown(text)).html_safe, escape: false, length: 299, separator: ' ', omission: ' …' ))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pygment_code_block(block)\n write_data block, 'code.rb', false\n system 'pygmentize -o block.html code.rb'\n File.open('block.html', 'r').read\n end",
"def render_code(code)\n render_block(Pygments.highlight(code, formatter: 'terminal256', lexer: 'ruby', options: {style: 'bw'}))\nend",
"def replace_code_blocks(contents)\n info = find_post_content_block(contents, '<p class=\"code\">', '</p>')\n while info\n formatted_block = pygment_code_block(info[:block])\n formatted_block = wrap_block_in_syntax_tags(formatted_block)\n contents = contents.split(\"\\n\")\n contents[info[:front]..info[:back]] = formatted_block\n contents = contents.join(\"\\n\")\n info = find_post_content_block(contents, '<p class=\"code\">', '</p>')\n end\n contents\n end",
"def pygmentize(code, lang)\n url = URI.parse 'http://pygments.simplabs.com/'\n options = {'lang' => lang, 'code' => code}\n begin\n Net::HTTP.post_form(url, options).body\n rescue\n \"<pre>#{code}</pre>\"\n end\n end",
"def highlight(blocks)\n puts \"Highlight code now\"\n\n ret = []\n for block in blocks\n doc, code = block\n\n # Process the code\n code = code.join(\"\\n\")\n unless code =~ /\\A\\s*\\z/\n code = Pygmentize.process(code, @options[:language])\n end\n\n doc = @md.render(doc.join(\"\\n\"))\n\n ret << {\n doc: doc,\n code: code\n }\n end\n\n puts \"Hello\"\n\n ret\n end",
"def pygmentize(file_name, code, lexer = nil)\n if lexer.present?\n Gitlab::Highlight.highlight(file_name, code)\n else\n \"<pre>#{Rack::Utils.escape_html(code)}</pre>\"\n end\n end",
"def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end",
"def block_code(code, language)\n \n lines=code.split(\"\\n\")\n lines.map! do |line|\n\n line=line.gsub(/\\&.squo;/, \"'\")\n line=line.gsub(/\\&.dquo;/, '\"')\n line=line.gsub(/</, \"<\")\n line=line.gsub(/>/, \">\")\n\n # Adding my own special coloring scheme for comments and outputs\n # (for which I've added my own special markup sequence, -->\n line=line.gsub(/(\\# .*$)/, \"<span.ps.class='comment'>\\\\1</span>\")\n line=line.gsub(/\\=\\=> (.*$)/, \"<span.ps.class='output'>\\\\1</span>\")\n\n # Kludgy way of only replacing spaces outside the HTML tags I'm adding to get comments\n # to be in a span of their own\n line=line.gsub(/ /, \" \")\n line=line.gsub(/\\.ps\\./, \" \")\n\n if /lt;/.match(line)\n puts \">>> #{line}\"\n end\n\n line\n end\n html_inner = lines.join(\"<br/>\\n\")\n\n html=\"<div class=mycode>\\n#{html_inner}\\n</div>\\n\"\n end",
"def parse_codeblocks(html); 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 code(lang, &block)\n source_code = capture(&block).strip\n eval('_erbout', block.binding).concat %Q(<pre class=\"CodeRay\"><code class=\"language-#{lang}\">#{html_escape source_code}</code></pre>)\nend",
"def codespan(code)\n \"{{#{code}}}\"\n end",
"def markup_code\n return '' unless @token_stream\n\n src = RDoc::TokenStream.to_html @token_stream\n\n # dedent the source\n indent = src.length\n lines = src.lines.to_a\n lines.shift if src =~ /\\A.*#\\ *File/i # remove '# File' comment\n lines.each do |line|\n if line =~ /^ *(?=\\S)/\n n = $&.length\n indent = n if n < indent\n break if n == 0\n end\n end\n src.gsub!(/^#{' ' * indent}/, '') if indent > 0\n\n add_line_numbers(src) if options.line_numbers\n\n src\n end",
"def block_code(code, language)\n if language.present?\n CodeRay.scan(code, language).div\n else\n \"<pre><code>#{code}</code></pre>\"\n end\n end",
"def highlight_codeblock(el)\r\n #puts highlight_code(el.value, el.attr['class'], :span)\r\n #h = ::Kramdown::Converter.syntax_highlighter(@options[:syntax_highlighter])\r\n #puts h.call(self, el.value, el.attr['class'], :span)\r\n #puts syntax_highlighter(self, el.value, el.attr['class'], :span)\r\n puts \"SB #{el.inspect}\"\r\n nil # until it's ready for Shoes to eval it. \r\n end",
"def backtick_codeblock(input)\n input.gsub /<p>`{3}\\s(\\w+)<\\/p>\\n\\n<pre><code>([^<]+)<\\/code><\\/pre>\\n\\n<p>`{3}<\\/p>/m do\n lang = $1\n str = $2.gsub('<','<').gsub('>','>')\n highlight(str, lang)\n end\n end",
"def formatted_body\n code_blocks = _get_code_blocks(self.body)\n red_clothed = RedCloth.new(body.gsub(REGEX, '${code_block}')).to_html\n\n code_blocks.each { |c|\n c = Syntaxi.new(c).process\n red_clothed.sub!(/\\$\\{code_block\\}/, c)\n }\n\n red_clothed\n end",
"def colorize(code, lang)\n if can_pygmentize?\n Albino.colorize(code, lang)\n else\n require 'net/http'\n Net::HTTP.post_form(URI.parse('http://pygments.appspot.com/'),\n {'code'=>code, 'lang'=>lang}).body\n end\n end",
"def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); end",
"def highlight(code, options = T.unsafe(nil)); end",
"def highlight_code(options={})\n require 'uv'\n\n wrap_with = options[:wrap_with] || ['','']\n text = @modified_string\n\n languages_syntax_list = File.readlines(\n File.expand_path(File.dirname(__FILE__) + '/../config/languages_syntax_list')\n ).map { |l| l.chomp }\n\n text.gsub!(/<code(\\s*?lang=[\"']?(.*?)[\"']?)?>(.*?)<\\/code>/) do\n if languages_syntax_list.include?($2)\n lang = $2\n else\n lang = 'ruby'\n end\n unless $3.blank?\n result = Uv.parse($3.gsub('<br/>', \"\\n\").gsub('<', '<').gsub('>', '>').gsub('"', '\"'), 'xhtml', lang, false, 'active4d')\n \"#{wrap_with[0].gsub('$lang', lang)}#{result}#{wrap_with[1]}\"\n end\n end\n\n # TODO: split string longer than 80 characters\n\n @modified_string = text\n self\n\n end",
"def codeblock\n H[:pre, attr, H[:code, value]]\n end",
"def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end",
"def syntax_highlight(html)\n line_numbers = config.line_numbers ? :table : nil\n opts = { css: :style, wrap: nil, line_numbers: line_numbers }\n html.gsub(/\\<code class=\"(.+?)\"\\>(.+?)\\<\\/code\\>/m) do\n lang, code = $1, $2\n code = CGI.unescapeHTML code\n CodeRay.scan(code, lang).html opts\n end\n end",
"def block_code(code, language)\n sha = Digest::SHA1.hexdigest(code)\n Rails.cache.fetch ['code', language, sha].join('-') do\n Pygments.highlight(code, lexer:language)\n end\n end",
"def wrap_block_in_syntax_tags(block)\n \"<div class=\\\"syntax\\\">\" + block + '</div>'\n end",
"def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end",
"def highlight(code, lang, options = T.unsafe(nil)); 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 thru_coderay #:nodoc:\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n elem, atts, code = $1, $2, CGI.unescapeHTML($3).sub(/\\A\\r?\\n/, '')\n\n lang_regexp = /\\blang=('|\")(.*?)\\1/io\n lang = atts[lang_regexp, 2]\n lang = :ruby if lang !~ /\\S/\n atts.sub! lang_regexp, %{lang=\"#{lang}\"}\n\n body = CodeRay.scan(code, lang).html(:css => :style)\n\n if code =~ /\\n/\n span = :para\n head = \"<ins><pre\"\n tail = \"</pre></ins>\"\n\n else\n span = :line\n head = \"<#{elem}\"\n tail = \"</#{elem}>\"\n end\n\n unless atts.sub!(/\\b(class=('|\"))(.*?\\2)/){ $1 + span + ' ' + $3 }\n atts << %{ class=\"#{span}\"}\n end\n\n %{#{head}#{atts}>#{body}#{tail}}\n end\n end",
"def block_html(html)\n html.gsub(/<markdown>([\\d\\D]+?)<\\/markdown>/) {|_|\n extensions = {fenced_code_blocks: true}\n renderer = Redcarpet::Markdown.new(WithHighlights, extensions)\n renderer.render(Regexp.last_match[1])\n }\n end",
"def inline_code; end",
"def escape_code_html(text)\n text.gsub(/<code[^>]*>(.*?)<\\/code>/m) do |t|\n \"<code>\" + h($1) + \"</code>\"\n end.gsub(/<pre[^>]*>(.*?)<\\/pre>/m) do |t|\n \"<pre>\" + h($1) + \"</pre>\"\n end\n end",
"def block_code(code, language)\n # highlight some code with a given language lexer \n # and formatter: html or terminal256 \n # and block if you want to stream chunks\n # github.com/jayferd/rouge/blob/master/lib/rouge.rb#L17\n Rouge.highlight(code, language || 'text', 'html') \n # watch out you need to provide 'text' as a default, \n # because when you not provide language in Markdown \n # you will get error: <RuntimeError: unknown lexer >\n end",
"def render(context)\n # Sanitize the code inside the block\n resolve_code = super.to_s.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n \n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n \n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end",
"def bob_code(options={}, &block)\n # if the only string is give, it must be filename by default\n if options.is_a? String\n f = options\n options = {}\n options[:filename] = f \n end\n if block_given?\n code = capture(&block)\n options[:brush] ||= :plain\n else\n unless options[:brush]\n # determine the brush from the filename\n if options[:filename]\n options[:brush] = case File.extname(options[:filename]).downcase\n when '.rb'\n :ruby\n when '.sh', '.ksh', '.csh'\n :shell\n when '.as3'\n :as3\n when '.cf'\n :cf\n when '.c#'\n :csharp\n when '.cpp', '.c'\n :cpp\n when '.css'\n :css\n when '.pas'\n :pascal\n when '.diff'\n :diff\n when '.erl'\n :elang\n when '.js'\n :javascript\n when '.java'\n :java\n when '.pl'\n :perl\n when '.php', '.php3'\n :php\n when '.txt'\n :plain\n when '.ps'\n :powershell\n when '.py', '.jy'\n :python\n when '.scala'\n :scala\n when '.sql'\n :sql\n when '.vb', '.vbs'\n :vb\n when '.xml', '.xhtml', '.xslt', '.html', '.xhtml'\n :xml\n else \n :plain # default value\n end\n end\n end\n code = raw File.read(Rails.root.join('code', options[:filename]))\n end\n s = raw \"<pre class=\\\"brush: #{options[:brush]}; highlight: #{options[:highlight_lines]}\\\">\"\n s += code\n s += raw '</pre>'\n end",
"def to_html_code(code)\n \"<figure class=\\\"highlight\\\"><pre><code class=\\\"language-resolve\\\" data-lang=\\\"#resolve\\\">\"\\\n \"#{code.chomp}</code></pre></figure>\"\n end",
"def html_syntax_highlight(source, type = T.unsafe(nil)); end",
"def final_pretty_code_listing(lines, caption=nil, ruby_filename=nil)\n # remove trailining white space\n lines.each_with_index {|r,i| lines[i]=r.rstrip}\n # make a string\n raw = lines.join(\"\\r\\n\") # windows friendly?\n # pretty print does not like <> brackets\n raw = process_angle_brackets_and_ampersands(raw)\n s = \"\"\n add_line(s, \"<pre class='prettyprint'>#{raw}</pre>\")\n if !caption.nil?\n caption = post_process_text(caption) # process text\n add_line(s, \"<div class='caption'>#{caption}</div>\") \n end \n if !ruby_filename.nil?\n\t add_line(s, \"<div class='download_src'>Download: <a href='#{ruby_filename}'>#{ruby_filename}</a>. Unit test available in the <%=machinelearning_dev_url(\\\"github project\\\")%></div>\")\n\tend\n return s\nend",
"def block_code(code, language)\n\n # --- Extract file name ---------------------- #\n filename = ''\n regx = Regexp.new(/(<!--\\s?filename:(\\s?.{1,}\\s?)-->\\n?)/)\n if !(code =~ regx).nil?\n code.match(regx)\n filename = $2.try(:strip) || ''\n code.gsub!(regx, '')\n end\n # -------------------------------------------- #\n\n lexer = Rouge::Lexer.find_fancy(language, code) || Rouge::Lexers::PlainText\n if lexer.tag == 'make'\n code.gsub! /^ /, \"\\t\"\n end\n formatter = rouge_formatter(lexer)\n result = formatter.format(lexer.lex(code))\n\n return result if language.blank? && filename.blank?\n\n # --- Compose language and filename section --- #\n\n info_inner_html = [filename, language].select(&:present?).map.with_index { |text, i|\n i == 0 ? \"<span class='highlight-info__inner'>#{text}</span>\" : nil\n }.compact.join('')\n\n %(<div class='highlight-info'>\n #{info_inner_html}\n </div>\n #{result}\n )\n # -------------------------------------------- #\n end",
"def parse_codeblock_fenced; end",
"def syntax_highlighter(html)\n doc = Nokogiri::HTML(html)\n doc.search(\"//pre[@lang]\").each do |pre|\n pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])\n end\n doc.to_s\n end",
"def textile_ruby( tag, atts, cite, content )\n %(<pre><code class=\"ruby\">#{content}</pre></code>)\n end",
"def call(tag, body, context)\n \n if param('fuse.pygmentize.eval_tags')\n body = website.blackboard.invoke(:content_processor, 'tags').call(context.clone(:content => body)).content\n end\n \n # figure out the indent level of the tag\n lines = body.split(/\\r?\\n/);\n last_line = lines.last\n tag_indent = \"\"\n if( last_line.match(/^[ \\t]+$/) ) \n tag_indent = last_line\n end\n \n # Strip off the tag_indent... and figure out the sections...\n state = 0\n\n for i in (0 .. (lines.size-1) )\n if( tag_indent.size > 0 ) \n lines[i] = lines[i].sub(/^[ \\t]{#{tag_indent.size}}/, \"\")\n end\n if state==0 \n if (!lines[i].strip.empty?) \n if( lines[i].match(/\\s*------+\\s*/) ) \n state=1\n else\n raise Exception, \"expecting 1st seperator: ------\"\n end\n end\n \n elsif state==1 \n m = lines[i].match(/\\s*([^:\\s]+)\\s*:\\s*(.+)/)\n raise Exception, \"left heading section expected.\" unless m\n leftlang = m[1]\n leftheading = m[2]\n leftcode =\"\"\n state=2\n\n elsif state==2\n if( lines[i].match(/\\s*------+\\s*/) ) \n state=3\n else\n raise Exception, \"expecting 2nd seperator: ------\"\n end\n \n elsif state==3\n if( lines[i].match(/\\s*------+\\s*/) ) \n state=4\n else\n leftcode += lines[i]+\"\\n\"\n end\n \n elsif state==4\n m = lines[i].match(/\\s*([^:\\s]+)\\s*:\\s*(.+)/)\n raise Exception, \"right heading section expected.\" unless m\n rightlang = m[1]\n rightheading = m[2]\n rightcode = \"\"\n state=5\n\n elsif state==5 \n if( lines[i].match(/\\s*------+\\s*/) ) \n state=6\n else\n raise Exception, \"expecting 4th seperator: ------\"\n end\n \n elsif state==6\n rightcode += lines[i]+\"\\n\"\n end\n end\n \n raise Exception, \"did not get all the sections: state: #{state}\" unless state==6\n \n # Execute the pygmentize tool\n lines = param('fuse.pygmentize_and_compare.lines') ? \",linenos=1\" : \"\"\n \n leftresult = pygmentize(leftlang, lines, leftcode)\n rightresult = pygmentize(rightlang, lines, rightcode)\n \n # Format the result\n result = \"#{tag_indent}<div class=\\\"compare\\\"><div class=\\\"compare-left\\\"><h3>#{leftheading}</h3><div class=\\\"syntax\\\">#{leftresult}</div></div><div class=\\\"compare-right\\\"><h3>#{rightheading}</h3><div class=\\\"syntax\\\">#{rightresult}</div></div><br class=\\\"clear\\\"/></div>\\n\"\n \n rescue Exception => e\n raise RuntimeError, \"Error processing the pygmentize_and_compare tag <#{context.ref_node.absolute_lcn}>: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def call(tag, body, context)\n \n if param('fuse.pygmentize.eval_tags')\n body = website.blackboard.invoke(:content_processor, 'tags').call(context.clone(:content => body)).content\n end\n \n # figure out the indent level of the tag\n last_line = body.split(/\\r?\\n/).last\n tag_indent = \"\"\n if( last_line.match(/^[ \\t]+$/) ) \n tag_indent = last_line\n end\n \n # Strip off the tag_indent...\n if( tag_indent.size > 0 ) \n buffer = \"\"\n for i in body.split(/\\r?\\n/)\n buffer += i.sub(/^[ \\t]{#{tag_indent.size}}/, \"\")+\"\\n\"\n end\n body = buffer.chomp\n end\n \n # Execute the pygmentize tool\n lang = param('fuse.pygmentize.lang')\n lines = param('fuse.pygmentize.lines') ? \",linenos=1\" : \"\"\n \n result = pygmentize(lang, lines, body)\n \n # Format the result\n result = \"#{tag_indent}<div class=\\\"syntax\\\">#{result}</div>\\n\"\n \n rescue Exception => e\n raise RuntimeError, \"Error processing the pygmentize tag <#{context.ref_node.absolute_lcn}>: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def html_markup_pre(text); end",
"def format_as_block_html(name, attr, body, indent); end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def thru_coderay\n gsub %r{<(code)(.*?)>(.*?)</\\1>}m do\n atts, code = $2, CGI.unescapeHTML($3)\n\n lang =\n if $2 =~ /lang=('|\")(.*?)\\1/i\n $2\n else\n :ruby\n end\n\n tag =\n if code =~ /\\n/\n :pre\n else\n :code\n end\n\n html = CodeRay.scan(code, lang).html(:css => :style)\n\n %{<#{tag} class=\"code\"#{atts}>#{html}</#{tag}>}\n end\n end",
"def html_highlight\n language, code = *values\n require 'coderay'\n language = 'nitro_xhtml' if language == 'ezamar'\n\n case language\n when *%w[ruby c delphi html nitro_xhtml plaintext rhtml xml]\n tokens = CodeRay.scan(code, language)\n html = tokens.html(:wrap => :div)\n when *%w[diff]\n require 'uv'\n Uv.parse(code, output = 'xhtml', syntax_name = language, line_numbers = false, render_style = 'amy', headers = false)\n else\n code = language if not code or code.strip.empty?\n html = tag(:pre, code)\n end\n end",
"def textile_code( tag, atts, cite, content )\n %(<pre><code>#{content}</pre></code>)\n end",
"def format_as_indented_block_html(name, attr, body, indent); end",
"def parse_codeblock; end",
"def block_code(text, lang=\"\")\n lang ||= lang.to_s\n result = \"```#{lang}\\n\"\n if lang.match RUBY_LANG\n result << ColorCode::Ruby.new(text).colorize\n else\n result << ColorCode::Unknown.new(text).colorize\n end\n result << \"```\\n\"\n result\n end",
"def format_code strip = true\n format_ruby self.code, strip\n end",
"def highlights; end",
"def highlights; end",
"def highlights; end",
"def test_link_syntax_is_not_processed_within_code_blocks\n markdown = @markdown.render(\" This is a code block\\n This is a link [[1]] inside\\n\")\n html_equal \"<pre class=\\\"prettyprint\\\"><code>This is a code block\\nThis is a link [[1]] inside\\n</code></pre>\\n\",\n markdown\n end",
"def code_highlighting_stylesheet\n Sass::Engine.new(<<STYLESHEET, syntax: :sass).render\npre\n background-color: #ccd\n margin: 0px\n padding: 0.75em\n .hll\n background-color: #ffffcc\n // Error\n .err\n border: 1px solid #FF0000\n .c\n color: #60a0b0\n font-style: italic /* Comment */\n .k\n color: #007020\n font-weight: bold /* Keyword */\n .o\n color: #666666 /* Operator */\n .cm\n color: #60a0b0\n font-style: italic /* Comment.Multiline */\n .cp\n color: #007020 /* Comment.Preproc */\n .c1\n color: #60a0b0\n font-style: italic /* Comment.Single */\n .cs\n color: #60a0b0\n background-color: #fff0f0 /* Comment.Special */\n .gd\n color: #A00000 /* Generic.Deleted */\n .ge\n font-style: italic /* Generic.Emph */\n .gr\n color: #FF0000 /* Generic.Error */\n .gh\n color: #000080\n font-weight: bold /* Generic.Heading */\n .gi\n color: #00A000 /* Generic.Inserted */\n .go\n color: #888888 /* Generic.Output */\n .gp\n color: #c65d09\n font-weight: bold /* Generic.Prompt */\n .gs\n font-weight: bold /* Generic.Strong */\n .gu\n color: #800080\n font-weight: bold /* Generic.Subheading */\n .gt\n color: #0044DD /* Generic.Traceback */\n .kc\n color: #007020\n font-weight: bold /* Keyword.Constant */\n .kd\n color: #007020\n font-weight: bold /* Keyword.Declaration */\n .kn\n color: #007020\n font-weight: bold /* Keyword.Namespace */\n .kp\n color: #007020 /* Keyword.Pseudo */\n .kr\n color: #007020\n font-weight: bold /* Keyword.Reserved */\n .kt\n color: #902000 /* Keyword.Type */\n .m\n color: #40a070 /* Literal.Number */\n .s\n color: #4070a0 /* Literal.String */\n .na\n color: #4070a0 /* Name.Attribute */\n .nb\n color: #007020 /* Name.Builtin */\n .nc\n color: #0e84b5\n font-weight: bold /* Name.Class */\n .no\n color: #60add5 /* Name.Constant */\n .nd\n color: #555555\n font-weight: bold /* Name.Decorator */\n .ni\n color: #d55537\n font-weight: bold /* Name.Entity */\n .ne\n color: #007020 /* Name.Exception */\n .nf\n color: #06287e /* Name.Function */\n .nl\n color: #002070\n font-weight: bold /* Name.Label */\n .nn\n color: #0e84b5\n font-weight: bold /* Name.Namespace */\n .nt\n color: #062873\n font-weight: bold /* Name.Tag */\n .nv\n color: #bb60d5 /* Name.Variable */\n .ow\n color: #007020\n font-weight: bold /* Operator.Word */\n .w\n color: #bbbbbb /* Text.Whitespace */\n .mb\n color: #40a070 /* Literal.Number.Bin */\n .mf\n color: #40a070 /* Literal.Number.Float */\n .mh\n color: #40a070 /* Literal.Number.Hex */\n .mi\n color: #40a070 /* Literal.Number.Integer */\n .mo\n color: #40a070 /* Literal.Number.Oct */\n .sb\n color: #4070a0 /* Literal.String.Backtick */\n .sc\n color: #4070a0 /* Literal.String.Char */\n .sd\n color: #4070a0\n font-style: italic /* Literal.String.Doc */\n .s2\n color: #4070a0 /* Literal.String.Double */\n .se\n color: #4070a0\n font-weight: bold /* Literal.String.Escape */\n .sh\n color: #4070a0 /* Literal.String.Heredoc */\n .si\n color: #70a0d0\n font-style: italic /* Literal.String.Interpol */\n .sx\n color: #c65d09 /* Literal.String.Other */\n .sr\n color: #235388 /* Literal.String.Regex */\n .s1\n color: #4070a0 /* Literal.String.Single */\n .ss\n color: #517918 /* Literal.String.Symbol */\n .bp\n color: #007020 /* Name.Builtin.Pseudo */\n .vc\n color: #bb60d5 /* Name.Variable.Class */\n .vg\n color: #bb60d5 /* Name.Variable.Global */\n .vi\n color: #bb60d5 /* Name.Variable.Instance */\n .il\n color: #40a070 /* Literal.Number.Integer.Long */\nSTYLESHEET\nend",
"def render_code(code)\n code.pegs.each { |peg| render_peg(peg) }\n end",
"def code(env)\n html_code <<\n css_code <<\n render(js_code,\n :TOKEN => Webconsole::Repl.token,\n :KEY_CODE => Webconsole.key_code,\n :CONTEXT => env['SCRIPT_NAME'] || \"\")\n end",
"def code_snippet(source_file, source_line) #exception\n ##backtrace = exception.backtrace.reject{ |bt| bt =~ INTERNALS }\n ##backtrace.first =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #caller =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #source_file, source_line = $1, $2.to_i\n\n source = source(source_file)\n\n radius = 3 # number of surrounding lines to show\n region = [source_line - radius, 1].max ..\n [source_line + radius, source.length].min\n\n # ensure proper alignment by zero-padding line numbers\n format = \" %2s %0#{region.last.to_s.length}d %s\"\n\n pretty = region.map do |n|\n format % [('=>' if n == source_line), n, source[n-1].chomp]\n end #.unshift \"[#{region.inspect}] in #{source_file}\"\n\n pretty\n end",
"def highlight(code)\n CodeRay.scan(code, :ruby).div(:css => :class)\n end",
"def segment(source_code) # rubocop:disable all\n sections, docs, code = [], [], []\n lines = source_code.split(\"\\n\")\n\n # The first line is ignored if it is a shebang line. We also ignore the\n # PEP 263 encoding information in python sourcefiles, and the similar ruby\n # 1.9 syntax.\n lines.shift if lines[0] =~ /^\\#\\!/\n lines.shift if lines[0] =~ /coding[:=]\\s*[-\\w.]+/ &&\n %w(python rb).include?(@options[:language])\n\n # To detect both block comments and single-line comments, we'll set\n # up a tiny state machine, and loop through each line of the file.\n # This requires an `in_comment_block` boolean, and a few regular\n # expressions for line tests. We'll do the same for fake heredoc parsing.\n in_comment_block = false\n in_heredoc = false\n single_line_comment, block_comment_start, block_comment_mid, block_comment_end =\n nil, nil, nil, nil\n unless @options[:comment_chars][:single].nil?\n single_line_comment = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:single])}\\\\s?\")\n end\n unless @options[:comment_chars][:multi].nil?\n block_comment_start = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*$\")\n block_comment_end = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n block_comment_one_liner = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\") # rubocop:disable Metrics/LineLength\n block_comment_start_with = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:start])}\\\\s*(.*?)$\")\n block_comment_end_with = Regexp.new(\"\\\\s*(.*?)\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:end])}\\\\s*$\")\n if @options[:comment_chars][:multi][:middle]\n block_comment_mid = Regexp.new(\"^\\\\s*#{Regexp.escape(@options[:comment_chars][:multi][:middle])}\\\\s?\")\n end\n end\n unless @options[:comment_chars][:heredoc].nil?\n heredoc_start = Regexp.new(\"#{Regexp.escape(@options[:comment_chars][:heredoc])}(\\\\S+)$\")\n end\n lines.each do |line|\n # If we're currently in a comment block, check whether the line matches\n # the _end_ of a comment block or the _end_ of a comment block with a\n # comment.\n if in_comment_block\n if block_comment_end && line.match(block_comment_end)\n in_comment_block = false\n elsif block_comment_end_with && line.match(block_comment_end_with)\n in_comment_block = false\n docs << line.match(block_comment_end_with).captures.first\n .sub(block_comment_mid || '', '')\n else\n docs << line.sub(block_comment_mid || '', '')\n end\n # If we're currently in a heredoc, we're looking for the end of the\n # heredoc, and everything it contains is code.\n elsif in_heredoc\n if line.match(Regexp.new(\"^#{Regexp.escape(in_heredoc)}$\"))\n in_heredoc = false\n end\n code << line\n # Otherwise, check whether the line starts a heredoc. If so, note the end\n # pattern, and the line is code. Otherwise check whether the line matches\n # the beginning of a block, or a single-line comment all on it's lonesome.\n # In either case, if there's code, start a new section.\n else\n if heredoc_start && line.match(heredoc_start)\n in_heredoc = Regexp.last_match[1]\n code << line\n elsif block_comment_one_liner && line.match(block_comment_one_liner)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_one_liner).captures.first\n elsif block_comment_start && line.match(block_comment_start)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n elsif block_comment_start_with && line.match(block_comment_start_with)\n in_comment_block = true\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.match(block_comment_start_with).captures.first\n elsif single_line_comment && line.match(single_line_comment)\n if code.any?\n sections << [docs, code]\n docs, code = [], []\n end\n docs << line.sub(single_line_comment || '', '')\n else\n code << line\n end\n end\n end\n sections << [docs, code] if docs.any? || code.any?\n normalize_leading_spaces(sections)\n end",
"def parse_codespan; end",
"def parse_lang_for_codeblock(source); end",
"def prettify\n @code.gsub(/(.{4})/, '\\1 ').strip\n end",
"def build\n html = []\n scripts.each do |script|\n code = File.read(script)\n html << %[<div class=\"file\" id=\"#{script}\"><pre>]\n html << highlight(code)\n html << %[</pre></div>]\n end\n text = html.join(\"\\n\")\n text = interlink(text)\n text = garnish(text)\n text\n end",
"def code\n str = Indentation.get\n str << \"var #{name} = function(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent { str << \"#{block}\\n\" }\n str << \"#{Indentation.get}};\\n\"\n str\n end",
"def content_for(code_object)\n Code.new(render_doc_markup_for(code_object),\n start_line_for(code_object), :text).\n with_line_numbers(use_line_numbers?).to_s\n end",
"def add_language_support_for_github_style_code(content)\n lang_regex = '\\\\[([^\\\\]]+)\\\\]'\n code_editor_regex = '\\\\(([^\\\\)]+)\\\\)'\n lang_and_editor_regex = \"(?:#{lang_regex})?(?:#{code_editor_regex})?\"\n content.gsub(/^```#{lang_and_editor_regex}\\s*?\\n?(.+?)^```\\s*$/m) do |match|\n languages, code_editor, content = $~.captures\n if languages\n \"bc[#{languages}]#{\"(#{code_editor})\" if code_editor}. #{strip_heredoc(content)}\"\n else\n \"bc. #{strip_heredoc(content)}\"\n end.gsub(/^\\s*\\n/m, '{{{github_br}}}')\n end\n end",
"def extract_code_blocks\n body.match /```([a-z]+)?\\n(.*)\\n```/\n end",
"def full_code\n build_body\n header + body + footer\n end",
"def code_block(str, language = nil, max_len = -1)\n if max_len > 0\n max_len -= code_block_builder('', language).length # Subtract markdown overhead\n str = str[0..max_len-1] if str.length > max_len\n end\n @result << code_block_builder(str, language)\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 indentation; end",
"def indentation; end",
"def to_s\n return unless filename\n\n result = []\n result << \"%= lang:#{language}#{highlight}\"\n result << '\\begin{code}'\n result.concat(raw_code)\n result << '\\end{code}'\n\n rescue CodeInclusionException => e\n code_error(e.message)\n end",
"def highlight_code(text, lang, type, opts = T.unsafe(nil)); end",
"def code_snippet(source_file, source_line) #exception\n ##backtrace = exception.backtrace.reject{ |bt| bt =~ INTERNALS }\n ##backtrace.first =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #caller =~ /(.+?):(\\d+(?=:|\\z))/ or return \"\"\n #source_file, source_line = $1, $2.to_i\n\n source = source(source_file)\n\n radius = @radius # number of surrounding lines to show\n region = [source_line - radius, 1].max ..\n [source_line + (radius + 2), source.length].min\n\n # ensure proper alignment by zero-padding line numbers\n #format = \" %6s %0#{region.last.to_s.length}d %s\"\n #pretty = region.map do |n|\n # format % [('=>' if n == source_line), n, source[n-1].chomp]\n #end #.unshift \"[#{region.inspect}] in #{source_file}\"\n #pretty\n\n # create an ordered hash of line => code\n region.map do |n|\n {n => source[n-1].rstrip}\n end\n end",
"def coderay(text = \"\")\n text.gsub(/\\<code( lang=\"(.+?)\")?\\>\\s*(.+?)\\<\\/code\\>/m) do \n CodeRay.scan($3, $2).div( :css => :class,\n :line_numbers => :inline,\n :tab_width => 2\n ) \n end\n end",
"def surround\r\n puts '{'\r\n yield\r\n puts '}'\r\nend",
"def smooth_offtags( text )\n unless @pre_list.empty?\n ## replace <pre> content\n text.gsub!(/<redpre#(\\d+)>/) do\n content = @pre_list[$1.to_i]\n if content.match(/<code\\s+class=\"(\\w+)\">\\s?(.+)/m)\n content = \"<code class=\\\"#{$1} syntaxhl\\\">\" + \n Redmine::SyntaxHighlighting.highlight_by_language($2, $1)\n end\n content\n end\n end\n end",
"def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end",
"def pygments_prefix\n self.class.pygments_prefix\n end",
"def process_code text\n # the first line is the lang identifier\n lang = text.lines.first.scan(/^#!+[\\s+]?(\\w+)/).flatten.first\n\n # if found remove first line from text\n if lang\n lang.downcase!\n text = text.lines.to_a[1..-1].join\n else\n lang = 'text'\n end\n\n # highlight and put into a `div` element\n html = CodeRay.scan(text, lang).div(:css => :class)\n end",
"def print_code(snippet)\n COLOR.send(:green, snippet)\n end",
"def code_format_print(code)\n indent = 0\n l = 1\n code.each_line do |ln|\n ln = ln.strip\n if(ln.match(/^end/))\n indent -= 4\n end\n indent = 0 if indent < 0\n ll = \" \"\n if(l<10)\n ll = \"00#{l} \"\n elsif(l<100)\n ll = \"0#{l} \"\n else\n ll = \"#{l} \"\n end\n l += 1\n\n puts ll + \" \"*indent + ln\n\n if(ln.match(/^class/))\n indent += 4\n elsif(ln.match(/^def/))\n indent += 4\n elsif(ln.match(/do$/))\n indent += 4\n end\n\n if(ln.match(/end$/) && !ln.match(/^end/))\n indent -= 4\n end\n end\nend",
"def show_opened_code(code)\n style = \"color: #{code.color || 'red'};\"\n code_text = \"#{code.ko}[#{code.bonus}] (#{code.show_code})\"\n code_text = content_tag(:b, content_tag(:span, code_text, style: style))\n code_text += (\", информация к коду: <br>#{code.info}<br>\").html_safe if code.info.present?\n content_tag(:div, code_text.html_safe)\n end",
"def surround\n puts '{'\n yield\n puts '}'\nend",
"def transform_code_blocks( str, rs )\n\t\t\t@log.debug \" Transforming code blocks\"\n\n\t\t\tstr.gsub( CodeBlockRegexp ) {|block|\n\t\t\t\tcodeblock = $1\n\t\t\t\tremainder = $2\n\n\n\t\t\t\ttmpl = %{\\n\\n<pre><code>%s\\n</code></pre>\\n\\n%s}\n\n\t\t\t\t# patch for ruby 1.9.1 bug\n\t\t\t\tif tmpl.respond_to?(:force_encoding) then\n\t\t\t\t\ttmpl.force_encoding(str.encoding)\n\t\t\t\tend\n\t\t\t\targs = [ encode_code( outdent(codeblock), rs ).rstrip, remainder ]\n\n\t\t\t\t# recover all backslash escaped to original form\n\t\t\t\tEscapeTable.each {|char, hash|\n\t\t\t\t\targs[0].gsub!( hash[:md5re]){char}\n\t\t\t\t}\n\n\t\t\t\t# Generate the codeblock\n\t\t\t\ttmpl % args\n\t\t\t}\n\t\tend",
"def surround\n\tputs \"{\"\n\tyield\n\tputs \"}\"\nend",
"def parse(text)\n text.split(/(<code.*?>.*?<\\/code>)/m).inject(\"\") do |result, piece|\n if piece =~ /^<code/\n result << highlight(piece.gsub(/<code.*?>|<\\/code>/, \"\"), parse_lang(piece)).chomp\n else\n result << format(piece)\n end\n end\n end",
"def bbcode_to_html(string); end",
"def convert_to_ruby (src)\n rb = \"\"\n # dunno how to deal with only leading declarations of ruby code,\n # so replace it with the other markings\n src.gsub!(/-%>/,\"%>\")\n while\tsrc.index(Embedded_ruby_line) != nil\n src.sub!(Embedded_ruby_line) { |match|\n match[match.index '%'] = \" \"\n \"<% \" + match + \" %>\"\n }\n end\n lines = src.split(Embedded_ruby_flag)\n\n is_ruby_line = false\n lines.each { |line|\n if (line.strip != \"\" and line.strip != nil)\n if is_ruby_line\n if line[0,1] == '='\n # line[0] = \" \"\n # rb += \"puts \" + line.strip\n rb+=\"gr_html_puts \"+line.strip\n else\n rb += line.strip\n end\n else\n rb += \"gr_html( \" + line.inspect + \" )\"\n end\n rb += \"\\n\"\n end\n is_ruby_line = (not is_ruby_line)\n }\n #puts rb\n return rb\n end",
"def process_code(data)\n return data if data.nil? || data.size.zero? || @codemap.size.zero?\n\n blocks = []\n @codemap.each do |id, spec|\n next if spec[:output] # cached\n\n code = spec[:code]\n if code.lines.all? { |line| line =~ /\\A\\r?\\n\\Z/ || line =~ /^( |\\t)/ }\n code.gsub!(/^( |\\t)/m, '')\n end\n\n blocks << [spec[:lang], code]\n end\n\n highlighted = begin\n blocks.size.zero? ? [] : Gollum::Albino.colorize(blocks)\n rescue ::Albino::ShellArgumentError, ::Albino::TimeoutExceeded,\n ::Albino::MaximumOutputExceeded\n []\n end\n\n @codemap.each do |id, spec|\n body = spec[:output] || begin\n if (body = highlighted.shift.to_s).size > 0\n update_cache(:code, id, body)\n body\n else\n \"<pre><code>#{CGI.escapeHTML(spec[:code])}</code></pre>\"\n end\n end\n data.gsub!(id, body)\n end\n\n data\n end",
"def comment_code\n block_match = /\\{([^\\{\\}]*)\\}/\n matches = @code.scan(block_match)\n return if matches.size != 1\n \n block = matches[0][0].to_s\n @code.gsub!(block_match, \"{\\n#{comment_struct_list(block)}#{@indent}}\")\n end",
"def content \n \trenderer = SyntaxRenderer.new(optionize [\n \t:with_toc_data,\n \t#{:hard_wrap,\n \t:xhtml,\n \t:prettify\n \t])\n \n \tmarkdown = Redcarpet::Markdown.new(renderer, optionize([\n \t:fenced_code_blocks,\n \t:no_intra_emphasis,\n \t:tables,\n \t:superscript,\n \t:autolink,\n \t:strikethrough,\n \t:space_after_headers,\n \t:with_toc_data,\n \t:quote,\n \t:lax_spacing\n \t]))\n \n \treturn markdown.render(parse_links(@content)) \n\tend"
] |
[
"0.82708204",
"0.7398464",
"0.73400646",
"0.7310136",
"0.71995157",
"0.7175097",
"0.6974562",
"0.6914219",
"0.6911271",
"0.67414504",
"0.6704593",
"0.66861206",
"0.66762227",
"0.6658763",
"0.66263986",
"0.6597498",
"0.6522186",
"0.6481362",
"0.64424443",
"0.6422328",
"0.6387824",
"0.63695806",
"0.63537574",
"0.63100165",
"0.62774694",
"0.6261286",
"0.6255298",
"0.62527496",
"0.62504834",
"0.62057555",
"0.6184012",
"0.61774606",
"0.6174547",
"0.6172884",
"0.61230576",
"0.61135185",
"0.60884804",
"0.6069522",
"0.60690475",
"0.60663867",
"0.60452974",
"0.5989494",
"0.59844303",
"0.5984231",
"0.5970182",
"0.59493345",
"0.59476423",
"0.5926882",
"0.5926882",
"0.5909239",
"0.59079653",
"0.58934265",
"0.58853847",
"0.5869311",
"0.58642894",
"0.58132786",
"0.5811644",
"0.5811644",
"0.5811644",
"0.58111316",
"0.57881814",
"0.577709",
"0.57570314",
"0.57540363",
"0.5745702",
"0.5737758",
"0.5732289",
"0.57184875",
"0.57164985",
"0.5710942",
"0.56877923",
"0.56857145",
"0.56841344",
"0.5684134",
"0.56751806",
"0.5666096",
"0.5665889",
"0.56634223",
"0.56634223",
"0.56633914",
"0.565726",
"0.56572485",
"0.5642447",
"0.56240845",
"0.5622304",
"0.56186473",
"0.55931336",
"0.5588913",
"0.5574895",
"0.55640304",
"0.55574936",
"0.55560493",
"0.5553934",
"0.5545701",
"0.5530659",
"0.55265594",
"0.5498383",
"0.5496347",
"0.5485645",
"0.5482006"
] |
0.62506694
|
28
|
POST /cyclists POST /cyclists.json
|
def create
@cyclist = Cyclist.new(cyclist_params)
@cyclist.shift_id = params["shift"]["id"]
respond_to do |format|
if @cyclist.save
format.html { redirect_to "/shifts/#{params['shift']['id']}", notice: "Cyclist data was successfully submitted at #{Time.now.localtime.strftime("%a, %b %d %Y, %I:%M %P")}." }
format.json { render :show, status: :created, location: @cyclist }
else
format.html { render :new }
format.json { render json: @cyclist.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @cyclist = Cyclist.new(params[:cyclist])\n\n respond_to do |format|\n if @cyclist.save\n format.html { redirect_to @cyclist, notice: 'Cyclist was successfully created.' }\n format.json { render json: @cyclist, status: :created, location: @cyclist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cyclist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cyclist = Cyclist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cyclist }\n end\n end",
"def set_cyclist\n @cyclist = Cyclist.find(params[:id])\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def destroy\n @cyclist = Cyclist.find(params[:id])\n @cyclist.destroy\n\n respond_to do |format|\n format.html { redirect_to cyclists_url }\n format.json { head :no_content }\n end\n end",
"def cyclist_params\n params.require(:cyclist).permit(:quantity, :sex, :helmet, :sidewalk, :wrong_way)\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def update\n @cyclist = Cyclist.find(params[:id])\n\n respond_to do |format|\n if @cyclist.update_attributes(params[:cyclist])\n format.html { redirect_to @cyclist, notice: 'Cyclist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cyclist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end",
"def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end",
"def create\n @list = Blog::List.new(list_params)\n\n respond_to do |format|\n if @list.save\n ActionCable.server.broadcast \"board\",\n { commit: 'addList', \n payload: render_to_string(:show, formats: [:json]) }\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_params\n params.require(:list).permit(:title, :category_id, :body)\n end",
"def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to club_path(@list.club_id), notice: 'List was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end",
"def create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end",
"def create\n @day_list = DayList.new(params[:day_list])\n\n respond_to do |format|\n if @day_list.save\n format.html { redirect_to @day_list, notice: 'Day list was successfully created.' }\n format.json { render json: @day_list, status: :created, location: @day_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @day_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @list = List.find(params[:list_id])\n @comment = Comment.where(list_id: @list.id).new(comment_params)\n @comment.user = @current_user\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n \n end",
"def create\n @coffeeshoplist = Coffeeshoplist.new(coffeeshoplist_params)\n\n respond_to do |format|\n if @coffeeshoplist.save\n format.html { redirect_to @coffeeshoplist, notice: 'Coffeeshoplist was successfully created.' }\n format.json { render :show, status: :created, location: @coffeeshoplist }\n else\n format.html { render :new }\n format.json { render json: @coffeeshoplist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @cyclist = Cyclist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cyclist }\n end\n end",
"def new\n @list = List.new\n 1.times { @list.tasks.build }\n respond_with(@list)\n end",
"def create\n @project = Project.new(project_params)\n if params[:project][:category_list].present?\n @project.category_list = []\n params[:project][:category_list].each do |cat|\n @project.category_list.add(cat)\n end \n end\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end",
"def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end",
"def create\n @activities_list = ActivitiesList.new(activities_list_params)\n\n respond_to do |format|\n if @activities_list.save\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully created.' }\n format.json { render :show, status: :created, location: @activities_list }\n else\n format.html { render :new }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_list = TaskList.new(params[:task_list])\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @task_list = TaskList.new(params[:task_list])\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @waiting_list = WaitingList.new(params[:waiting_list])\n\n respond_to do |format|\n if @waiting_list.save\n format.html { redirect_to @waiting_list, notice: 'Waiting list was successfully created.' }\n format.json { render json: @waiting_list, status: :created, location: @waiting_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @waiting_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_list = TaskList.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tlcp_rueba_list = TlcpRuebaList.new(tlcp_rueba_list_params)\n\n respond_to do |format|\n if @tlcp_rueba_list.save\n format.html { redirect_to @tlcp_rueba_list, notice: 'Tlcp rueba list was successfully created.' }\n format.json { render :show, status: :created, location: @tlcp_rueba_list }\n else\n format.html { render :new }\n format.json { render json: @tlcp_rueba_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @college_wish_list = CollegeWishList.new(params[:college_wish_list])\n\n respond_to do |format|\n if @college_wish_list.save\n format.html { redirect_to @college_wish_list, notice: 'College wish list was successfully created.' }\n format.json { render json: @college_wish_list, status: :created, location: @college_wish_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @college_wish_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end",
"def create\n @duelist = Duelist.new(duelist_params)\n\n respond_to do |format|\n if @duelist.save\n format.html { redirect_to @duelist, notice: 'Duelist was successfully created.' }\n format.json { render :show, status: :created, location: @duelist }\n else\n format.html { render :new }\n format.json { render json: @duelist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @black_list = BlackList.new(params[:black_list])\n\n respond_to do |format|\n if @black_list.save\n format.html { redirect_to black_lists_path, notice: 'Balck list was successfully created.' }\n format.json { render json: @black_list, status: :created, location: @black_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @black_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end",
"def create\n\t\t@list = List.new(list_params)\n\t\t@list.save\n\t\t\tredirect_to '/tasks'\n\tend",
"def create\n # initializes a GroceryList with attributes automatically\n # mapped to the respective database columns\n @grocery_list = GroceryList.new(grocery_list_params)\n\n # saves the model in the database\n if @grocery_list.save\n render json: @grocery_list, status: :created\n else\n render json:{\n errors: @grocery_list.errors.full_messages\n },\n status: 422 # unprocessable entity\n end\n end",
"def list_params\n params.require(:list).permit(:name, :campsite_id)\n end",
"def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end",
"def create\n \n @day_road_list = DayRoadList.new(day_road_list_params)\n\n respond_to do |format|\n if @day_road_list.save\n format.html { redirect_to @day_road_list, notice: 'Данные добавлены' }\n format.json { render :index, location: @day_road_list }\n else\n format.html { render :new }\n format.json { render json: @day_road_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @list = List.new\n\n @list.list_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Nice Work- List Created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_list = Task::List.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def create_list\n # First delete all current contacts for this user (no overlapping contacts)\n Contact.delete_all(\"user_id = #{current_user.id}\")\n \n # Parse the list (json encoded) and create individual contact entries\n if params[:contacts].nil? || params[:contacts].empty?\n return render :status => 170, :json => {:message => 'Contacts are missing.'}\n end\n contacts = ActiveSupport::JSON.decode(CGI::unescape(params[:contacts]))\n \n total_saved = 0\n contacts.each do |contact|\n # Verify this contact has all required params\n next if (!contact.key?('name') || !contact.key?('email') || !contact.key?('source'))\n\n # Create new contact entry\n Contact.create({\n :user_id => current_user.id,\n :name => contact['name'],\n :email => contact['email'],\n :source => contact['source']\n })\n\n total_saved += 1\n end\n\n render :status => 200, :json => {:message => \"Contacts saved successfully (#{total_saved} of #{contacts.size}).\"}\n end",
"def create\n @news_list = NewsList.new(params[:news_list])\n\n respond_to do |format|\n if @news_list.save\n format.html { redirect_to @news_list, notice: 'News list was successfully created.' }\n format.json { render json: @news_list, status: :created, location: @news_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @news_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n name, board_id = params[:name], params[:board_id]\n @list = List.new\n @list.name = name\n @list.board_id = board_id\n @list.order = List.get_max_order board_id\n @lists_size = List.get_size board_id\n respond_to do |format|\n if @lists_size < 6 && @list.save\n @lists_size += 1\n format.js { render action: 'create', status: :created, location: @list}\n else\n format.js { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @component_list = ComponentList.new(component_list_params)\n\n respond_to do |format|\n if @component_list.save\n format.html { redirect_to @component_list, notice: 'Component list was successfully created.' }\n format.json { render :show, status: :created, location: @component_list }\n else\n format.html { render :new }\n format.json { render json: @component_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todoslist = Todoslist.new(todoslist_params)\n\n respond_to do |format|\n if @todoslist.save\n format.html { redirect_to @todoslist, notice: \"Todoslist was successfully created.\" }\n format.json { render :show, status: :created, location: @todoslist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @todoslist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n admin_control = AdminControl.find(params[:admin_control_id])\n checklist = admin_control.checklists.create\n redirect_to admin_control_path(admin_control.id)\n\n end",
"def create\n #@list = List.new(list_params)\n @list = current_user.lists.create(list_params)\n if params[:campsite_id] && @list.listeds.find_by_campsite_id(params[:campsite_id]).blank?\n campsite = Campsite.find(params[:campsite_id])\n @listed = campsite.listeds.create(list:@list.id, user_id:current_user.id)\n #@listed = Listed.new()\n #@listed.list_id = @list.id\n #@listed.user_id = current_user.id\n #@listed.save\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to management_lists_path, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.lists')\n url = build_url(url)\n payload = list.to_json\n response = RestClient.post(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end",
"def mustdo_list_params\n params.require(:mustdo_list).permit(:title, :category, :description)\n end",
"def create\n @task = Task.new(task_params)\n @task.list_id = params[:list_id]\n @task.save\n redirect_to user_category_list_path(@task.list.category, @task.list)\n end",
"def create\n @collectible_attribute_list = CollectibleAttributeList.new(collectible_attribute_list_params)\n\n respond_to do |format|\n if @collectible_attribute_list.save\n format.html { redirect_to @collectible_attribute_list, notice: 'Collectible attribute list was successfully created.' }\n format.json { render :show, status: :created, location: @collectible_attribute_list }\n else\n format.html { render :new }\n format.json { render json: @collectible_attribute_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully created.\" }\n format.json { render :json=>@todo_list, :status=>:created, :location=>@todo_list }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@todo_list.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def create\n @calllist = Calllist.new(calllist_params)\n\n respond_to do |format|\n if @calllist.save\n format.html { redirect_to @calllist, notice: 'Calllist was successfully created.' }\n format.json { render :show, status: :created, location: @calllist }\n else\n format.html { render :new }\n format.json { render json: @calllist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @calllist = Calllist.new(calllist_params)\n\n respond_to do |format|\n if @calllist.save\n format.html { redirect_to @calllist, notice: 'Calllist was successfully created.' }\n format.json { render :show, status: :created, location: @calllist }\n else\n format.html { render :new }\n format.json { render json: @calllist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def calllist_params\n params.require(:calllist).permit(:calllists_day, :custname, :custcode, :shipto, :rep, :csr, :dept, :item, :phone, :manager, :totalitems, :called, :called_date, :id, :ordered, :notes, :called_csr, :called_day, :called_route, :callback_day, :callback_date, :instructions)\n end",
"def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n records = nested.collect do |_, fields| \n\n ListItem.new( { \"list\" => @list }.merge( fields ) ) if !item_blank?( fields )\n\n end.compact\n\n respond_to do |format|\n if @list.save && records.map( &:save ).all?\n\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n\n else\n\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end",
"def create\n @list = @project.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@project, @list], notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @task = current_user.lists.find(params[:list_id]).tasks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def create\n @category_of_playlists_channel = CategoryOfPlaylistsChannel.new(category_of_playlists_channel_params)\n\n respond_to do |format|\n if @category_of_playlists_channel.save\n format.html { redirect_to @category_of_playlists_channel, notice: 'Category of playlists channel was successfully created.' }\n format.json { render :show, status: :created, location: @category_of_playlists_channel }\n else\n format.html { render :new }\n format.json { render json: @category_of_playlists_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delivery_list_params\r\n params.require(:delivery_list).permit(:client_dc_no, :our_dc_no, :j_name, :j_id, :fresh_pecs, :rework_pecs, :reject_pecs, :notes, :job_list_id)\r\n end",
"def create\n @activity_list = ActivityList.new(activity_list_params)\n\n respond_to do |format|\n if @activity_list.save & current_user.admin?\n format.html { redirect_to @activity_list, notice: 'Activity list was successfully created.' }\n format.json { render :show, status: :created, location: @activity_list }\n else\n format.html { render :new }\n format.json { render json: @activity_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cilist_params\n params.require(:cilist).permit(:cell_or_location, :waste_type_id, :benefit_id, :current_state, :improvement_suggestion, :implementation_status_id, :feasibility_id, :user_id, :sort_order, :active_status)\n end",
"def create\n @list = current_user.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully created.' }\n format.json { render json: @todo_list, status: :created, location: @todo_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.build(params[:list])\n respond_to do |format|\n format.js\n end\n end",
"def create\n @recipe_list = RecipeList.new(recipe_list_params)\n\n respond_to do |format|\n if @recipe_list.save\n format.html { redirect_to @recipe_list, notice: 'Recipe list was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_list }\n else\n format.html { render :new }\n format.json { render json: @recipe_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url_list = UrlList.new(url_list_params)\n\n respond_to do |format|\n if @url_list.save\n format.html { redirect_to @url_list, notice: 'Url list was successfully created.' }\n format.json { render :show, status: :created, location: @url_list }\n else\n format.html { render :new }\n format.json { render json: @url_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end",
"def create\n @model_list = ModelList.new(model_list_params)\n\n respond_to do |format|\n if @model_list.save\n format.html { redirect_to @model_list, notice: 'Model list was successfully created.' }\n format.json { render :show, status: :created, location: @model_list }\n else\n format.html { render :new }\n format.json { render json: @model_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @twitter_list = TwitterList.new(params[:twitter_list])\n\n respond_to do |format|\n if @twitter_list.save\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully created.' }\n format.json { render json: @twitter_list, status: :created, location: @twitter_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @doulist = Doulist.new(doulist_params)\n\n respond_to do |format|\n if @doulist.save\n format.html { redirect_to @doulist, notice: 'Doulist was successfully created.' }\n format.json { render :show, status: :created, location: @doulist }\n else\n format.html { render :new }\n format.json { render json: @doulist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n if @list.save\n redirect_to @list, :notice =>\"List successfully created.\"\n else\n flash[:error] = \"Your list could not be saved.\"\n render :action => \"new\"\n end\n end",
"def create\n @wellist = Wellist.new(wellist_params)\n\n if @wellist.save\n render json: @wellist, status: :created, location: @wellist\n else\n render json: @wellist.errors, status: :unprocessable_entity\n end\n end",
"def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end",
"def create\n campsite = Campsite.find(params[:campsite_id])\n if user_signed_in? && current_user.lists.find(params[:list_id]).present? #verify ownership\n unless campsite.listeds.present? && campsite.listeds.where(list_id:params[:list_id]).present?\n #Listed.find_by(list_id:params[:list_id], listable_id:campsite.id, listable_type:'Campsite').blank?\n # if it passes these hurdles, create the list\n #if campsite.listeds.find_by(list_id:params[:list_id]).blank? && !current_user.lists.find_by(list_id:params[:list_id]).blank?\n @listed = campsite.listeds.create(list_id:params[:list_id])\n else\n @listed = campsite.listeds.find_by(list_id:params[:list_id])\n end\n end\n\n respond_to do |format|\n if @listed.save\n puts \"Campsite was added to list\"\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully created.' }\n format.json { render json: {message:\"Created successfully\"} }\n else\n puts \"Campsite was not added to list\"\n format.html { render action: 'new' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(params[:list])\n Grade.all.each do |g|\n @list.posts.build(gname: g.name, tname: g.teacher_name)\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/#{@version}/list/create/\"\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n make_post_request(endpoint, custom_params)\n end",
"def create\n @keylist = Keylist.new(keylist_params)\n\n respond_to do |format|\n if @keylist.save\n format.html { redirect_to @keylist, notice: 'Keylist was successfully created.' }\n format.json { render :show, status: :created, location: @keylist }\n else\n format.html { render :new }\n format.json { render json: @keylist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_post(api_key, access_token, list, body, opts = {})\n list_post_with_http_info(api_key, access_token, list, body, opts)\n return nil\n end",
"def create\n @list_cat = ListCat.new(params[:list_cat])\n\n respond_to do |format|\n if @list_cat.save\n flash[:notice] = 'ListCat was successfully created.'\n format.html { redirect_to(:controller => 'list_cats', :action => 'edit', :id => @list_cat.id) }\n format.xml { render :xml => @list_cat, :status => :created, :location => @list_cat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @list_cat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n @todoit_list = TodoitList.new(todoit_list_params)\n\n respond_to do |format|\n if @todoit_list.save\n format.html { redirect_to @todoit_list, notice: 'Todoit list was successfully created.' }\n format.json { render action: 'show', status: :created, location: @todoit_list }\n else\n format.html { render action: 'new' }\n format.json { render json: @todoit_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = current_user.lists.find params[:list_id]\n @task = @list.tasks.build(params[:task])\n authorize! :read, @list\n authorize! :create, @task\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @list, notice: I18n.t('tasks.create_success') }\n format.json { render json: @task, status: :created, location: list_task_path(@list, @task) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stopword_list = StopwordList.new(params[:stopword_list])\n\n respond_to do |format|\n if @stopword_list.save\n format.html { redirect_to @stopword_list, notice: 'Stopword list was successfully created.' }\n format.json { render json: @stopword_list, status: :created, location: @stopword_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stopword_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save(list_params)\n if(cookies[:list].blank?)\n cookies[:list]=\"\"\n end\n cookies[:list]=cookies[:list]+\",#{@list.id}\"\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n \n else\n @lists=set_lists\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end",
"def list_params\n params.require(:list).permit(:todo)\n end",
"def create\n @checklist = Checklist.new(checklist_params)\n\n respond_to do |format|\n if @checklist.save\n format.html { redirect_to @checklist, notice: 'Checklist was successfully created.' }\n format.json { render json: @checklist, status: :created, location: @checklist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @checklist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @watch_list = WatchList.new(params[:watch_list])\n\n respond_to do |format|\n if @watch_list.save\n format.html { redirect_to @watch_list, notice: 'Watch list was successfully created.' }\n format.json { render json: @watch_list, status: :created, location: @watch_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @watch_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @task_list = @project.task_lists.new\n\n respond_with @task_lists\n end"
] |
[
"0.7611551",
"0.6480665",
"0.6416619",
"0.61685336",
"0.6167848",
"0.61156625",
"0.58950394",
"0.5883342",
"0.5850696",
"0.57932186",
"0.57357115",
"0.5664974",
"0.5620122",
"0.55992705",
"0.55777174",
"0.55715436",
"0.5565492",
"0.55392015",
"0.5537278",
"0.5516368",
"0.54851836",
"0.5468496",
"0.54399884",
"0.54283905",
"0.5423775",
"0.54114014",
"0.5396364",
"0.5379825",
"0.5365919",
"0.53658503",
"0.53648937",
"0.5355211",
"0.5350981",
"0.5347666",
"0.53456014",
"0.5342253",
"0.5341297",
"0.5340675",
"0.533848",
"0.5320462",
"0.5304742",
"0.5290392",
"0.52885634",
"0.5282235",
"0.52765703",
"0.52740675",
"0.52727115",
"0.52662253",
"0.52662253",
"0.52655274",
"0.5265086",
"0.5262996",
"0.52462053",
"0.52413833",
"0.52394646",
"0.52324146",
"0.522574",
"0.52246386",
"0.522417",
"0.5217336",
"0.52030516",
"0.52030516",
"0.51994103",
"0.51967967",
"0.5192225",
"0.5189648",
"0.5176733",
"0.5176717",
"0.5175135",
"0.5170445",
"0.51612824",
"0.5159567",
"0.515673",
"0.5153367",
"0.51531917",
"0.5151281",
"0.5148034",
"0.5147994",
"0.5132654",
"0.51316",
"0.51315886",
"0.51157796",
"0.5107011",
"0.5097016",
"0.50894594",
"0.50885785",
"0.5083307",
"0.5081144",
"0.5080138",
"0.5076087",
"0.5075988",
"0.50753474",
"0.5071461",
"0.506445",
"0.5056992",
"0.5056816",
"0.50481695",
"0.50479466",
"0.50476",
"0.50437456"
] |
0.67147046
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_cyclist
@cyclist = Cyclist.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 cyclist_params
params.require(:cyclist).permit(:quantity, :sex, :helmet, :sidewalk, :wrong_way)
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
|
GET /students/1 GET /students/1.json
|
def show
redirect_to root_path, notice: "Survey submitted!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end",
"def show\n student = Student.find(params[:id])\n render json: student\nend",
"def show\n @student = User.find params[:id]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student }\n end\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def index\n @students = Student.all\n render json: @students\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @student }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @student }\n end\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def show\n respond_to do |format|\n format.json {\n\n @student = User.find_by_id(params[:id])\n\n if @student\n render :json => @student\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n # @student = Student.find(params[:id])\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 @students = Student.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def index\n puts render json: @user.students, each_serializer: UserSerializer\n end",
"def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @students }\n end\n end",
"def show\n student = Student.find(params[:id])\n\n render json: {status: 'SUCCESS', message:\"Student listed with name #{student.name}\", data:student}, status: :ok\n end",
"def show\n render json: @student\n end",
"def show\n @student_user = StudentUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_user }\n end\n end",
"def index\n @students = current_user.groups[0].students\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n \n \n format.json { render json: @student }\n end\n end",
"def show\n student = Student.find(params[:id])\n render json: { status: '200', message: \"Loaded Student with id #{params[:id]}\", data: student }, status: :ok\n rescue ActiveRecord::RecordNotFound\n render json: { status: '404', error: \"No Student with id #{params[:id]}\", data: student }, status: :not_found\n end",
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def show\r\n @student1 = Student1.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @student1 }\r\n end\r\n end",
"def index\n @students = Student.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @students.pluck(:id, :firstname, :lastname) }\n end\n end",
"def index\n @students = Student.all\n respond_to do |format|\n\t\t\tformat.html { render :index }\n\t\t\tformat.json { render json: Oj.dump(@students) }\n\t\tend\n end",
"def show\n @student = Student.find(params[:id])\n @times = times\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end",
"def students\n @course = Course.find(params[:id])\n\t\t@students = @course.students\n\t\t@other_students = Student.find(:all, :conditions => [\"id not in (select student_id from courses_students where course_id=?)\", @course.id])\n\n respond_to do |format|\n format.html # students.html.erb\n format.json { render :json => @students }\n end\n end",
"def show\n @course = Course.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n student = StudentEntity.find_by(id: params[:id])\n if student.present?\n render json: student, staus: :ok\n else\n render json: {msg: \"not found\"}, staus: :not_found\n end\n end",
"def show\n @indexstudent = Indexstudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indexstudent }\n end\n end",
"def index\n if request.format == \"json\"\n @students = Student.all.order(:last_name)\n end\n end",
"def show\n @dojo_student = DojoStudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dojo_student }\n end\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 show\n @online_student = OnlineStudent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_student }\n end\n end",
"def show\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_test }\n end\n end",
"def show\n @studentgrade = Studentgrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @studentgrade }\n end\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def index\n @students = Student.paginate(page: params[:page], per_page: 2)\n #respond_with(@students)\n respond_to do |format|\n format.json {render json: {\"students\": @students}}\n format.html #index.html.erb\n end\n end",
"def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end",
"def show\n @student = Student.find(params[:id])\n\n _load_constants\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 @student_profiles = StudentProfile.all \n render json: @student_profiles\n end",
"def students\n student_size = User.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n if current_offset + direction < student_size && current_offset + direction >= 0\n offset = current_offset + direction\n @students = User.all.offset(offset).take(10) \n render :json => @students\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\tend",
"def show\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @studentset }\n end\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 student\n\n\t\tif(params[:student_user_id].eql?('null') || params[:classroom_id].eql?('null') )\n\t\t\trender json: {status: \"error\", error: \"invalid-student-user-or-classroom\"}\n\t\telse\n\t\t\tstudent = StudentUser.joins(:classrooms)\n\t\t\t\t.joins(\"inner join teacher_users t on classrooms.teacher_user_id = t.id\")\n\t\t\t\t.where(\"t.id = ?\", @current_teacher_user.id)\n\t\t\t\t.where(\"classrooms.id = ?\", params[:classroom_id])\n\t\t\t\t.where(\"student_users.id = ?\" , params[:student_user_id])\n\t\t\t\t.first\n\n\t\t\tif(!student.nil?)\n\t\t\t\tstudent = student.as_json\n\t\t\t\tstudent.delete(\"salt\")\n\t\t student.delete(\"password_digest\")\n\t\t student.delete(\"oauth_expires_at\")\n\t\t student.delete(\"oauth_token\")\n\t\t student.delete(\"updated_at\")\n\t\t student.delete(\"create_at\")\n\n\t\t\t\trender json: {status: \"success\", student: student}\n\t\t\t\n\t\t\telse\n\n\t\t\t\trender json: {status: \"error\", error: \"invalid-student-user-or-classroom\"}\n\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\tend",
"def index\n @student_entities = StudentEntity.all\n render json: @student_entities, status: :ok\n end",
"def show\n respond_to do |format|\n format.html\n format.json {render json: @student, serializer: StudentSerializer, include: '**'}\n end\n end",
"def show\n render json: @student_type\n end",
"def index\n # We will be creating a new student object to use with Register URL form\n @student = Student.new \n @students = Student.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"def show\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_source }\n end\n end",
"def index\n @students = Student.all(:order => \"family_name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def show\n @camp = Camp.find(params[:id])\n @students = Student.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camp }\n end\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n @student = Student.find(params[:id])\n end",
"def show\n \n if current_user.teacher.nil?\n @students = []\n @groups = []\n else\n @student = current_user.teacher.students.find(params[:id])\n @groups = current_user.teacher.groups\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def show\n @student = current_user.groups[0].students.find(params[:id])\n\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def index\n @students = Student.all\n respond_to do |format|\n format.html\n format.json {render json: StudentsDatatable.new(view_context)}\n end\n end",
"def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end",
"def show\n @student = find_student # Load the student mentioned by id in the route\n end",
"def index\n # logger.info \"☻ request query parameters: #{request.query_parameters}\"\n\n # logger.info \"--> #{request.fullpath}\"\n # logger.info \"--> GITHUB_KEY: #{ENV['GITHUB_KEY']}\"\n # logger.info \"--> GITHUB_SECRET: #{ENV['GITHUB_SECRET']}\"\n\n class_name = params[:class_name] || \"unknown\"\n year = params[:year] || \"2011\"\n semester = params[:semester] || \"summer\"\n\n if params[:class_name]\n @students = Student.where(class_name: class_name, year: year, semester: semester)\n else\n @students = Student.where(year: 2011, semester: \"summer\", class_name: \"unallocated\")\n end\n\n # @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end",
"def index\n @student_types = StudentType.all\n\n render json: @student_types\n end",
"def show\n add_breadcrumb @student.login, student_path(@student.login)\n @student_data = gon.jbuilder template: 'app/views/students/show.json.jbuilder', as: 'student_data' if request.format.symbol != :json\n end",
"def show\n @student_availability = StudentAvailability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_availability }\n end\n end",
"def show\n @student = Student.find(params[:id])\n\n render :show\nend",
"def show\n @student = Student.find_by_id(params[:id])\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def show\n @student = Student.find(params[:id])\n\n if (@student.family_id && @student.family_id > 0)\n @family = Family.find(@student.family_id)\n end\n\n @resound_process = ResoundProcess.find_by_student_id(@student.id)\n\n @instruments = Instrument.all\n @instrument_names = Instrument.all.collect { |instrument| [instrument.name, instrument.id] }\n\n @student_instrument = StudentInstrument.new\n @student_availability = StudentAvailability.new\n @preferred_teacher = PreferredTeacher.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def index\n @student_sources = StudentSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_sources }\n end\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end",
"def index\n @students = Student.all\n end"
] |
[
"0.79915404",
"0.77167404",
"0.764098",
"0.7618442",
"0.7569385",
"0.75570226",
"0.75570226",
"0.75570226",
"0.75570226",
"0.75570226",
"0.75570226",
"0.75570226",
"0.75570226",
"0.749562",
"0.749562",
"0.7488676",
"0.74655014",
"0.74655014",
"0.74454695",
"0.74425215",
"0.7441312",
"0.7434605",
"0.7420545",
"0.7384584",
"0.73802096",
"0.7371361",
"0.73150074",
"0.7272112",
"0.72671133",
"0.7266782",
"0.7248199",
"0.72079915",
"0.71729434",
"0.7146067",
"0.7097866",
"0.70735395",
"0.7072368",
"0.7024286",
"0.7017991",
"0.70119876",
"0.70091045",
"0.70013493",
"0.69904315",
"0.6980124",
"0.69538707",
"0.69420683",
"0.6925956",
"0.6912595",
"0.6903479",
"0.6874905",
"0.68656427",
"0.68467116",
"0.6833791",
"0.6809744",
"0.68085957",
"0.6796223",
"0.67803144",
"0.6746047",
"0.67390096",
"0.673745",
"0.67246085",
"0.6718684",
"0.6718684",
"0.6718684",
"0.6718684",
"0.6718684",
"0.66971177",
"0.66733706",
"0.66572994",
"0.6655061",
"0.6650502",
"0.6625196",
"0.661673",
"0.6606733",
"0.65878105",
"0.6585096",
"0.6579794",
"0.65757805",
"0.656222",
"0.6542772",
"0.65301836",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483",
"0.6523483"
] |
0.0
|
-1
|
POST /students POST /students.json
|
def create
@student = Student.new(params[:student])
respond_to do |format|
if @student.save
format.html { redirect_to @student, notice: 'Student was successfully created.' }
format.json { render json: @student, status: :created, location: @student }
else
format.html { render action: "new" }
format.json { render json: @student.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student = current_user.students.create(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Registro Exitoso.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_user.students.build(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_url, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tp = params[:student]\n\t\thash = { :original_name => p['original_name'], :sort_name => Student.make_sort_name(p['original_name']), :other_name => p['other_name'],\n\t\t\t:gender => p['gender'] == 'Male' ? 'M' : 'F', :born => VagueDate.factory(p['born']).to_s, :died => VagueDate.factory(p['died']).to_s,\n\t\t\t:home_town => p['home_town']['town'], :home_state => p['home_town']['state'], :home_country => p['home_town']['country'],\n\t\t\t:biographical_notes => p['biographical_notes'], :quotes => p['quotes'], :additional_notes => p['additional_notes'], :private_notes => p['private_notes'], :is_stub => 0\n\t\t}\n\n\t\t@student = Student.new(hash)\n\t\t@student.generate_unique_name()\n\n\t\trespond_to do |format|\n\t\t\tif @student.save\n\t\t\t\tmarriages = parse_array(p['marriage'])\n\t\t\t\tmarriages.each {|marriage|\n\t\t\t\t\tif !marriage['name'].blank?\n\t\t\t\t\t\tMarriage.create_marriage(@student, { :name => marriage['name'] }, marriage['date'])\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tresidences = parse_array(p['residence'])\n\t\t\t\tresidences.each {|residence|\n\t\t\t\t\tif !residence.blank?\n\t\t\t\t\t\tStudentResidence.create_residence(@student, residence)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tBrowse.student_changed(@student, nil)\n\t\t\t\tsolr().add_object(@student.to_solr())\n\n\t\t\t\tformat.html { redirect_to(@student, :notice => 'The student was successfully created.') }\n\t\t\telse\n\t\t\t\tformat.html {\n\t\t\t\t\t@page_title = 'Student'\n\t\t\t\t\tnew_setup()\n\t\t\t\t\trender :action => \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tend",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: \"Student was successfully created.\" }\n format.json { render json :show, status: :created, location: @student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n if @student.save\n render :show, status: :created, location: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student,\n notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to root_path, notice: 'Student details were successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n validate_student(student_params)\n begin\n student = Student.create!(student_params)\n\n render json: {status: 'SUCCESS', message:\"Student registered Successfully with name #{student.name}\", data:student.reload}, status: :ok\n rescue => error\n render json: {message: error}\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student Info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '生徒情報が追加されました' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente creado.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studentgrade = Studentgrade.new(params[:student])\n\n respond_to do |format|\n if @studentgrade.save\n format.html { redirect_to @studentgrade, notice: 'Student was successfully created.' }\n format.json { render json: @studentgrade, status: :created, location: @studentgrade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @studentgrade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_user.students.build(student_params)\n @student.status = 'imcomplete'\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_entity = StudentEntity.new(student_entity_params)\n\n respond_to do |format|\n if @student_entity.save\n format.json { render :show, status: :created, location: @student_entity }\n else\n format.json { render json: @student_entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manage_student = Manage::Student.new(manage_student_params)\n\n respond_to do |format|\n if @manage_student.save\n format.html { redirect_to @manage_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @manage_student }\n else\n format.html { render :new }\n format.json { render json: @manage_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = current_user.students.build(student_params)\n # @student = Student.new(student_params)\n # @student.user_id = current_user.id\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to admissions_url, success: 'Student record was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @current_lop.students.build(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to lop_students_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_student = Admin::Student.new(admin_student_params)\n\n respond_to do |format|\n if @admin_student.save\n format.html { redirect_to @admin_student, notice: \"Student was successfully created.\" }\n format.json { render :show, status: :created, location: @admin_student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @admin_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(admin_student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @schools_students = SchoolsStudent.new\n @schools_students.student_id = @student.id\n @schools_students.school_id = params[:school_id]\n @schools_students.save!\n\n @contract = Contract.new\n @contract.student_id = @student.id\n @contract.save!\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_test = StudentTest.new(params[:student_test])\n\n respond_to do |format|\n if @student_test.save\n format.html { redirect_to @student_test, notice: 'Student test was successfully created.' }\n format.json { render json: @student_test, status: :created, location: @student_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n student_ids = params[:student_ids].to_a\n student_ids.each_with_index do |student_id|\n student = Student.where(id: student_id.to_i).first\n @team.students << student\n end\n end",
"def create\n @student = Student.new(params[:student])\n @student.save\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to students_url, notice: 'Student was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @dojo_student = DojoStudent.new(params[:dojo_student])\n\n respond_to do |format|\n if @dojo_student.save\n format.html { redirect_to @dojo_student, notice: 'Dojo student was successfully created.' }\n format.json { render json: @dojo_student, status: :created, location: @dojo_student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dojo_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studen = Studen.new(studen_params)\n\n respond_to do |format|\n if @studen.save\n format.html { redirect_to @studen, notice: 'Studen was successfully created.' }\n format.json { render :show, status: :created, location: @studen }\n else\n format.html { render :new }\n format.json { render json: @studen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_type = StudentType.new(student_type_params)\n\n if @student_type.save\n render json: @student_type, status: :created, location: @student_type\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @student_interest = StudentInterest.new(student_interest_params)\n\n respond_to do |format|\n if @student_interest.save\n format.html { redirect_to @student_interest, notice: 'Student interest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_interest }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.find(params[:student_id])\n @grade = @student.grades.new(grade_params)\n respond_to do |format|\n if @grade.save\n format.html { redirect_to student_grades_path, notice: 'Grade was successfully created.' }\n format.json { render :show, status: :created, location: @grade }\n else\n format.html { render :new }\n format.json { render json: @grade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map_student = MapStudent.new(map_student_params)\n\n respond_to do |format|\n if @map_student.save\n format.html { redirect_to @map_student, notice: 'Map student was successfully created.' }\n format.json { render :show, status: :created, location: @map_student }\n else\n format.html { render :new }\n format.json { render json: @map_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student\n\n\t\tif(params[:student_user_id].eql?('null') || params[:classroom_id].eql?('null') )\n\t\t\trender json: {status: \"error\", error: \"invalid-student-user-or-classroom\"}\n\t\telse\n\t\t\tstudent = StudentUser.joins(:classrooms)\n\t\t\t\t.joins(\"inner join teacher_users t on classrooms.teacher_user_id = t.id\")\n\t\t\t\t.where(\"t.id = ?\", @current_teacher_user.id)\n\t\t\t\t.where(\"classrooms.id = ?\", params[:classroom_id])\n\t\t\t\t.where(\"student_users.id = ?\" , params[:student_user_id])\n\t\t\t\t.first\n\n\t\t\tif(!student.nil?)\n\t\t\t\tstudent = student.as_json\n\t\t\t\tstudent.delete(\"salt\")\n\t\t student.delete(\"password_digest\")\n\t\t student.delete(\"oauth_expires_at\")\n\t\t student.delete(\"oauth_token\")\n\t\t student.delete(\"updated_at\")\n\t\t student.delete(\"create_at\")\n\n\t\t\t\trender json: {status: \"success\", student: student}\n\t\t\t\n\t\t\telse\n\n\t\t\t\trender json: {status: \"error\", error: \"invalid-student-user-or-classroom\"}\n\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\tend",
"def create\n # binding.pry\n @student_id = StudentId.new(student_id_params)\n\n respond_to do |format|\n if @student_id.save\n if @enrolment\n format.html { redirect_to enrolment_student_ids_path(@enrolment), notice: 'Student was successfully created.' }\n else\n format.html { redirect_to student_ids_url, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student_id }\n end\n else\n format.html { render :new }\n format.json { render json: @student_id.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.create(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n StudentMailer.mailer_inschool(@student, @inschool).deliver\n format.html { redirect_to :back, notice: 'Inschool was successfully created and an email sent was sent to the teacher.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @student_instrument = StudentInstrument.new(params[:student_instrument])\n\n @student = Student.find(params[:student_instrument][:student_id])\n\n respond_to do |format|\n if @student_instrument.save\n format.html { redirect_to @student, notice: 'Instrument was successfully added.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n relate_with_courses\n format.html { redirect_to admin_student_path(@student), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @studenttest = Studenttest.new(studenttest_params)\n\n respond_to do |format|\n if @studenttest.save\n format.html { redirect_to @studenttest, notice: 'Studenttest was successfully created.' }\n format.json { render :show, status: :created, location: @studenttest }\n else\n format.html { render :new }\n format.json { render json: @studenttest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hash = params[:post]\n student_id = hash[:student_id].to_i\n\n # check if student already has request submitted\n if Request.where(student_id: student_id).size > 0\n respond_to do |format|\n format.html { redirect_to Request.where(student_id: student_id).take, notice: 'You already have this request:' }\n format.json { render :show, status: 400 }\n end\n # check that student is registered\n elsif Student.where(id_num: student_id).size == 0\n respond_to do |format|\n format.html { redirect_to requests_path, notice: \"Invalid ID number: #{student_id}\" }\n format.json { render :show, status: 400 }\n end\n # create request\n else\n @request = Request.new(request_params)\n @request.student_id = student_id\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to '/requests', notice: 'Request was successfully created.' }\n format.json { render :show, status: :created, location: @request }\n else\n format.html { render :new }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '学生资料创建成功.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:notice] = 'Student was successfully created.'\n format.html { redirect_to(students_url) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @students = Student.all\n render json: @students\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n add_model_error_to_flash @student\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @user = User.find_by_id(params[:user])\n @student.user = @user\n @department = Department.find_by_id(params[:department])\n @student.department = @department\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n @student.kundenstatus = 1\n @student.percentage = 1\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_major = StudentMajor.new(student_major_params)\n\n respond_to do |format|\n if @student_major.save\n format.html { redirect_to @student_major, notice: 'Student major was successfully created.' }\n format.json { render json: @student_major, status: :created, location: @student_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group_student = GroupStudent.new(group_student_params)\n\n respond_to do |format|\n if @group_student.save\n format.html { redirect_to @group_student, notice: 'Group student was successfully created.' }\n format.json { render :show, status: :created, location: @group_student }\n else\n format.html { render :new }\n format.json { render json: @group_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @find_student = FindStudent.new(find_student_params)\n\n respond_to do |format|\n if @find_student.save\n format.html { redirect_to @find_student, notice: 'Find student was successfully created.' }\n format.json { render :show, status: :created, location: @find_student }\n else\n format.html { render :new }\n format.json { render json: @find_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_student(student_name)\n object = controller_create(:student)\n fail format(\"Student '%s' not created.\", student_name) if object.nil?\n\n PrcLib.info(format(\"'student': '%s' created with id %s\",\n student_name,\n object[:id]))\n object\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n # Add the course just created to this student's courses, better use the drop down list \n if params[:course] != nil then\n @student.courses << Course.find(params[:course][:id])\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n \n respond_to do |format|\n if @student.save\n format.html { redirect_to convert_path(@student) }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def index\n puts render json: @user.students, each_serializer: UserSerializer\n end",
"def create\n @student = Student.new(student_params)\n @teachers = Teacher.all\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: \"Student was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_availability = StudentAvailability.new(params[:student_availability])\n\n @student = Student.find(params[:student_availability][:student_id])\n\n respond_to do |format|\n if @student_availability.save\n format.html { redirect_to @student, notice: 'Student availability was successfully created.' }\n format.json { render json: @student_availability, status: :created, location: @student_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\tif session[:user].nil?\n\t\tredirect_to('/login/login')\n\tend\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t#for each student, create student params\n\t\t@student = Student.create!(student_params)\n\t\t#once created, go back to students path\n\t\tredirect_to students_path\n\t#wrap up \"create\" action\n\tend",
"def create\n @ststu = Ststu.new(ststu_params)\n\n respond_to do |format|\n if @ststu.save\n format.html { redirect_to @ststu, notice: 'Ststu was successfully created.' }\n format.json { render :show, status: :created, location: @ststu }\n else\n format.html { render :new }\n format.json { render json: @ststu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n\n #-CONNECT THE SCHOOL AND THE STUDENT IF @school IS PRESENT\n @student.schools << @school if @school\n\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student creation successful.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n flash[:success] = t('student.created')\n format.html { redirect_to(students_path) }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n flash[:error] = t('default_error_message')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to(@student, :notice => 'Student was successfully created.') }\n format.xml { render :xml => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @monedero = Monedero.new\n @monedero.student = @student\n @monedero.cantidad = 0\n @monedero.save\n\n @alumno = Alumno.new\n @alumno.email = @student.matricula + '@mail.com'\n @alumno.password = 'password'\n @alumno.student = @student\n @alumno.save\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7276993",
"0.71327525",
"0.71093845",
"0.71093845",
"0.70346844",
"0.6977986",
"0.6972182",
"0.69504297",
"0.69486904",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6947548",
"0.6938531",
"0.6929497",
"0.6916051",
"0.68901366",
"0.68825495",
"0.68804747",
"0.68800503",
"0.6830429",
"0.68077713",
"0.6714526",
"0.66657513",
"0.6650756",
"0.66389436",
"0.6638717",
"0.6638012",
"0.6631731",
"0.6625019",
"0.6609019",
"0.6605634",
"0.6578492",
"0.655997",
"0.6540671",
"0.6531589",
"0.64996684",
"0.6497988",
"0.64950794",
"0.6489864",
"0.64837414",
"0.6462999",
"0.6461036",
"0.6457987",
"0.6454157",
"0.645364",
"0.6447284",
"0.64347893",
"0.6401688",
"0.63794523",
"0.6371903",
"0.6371854",
"0.6353841",
"0.63530636",
"0.6344433",
"0.63403016",
"0.6323079",
"0.631769",
"0.63162905",
"0.6311834",
"0.62960136",
"0.62900174",
"0.62899363",
"0.6287107",
"0.62856966",
"0.6263253",
"0.6251533",
"0.62503445",
"0.6244792",
"0.6243785",
"0.6236858",
"0.62076944",
"0.62048227",
"0.62027335",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202453",
"0.6202057",
"0.61957806"
] |
0.7029056
|
10
|
Never trust parameters from the scary internet, only allow the white list through.
|
def senkyoku_params
params.permit(:pref_code, :senkyoku_no)
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
|
SQL Injection attacks If we just pulled the values from our instance variables a malicious user could do damage to our database unless the passed arg is sanitized. Ex. playwright_id == '3; DROP TABLE plays' This would send the playwright_id, signal the end of a command then drop our plays table. SQL injection attacks are common and need to be defended against. A user could do a lot of damage to a app by dropping a user table etc. Essentially your giving users an oppurtunity to run any SQL commands they want without sanatizing it first
|
def update
raise "#{self} not in database" unless @id
PlayDBConnection.instance.execute(<<-SQL, @title, @year, @playwright_id, @id)
UPDATE plays
SET title = ?, year = ?, playwright_id = ? WHERE id = ?
SQL
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sanitize_sql(*args)\n klass.send(:sanitize_sql, args)\n end",
"def escape_sql(args)\n return @text if args.empty?\n sql = @text.dup\n vars = args.dup\n\n replacements = 0\n mismatch = false\n\n sql.gsub!(/'[^']*'|\"[^\"]*\"|`[^`]*`|\\?/) do |x|\n next x unless x == '?'\n replacements += 1\n if vars.empty?\n mismatch = true\n else\n var = vars.shift\n connection.quote_value(var)\n end\n end\n\n if !vars.empty? || mismatch\n raise ArgumentError, \"Binding mismatch: #{args.size} for #{replacements}\"\n else\n sql\n end\n end",
"def cleanse(args)\n # Clean sql, need to add code to escape quotes and prevent deletions without conditions\n @sql\n end",
"def run_sql(statement, params)\n @low_card_model.connection.execute(@low_card_model.send(:sanitize_sql, [ statement, params ]))\n end",
"def sanitize(value)\n ActiveRecord::Base.sanitize_sql(value)\n end",
"def scout_sanitize_sql(sql)\n return nil if sql.length > 1000 # safeguard - don't sanitize large SQL statements\n sql = sql.dup\n sql.gsub!(/\\\\\"/, '') # removing escaping double quotes\n sql.gsub!(/\\\\'/, '') # removing escaping single quotes\n sql.gsub!(/'(?:[^']|'')*'/, '?') # removing strings (single quote)\n sql.gsub!(/\"(?:[^\"]|\"\")*\"/, '?') # removing strings (double quote)\n sql.gsub!(/\\b\\d+\\b/, '?') # removing integers\n sql.gsub!(/\\?(,\\?)+/,'?') # replace multiple ? w/a single ?\n sql\n end",
"def execute sql\n db[sql]\n end",
"def sanitize_sql(*args)\n Invoice.send(:sanitize_sql, *args)\n end",
"def escape_and_execute_sql(query)\n query = ::ActiveRecord::Base.send :sanitize_sql_array, query\n ::ActiveRecord::Base.connection.execute(query).first\n end",
"def query(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n check_disconnect_errors{super}\n end",
"def content_threat_detection_check_sql_injection_string(value, opts = {})\n data, _status_code, _headers = content_threat_detection_check_sql_injection_string_with_http_info(value, opts)\n data\n end",
"def sanitize_sql_array(ary)\n statement, *values = ary\n if values.first.is_a?(Hash) and statement =~ /:\\w+/\n replace_named_bind_variables(statement, values.first)\n elsif statement.include?('?')\n replace_bind_variables(statement, values)\n else\n statement % values.collect { |value| quote_string(value) }\n end\n end",
"def prepare( str )\n @db.prepare( str )\n end",
"def preprocess_order_args(order_args)\n order_args.flatten!\n validate_order_args(order_args)\n\n references = order_args.grep(String)\n references.map! { |arg| arg =~ /(\\%27)|(\\')|(\\-\\-)|(\\%23)|(\\#)/ix && $1 }.compact!\n if references.any?\n raise ArgumentError, 'sql injection attemp detected'\n end\n order_args\n end",
"def clean_sql\n self.sql=SqlText.clean(sql) if sql.present?\n end",
"def prep_sql_for_run\n self.sql = sql.strip\n self.sql = sql[0..-2] if sql.last == ';'\n self.sql = sql.dup\n end",
"def edit_player_info(db)\r\n puts \"\\nEnter the number of the player you would like to edit.\"\r\n view_players(db)\r\n id = gets.chomp\r\n puts \"\\nWould you like to update name or location?\"\r\n field = gets.chomp.downcase\r\n puts \"\\nWhat is the updated #{field}?\"\r\n correction = gets.chomp\r\n db.execute(\"UPDATE players SET #{field} = \\\"#{correction}\\\" WHERE id = #{id}\")\r\nend",
"def raw_sql\n \"SELECT * FROM users WHERE name = '#{@name}'\"\n end",
"def with_sql(sql, *args)\n if sql.is_a?(Symbol)\n sql = public_send(sql, *args)\n else\n sql = SQL::PlaceholderLiteralString.new(sql, args) unless args.empty?\n end\n clone(:sql=>sql)\n end",
"def execute(*args)\n @db.execute(*args)\n end",
"def sanitize_params\n # @where[/\\w*=\\'(.*)\\'/].gsub(/\\'/, \"''\")\n # @where.sub!(/\\w*=\\'(.*)\\'/, { |s| puts s })\n end",
"def sanitize_sql(query)\n ActiveRecord::Base.send(:sanitize_sql_array, query)\n end",
"def fake_sql(message, args)\n args = args.tr(',&', ' ')\n terms = args.split[1..-1]\n argv = []\n terms.each do |term|\n m = /(\\w+)(=|==|>|>=|<|<=|!=|\\.like\\.|\\.include\\.)(\\w+)/.match(term)\n next unless m\n argv << {:key => m[1].downcase, :operator => m[2].downcase, :value => m[3].downcase}\n end\n\n p argv\n m = Monster.all\n #handle with sql\n argv.each do |arg|\n key = arg[:key]\n if ['stars', 'cost'].include?(key)\n op = {'=' => 'to_sym', '==' => 'to_sym', '>' => 'gt', '<' => 'lt', '>=' => 'gte', '<=' => 'lte', '!=' => 'not'}[arg[:operator]]\n m = m.all({key.to_sym.send(op) => arg[:value]})\n elsif ['atk', 'hp', 'rcv'].include?(key)\n op = {'=' => 'to_sym', '==' => 'to_sym', '>' => 'gt', '<' => 'lt', '>=' => 'gte', '<=' => 'lte', '!=' => 'not'}[arg[:operator]]\n m = m.all({\"#{key}_max\".to_sym.send(op) => arg[:value]})\n elsif key == 'leader'\n if arg[:operator] == \".like.\"\n m = m.all(:leader_text.like => arg[:value])\n elsif arg[:operator] == \".include\"\n m = m.all(:leader_text.like => \"%#{arg[:value]}%\")\n elsif arg[:operator] == \"=\" || arg[:operator] == \"==\"\n m = m.all(:leader_text => arg[:value])\n end\n elsif key == 'active'\n if arg[:operator] == \".like.\"\n m = m.all(:skill_text.like => arg[:value])\n elsif arg[:operator] == \".include\"\n m = m.all(:skill_text.like => \"%#{arg[:value]}%\")\n elsif arg[:operator] == \"=\" || arg[:operator] == \"==\"\n m = m.all(:skill_text => arg[:value])\n end \n end\n end\n # handle in ruby, convert relation to array\n argv.each do |arg|\n key = arg[:key]\n if key == 'type' || key == 'types'\n if ['=', '==', '.include.'].include? arg[:operator]\n m = m.select{|monster| monster.types.map(&:downcase).include?(arg[:value].downcase)}\n end \n elsif key == 'awakenings' || key == 'awakening'\n awakening = Awakening.find_by_name(arg[:value].tr('-_:', ' '))\n next if awakening.nil?\n if ['=', '==', '.include.'].include? arg[:operator]\n m = m.select{|monster| monster.awakenings.include?(awakening.id)}\n end\n elsif key == 'element' || key == 'elements'\n if ['=', '==', '.include.'].include? arg[:operator]\n m = m.select{|monster| monster.element.split(\"/\").map(&:downcase).include?(arg[:value].downcase)}\n end \n end\n end\n\n terms.each do |term|\n if term.downcase == \"evolved\"\n m = m.select{|monster| monster.evolved.nil?}\n elsif term.downcase == \"padherder\" || term.downcase == \"herder\"\n user_owned = get_box(message.user.nick)\n if user_owned.nil?\n message.reply \"Failed to establish padherder API link for #{message.user.nick}.\" and return\n end\n m = m.select{|monster| user_owned.include?(monster.id)}\n end\n end\n\n results = m\n \n if message.channel && results.count >= 15\n message.reply \"Query matched #{results.count} records; please refine or PM me out of channel.\"\n else\n lead = \"Query\"\n message.reply \"#{lead}: #{results.map{|r| list_monster(r)}.join('; ')}\"\n end\n end",
"def sanitize(args = '')\n args\n end",
"def sanitize_sql_like(text, escape_character = '\\\\')\n text.to_s.gsub(/(^|.)([%_])/) do |s|\n ($1 == escape_character) ? s : [$1, escape_character, $2].compact.join\n end\n end",
"def test_failedsqlinjection\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@sqlinjection, @@sqlinjection)\n\n loginpage.VerifyUnrecognisedEmailPasswordErrorMessage()\n\n end",
"def run_sql(sql, arr = [])\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'native_plants'})\n results = db.exec_params(sql, arr)\n db.close\n return results\nend",
"def is_valid_username(db, username)\n\n # if value is returned then username is not valid\n if db.execute('SELECT 1 FROM users WHERE username=?', username).length > 0 then\n return false\n else\n return true\n end\n\nend",
"def run_sql(sql, arr = []) # array is for security feature\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'picgallary'})\n results = db.exec_params(sql, arr)\n db.close\n return results\n end",
"def sql! sql=nil\n require 'niceql'\n puts Niceql::Prettifier.prettify_sql sql || $last_sql_command\n end",
"def sanitize(sql_query)\n sql_query[0..22].downcase.split('').each.select {|w| w =~ /[a-z]|[áéíóúü]/i}.join('') \nend",
"def esc_sql(data )\n # global $wpdb;\n $wpdb._escape(data)\n end",
"def sql(method, query, *args)\n query = ActiveRecord::Base.send(:sanitize_sql_array, [query] + args)\n with_connection do |conn|\n conn.send(method, query)\n end\n end",
"def sql_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\" \nend",
"def sanitize_sql_like(string, escape_character = '\\\\')\n pattern = Regexp.union(escape_character, '%', '_')\n string.gsub(pattern) { |x| [escape_character, x].join }\n end",
"def sanitize_sql_name(*name)\n name.join('_').presence&.gsub(/\\d/) { |d| DIGIT_TO_ALPHA[d] || '_' }\n end",
"def prepare_sql; raise \"Define #prepare_sql in your subclass\"; end",
"def escape(value)\n $db.escape_identifier(value)\nend",
"def show_id(db)\n\tputs \"Enter your username to retrieve your reference number:\"\n\tuser_name = gets.chomp\n\tputs \"Your reference id is:\"\n\tputs db.execute(\"SELECT id FROM incidents WHERE username = '#{user_name}'\")\nend",
"def make_sql_friendly( name )\n return name.strip.gsub( \"'\", \"''\" )\n end",
"def test_xquery_safe_unsafe\n assert_equal('secret', 'secret'.xquery_safe.xquery_unsafe)\n assert_equal('crazypassword{123@#$%}},.<>', 'crazypassword{123@#$%}},.<>'.xquery_safe.xquery_unsafe)\n end",
"def db_command(user, pass, host, database, command)\n ENV['PGUSER'] = user\n ENV['PGPASSWORD'] = pass\n ENV['PGHOST'] = host\n ENV['PGDATABASE'] = database\n puts \"Running: #{command}\"\n `psql -c \"#{command}\"`\nend",
"def test_long_sql\n sql = \" \" * 1001\n assert_equal '', SqlSanitizer.new(sql).to_s\n end",
"def prepare_statement_sub(sql)\n sql.gsub(/\\$\\d+/, '?')\n end",
"def escape(str)\n return ActiveRecord::Base.connection.quote_string(str)\n end",
"def sanitize_arguments(args)\n # Resolve the host to an IP\n args[:host] = lookup_hostname(args[:hostname])\n args[:port] = args[:port].to_i\n\n # Username should be lowercase, alphanumeric only.\n args[:username].downcase!\n args[:username].gsub!(/[^a-z0-9_-]/, '')\n\n # Remove control characters from password\n args[:password].tr!(\"\\u0000-\\u001f\\u007f\\u2028-\\u2029\", '')\n\n # Read in ssh key data if able.\n if File.file?(args[:ssh_key])\n key_path = File.expand_path(args[:ssh_key].to_s)\n args[:key_data] = File.read(key_path)\n end\n\n args\n rescue Errno::EACCES\n args\n end",
"def initialize(fname=\"\", lname=\"\", email=\"\")\n @fname = fname\n @lname = lname\n @email = email\n\n puts `psql -d wdi-november -c \"INSERT INTO users (fname, lname, email) VALUES ('#{fname}','#{lname}', '#{email}')\"`\nend",
"def sql\n Slacker.sql(self)\n end",
"def psql(args)\n \"psql -X -q #{args}\"\nend",
"def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end",
"def normalize_pending_arguments(arguments)\n if arguments.empty?\n self.where = \"dbagile\"\n else\n self.where = valid_argument_list!(arguments, String)\n end\n end",
"def execute(sql)\n @db.send(:_execute, self, sql, :log=>false) \n end",
"def sanitize_sql(conditions)\n if conditions.is_a?(Hash)\n sanitize_sql_activerecord5(conditions)\n else\n @model_class.send(:sanitize_sql, conditions)\n end\n end",
"def sanitize_sql(conditions)\n if conditions.is_a?(Hash)\n sanitize_sql_activerecord5(conditions)\n else\n @model_class.send(:sanitize_sql, conditions)\n end\n end",
"def sanitize!; end",
"def escape_str_field(str)\n str = str.to_s.sub(/\\`/,'')\n @mysql.escape(str)\n end",
"def sql_raw(*args)\n sql, bind = parse_args(*args)\n return SQL::QueryMaker.new(nil, Proc.new { sql }, bind)\n end",
"def quote_params(params); end",
"def add_input (db, user_input)\r\n db.execute(\"INSERT INTO strength (date, exercise, weight, reps, minutes, difficult) VALUES (?, ?, ?, ?, ?, ?)\", [user_input])\r\nend",
"def run_sql(query)\n raw_run_sql(query)\n end",
"def psql_db__sample_example *args\n db_name=\"any_db\"\n db_user=\"any_user\"\n db_host=\"localhost\"\n db_password=\"onlyNSAknows\"\n db_port = nil\n db_connection = nil\n\n [\n db_name,\n db_user,\n db_password,\n db_host,\n db_port,\n db_connection,\n ]\n end",
"def execute_query(sql, *vars)\n if vars && vars.count > 0\n @database.prepare(sql).execute(*vars.flatten)\n else\n @database.prepare(sql).execute\n end\n rescue\n puts \"MyMysql.execute_query(): #{$!}\" if @@verbose\n end",
"def sanitize_quotes(query)\n query.gsub!('\"\"', '\"')\n query.delete!('\"') if query.count('\"').odd?\n query = \"\" if query.blank?\n\n query\n end",
"def add_user(db, username)\n puts \"What is the age of the new user?\"\n age = gets.chomp\n db.execute(\"INSERT INTO users (username, age) VALUES (?, ?)\", [username, age])\n puts \"#{username} was added to the table\"\nend",
"def update()\ndb = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\nsql = \"UPDATE bounty_hunters\nSET (name,\n species,\n homeworld,\n favourite_weapon\n )=(\n $1, $2, $3, $4\n )\n WHERE id = $5\n \"\n\nvalues = [@name, @species, @homeworld, @favourite_weapon]\ndb.prepare('update',sql)\n db.exec_prepared('update', values)\n db.close\nend",
"def q(str)\n str.class == String ? ActiveRecord::Base.connection.quote_string(str) : str\n end",
"def _format_sql(sql)\n sql = sql.delete '\"'\n sql.downcase\n end",
"def save_post(params)\n sql= 'INSERT INTO posts (title, description, url, created_at)\n VALUES($1,$2,$3,NOW())'\n db_connection do |conn|\n conn.exec_params(sql,[params[:title],params[:description],params[:url]])\n end\nend",
"def execute_dui(sql, opts=OPTS, &block)\n super(prepared_statement_name, opts, &block)\n end",
"def create_user(db,first_name,last_name,is_artist,playlist_id)\n\tdb.execute(\"INSERT INTO users (first_name,last_name,is_artist,playlist_id) VALUES ('#{first_name}', '#{last_name}', '#{is_artist}', #{playlist_id});\")\nend",
"def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end",
"def escape_col(name)\n raise \"Possible SQL injection hack: '#{name}'.\" unless name.to_s.match(/\\A[A-z\\d_]+\\Z/)\n return name\n end",
"def update!(**args)\n @sql_script = args[:sql_script] if args.key?(:sql_script)\n end",
"def player_creator(data_var,name)\r\n\tdata_var.execute(\"INSERT INTO players (name,placing) VALUES (?,?)\",[name,\"no place\"])\r\nend",
"def dbinsert(table, variables, variable_names)\n i = 1\n marks = \"?\"\n while i < variables.length\n marks += \",?\"\n i += 1\n end\n\n v = \"\"\n i = 0\n while i < variables.length\n v += variables[i].to_s \n i += 1\n if i < variables.length\n v += \", \"\n end\n end\n\n return db.execute(\"INSERT INTO #{table}(#{v}) VALUES (#{marks})\", variable_names)\nend",
"def escape(string)\n # This code is taken directly from the documentation so we dont have to rely on the SQLite3::Database class. This way it can also be used with JRuby and IronRuby...\n # http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html\n string.to_s.gsub(\"'\", \"''\")\n end",
"def execute(cmd)\n RawDB.execute(db, cmd)\n end",
"def update_sql(values=OPTS)\n case values\n when LiteralString\n super\n when String\n super(LiteralString.new(values))\n else\n super\n end\n end",
"def my_sql_params\n params.require(:my_sql).permit(:title, :Content)\n end",
"def execute(sql, name = nil)\n # check for some DDL and DML statements\n puts \"Running sql? #{RUN_SQL}\"\n\n if /(create |alter |drop |insert |delete |update )/i.match sql.squish\n File.open(SQL_FILENAME, 'a') { |f| f.puts \"#{sql};\\n\" }\n puts \"Rails.env: #{Rails.env} - #{ENV['FPHS_POSTGRESQL_SCHEMA']}\"\n old_execute sql, name if RUN_SQL\n else\n # pass everything else to the aliased execute\n puts \"------------- (#{name}) ---------------\"\n puts sql || ''\n puts \"------------- ---------------\"\n old_execute sql, name if RUN_SQL\n end\n end",
"def sanitize_query(q)\n return '' if q.nil?\n q.gsub(/\\s+/, ' ').gsub(/[^a-zA-Z 0-9\\*\\?'\\\"]/i, '?')\n end",
"def skip_sql_param_names=(_arg0); end",
"def set_injection\n @injection = Injection.find(params[:id])\n end",
"def execute_sql(sql_code)\n done = system \"sh db_execute.sh \\\"#{sql_code}\\\"\"\n raise Exception.new(\"Issue executing sql code: #{sql_code}\") unless done\nend",
"def query(statement, *params) #Use of splat(*) parameter used with methods where you don't know how many arguements it will take \n @logger.info \"#{statement}: #{params}\" #Funtionailty for the ability to see in the local host terminal d-bug output from sinatra showing all of the requests it's accepting; this will alow us to see the SQL queries that are being executed in the db to help troubleshoot \n @db.exec_params(statement, params)\n end",
"def quote_ident(*args)\n PG::Connection.quote_ident(*args.map(&:to_s))\n end",
"def prepared_statement_arg(v)\n case v\n when Numeric\n v.to_s\n when Date, Time\n literal(v).gsub(\"'\", '')\n else\n v\n end\n end",
"def test_obfuscation_of_truncated_query\n insert = \"INSERT INTO data (blah) VALUES ('abcdefg...\"\n\n assert_equal('Query too large (over 16k characters) to safely obfuscate',\n NewRelic::Agent::Database.obfuscate_sql(insert))\n end",
"def update # EXTENSION\n sql = \"UPDATE tickets SET customer_id = $1, film_id = $2, screening_id = $3 WHERE id = $4\"\n values = [@customer_id, @film_id, @screening_id, @id]\n SqlRunner.run(sql, values)\nend",
"def execute_dui(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end",
"def sanitize_query(value, command = nil)\n return value if relation_query?(value)\n return value if value.is_a?(::Arel::SelectManager)\n\n command = value if command.nil? # For compatibility purposes\n valid_type = command.respond_to?(:call) || command.is_a?(String)\n\n raise ArgumentError, <<-MSG.squish unless valid_type\n Only relation, string and proc are valid object types for query,\n #{command.inspect} given.\n MSG\n\n command\n end",
"def save()\n #connect to database\n db = PG.connect({ dbname: 'bounty_hunters', host: 'localhost' })\n #write big long SQL string\n sql = \"INSERT INTO bounties\n (\n name,\n species,\n bounty_value,\n favourite_weapon\n )\n VALUES\n ($1, $2, $3, $4)\"\n\n #make array of values for prepared statement\n values = [@name, @species, @bounty_value, @favourite_weapon]\n #prepare statement\n db.prepare(\"save\", sql)\n #exec statement\n db.exec_prepared(\"save\", values)\n #close link to db\n db.close()\n end",
"def replace_variables_in_query_string\n # if @queries_as_string.empty?\n # Display.write_your_own_query\n # else\n # binding.pry\n # MOCKED DATA IF NECESSARY\n # @queries_as_string = [\"MerchantTransaction.find(10553628)\",\n # \"MerchantTransaction.find_by(reference: '1055-3628', kind: 'PLACE_BATCH')\",\n # \"MerchantTransaction.find_by(reference: '1055-3628', kind: 'PLACE_BATCH')\",\n # \"MerchantTransaction.where(parent_ref: '1055-3627', kind: 'BATCH_BET')\",\n # ]\n @queries_as_string.each_with_index do | query, index |\n mocked_query = Display.query(query)\n @mocked_queries_as_string << mocked_query ? mocked_query : query\n end\n Readline.pre_input_hook = nil\n evaluate_queries_as_lambdas\n # end\n end",
"def apt_adder(db)\n puts \"1)Enter apartment name:\"\n inp_name = gets.chomp\n\n puts \"2) Address:\"\n inp_addr = gets.chomp\n\n puts \"3) Amenities:\"\n inp_amen = gets.chomp\n\n puts \"4) Rent Range:\"\n inp_rent = gets.chomp\n\n puts \"5) Commute:\"\n inp_commute = gets.chomp\n\n puts \"6) Rating:\"\n inp_rating = gets.chomp\n\n puts \"7) Comments:\"\n inp_comments = gets.chomp\n\n db.execute(\"INSERT INTO apt_list (name, address, amenities, rent_range, commute, rating, comments) VALUES ('#{inp_name}', '#{inp_addr}', '#{inp_amen}', '#{inp_rent}', '#{inp_commute.to_i}', '#{inp_rating.to_i}', '#{inp_comments}') \")\nend",
"def should_log_scrubbed_query(input:, output:)\n queries = sql(input)\n\n expect(queries.join(\"\\n\")).to_not include(input)\n expect(queries.join(\"\\n\")).to include(output)\n end",
"def escaped_sql\n sql % binds.reduce({}) { |a, (col, val)|\n a[col.to_sym] = if val.is_a? Array\n val.map { |x| @conn.quote x }.join(', ')\n else\n @conn.quote val\n end\n a\n }\n end",
"def preprocess_query(query, *binds)\n mutex.synchronize do\n self.last_query = query\n end\n\n ep = Epoxy.new(query)\n ep.quote { |x| %Q{'#{binds[x].to_s.gsub(/'/, \"''\")}'} }\n end",
"def query_literal(args)\n case (s = args[0])\n when LiteralString, SQL::Blob\n nil\n when String\n if args.length == 1\n LiteralString.new(s)\n else\n SQL::PlaceholderLiteralString.new(s, args[1..-1])\n end\n end\n end",
"def prepare_param_dbid\n retval = params[:dbid]\n retval = session[:database][:dbid] unless retval\n retval\n end",
"def sql_command_string(query, database, ctrl, grep_for = nil)\n raw_query = query.is_a?(String) ? query : query.join(\";\\n\")\n Chef::Log.debug(\"Control Hash: [#{ctrl.to_json}]\\n\")\n cmd = \"/usr/bin/mysql -B -e \\\"#{raw_query}\\\"\"\n cmd << \" --user=#{ctrl[:user]}\" if ctrl && ctrl.key?(:user) && !ctrl[:user].nil?\n cmd << \" -p#{ctrl[:password]}\" if ctrl && ctrl.key?(:password) && !ctrl[:password].nil?\n cmd << \" -h #{ctrl[:host]}\" if ctrl && ctrl.key?(:host) && !ctrl[:host].nil? && ctrl[:host] != 'localhost'\n cmd << \" -P #{ctrl[:port]}\" if ctrl && ctrl.key?(:port) && !ctrl[:port].nil? && ctrl[:host] != 'localhost'\n cmd << \" -S #{default_socket}\" if ctrl && ctrl.key?(:host) && !ctrl[:host].nil? && ctrl[:host] == 'localhost'\n cmd << \" #{database}\" unless database.nil?\n cmd << \" | grep #{grep_for}\" if grep_for\n Chef::Log.debug(\"Executing this command: [#{cmd}]\\n\")\n cmd\n end",
"def execute(sql)\n @database_handle.execute(sql)\n end"
] |
[
"0.68672246",
"0.6751757",
"0.64046997",
"0.64045584",
"0.6281214",
"0.6206387",
"0.6143647",
"0.60640997",
"0.60109633",
"0.5913247",
"0.5863718",
"0.58425814",
"0.5779374",
"0.57738566",
"0.57726157",
"0.57431674",
"0.57018197",
"0.56976336",
"0.56765336",
"0.56712276",
"0.56644255",
"0.5659021",
"0.56044316",
"0.5600629",
"0.55753887",
"0.55370164",
"0.54766953",
"0.5475643",
"0.545229",
"0.543818",
"0.5436634",
"0.54327416",
"0.54314595",
"0.5429791",
"0.5422932",
"0.5415404",
"0.54027456",
"0.5390458",
"0.5385728",
"0.5385021",
"0.5377628",
"0.53729415",
"0.5363159",
"0.5351592",
"0.53412676",
"0.53329104",
"0.53121173",
"0.5308558",
"0.5304143",
"0.52981335",
"0.52855307",
"0.52601147",
"0.5256007",
"0.5256007",
"0.5249467",
"0.52487904",
"0.52297306",
"0.5215056",
"0.5210106",
"0.520753",
"0.52002674",
"0.5198144",
"0.5197737",
"0.51903874",
"0.5190278",
"0.51898134",
"0.51817447",
"0.5171104",
"0.5162633",
"0.5157414",
"0.5155277",
"0.5154854",
"0.51520103",
"0.51492995",
"0.5140482",
"0.5137663",
"0.5133678",
"0.51271844",
"0.51260006",
"0.51237667",
"0.51233804",
"0.5121498",
"0.51171076",
"0.51146495",
"0.51129824",
"0.5107885",
"0.50992316",
"0.509802",
"0.5090828",
"0.5088009",
"0.5084539",
"0.50838786",
"0.5082968",
"0.5082328",
"0.50821847",
"0.50766844",
"0.50764215",
"0.50761247",
"0.5075801",
"0.50698286",
"0.5054709"
] |
0.0
|
-1
|
This avoids a refactor to pass more task data around
|
def task_name_from_path(path)
path = File.absolute_path(path)
parts = path.split(File::Separator)
if parts.length < 3 || parts[-2] != 'tasks'
raise ArgumentError, "Task path was not inside a module."
end
mod = parts[-3]
name = File.basename(path).split('.')[0]
if name == 'init'
mod
else
"#{mod}::#{name}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def task\n end",
"def prepare_task\n end",
"def jeweler_tasks=(_arg0); end",
"def tasks() []; end",
"def jeweler_tasks; end",
"def initialize(task)\n @task = task\n end",
"def load_tasks\n end",
"def taskOpts\nend",
"def initialize(task)\n super()\n @task= task \n end",
"def perform_task\n # actually do the work\n end",
"def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end",
"def task_info(name, details=nil, code=nil)\r\n task_files unless @task_files\r\n\r\n # FIND TASK FILE\r\n\r\n name = name.sub('bg_worker_', '')\r\n rake = \"bg_worker_#{name}.rake\"\r\n @filename = Rails.root.join('lib', 'tasks', rake)\r\n return BgWorker.task if name.blank? || !@task_files.find(name)\r\n\r\n # SET BASIC PROPERTIES\r\n\r\n task = BgWorker.task(:name => name, :filename => @filename)\r\n\r\n # IF LOOKING FOR ADVANCED PROPERTIES, MUST READ FILE\r\n\r\n if details || code\r\n begin\r\n @data = IO.readlines(@filename)\r\n rescue\r\n flash[:warning] = _(\"File invalid\")\r\n return task\r\n end\r\n end\r\n\r\n # DETAILS ARE MERELY EXTRACTED FROM COMMENTS\r\n # ONE MAY EXTRACT INFORMATION DIRECTLY FROM THE SOURCE\r\n # USING CLEVER REGEXEN\r\n\r\n if details\r\n @data.grep(/. (name|args|desc|namespace|dependencies): (.*)/) do |line|\r\n ppt = Regexp.last_match(1)\r\n val = Regexp.last_match(2)\r\n if ppt == 'args' || ppt == 'dependencies'\r\n task[ppt.to_sym] = val.tr(' :', ',').split(',').map{|d| d unless d.blank? }.compact.join(', ')\r\n elsif ppt == 'namespace' && !val.blank?\r\n task[:namespace] = val\r\n task[:fullname] = \"#{task[:namespace]}:bg_worker_#{task[:name]}\"\r\n else\r\n task[ppt.to_sym] = val\r\n end\r\n end\r\n end\r\n\r\n # CODE HAS TO BE EXTRACTED FROM IN-BETWEEN TASK DEFINITION\r\n # AND BLOCK END\r\n\r\n if code\r\n task_begin_code_regexp = /\\A\\s*task :#{task[:name]}.* do \\|.*\\|\\Z/\r\n task_end_code_regexp = /\\A\\s*end\\Z/\r\n ends = []\r\n defs = []\r\n @data.each_with_index {|l, i|\r\n defs << i if l =~ task_begin_code_regexp\r\n ends << i if l =~ task_end_code_regexp\r\n }\r\n if defs.size == 1 && ends.size >= 1\r\n task_end = (task[:namespace] && ends[-2]) ? ends[-2] : ends[-1]\r\n task_def = defs[0] + 1\r\n task_end -= 1\r\n task[:code] = task_def < task_end ? @data[task_def..task_end].join.strip : ''\r\n else\r\n flash[:warning] = _(\"This file is not standardized\")\r\n task[:code] = @data.join.strip\r\n end\r\n end\r\n return BgWorker.task(task)\r\n end",
"def tasks_data_today \n tasks_of_today = self.tasks_due_today\n tasks = []\n tasks_of_today.each do |task|\n task = {\n task_name: task.name, \n completion_value: task.completions.last.completion_value,\n completion_max: task.completion_max,\n completion_unit: task.completion_unit\n }\n tasks << task \n end\n tasks \n end",
"def update_task\r\n\r\n t = BgWorker.task(:name => params[:task][:name]) # new task so we update data\r\n if t[:name].blank?\r\n flash[:error] = _('Invalid name!')\r\n redirect_to :action => :back\r\n end\r\n t[:filename]\t= Rails.root.join('lib', 'tasks', \"bg_worker_#{t[:name]}.rake\")\r\n id \t\t= params[:task][:id]\r\n t[:code]\t= params[:task][:code]\r\n t[:namespace] \t= params[:task][:namespace]\r\n t[:desc]\t= params[:task][:desc]\r\n t[:args]\t= params[:task][:args].blank? ? nil :\r\n params[:task][:args].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n arg_string\t= \", [#{t[:args]}]\" unless t[:args].blank?\r\n t[:dependencies]= params[:task][:dependencies].blank? ? nil :\r\n params[:task][:dependencies].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n dep_string\t= \" => [#{t[:dependencies]}]\" unless t[:dependencies].blank?\r\n t = BgWorker.task(t)\r\n file = %Q[# name: #{t[:name]}\r\n\r\n # args: #{t[:args]}\r\n # desc: #{t[:desc]}\r\n #{\"# namespace: #{t[:namespace]}\" unless t[:namespace].blank?}\r\n # dependencies: #{t[:dependencies] unless t[:dependencies].blank?}\r\n #{\"namespace :#{t[:namespace]} do\" unless t[:namespace].blank?}\r\n\r\n desc %q[#{t[:desc]}]\r\n task :#{t[:name]} #{arg_string} #{dep_string} do |task #{', args' if arg_string}|\r\n\r\n #{t[:code]}\r\n\r\n end\r\n\r\n #{'end' unless t[:namespace].blank?}]\r\n\r\n if !id.blank? && id != t[:name]\r\n begin\r\n File.rm(Rails.root.join('lib', 'tasks', \"#{id}.rake\"))\r\n rescue\r\n flash[:error] = _('Task %{obj} could not be erased!') % {:obj => id}\r\n end\r\n end\r\n begin\r\n File.open(t[:filename], 'w+') {|f| f.write file}\r\n flash[:notice] = _('%{obj} successfully modified') % {:obj => _('Task')}\r\n rescue\r\n flash[:error] ||= ''\r\n flash[:error] << _('%{obj} could not be modified!') % {:obj => _('Task')}\r\n end\r\n redirect_to :action => :list\r\n end",
"def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end",
"def currentTask _args\n \"currentTask _args;\" \n end",
"def perform(**task)\n raise \"No work defined! for this task: #{task[:body]}. Define #perform private method in your class\"\n end",
"def load_task_param_variables!\n Task[].each do |task_name, task|\n task.param_values.each do |param_name, param_value|\n self[\"#{task.name}:#{param_name}\"] = param_value\n end\n end\n end",
"def task(task_name, opts = EMPTY_HASH)\n conf = OpenStruct.new # rubocop:disable Style/OpenStructUse\n yield conf\n tasks << ({ name: task_name, **opts, **conf.to_h })\n self\n end",
"def to_task; self end",
"def run(input)\n task = input\n task_name = \"#{task[1..-1].join(\" \")}\"\n case task[0] \n when \"add\" then add_task(task_name)\n when \"index\" then read_index\n when \"delete\" then delete_task(task_name)\n when \"complete\" then update_complete(task_name)\n end\n end",
"def process_task(options, filter, vars)\n printtitle(options['name']) if options['name']\n filter = options['filter'] || filter\n case\n when options['foreach_node']\n process_foreach(options['foreach_node'], filter, vars)\n when options['tasks']\n options['tasks'].each do |task|\n process_task(task, filter, vars)\n end\n when options['action']\n process_action(options, filter, vars)\n end\nend",
"def load_all_tasks_in_order\n load_dir = ENV[\"load_dir\"]\n tasks_and_files= [{\"ansi_code\"=>\"ansicode.csv\"},\n {\"client_profile_group\"=>\"clients.csv\"},\n {\"facilities\"=>\"facilities.csv\"},\n {\"rcc_payer\"=>\"rcc_payer.csv\"},\n {\"temp_reason_codes\"=>\"rcc_reason_codes.csv\"},\n {\"temp_reason_code_mappings\"=>\"rcc_mappings.csv\"},\n {\"temp_lockbox\"=>\"client_profile_lockbox.csv\"},\n {\"temp_payers\"=>\"ABAInfo.csv\"},\n {\"process_relationships_from_temp_tables\"=>\"\"},\n {\"change_partner_to_bac\"=>\"\"},\n {\"remove_temp_tables\" =>\"\"}]\n errors = []\n \n errors << \"Please provide a valid directory\" if (load_dir.blank? || !FileTest.exists?(load_dir))\n if errors.empty?\n tasks_and_files.each do |hash|\n csv_file = hash[hash.keys[0]]\n if !csv_file.blank?\n abs_path = load_dir + \"/\" + csv_file\n errors << \"File #{csv_file} not found in #{load_dir}\" if ! FileTest.exists?(abs_path)\n end\n end\n end\n\n if errors.empty?\n tasks_and_files.each do |hash|\n task = hash.keys[0]\n csv_file = hash[task]\n if !csv_file.blank?\n abs_path = load_dir + \"/\" + csv_file\n ENV[\"path\"] = abs_path\n puts \"processing file \" + ENV[\"path\"]\n end\n puts \"invoking task dataimport:#{task} ......\"\n Rake::Task[\"dataimport:#{task}\"].invoke \n end\n else\n errors.each do |err|\n puts err + \"\\n\"\n end\n end \nend",
"def task(*args, &block)\n Util.task(*args, &block)\n end",
"def formationTask _args\n \"formationTask _args;\" \n end",
"def task(name, &block)\r\n if name.kind_of?(Hash)\r\n name.each do |alias_name, task_name|\r\n raise(\"Undefined task `#{task_name}'\") unless @@tasks[task_name.to_s]\r\n @@tasks[alias_name.to_s] = @@tasks[task_name.to_s]\r\n @@descriptions[alias_name.to_s] = @@last_description\r\n end\r\n else\r\n raise(\"Task `#{name}' is defined more than once\") if @@tasks[name.to_s]\r\n @@tasks[name.to_s] = block\r\n @@descriptions[name.to_s] = @@last_description\r\n end\r\n\r\n @@last_description = nil\r\n end",
"def task options={}, &block\n worker([], options, &block)\n end",
"def post_task\n end",
"def executor; end",
"def executor; end",
"def executor; end",
"def rake_tasks(&block); end",
"def rake_tasks(&block); end",
"def initialize # Initialize method that is similar to a Constructor in Java\n @all_tasks = [] # Method includes an array that stores all tasks\n end",
"def pre_task\n end",
"def external_task\n output[:task]\n end",
"def simpleTasks _args\n \"simpleTasks _args;\" \n end",
"def task1(argument, option:)\nend",
"def get_taskarray\n @task_array\n end",
"def task\n @keys[:task]\n end",
"def normalize_tasks_harvest(tasks)\n tasks.each do |task|\n project_original_id = task[\"payload\"][\"project\"][\"id\"]\n project = Project.find_by(workspace_id: harvest_workspace.id, original_id: project_original_id)\n found_task = Task.find_by(project_id: project.id, original_id: task[\"payload\"][\"task\"][\"id\"])\n if found_task\n found_task.name = task[\"payload\"][\"task\"][\"name\"]\n else\n found_task = Task.create!(project_id: project.id, name: task[\"payload\"][\"task\"][\"name\"], original_id: task[\"payload\"][\"task\"][\"id\"])\n end\n end\n end",
"def configure_tasks\n end",
"def extra_pubish_tasks(p)\n \n end",
"def fetch(task_name, opts = EMPTY_HASH)\n task(task_name, opts)\n end",
"def task_params\n params[:task]\n end",
"def explain_true(task); end",
"def to_task(name, priority = 1)\r\n {\"name\" => name, \"priority\" => priority}\r\nend",
"def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end",
"def doc_task=(_arg0); end",
"def taskDescription _args\n \"taskDescription _args;\" \n end",
"def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end",
"def add_task(hash_task, *args)\n add_tasks([hash_task,], *args)\n end",
"def task(*arguments)\n if arguments.first.kind_of?(Hash)\n super(*arguments)\n else\n super(arguments.first => :environment)\n end\n end",
"def initialize\n @tasks = []\n @futures = nil\n end",
"def task\n return @task\n end",
"def resolve_task(task)\n if root_task && task.kind_of?(Roby::Task)\n root_task.plan.add(task)\n model_task = Coordination::Models::Task.new(task.model)\n script_task = instance_for(model_task)\n bind_coordination_task_to_instance(script_task, task, on_replace: :copy)\n else\n model_task = self.model.task(task)\n script_task = instance_for(model_task)\n end\n\n [script_task, model_task]\n end",
"def perform(*args)\n user_id, task_id, task_type, empirical_value, obi, from = args[0][0][0], args[0][0][1], args[0][0][2], args[0][0][3], args[0][0][4], args[0][0][5]\n empirical_value = empirical_value.to_i\n obi = obi.to_i\n user = Core::User.find_by(id: user_id)\n return p \"#{Time.now}————————>error---------------->用户不对!\" unless user.present?\n size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n case task_type\n when 'Shop::DynamicComment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::DynamicComment.find_by(id: task_id)\n comment.dynamic.topic.shop_task.get_obi user\n comment.dynamic.topic.shop_task.increment!(:participants)\n when 'Shop::VoteResult'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n vote_result = Shop::VoteResult.find_by(id: task_id)\n vote_result.resource.topic.shop_task.get_obi user\n vote_result.resource.topic.shop_task.increment!(:participants)\n when 'Shop::TopicDynamic'\n topic = Shop::TopicDynamic.find_by(id: task_id).topic\n if from.match(/._share/)\n topic.shop_task.share_state[\"#{Shop::Topic}:#{user.id}\"] += 1\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size #分享次数\n\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n #创建动态\n create_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"create_topic_dynamic\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #点赞\n like_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"self\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n #被别人点赞次数\n liked_size = Core::TaskAward.where(user_id: user_id, task_type: task_type, from: \"other\").where(\"created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n\n if (from == 'self' && like_size <= 5) || (from == 'other' && liked_size <= 50) || from == 'create_topic_dynamic' && create_size <= 5\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n if from == 'self' || from == \"create_topic_dynamic\"\n topic.shop_task.get_obi user\n topic.shop_task.increment!(:participants)\n end\n when 'Shop::Comment'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n comment = Shop::Comment.find_by(id: task_id)\n comment.task.shop_task.get_obi user\n comment.task.shop_task.increment!(:participants)\n when 'Shop::FundingOrder'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from )\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::FundingOrder.find_by(id: task_id)\n task = order.owhat_product.shop_task\n #task.increment!(:participants)\n task.get_obi(user)\n when 'Shop::Order'\n if size <= 50\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n order = Shop::Order.find_by(id: task_id)\n order.order_items.each do |item|\n #item.owhat_product.shop_task.increment!(:participants)\n item.owhat_product.shop_task.get_obi(user)\n end\n when 'Core::User', 'Core::Star', 'Qa::Poster', \"Shop::Event\", \"Shop::Product\", \"Shop::Topic\", \"Shop::Media\", \"Shop::Subject\", \"Shop::Funding\"\n if from.match(/._share/)\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.share_state[\"#{task.shop_type}:#{user.id}\"] += 1\n task.get_obi(user, type: 'share')\n end\n share_size = Core::TaskAward.where(user_id: user_id, task_type: task_type).where(\"`from` like '%_share' AND created_at > ? \", Time.now.beginning_of_day.to_s(:db)).size\n if share_size < 20\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n else\n #发任务暂时不送O元 包含媒体任务参与 打卡任务\n if task_type != 'Core::User' && task_type != 'Core::Star'\n task = eval(task_type).find_by(id: task_id).shop_task\n task.get_obi user\n task.increment!(:participants)\n end\n Core::TaskAward.create(user_id: user_id, task_id: task_id, task_type: task_type, empirical_value: empirical_value, obi: obi, from: from)\n user.update(empirical_value: user.empirical_value+empirical_value, obi: user.obi+obi)\n end\n end\n\n level, obi = user.update_obi_and_empirical_value(user.empirical_value, user)\n unless user.level == level\n Core::TaskAward.create(user_id: user_id, task_id: user.id, task_type: user.class, empirical_value: 0, obi: (obi - user.obi), from: 'level_up')\n user.update(level: level, obi: obi)\n end\n end",
"def currentTasks _args\n \"currentTasks _args;\" \n end",
"def registeredTasks _args\n \"registeredTasks _args;\" \n end",
"def proceed(*args)\n if(style == :serial)\n task.resume(*args)\n else\n task[:task_args] = args\n task.run\n task[:task_args]\n end\n end",
"def tasks\n @tasks ||= {}\n end",
"def task_arguments(options)\n options[:task] == 'retire_now' ? [options[:userid]] : []\n end",
"def task_arguments(options)\n options[:task] == 'retire_now' ? [options[:userid]] : []\n end",
"def to_task\n task = Task.new(work_block: proc { run!(params_to_hash) })\n task.recreatable = true\n task.recreatable.freeze # Avoid further mutations on this.\n task.recreatable_class = self.class\n task.recreatable_class.freeze\n task.recreatable_params = params_to_hash\n task.recreatable_params.freeze\n task\n end",
"def initialize\r\n load_tasks\r\n end",
"def resolve( task_hash )\n self\n end",
"def map_tasks(mapping)\n super\n @dependencies = dependencies.map do |task, role|\n [mapping[task] || task, role]\n end\n end",
"def task_to_hash(task)\n {\n \"id\" => task.id,\n \"state\" => task.state,\n \"description\" => task.description,\n \"timestamp\" => task.timestamp.to_i,\n \"started_at\" => task.started_at ? task.started_at.to_i: nil,\n \"result\" => task.result,\n \"user\" => task.username || \"admin\",\n \"deployment\" => task.deployment_name,\n \"context_id\" => task.context_id\n }\n end",
"def task(executor, message)\n\n domain = message['exid'].split('-', 2).first\n #tname = message['tasker']\n tname = determine_tasker_name(executor, message)\n\n tconf =\n ( ! message['routed'] &&\n (@unit.loader.tasker(domain, 'ganger', message) ||\n @unit.loader.tasker(domain, 'tasker', message))) ||\n @unit.loader.tasker(domain, tname, message)\n\n fail ArgumentError.new(\n \"tasker #{tname.inspect} not found\"\n ) unless tconf\n\n if tconf.is_a?(Array)\n\n points = [ nil, message['point'] ]\n points << 'detask' if points.include?('cancel')\n points << 'task' if points.include?('return')\n\n tconf = tconf.find { |h| points.include?(h['point']) }\n end\n\n fail ArgumentError.new(\n \"tconf #{tconf.inspect} not a hash\"\n ) unless tconf.is_a?(Hash)\n\n message['tconf'] = tconf unless tconf['include_tconf'] == false\n\n message['vars'] = gather_vars(executor, tconf, message)\n\n m = Flor.dup_message(message)\n #\n # the tasker gets a copy of the message (and it can play with it\n # to its heart content), meanwhile the message is handed to the\n # \"post\" notifiers.\n\n @unit.caller.call(self, tconf, m)\n #\n # might return a re-routing message,\n # especially if it's a domain tasker\n end",
"def jsonToTask(jsonObject)\r\n\t\t\t\ttask = Task.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\ttask.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"id_string\")\r\n\t\t\t\t\ttask.setIdString(jsonObject[\"id_string\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\ttask.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"completed\")\r\n\t\t\t\t\ttask.setCompleted(jsonObject[\"completed\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"created_by\")\r\n\t\t\t\t\ttask.setCreatedBy(jsonObject[\"created_by\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"created_person\")\r\n\t\t\t\t\ttask.setCreatedPerson(jsonObject[\"created_person\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"priority\")\r\n\t\t\t\t\ttask.setPriority(jsonObject[\"priority\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"percent_complete\")\r\n\t\t\t\t\ttask.setPercentComplete(jsonObject[\"percent_complete\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date\")\r\n\t\t\t\t\ttask.setStartDate(jsonObject[\"start_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_format\")\r\n\t\t\t\t\ttask.setStartDateFormat(jsonObject[\"start_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_long\")\r\n\t\t\t\t\ttask.setStartDateLong(jsonObject[\"start_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date\")\r\n\t\t\t\t\ttask.setEndDate(jsonObject[\"end_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_format\")\r\n\t\t\t\t\ttask.setEndDateFormat(jsonObject[\"end_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_long\")\r\n\t\t\t\t\ttask.setEndDateLong(jsonObject[\"end_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"duration\")\r\n\t\t\t\t\ttask.setDuration(jsonObject[\"duration\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"details\")\r\n\t\t\t\t\tdetails = jsonObject[\"details\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"owners\")\r\n\t\t\t\t\t\towners = details[\"owners\"]\r\n\t\t\t\t\t\townerList = Array.new\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tfor i in 0...owners.length\r\n\t\t\t\t\t\t\towner = owners[i]\r\n\t\t\t\t\t\t\townerList.push(jsonToOwner(owner))\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\ttask.setOwners(ownerList)\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"comments\")\r\n\t\t\t\t\t\tcomments = details[\"comments\"]\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcommentList = Array.new\r\n\r\n\t\t\t\t\t\tfor j in 0...comments.length\r\n\t\t\t\t\t\t\tcomment = comments[j]\r\n\t\t\t\t\t\t\tcommentList.push(jsonToComment(comment))\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\ttask.setComments(commentList)\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"documents\")\r\n\t\t\t\t\t\tdocuments = details[\"documents\"]\r\n\t\t\t\t\t\tdocumentIds = Array.new\r\n\r\n\t\t\t\t\t\tfor l in 0...documents.length\r\n\t\t\t\t\t\t\tdocumentIds[l] = String(documents[l][\"id\"])\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttask.setAssociateDocumentIds(documentIds)\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif details.has_key?(\"forums\")\r\n\t\t\t\t\t\tforums = details[\"forums\"]\r\n\t\t\t\t\t\tforumIds = Array.new\r\n\r\n\t\t\t\t\t\tfor m in 0...forums.length\r\n\t\t\t\t\t\t\tforumIds[m] = String(forums[m][\"id\"])\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttask.setAssociateForumIds(forumIds)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\ttask.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"subtask\")\r\n\t\t\t\t\t\ttask.setSubtaskUrl(link[\"subtask\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\tif link.has_key?(\"timesheet\")\r\n\t\t\t\t\t\ttask.setTimesheetURL(link[\"timesheet\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"subtasks\")\r\n\t\t\t\t\t\r\n\t\t\t\t\t#subtasks = jsonObject[\"subtasks\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\t#tasks = Array.new\r\n\r\n\t\t\t\t\t#for k in 0...subtasks.length\r\n\t\t\t\t\t#\ttaskObj = subtasks[k]\r\n\t\t\t\t\t#\ttasks.push(jsonToTask(taskObj))\r\n\t\t\t\t\t#end\r\n\t\t\t\t\t\r\n\t\t\t\t\ttask.setSubtasks(jsonObject[\"subtasks\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"tasklist\")\r\n\t\t\t\t\ttasklist = jsonObject[\"tasklist\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\ttask.setTasklist(jsonToTasklist(tasklist))\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn task\r\n\t\t\tend",
"def on_task_complete(task)\n end",
"def _prepare_for_invocation(name, sent_task=nil) #:nodoc:\n if name.is_a?(Thor::Task)\n task = name\n elsif task = self.class.all_tasks[name.to_s]\n object = self\n else\n object, task = self.class.prepare_for_invocation(nil, name)\n task ||= sent_task\n end\n\n # If the object was not set, use self and use the name as task.\n object, task = self, name unless object\n return object, _validate_task(object, task)\n end",
"def load_tasks(app = T.unsafe(nil)); end",
"def load_tasks(app = T.unsafe(nil)); end",
"def set_default_task_data(task)\n @work_types = @work_subtypes = @complexities= []\n if task.work_subtype\n @work_subtype = task.work_subtype\n @work_type = @work_subtype.work_type\n @work_subtypes = @work_type.work_subtypes\n @complexities = @work_subtype.work_subtype_complexities\n category = @work_type.category\n @back_office_task = category.has_complexity\n categories = Category.find_with_complexity(category.has_complexity)\n for cat in categories\n @work_types += cat.work_types\n end\n else\n @back_office_task=false\n @work_types = WorkType.livian_work_types\n @work_subtypes = @work_types.first.work_subtypes\n end\n @work_types.uniq!\n end",
"def tasks_for(list)\n\t\t@tasks[list] ||= fetch_latest_tasks_for(list)\n\tend",
"def initialize(description, completed_status = false) # Initialize method that is similar to a Constructor in Java\n @description = description # Method initializes each task object with a description\n @completed_status = completed_status # Boolean value to determine whether task is complete or not complete, default is false\n end",
"def task_get(task_name)\n tasks.fetch prepare_key(task_name), nil\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def pre_generation_hook(task)\n end",
"def task=(value)\n @task = value\n end",
"def taskHint _args\n \"taskHint _args;\" \n end",
"def program(tasks, hour, &task)\n\ttasks[hour] = task\nend",
"def taskCompleted _args\n \"taskCompleted _args;\" \n end",
"def do_work\n end",
"def work_pool; end",
"def set_task\n @task = Task.where(authorization_id: Authorization.current_id).find(params[:id])\n end",
"def process_current_task(params)\n game = params[:game]\n team = params[:user].team\n\n\n\n end",
"def taskParent _args\n \"taskParent _args;\" \n end",
"def set_task\n @task = Task.find(params[:id]) # OG\n end",
"def capable_tasks() @capable_tasks ||= Task.children; end",
"def my_task\n @my_id = current_user.id # may be redundant4 but will head towards service objects\n @tasks = Task.where(user_id: @my_id)\n end",
"def definition; Mrowka::Tasks[self.type.to_sym]; end",
"def run_tasks()\n self.task_queue.each do |task|\n\n self.task_list << task\n trigger_event(:start,:task)\n\n result = self.send(task[:name],*(task[:args]))\n if result[:status] == :failed\n break\n end\n\n\n self.task_list.last[:result]=result\n trigger_event(:end,:task)\n end\n end",
"def backend_addTask(param) \n @Tasks.push(param) \n end",
"def sync_tasks\n\n #TODO make this line optional\n @account_info = @authenticator.get_account\n\n #Add any tasks that needed to be added\n new_tasks = @tasks.keys.select{|task| task.brand_new?}\n @authenticator.add_tasks(new_tasks.collect {|task| task.json_parsed}) unless @new_tasks.new_tasks.empty?\n\n #Record that the tasks have already been added\n new_tasks.each {|task| task.no_longer_new}\n\n #Delete any tasks that were marked as deleted locally but not yet removed from @tasks\n deleted_tasks = @tasks.keys.select{|task| task.deleted?}\n @authenticator.delete_tasks(deleted_tasks.collect {|task| task.id}) unless deleted_tasks.empty?\n \n if lastedit_task > @last_task_sync\n #Get (recently edited) tasks\n tasks = @authenticator.get_tasks {:after => lastedit_task}\n \n locally_edited = []\n\n #TODO we may need to put this in a loop and load tasks page by page\n tasks.each do |task|\n if not @tasks[task.id]\n #If for some reason the task doesn't exist yet locally, add it\n @tasks[task.id] = task\n else\n #Compare modification times, update local copy when necessary, and resolve editing conflicts\n #Do NOT use task.last_mod, because that will just refer to the time that the get_tasks function was called!\n #Instead, we care about the time that the last edits were actually saved on the Toodledo server\n if task.modified > @tasks[task.id].last_mod\n #The server-stored task was modified more recently than the local task\n #TODO make sure all other locations are properly mutating the task, rather than creating parallel/outdated instances\n #If we simply overwrote the task instead of updating task.json_parsed, any past references to the task would point to an invalid/outdated\n @tasks[task.id].json_parsed = task.json_parsed\n @tasks[task.id].edit_saved\n else\n #The local task was modified more recently than the server-stored task\n #Realistically, the two timestamps cannot be the same, but if they are, we will assume the local copy is more accurate\n locally_edited.push(@tasks[task.id])\n end\n end\n end\n end\n\n if lastdelete_task > @last_task_sync\n #Query the deleted tasks (on the Toodledo server) and delete them here locally\n @user.get_deleted_tasks.collect{|task| task.id}.each do |id| \n #The delete boolean will be set just in case there are other references to the task, in which case it would not be garbage-collected\n @tasks[id].delete!\n @tasks[id].edit_saved #Make sure it won't be edited-saved in the future\n @tasks.delete(id)\n end\n end\n\n locally_edited = locally_edited.select{|task| not task.deleted?}\n @user.edit_tasks(locally_edited.collect{|task| task.json_parsed}) unless locally_edited.empty?\n \n #After this, the modified timestamp on the server will be the current time, which is later than the task.last_mod for any task stored locally\n \n #TODO check if there were repeating tasks that needed to be rescheduled\n \n #Remove any deleted tasks from @tasks. There may still be references elsewhere to them (depending on the application), so they may not necessarily be garbage-collected\n @tasks = @tasks.select{|task| not task.deleted?}\n\n @last_task_sync = Time.now\n end",
"def update(object_manager, task)\n\t\tsuper\n\n\t\ttask.started = flags[:started]\n\t\ttask.finished = flags[:finished]\n\t\ttask.success = flags[:success]\n\n\t\tif task.mission? != flags[:mission]\n\t\t plan = object_manager.local_object(self.plan) || object_manager.plan\n\t\t if plan.owns?(task)\n\t\t\tif flags[:mission]\n\t\t\t plan.add_mission(task)\n\t\t\telse\n\t\t\t plan.remove_mission(task)\n\t\t\tend\n\t\t else\n\t\t\ttask.mission = flags[:mission]\n\t\t end\n\t\tend\n\n\t\ttask.arguments.merge!(object_manager.local_object(arguments))\n\t\ttask.instance_variable_set(\"@data\", object_manager.local_object(data))\n\t end",
"def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end",
"def run_task(task)\n packaged = task.keys[0]\n package, name = Bee::Util::get_package_name(packaged)\n parameters = @build.context.evaluate_object(task[packaged])\n if not @packages[package]\n @packages[package] = Bee::Task::PackageManager.load_package(package, @build)\n end\n error \"Task '#{name}' not found in package '#{package}'\" if\n not @packages[package].respond_to?(name)\n @packages[package].send(name, parameters)\n end",
"def to_task_hash\n {\n mydevices: true,\n deviceid: rhizome.particle_device.device_id,\n event: \"#{event_type}/#{event_id}\",\n url: \"#{endpoint}/hooks/v1/#{event_type}\",\n json: self.class.send(\"#{self.class.event_to_json(event_type)}_task_json\")\n }\n end"
] |
[
"0.71333736",
"0.68506306",
"0.6676017",
"0.6413276",
"0.6253609",
"0.61941403",
"0.616741",
"0.61225724",
"0.6121424",
"0.6115851",
"0.60889715",
"0.6076551",
"0.6072162",
"0.6043144",
"0.60217136",
"0.60198337",
"0.60119",
"0.60106444",
"0.6006436",
"0.6001326",
"0.5954585",
"0.59384376",
"0.593136",
"0.59233165",
"0.5911156",
"0.59050864",
"0.59018886",
"0.5896931",
"0.5887979",
"0.5887979",
"0.5887979",
"0.58862287",
"0.58862287",
"0.5882788",
"0.5882397",
"0.5880687",
"0.58788294",
"0.5872512",
"0.5861922",
"0.583978",
"0.5837856",
"0.5835813",
"0.583509",
"0.5834978",
"0.5818123",
"0.5810526",
"0.579759",
"0.5794747",
"0.57945",
"0.57822114",
"0.57721364",
"0.57709926",
"0.57648754",
"0.5762807",
"0.5761194",
"0.57605743",
"0.57500255",
"0.57462865",
"0.5746213",
"0.57375515",
"0.572813",
"0.5722735",
"0.5722735",
"0.5708098",
"0.570287",
"0.5698384",
"0.5696324",
"0.56946886",
"0.5692676",
"0.5683507",
"0.56824553",
"0.56769824",
"0.5675402",
"0.5675402",
"0.567512",
"0.567126",
"0.5663054",
"0.5653113",
"0.56508356",
"0.5643536",
"0.56412077",
"0.56386685",
"0.5637058",
"0.5626152",
"0.5619485",
"0.56112015",
"0.5605307",
"0.5592488",
"0.5591503",
"0.55808675",
"0.5577917",
"0.5577855",
"0.55764705",
"0.55730945",
"0.5571261",
"0.55700624",
"0.55687195",
"0.5566127",
"0.5565391",
"0.5564449",
"0.5556669"
] |
0.0
|
-1
|
run_task generates a result that makes sense for a generic task which needs to be unwrapped to extract stdout/stderr/exitcode.
|
def unwrap_bolt_result(result)
if result.error_hash
# something went wrong return the failure
return result
end
Bolt::Result.for_command(@target, result.value['stdout'], result.value['stderr'], result.value['exit_code'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def result\n wait_for\n # If the task threw an exception during execution we raise that here.\n @task_error ? raise(@task_error) : @task_result\n end",
"def run_errored_task(broker, targets, task, files, input: {}, metadata: nil)\n run_task(broker, targets, task, files, input: input, metadata: metadata,\n blocking_request: true,\n expected_response_type: \"http://puppetlabs.com/rpc_error_message\") do |response_dataset|\n response_dataset.each { |data| yield data['description'] } if block_given?\n end\nend",
"def runCmd\n puts \" Deployed and running #{@request.data['command']} #{@request.data['arguments']}\".light_green\n print ' STDOUT'.light_cyan + ' and' + ' STDERR'.light_magenta + \":\\n\"\n\n # offset (place saving) variables\n @stdoutOffset = 0\n @stderrOffset = 0\n begin\n # get most recent task state\n # need to wait for \"task_running\" before we can ask for STDOUT/STDERR\n @taskState = JSON.parse(RestClient.get \"#{@uri}/api/history/task/#{@thisTask['taskId']['id']}\")\n @taskState[\"taskUpdates\"].each do |update|\n @taskState = update['taskState']\n end\n if @taskState == \"TASK_FAILED\"\n return 1 # failure\n end\n if @taskState == \"TASK_RUNNING\"\n sleep 1\n # print stdout\n @stdout = JSON.parse(RestClient.get \"#{@uri}/api/sandbox/#{@thisTask['taskId']['id']}/read\", {params: {path: \"stdout\", length: 30000, offset: @stdoutOffset}})['data']\n outLength = @stdout.bytes.to_a.size\n if @stdout.length > 0\n print @stdout.light_cyan\n @stdoutOffset += outLength\n end\n # print stderr\n @stderr = JSON.parse(RestClient.get \"#{@uri}/api/sandbox/#{@thisTask['taskId']['id']}/read\", {params: {path: \"stderr\", length: 30000, offset: @stderrOffset}})['data']\n errLength = @stderr.bytes.to_a.size\n if @stderr.length > 0\n print @stderr.light_magenta\n @stderrOffset += errLength\n end\n end\n end until @taskState == \"TASK_FINISHED\"\n\n return 0 # success\n end",
"def run_failed_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n run_task(broker, targets, task, files, input: input, metadata: metadata) do |response_dataset|\n ensure_failed(broker, targets, response_dataset, **kwargs, &block)\n end\nend",
"def process_result(result, exit_status); end",
"def run_successful_task(broker, targets, task, files, input: {}, metadata: nil, max_retries: 30, query_interval: 1, &block)\n target_identities = targets.map {|agent| \"pcp://#{agent}/agent\"}\n\n run_task(broker, target_identities, task, input, files, metadata,\n method(:rpc_non_blocking_request), \"http://puppetlabs.com/rpc_provisional_response\") do |datas|\n transaction_ids = datas.map { |data| data[\"transaction_id\"] }\n target_identities.zip(transaction_ids).map do |identity, transaction_id|\n check_non_blocking_response(broker, identity, transaction_id, max_retries, query_interval) do |result|\n assert_equal('success', result['status'], 'Task was expected to succeed')\n assert_equal(nil, result['stderr'], 'Successful task expected to have no output on stderr')\n assert_equal(0, result['exitcode'], 'Successful task expected to have exit code 0')\n block.call(result['stdout'])\n end\n end\n end\nend",
"def run_task(task_name)\n puts heading(\"Running #{task_name}\")\n @results[task_name] = Rake::Task[task_name].invoke\n end",
"def define_run_task\n desc @run_description\n task 'run' do\n target_sha = ENV['TARGET_SHA']\n ts = TTNT::TestSelector.new(repo, target_sha, expanded_file_list)\n tests = ts.select_tests!\n\n if tests.empty?\n STDERR.puts 'No test selected.'\n else\n if ENV['ISOLATED']\n tests.each do |test|\n args = \"#{ruby_opts_string} #{test} #{option_list}\"\n run_ruby args\n break if @failed && ENV['FAIL_FAST']\n end\n else\n args =\n \"#{ruby_opts_string} #{run_code} \" +\n \"#{tests.to_a.join(' ')} #{option_list}\"\n run_ruby args\n end\n end\n end\n end",
"def result_status(task)\n reason = why_ignore(task)\n case reason\n when :upstream; :-\n when :execute; :pending\n when :complete; :complete\n else; :\"ignore_#{reason}\"\n end\n end",
"def execute_cmd\t\n\t\t#rake_output = toolpath(\"webrobot\") + \"./results/#{@uuid}_stdout.tmp\"\n\t\t@keepstdout = false\n\t\tENV['FILE'] = File.join(File.dirname(__FILE__), \"/home/tasks/\"+@pattern)\n\t\tENV['WR_DEBUG'] = 'on'\n\t\t\n\t\tputs \"BREAK IT OFF\"\n\t\tapp = Rake.application\n\t\tapp.init\n\t\tapp.add_import toolpath(\"webrobot\", @task_data['toolbox_tools'], @task_data['tool_path_lookup'])+\"/webrobot.rake\"\n\t\tapp.load_imports\n\n\t\tputs \"executing WRTask command:: \" + @raketask\n\t\t\n\t\tif @keepstdout \n\t\t\tputs \"Executing rake (STDOUT)\"\n\t\t\tRake.application['for:real'].invoke()\n\t\t\t@output = \"1 example, 0 failures\"\n\t\t\t#@output = \"4 examples, 0 failures\"\n\t\telse \n\t\t\tputs \"Executing rake (STDOUT REDIR)\"\t\t\n\t\t\t\n\t\t\tbegin\n\t\t\t\tredirect_webrobot_stdout{Rake.application[@raketask].invoke() }\n\t\t\trescue\n\t\t\t\tputs \"SHIT BROKE\"\n\t\t\tensure\n\t\t\t\t@output = retrieve_webrobot_log\n\t\t\t\t@exit_status = case @output\n\t\t\t\t\twhen /0 failures/ then @task_data['test_exit_status_passed']\n\t\t\t\t\telse @task_data['test_exit_status_failed']\n\t\t\t\tend\t\n\t\t\t\t@matrix = {}\n\t\t\tend\n\t\tend\t\t\n\t\t\n\tend",
"def run_successful_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n run_task(broker, targets, task, files, input: input, metadata: metadata) do |response_dataset|\n ensure_successful(broker, targets, response_dataset, **kwargs, &block)\n end\nend",
"def external_task\n output[:task]\n end",
"def run(&code)\n env = self.new\n stderr = StringIO.new\n status, result = begin\n real_stderr = $stderr ; $stderr = stderr # swap stderr\n \n env.instance_eval(&self.setup_block) if self.setup_block\n value = env.instance_eval(&code)\n result = env._status == :info ? \n render_value(value) : render_checks(env._checks)\n [env._status, result]\n \n rescue Object => error\n [:error, render_error(error)]\n ensure\n $stderr = real_stderr # swap stderr back\n end\n [status, result, stderr.rewind && stderr.read]\n end",
"def run_task\n begin\n run \n rescue Exception => e\n @task_run.add_error_text(e.class.name + \": \" + e.message)\n @task_run.add_error_text(e.backtrace.inspect)\n @task_run.success = false\n end \n\n finally\n\n @task_run.end_time = Time.now\n @task_run.save\n end",
"def faulted_result(task, exception)\n task.__result = nil\n task.__exception = exception\n task.__status = TaskStatus::FAULTED\n end",
"def task_run(task_name, params)\n config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') }\n inventory_hash = inventory_hash_from_inventory_file\n target_node_name = ENV['TARGET_HOST'] if target_node_name.nil?\n\n result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)\n\n raise \"task failed\\n`#{task_name}`\\n======\\n#{result}\" if result.first['status'] != 'success'\n\n result\n end",
"def result_status(task)\n reason = why_ignore(task)\n case reason\n when :upstream then :-\n when :execute then :pending\n when :complete then :complete\n else; :\"ignore_#{reason}\"\n end\n end",
"def run_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n params = { task: task, input: input, files: files }\n params[:metadata] = metadata if metadata\n do_module_action(broker, agent_identities(targets), 'task', 'run', params, **kwargs, &block)\nend",
"def run_task(task)\n packaged = task.keys[0]\n package, name = Bee::Util::get_package_name(packaged)\n parameters = @build.context.evaluate_object(task[packaged])\n if not @packages[package]\n @packages[package] = Bee::Task::PackageManager.load_package(package, @build)\n end\n error \"Task '#{name}' not found in package '#{package}'\" if\n not @packages[package].respond_to?(name)\n @packages[package].send(name, parameters)\n end",
"def run_it *a, &b\n exit_status, stdout, stderr = systemu *a, &b\n\n puts stdout unless stdout.empty?\n STDERR.puts stderr unless stderr.empty?\n\n exit_status\n end",
"def run_pxp_errored_task(broker, targets, task, files, input: {}, metadata: nil, &block)\n target_identities = targets.map {|agent| \"pcp://#{agent}/agent\"}\n\n run_task(broker, target_identities, task, input, files, metadata,\n method(:rpc_blocking_request), \"http://puppetlabs.com/rpc_error_message\") do |datas|\n descriptions = datas.map { |data| data[\"description\"] }\n descriptions.each { |description| block.call(description) }\n end\nend",
"def execute_task\n create_test_files\n commands = rake_result[:commands] = []\n allow(task).to receive(:sh) do |command, _|\n commands << command\n end\n Rake::Task[:default].invoke\n end",
"def execute_task task\n puts \"starting #{task}...\"\n Rake::Task[\"railties:install:migrations\"].reenable\n Rake::Task[task].reenable\n r = Rake::Task[task].invoke\n puts \"#{task} done! #{r}\"\nend",
"def run_wrapped_cmd(cmd)\n separator = '-' * (TW - 4)\n\n puts \"Command output follows, on STDERR:\\n#{separator}\"\n ret = nil\n\n Open3.popen2e(cmd) do |_in, out, thr|\n # rubocop:disable Lint/AssignmentInCondition\n while l = out.gets do warn l end\n # rubocop:enable Lint/AssignmentInCondition\n ret = thr.value.exitstatus\n end\n\n puts separator\n ret\n end",
"def run_and_output(cmd)\n run(cmd).output\n end",
"def execute_task\n self.result_details = nil\n task_type = task['task_type'].to_s\n\n unless supported_tasks.include?(task_type)\n raise \"Unsupported task type: #{task_type}, valid options: #{supported_tasks.inspect}\"\n end\n\n # call the method to execute the task based on task and job type\n task_method = \"#{task_type}_#{job_type}\"\n send(task_method)\n raise \"Task must set the result details (via completed_with): #{task_method}\" unless result_details\n end",
"def build_run_msg(task)\n date = Time.now.strftime(\"%b %d %H:%M:%S\")\n hostname = Socket.gethostname\n username = Etc.getpwuid(Process.uid).name\n \"#{date} #{hostname} #{$$} (#{username}) JOB (#{task})\"\n end",
"def run_task(type, properties)\n tasks = playbook.tasks.load_tasks([type => properties], \"tasks\")\n\n playbook.tasks.run_task(tasks[0], \"plan\", false)\n\n result = tasks[0][:result]\n runner = tasks[0][:runner]\n\n execution_result = runner.to_execution_result([result.success, result.msg, result.data])\n fail_ok = properties.fetch(\"fail_ok\", false)\n\n return execution_result if result.success\n return execution_result if fail_ok\n raise(result.msg)\n end",
"def run()\n stdout_file = Tempfile::new(\"rbatch_tmpout\",RBatch::tmp_dir)\n stderr_file = Tempfile::new(\"rbatch_tmperr\",RBatch::tmp_dir)\n pid = spawn(@cmd_str,:out => [stdout_file,\"w\"],:err => [stderr_file,\"w\"])\n if @opt[:timeout] != 0\n timeout(@opt[:timeout]) do\n begin\n status = Process.waitpid2(pid)[1] >> 8\n rescue Timeout::Error => e\n raise(CmdException,\"Command timeout (over \" + @opt[:timeout] + \" sec)\" )\n end\n end\n else\n status = Process.waitpid2(pid)[1] >> 8\n end\n result = RBatch::CmdResult.new(stdout_file,stderr_file,status,@cmd_str)\n if @opt[:raise] && status != 0\n raise(CmdException,\"Command exit status is not 0. result: \" + result.to_s)\n end\n return result\n end",
"def log_task_run(run_msg, error_msg)\n if error_msg\n @logger.add(Logger::ERROR, run_msg + \"\\n\" + error_msg)\n elsif @debug\n @logger.add(Logger::DEBUG, run_msg + \"\\n\" + build_debug_msg)\n else\n @logger.add(Logger::INFO, run_msg)\n end\n end",
"def run(task)\n debug \"Run task: #{task}\"\n raise Deployment::NotImplemented, 'This method is abstract and should be implemented in a subclass'\n end",
"def run_with_tee(cmd)\n status, stdout, stderr = nil\n\n if windows?\n #:nocov: TODO: Test block\n system(cmd)\n status = $?.exitstatus\n #:nocov:\n else\n stdout, stderr = [$stdout, $stderr].map{ |t| StringTee.new(t) }\n status = Open4.spawn(cmd, 'stdout' => stdout, 'stderr' => stderr, 'quiet' => true)\n stdout, stderr = [stdout, stderr].map(&:string)\n end\n\n [status, stdout, stderr]\n end",
"def test_outputonfailure\n provider = newprovider\n\n dir = tstdir\n file = File.join(dir, \"mycmd\")\n sh = Puppet::Util.which(\"sh\")\n File.open(file, \"w\") { |f|\n f.puts %{#!#{sh}\n echo A Failure >&2\n exit 2\n }\n }\n File.chmod(0755, file)\n\n provider.commands :cmd => file\n\n inst = provider.new(nil)\n\n assert_raise(Puppet::ExecutionFailure) do\n inst.cmd \"some\", \"arguments\"\n end\n\n out = nil\n begin\n inst.cmd \"some\", \"arguments\"\n rescue Puppet::ExecutionFailure => detail\n out = detail.to_s\n end\n\n\n assert(\n out =~ /A Failure/,\n\n \"Did not receive command output on failure\")\n\n\n assert(\n out =~ /Execution of/,\n\n \"Did not receive info wrapper on failure\")\n end",
"def input_output_nested_for_task(task)\n input = task[0]\n output = task[-1]\n\n output, nested = output.is_a?(Entity::Output) ? [output, task-[input, output]] : [nil, task[1..-1]]\n\n return input, output, nested\n end",
"def execute_task_tests\n # Run all tasks tests (ensuring we capture any changes in the sites we are monitoring)\n test_results = @tasks_by_job_ids.values.map {|task|\n puts \"- Running test for task: #{task.class.name}\" \n if task.respond_to?(:test)\n begin\n result = task.test()\n if result.kind_of?(Array) && result.length > 0\n # Log the error for the result\n @task_test_results_logger.error(\"FAILURE:#{result.inspect}\")\n # Send an email with the failure information\n Notifier.deliver_crawler_error(\"christkv@gmail.com\", task.class.name, result)\n end\n rescue Exception => e\n # Log the error for the result\n @task_test_results_logger.error(\"ERROR:#{e.backtrace}\")\n # Send an email with the failure information\n Notifier.deliver_crawler_error(\"christkv@gmail.com\", task.class.name, [e.backtrace.inspect])\n end\n end\n }\n # return the test results\n return test_results\n end",
"def run(options={})\n output = options[:output] || $stdout\n tasks.each do |t|\n apply_directory_settings(t)\n output_message(t, output)\n return unless t.run(options)\n end\n end",
"def backtick_output(command)\n success, output = run_external(command, {}, SETTINGS[:project])\n return output, success\n end",
"def run\n log.info(\"Running...\")\n result = run_internal()\n log.info(\"Success! #{result.message}\")\n return result\n end",
"def run_result; result['run_cyber_dojo_sh']; end",
"def link_outputs(task_full_name)\n <<~CODE\n python <<EOF\n import json\n import subprocess\n import re\n\n def sh(cmd, ignore_error=False):\n try:\n print cmd\n subprocess.check_call(cmd, shell=True)\n except subprocess.CalledProcessError as e:\n sys.exit(e.returncode)\n\n with open(\"#{CROMWELL_OUTPUTS_FILE}\") as f:\n cwloutputs = json.loads(f.read())['outputs']\n\n for oname, ovalue in cwloutputs.items():\n if ovalue is not None:\n sh(\"emit {} {}\".format(re.sub(\"#{task_full_name}.\", \"\", oname), ovalue))\n EOF\n CODE\n end",
"def run\n puts 'running task...'\n resp = if @container_name\n @client.run_task(cluster: @cluster, task_definition: @task_def, overrides: {\n container_overrides: [{\n name: @container_name, command: @command\n }]\n })\n else\n @client.run_task(cluster: @cluster, task_definition: @task_def)\n end\n task_arn = resp[0][0]['task_arn']\n result =\n begin\n puts 'waiting for task to complete...'\n @client.wait_until(:tasks_stopped, cluster: @cluster, tasks: [task_arn])\n rescue Aws::Waiters::Errors::WaiterFailed => error\n puts \"failed waiting for task to run: #{error.message}\"\n end\n puts \"task ended with exit code #{result[0][0]['containers'][0]['exit_code']}\"\n # return exit code\n raise 'task appears to have failed, check container logs' if result[0][0]['containers'][0]['exit_code'] != 0\n end",
"def run_runner(runner)\n puts \" Running #{runner} tests...\"\n error_detail = \"\"\n result = \"\"\n passed = false\n if Config::CONFIG['host_os'] =~ /mswin/\n stdout = IO.popen(\"cmd.exe /C rake #{runner} 2>test_#{runner}_error.log\")\n result = stdout.read\n error_detail = File.read(\"test_#{runner}_error.log\")\n else\n Open3::popen3(\"rake #{runner}\") do |stdin, stdout, stderr, pid|\n result = stdout.read.strip\n if result.match(/Finished in/).nil?\n error_detail = stderr.read.strip\n end\n end\n end\n return error_detail, result\n end",
"def run_bolt_task(task_name, params = {}, opts = {})\n config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') }\n target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV.fetch('TARGET_HOST', nil)\n inventory_hash = if !opts[:inventory_file].nil? && File.exist?(opts[:inventory_file])\n inventory_hash_from_inventory_file(opts[:inventory_file])\n elsif File.exist?('spec/fixtures/litmus_inventory.yaml')\n inventory_hash_from_inventory_file('spec/fixtures/litmus_inventory.yaml')\n else\n localhost_inventory_hash\n end\n\n target_option = opts['targets'] || opts[:targets]\n if target_option.nil?\n raise \"Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml\" unless target_in_inventory?(inventory_hash, target_node_name)\n else\n target_node_name = search_for_target(target_option, inventory_hash)\n end\n\n bolt_result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)\n result_obj = {\n exit_code: 0,\n stdout: nil,\n stderr: nil,\n result: bolt_result.first['value']\n }\n\n if bolt_result.first['status'] == 'success'\n # stdout returns unstructured data if structured data is not available\n result_obj[:stdout] = if bolt_result.first['value']['_output'].nil?\n bolt_result.first['value'].to_s\n else\n bolt_result.first['value']['_output']\n end\n\n else\n raise \"task failed\\n`#{task_name}`\\n======\\n#{bolt_result}\" if opts[:expect_failures] != true\n\n result_obj[:exit_code] = if bolt_result.first['value']['_error']['details'].nil?\n 255\n else\n bolt_result.first['value']['_error']['details'].fetch('exitcode', 255)\n end\n result_obj[:stderr] = bolt_result.first['value']['_error']['msg']\n end\n\n result = OpenStruct.new(exit_code: result_obj[:exit_code],\n stdout: result_obj[:stdout],\n stderr: result_obj[:stderr],\n result: result_obj[:result])\n yield result if block_given?\n result\n end",
"def run_and_output(*args, **kwargs)\n _wrap_run((proc { |*a, **k| Host.run_and_output(*a, **k) }), *args, **kwargs)\n end",
"def run_simple(*command, **opts, &b)\n\t\t\t# here the block is called in case of error\n\t\t\topts[:error_mode]=b if b\n\t\t\t_status, out, _error = run(*command, **opts)\n\t\t\treturn out\n\t\tend",
"def sendTaskResult _obj, _args\n \"_obj sendTaskResult _args;\" \n end",
"def sendTaskResult _obj, _args\n \"_obj sendTaskResult _args;\" \n end",
"def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end",
"def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end",
"def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end",
"def run_task(task, set, hooks=true)\n properties = task[:properties]\n result = task[:result]\n task_runner = task[:runner]\n\n Log.info(\"About to run task: %s\" % t(task[:runner].description))\n result.description = t(task[:runner].description)\n\n if hooks && !run_set(\"pre_task\")\n Log.warn(\"Failing task because a critical pre_task hook failed\")\n return false\n end\n\n if properties[\"pre_sleep\"]\n Log.info(\"Sleeping %d seconds before check\" % [properties[\"pre_sleep\"]])\n sleep(Integer(properties[\"pre_sleep\"]))\n end\n\n (1..properties[\"tries\"]).each do |try|\n task_runner.from_hash(t(properties))\n task_runner.validate_configuration!\n\n @results << result.timed_run(set)\n\n if result.success?\n Log.info(result.msg)\n else\n Log.error(result.msg)\n end\n\n if try != properties[\"tries\"] && !result.success\n Log.warn(\"Task failed on try %d/%d, sleeping %ds: %s\" % [try, properties[\"tries\"], properties[\"try_sleep\"], result.msg])\n sleep(Integer(properties[\"try_sleep\"]))\n end\n\n break if result.success\n end\n\n if hooks && !run_set(\"post_task\")\n Log.warn(\"Failing task because a critical post_task hook failed\")\n return false\n end\n\n result.success\n end",
"def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end",
"def run!(input)\n stdout, stderr, process = run(input)\n\n if process.success?\n puts stdout\n\n STDERR.puts(stderr) unless stderr.empty?\n else\n abort stderr\n end\n end",
"def run(result:)\n result\n .bind do |shell_out|\n ::Kitchen::Terraform::Client::Command\n .run(\n logger: logger,\n shell_out: shell_out,\n timeout: config_command_timeout\n )\n end\n end",
"def run_task_from_file\n result = nil\n task = nil\n log.info \"Start Worker run for file #{@file}\"\n task = JSON.parse(IO.read(@file))\n\n # While provisioning, don't allow the provisioner to terminate by disabling signal\n sigterm = Coopr::Worker::SignalHandler.new('TERM')\n sigterm.dont_interupt do\n result = delegate_task(task)\n end\n rescue StandardError => e\n log.error \"Caught exception when running task from file #{@file}\"\n\n result = {} if result.nil? == true\n result['status'] = '1'\n # Check if it's an ssh_exec exception for additional logging info\n if e.class.name == 'CommandExecutionError'\n log.error \"#{e.class.name}: #{e.to_json}\"\n result['stdout'] = e.stdout\n result['stderr'] = e.stderr\n else\n result['stdout'] = e.inspect\n result['stderr'] = \"#{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n log.error \"Worker run failed, result: #{result}\"\n end",
"def run_a_rake_command(rake_task_and_args)\n command_text = \"cd /opt/supermarket/embedded/service/supermarket && \\\n RAILS_ENV=\\\"production\\\" env PATH=/opt/supermarket/embedded/bin \\\n bin/rake #{rake_task_and_args}\"\n\n shell_out = Mixlib::ShellOut.new(command_text)\n shell_out.run_command\n $stdout.puts shell_out.stdout\n $stderr.puts shell_out.stderr\n exit shell_out.exitstatus\nend",
"def run\n out = \"\"\n\n begin\n PTY.spawn(command) do |stdout, stdin, pid|\n begin\n stdout.each do |line|\n out << line.strip+\"\\n\"\n print line if @tee\n end\n rescue Errno::EIO\n #Errno:EIO error probably just means that the process has finished giving output\n end\n Process.wait(pid)\n end\n rescue PTY::ChildExited\n # The child process has exited.\n end\n\n if $?.exitstatus == 0\n return Parser.parse(out) if @parse\n return out\n else\n raise \"httperf exited with status #{$?.exitstatus}\\n\\nhttperf output:\\n--------------\\n#{out}\"\n end\n end",
"def run!(*tasks_to_run)\n tasks_to_run.flatten!\n\n tasks_to_run.map! do |ttr| \n unless ret = self.__tasks.find {|t| t.__name == ttr } \n seq = self.__sequences.find {|t| t.__name == ttr }\n ret = seq.__task_names.map {|tn| self.__tasks.find {|t| t.__name == tn }}.compact if seq\n end\n ret\n end\n tasks_to_run.flatten!\n tasks_to_run.compact!\n\n ret = []\n tasks_to_run.each do |task|\n ret << task.__build_commands(self.__tasks)\n Runner.execute!(:task => task, :tasks => self.__tasks, :servers => self.__servers, :silent => self.__options[:silent], :verbose => self.__options[:verbose])\n end\n\n $stdout << \"\\033[0m\"\n ret.flatten # return this for tests\n end",
"def run\n Application.logger.info \"Executing #{self.class.to_s} (UseCase)\"\n _r = execute\n Application.logger.info \"Returned from #{self.class.to_s} => #{_r.inspect}\"\n _r\n end",
"def render(results) \n case verb\n when 'check_tests' then \n starting_str = \"The following manifests are missing tests\\n\"\n results.inject(starting_str) do |str, element| \n exit_code = 1\n str << \"#{element}\\n\" \n end\n when 'compile_tests' then\n transformed_results = {\n 'failed_to_compile' => [],\n 'compiled' => []\n }\n results.each do |k,v|\n if v['catalog'] == :failed_to_compile\n transformed_results['failed_to_compile'].push(k)\n else\n transformed_results['compiled'].push(k)\n if @options[:run_noop]\n if v['results'] == :failed_to_run\n transformed_results[:failed_to_run] ||= []\n transformed_results[:failed_to_run].push(k)\n else\n transformed_results[v['results'].status] ||= []\n transformed_results[v['results'].status].push(k) \n end\n end\n end\n end\n # TODO - I could store catalogs at outputdir\n # if either of these keys exist, return non-zero\n if transformed_results[:failed_to_compile] or\n transformed_results[:failed]\n @exit_code=1\n end\n transformed_results.to_yaml\n end\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def parse_deploy_output(stdout, _stderr)\n tasks = []\n current_task = nil\n stdout.split(\"\\n\").each do |line|\n # Remove control chars and spaces around\n case line.gsub(/\\e\\[[^\\x40-\\x7E]*[\\x40-\\x7E]/, '').strip\n when /^\\* (\\w+\\[[^\\]]+\\]) action (.+)$/\n # New task\n task_name = Regexp.last_match(1)\n task_action = Regexp.last_match(2)\n current_task = {\n name: task_name,\n action: task_action,\n status: :identical\n }\n tasks << current_task\n when /^- (.+)$/\n # Diff on the current task\n diff_description = Regexp.last_match(1)\n unless current_task.nil?\n current_task[:diffs] = '' unless current_task.key?(:diffs)\n current_task[:diffs] << \"#{diff_description}\\n\"\n current_task[:status] = :changed\n end\n end\n end\n tasks\n end",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run_a_rake_command(rake_task_and_args)\n cmd_helper = CtlCommandHelper.new('spdx-<command>')\n cmd_helper.must_run_as 'supermarket'\n\n command_text = cmd_helper.rails_env_cmd(\"bin/rake #{rake_task_and_args}\")\n shell_out = Mixlib::ShellOut.new(command_text)\n shell_out.run_command\n $stdout.puts shell_out.stdout\n $stderr.puts shell_out.stderr\n exit shell_out.exitstatus\nend",
"def _run_and_output(*args, **kwargs)\n Host.run_and_output(*args, **kwargs)\n end",
"def execute\n { 'output' => `#{@cmd}`, 'process_status' => $? }\n end",
"def run_task_result_with_http_info(task_id, job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.run_task_result ...'\n end\n # verify the required parameter 'task_id' is set\n if @api_client.config.client_side_validation && task_id.nil?\n fail ArgumentError, \"Missing the required parameter 'task_id' when calling TasksApi.run_task_result\"\n end\n # verify the required parameter 'job_id' is set\n if @api_client.config.client_side_validation && job_id.nil?\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling TasksApi.run_task_result\"\n end\n # resource path\n local_var_path = '/tasks/{task_id}/action/run'.sub('{' + 'task_id' + '}', CGI.escape(task_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'job_id'] = job_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'queued', 'working', 'failed'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ActiveJobStatus' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TasksApi#run_task_result\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def clean_exit\n\ttasks_passed\n tests_passed = all_by_exit_status(@task_config['test_exit_status_passed'])\n tests_failed = all_by_exit_status(@task_config['test_exit_status_failed'])\n tests_skipped = all_by_exit_status(@task_config['test_exit_status_skipped'])\n testcases_total = all_testcase_in_tests\n testcases_passed = all_passing_testcase_in_tests\n verifications = all_verifications_in_tests\n verifications_passed = all_passed_verifications_in_tests\n \n @task_config.merge!({'execution_time' => @execution_time, 'tests_passed' => tests_passed, 'tests_failed' => tests_failed, 'tests_skipped' => tests_skipped, 'testcases_total' => testcases_total, 'testcases_passed' => testcases_passed, 'verifications' => verifications, 'verifications_passed' => verifications_passed})\n \n\t \n\t #Publisher.new(@task_config).publish_reports\n \n\t \n\t \n\t puts(\"\\n==> DONE\\n\\n\")\n puts(\":: [SESSION]\\n\")\n puts(\" -- reports prepared: #{@task_config['reports_dir']}\\n\")\n puts(\" -- execution time : #{@execution_time.to_s} secs\\n\")\n puts(\" -- tests executed : #{@executed_tests.to_s}\\n\")\n puts(\" -- tests passed : #{tests_passed.length.to_s}\\n\")\n puts(\" -- tests failed : #{tests_failed.length.to_s}\\n\")\n puts(\" -- tests skipped : #{tests_skipped.length.to_s}\\n\")\n puts(\" -- cases total : #{testcases_total.to_s}\\n\")\n puts(\" -- cases passed : #{testcases_passed.to_s}\\n\")\n puts(\" -- verifications : #{verifications.to_s}\\n\")\n puts(\" -- verify passed : #{verifications_passed.to_s}\\n\")\n \n if @task_config['test_retry']\n puts(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n end\n if tests_failed.length > 0 || verifications_passed != verifications\n puts(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n exit(1)\n end\n exit(0)\nend",
"def run_with_stderr(*cmd)\n result = IO.popen(cmd, err: [:child, :out]) do |io|\n block_given? ? yield(io) : io.read\n end\n String === result && result.empty? ? nil : result\n end",
"def puppet_output(bolt_result)\n bolt_result.dig(0, 'value', 'stderr').to_s + \\\n bolt_result.dig(0, 'value', 'stdout').to_s\n end",
"def run(cmd)\n ENV['LANG'] = 'C'\n log \"Run: #{cmd}\"\n if dry_run\n return ['', 0]\n end\n stdout = `#{cmd} 2>&1`\n return_code = $?.exitstatus\n puts stdout\n puts \"Return: #{return_code}\"\n [stdout, return_code]\n end",
"def run_check!(chk)\n chk.run\n rescue SystemExit => e\n results[exit_statuses[e.status]] << chk.output\n rescue StandardError => e\n # Though an argument could be made to treat other exceptions as\n # critical instead of unknown.\n results[:unknown] << e.to_s\n end",
"def process_agent_task(task)\n if task.key?(\"action\")\n if task[\"action\"] == \"ruby.source\"\n payload = ::Instana::Util.get_rb_source(task[\"args\"][\"file\"])\n else\n payload = { :error => \"Unrecognized action: #{task[\"action\"]}. An newer Instana gem may be required for this. Current version: #{::Instana::VERSION}\" }\n end\n else\n payload = { :error => \"Instana Ruby: No action specified in request.\" }\n end\n\n path = \"com.instana.plugin.ruby/response.#{@process[:report_pid]}?messageId=#{URI.encode(task['messageId'])}\"\n uri = URI.parse(\"http://#{@discovered[:agent_host]}:#{@discovered[:agent_port]}/#{path}\")\n req = Net::HTTP::Post.new(uri)\n req.body = Oj.dump(payload, OJ_OPTIONS)\n ::Instana.logger.debug \"Responding to agent request: #{req.inspect}\"\n make_host_agent_request(req)\n\n rescue StandardError => e\n Instana.logger.debug { \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\" }\n Instana.logger.debug { e.backtrace.join(\"\\r\\n\") }\n end",
"def task_status(proxmox, pve_node, task)\n status_info = proxmox_get(proxmox, \"nodes/#{pve_node}/tasks/#{task}/status\")\n \"#{status_info['status']}#{status_info['exitstatus'] ? \":#{status_info['exitstatus']}\" : ''}\"\n end",
"def exec_read_result(powershell_code)\n write_pipe(pipe_command(:execute))\n write_pipe(length_prefixed_string(powershell_code))\n read_streams\n # If any pipes are broken, the manager is totally hosed\n # Bad file descriptors mean closed stream handles\n # EOFError is a closed pipe (could be as a result of tearing down process)\n # Errno::ECONNRESET is a closed unix domain socket (could be as a result of tearing down process)\n rescue Errno::EPIPE, Errno::EBADF, EOFError, Errno::ECONNRESET => e\n @usable = false\n [nil, nil, [e.inspect, e.backtrace].flatten]\n # Catch closed stream errors specifically\n rescue IOError => e\n raise unless e.message.start_with?('closed stream')\n\n @usable = false\n [nil, nil, [e.inspect, e.backtrace].flatten]\n end",
"def run!\n test_result = Tester::Runner.run(file)\n if test_result.stdout.to_s.strip.empty?\n new_reason = reason\n else\n new_reason = test_result.stdout \n end\n # Capture the exit status, and map to a result object\n result = case test_result.exitstatus\n when 0; Result::Pass\n when 1; Result::Fail\n when 2; Result::Skip\n when nil; Result::NoResult\n else\n new_reason = (test_result.stderr.strip + \"\\n\" + test_result.stdout.strip).strip\n Result::Error\n end\n Tester::Test.new(file, base, result, new_reason, stack)\n end",
"def run_task(_task, _args)\n invoke(\"#{name}:upload\")\n end",
"def clean_exit\n\ttasks_passed = all_by_exit_status(@task_data['test_exit_status_passed'])\n\ttasks_failed = all_by_exit_status(@task_data['test_exit_status_failed'])\n\ttasks_skipped = all_by_exit_status(@task_data['test_exit_status_skipped'])\n @task_data.merge!({'execution_time' => @chain.execution_time, 'tasks_passed' => tasks_passed, 'tasks_failed' => tasks_failed, 'tasks_skipped' => tasks_skipped})\n \n\tPublisher.new(@task_data).publish_reports\t \n\t\n if tasks_failed.length == 0\n\t\tputs \"[TCRESULT]=SUCCESSFUL\\n\"\n\telse\n\t\tputs \"[TCRESULT]=UNSUCCESSUL\\n\"\n\tend\n\t\n\tputs(\"\\n==> DONE\\n\\n\")\n puts(\"[ :: [SESSION]\\n\")\n puts(\"[TC] -- tests passed : #{tasks_passed.length.to_s}\\n\")\n puts(\"[TC] -- tests failed : #{tasks_failed.length.to_s}\\n\")\n puts(\"[TC] -- tests executed : #{@chain.executed_tasks.to_s}\\n\")\n puts(\"[TC] -- tests skipped : #{tasks_skipped.length.to_s}\\n\") \n puts(\"[TC] -- execution time : #{@chain.execution_time.to_s} secs\\n\")\t\n\tputs(\" -- reports prepared: #{@reports_dir}\\n\")\n puts(\" -- logs prepared : #{@logs_dir}\\n\")\n\t\n\tputs(\"[TC] The test run contained the following tasks :\\n\")\n\t@chain.get_tasknames.each do |taskname|\n\t\tputs(\"[TC] -> #{taskname}\\n\")\t\n\tend\n\t\t\n\tif @task_data['test_retry']\n\t\tputs(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n\tend\n\tif tasks_failed.length > 0\n\t\tputs(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n\t\texit(1)\n\tend\n\texit(0)\nend",
"def run_cmd(cmd)\n Dir.chdir(Rails.root) {\n #@output = `cd #{CTMWEB_PATH} && #{cmd} 2>&1`\n cmd = \"#{cmd}\"\n @output = `#{cmd}`\n }\n result = $?.success?\n if result\n print \"OK\\n\".green\n else\n print \"ERROR\\n\".red\n puts \"#{@output.to_s.red}\"\n send_to_flowdock(\"CTMWEB\", \"Deployment for #{Rails.env.upcase} failed. (CMD: #{cmd})\", @tags)\n abort \"Deployment Halted.\".red\n end\nend",
"def assert_exec_output(node, command, expected_exitcode, expected_outputs)\n params = {}\n params[:exceptiononfailure] = false\n params[:exitcode] = true\n (exitcode, output) = node.execute(command, params)\n assert_equal(expected_exitcode.to_s, exitcode, \"Wrong exitcode returned\")\n assert_correct_output(expected_outputs, output)\n end",
"def get_execution_result\n @result\n end",
"def run_succeeded; end",
"def unwrap_bolt_result(target, result)\n if result.error_hash\n # something went wrong return the failure\n return result\n end\n\n Bolt::Result.for_command(target, result.value['stdout'], result.value['stderr'], result.value['exit_code'])\n end",
"def execute_and_get_result(cmd, runasdomain, ctrlcfg, try)\n @cli_executor.execute_and_get(cmd, runasdomain, ctrlcfg, try)\n end",
"def system_exitcode(t, stderr, name)\t\n\t\tif t.value.success?\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Running #{name} finished.\"\n\t\t\tif stderr.any?\n\t\t\t\t$logfile.puts \"#{name} output:\"\n\t\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\tend\n\t\telse\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Error in #{name}:\"\n\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\texit\n\t\tend\n\tend",
"def run_output\n run(\n result:\n ::Kitchen::Terraform::Client::Command.output(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .json\n .state(path: config_state),\n working_directory: instance_directory\n )\n )\n end",
"def execute(filename, command, error)\n # Execute Command\n @result[:_task] = filename\n @result[:_timestamp]= Time.now.to_i\n # @result[:_date]\n unless @params[\"_target\"][\"remote\"].nil?\n begin \n stdout, stderr, status = Open3.capture3(*command)\n rescue Exception => e\n default_error = { \n msg: e.message,\n kind: \"test::#{filename}\",\n details: { class: e.class.to_s,\n backtrace: e.backtrace }, \n }\n @result[:_error] = default_error.merge(error)\n\n end\n @result[:_stdout] = stdout\n @result[:_sterr] = stderr\n @result[:_status] = status\n @result\n else\n @result[:_timestamp]= Time.now\n @result[:_command_start_time] = Time.now\n begin \n $results = command.call()\n @result[:_command_end_time] = Time.now\n rescue Exception => e\n @result[:_command_end_time] = Time.now\n default_error = { \n msg: e.message,\n kind: \"test::#{filename}\",\n details: { class: e.class.to_s,\n backtrace: e.backtrace }, \n }\n @result[:_error] = default_error.merge(error)\n #puts @result\n end\n # makes sure the results are at the top level of the return object\n unless $results.nil?\n $results.each do |key, value|\n @result[key] = value\n end\n end\n end\n @result\n end",
"def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end",
"def run\n @wait = 0\n @status = @@statuses[:running]\n while !@finished && @wait == 0 && @status != @@statuses[:error]\n begin\n execState\n rescue\n pp $!\n pp $@\n puts \"An error occured.\"\n @status = :error\n end\n end\n\n # The only way it exits the loop is if the task is finished or waiting.\n @status = @finished ? :finished : :waiting\n end",
"def log_result(task_name, user, result)\n if result[0]\n log_success(user, task_name)\n else\n log_fail(user, task_name, result[1])\n end\n end",
"def run_failed; end",
"def __execute\n Thread.new do\n tasks = flatten_task_tree\n pipe_reader, pipe_writer = IO.pipe\n @__pid = execute_in_process(tasks, pipe_reader, pipe_writer)\n pipe_writer.close\n\n tasks.each do |task|\n task.__pid = @__pid\n task.__status = TaskStatus::RUNNING\n\n begin\n task.__result = Marshal.load(pipe_reader)\n rescue EOFError\n # do nothing\n end\n\n if task.__result == '__TASK_FINISHED_WITH_EXCEPTION__'\n faulted_result(task, Marshal.load(pipe_reader))\n else\n task.__result = nil if task.__result == '__TASK_FINISHED_NO_RESULT__' || task.canceled?\n task.__status = TaskStatus::COMPLETED unless task.canceled?\n end\n\n yield if block_given?\n\n case task.__status\n when TaskStatus::COMPLETED\n task.oncomplete_block&.call(task)\n when TaskStatus::FAULTED\n task.onfault_block&.call(task)\n end\n end\n\n pipe_reader.close\n end\n end",
"def execution_error_tasks\n @execution_error_tasks ||= failed_tasks.select(&:execution_error?)\n end",
"def run_shell(command_to_run, opts = {})\n inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash\n\n target_option = opts['targets'] || opts[:targets]\n if target_option.nil?\n target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV.fetch('TARGET_HOST', nil)\n raise \"Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml\" unless target_in_inventory?(inventory_hash, target_node_name)\n else\n target_node_name = search_for_target(target_option, inventory_hash)\n end\n\n bolt_result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)\n\n raise \"shell failed\\n`#{command_to_run}`\\n======\\n#{bolt_result}\" if bolt_result.first['value']['exit_code'] != 0 && opts[:expect_failures] != true\n\n result = OpenStruct.new(exit_code: bolt_result.first['value']['exit_code'],\n exit_status: bolt_result.first['value']['exit_code'],\n stdout: bolt_result.first['value']['stdout'],\n stderr: bolt_result.first['value']['stderr'])\n yield result if block_given?\n result\n end"
] |
[
"0.61210275",
"0.6050874",
"0.57300586",
"0.5714251",
"0.5665131",
"0.56597817",
"0.56028163",
"0.556722",
"0.55197155",
"0.55180764",
"0.5510208",
"0.54618657",
"0.5458577",
"0.54489684",
"0.539753",
"0.5381986",
"0.53605723",
"0.53220755",
"0.52634",
"0.5251962",
"0.5243449",
"0.5239525",
"0.52317274",
"0.52169585",
"0.51772135",
"0.5167555",
"0.5156591",
"0.5134593",
"0.51109606",
"0.5106883",
"0.5104606",
"0.5102785",
"0.5089058",
"0.50815535",
"0.5073839",
"0.5070009",
"0.50665313",
"0.50597227",
"0.5054165",
"0.5039393",
"0.5030357",
"0.5022965",
"0.5018867",
"0.50071305",
"0.4995141",
"0.49920774",
"0.49920774",
"0.4988288",
"0.4988162",
"0.4988162",
"0.4987309",
"0.4973205",
"0.49688378",
"0.49573603",
"0.49260843",
"0.49241504",
"0.4919278",
"0.49106526",
"0.49055213",
"0.48885462",
"0.48881763",
"0.48881763",
"0.48881763",
"0.48881763",
"0.48881555",
"0.4878526",
"0.4878526",
"0.4878526",
"0.4878526",
"0.48748395",
"0.48670942",
"0.48506188",
"0.4832483",
"0.48306575",
"0.48238713",
"0.48220775",
"0.48148283",
"0.48137704",
"0.47976002",
"0.4797136",
"0.47969976",
"0.47926676",
"0.4788081",
"0.4785618",
"0.47668922",
"0.47643533",
"0.4761067",
"0.47566438",
"0.47507393",
"0.473987",
"0.47392386",
"0.47382984",
"0.4737804",
"0.47312886",
"0.47307587",
"0.47216672",
"0.47209486",
"0.47201514",
"0.47057167",
"0.46996263"
] |
0.47446814
|
89
|
GET /high_schools GET /high_schools.json
|
def index
@high_schools = HighSchool.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end",
"def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school }\n end\n end",
"def show_location\n\t\trecords = University.where(['state LIKE ?', \"%#{params[:location]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @cms_schools = Cms::School.all\n end",
"def show\n @school = School.find(params[:id])\n @owner = User.find(@school.owned_by)\n \n @json = @school.to_gmaps4rails\n\n @school_types = [ \"District\", \"Charter\", \"Private\", \"Other\" ]\n @grades = [ \"Pre-K\", \"Elementary\", \"Middle\", \"High School\", \"Adult School\", \"Other\", \"K-6\", \"K-8\", \"6-12\", \"K-12\" ]\n @calendar = [ \"Year-round\", \"Track\", \"Semester\", \"Traditional\" ]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end",
"def index\n render json: serializer_class.new(paginate(ecf_schools), params: { cohort: }).serializable_hash.to_json\n end",
"def index\n @schools = @city.schools\n end",
"def index\r\n @schools = School.all\r\n\r\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def index\n @schools = School.all\n end",
"def overview_json\n safe_params = params.permit(:force_querying_on_demand)\n force_querying_on_demand = safe_params.has_key?(:force_querying_on_demand)\n query = SchoolOverviewQueries.new(force_querying_on_demand: force_querying_on_demand)\n overview_json = query.json_for_overview(current_educator, @school)\n\n render json: overview_json\n end",
"def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def index\n @school_classes = SchoolClass.where('school_id = ?', current_user.user_info.school_id).order(\"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_classes }\n end\n end",
"def index\n @schools = Admin::School.all\n end",
"def index\n @school_setups = SchoolSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_setups }\n end\n end",
"def index\n @schools = School.default\n end",
"def show\n render json: serializer_class.new(ecf_school, params: { cohort: }).serializable_hash.to_json\n end",
"def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end",
"def high_school\n\tend",
"def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end",
"def show\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_setup }\n end\n end",
"def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end",
"def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end",
"def index\n @code_club_schools = CodeClubSchool.all\n end",
"def get_school\n @school = School.find_by_id(params[:school_id])\n end",
"def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end",
"def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schools_map\n @departments = @city.departments.schools\n render action: :department_map\n end",
"def schools\n Rollcall::School.for_user(self).order(:display_name)\n end",
"def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end",
"def students_for_grade_level_next_year_json\n params.require(:workspace_id)\n params.require(:school_id)\n params.require(:grade_level_next_year)\n school_id = params[:school_id].to_i\n grade_level_next_year = params[:grade_level_next_year]\n\n # Check authorization by grade level, differently than normal.\n students = queries.authorized_students_for_next_year(school_id, grade_level_next_year)\n students_json = ClassListQueries.students_as_json(students)\n\n # educator names\n educators_json = Educator.where(school_id: school_id).as_json(only: [:id, :full_name])\n\n render json: {\n students: students_json,\n educators: educators_json,\n current_educator_id: current_educator.id\n }\n end",
"def index\n @user_in_schools = UserInSchool.all\n end",
"def show\n @student_schools = @student.schools.order(:name => :asc)\n end",
"def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end",
"def show\n @school = School.find(params[:id])\n end",
"def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end",
"def show\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n render :layout => \"print\"\n \n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @inschool }\n # end\n end",
"def school_list\n @schools.to_a\n end",
"def show\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @undergraduate_major }\n end\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 show\n @community_health_station = CommunityHealthStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_health_station }\n end\n end",
"def index\n @school_info = SchoolInfo.first\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def school\n filters = ['Student Employment', 'Undergraduate Admission and Student Aid', 'VP For Campus Affairs']\n @school ||= @data[:edupersonschoolcollegename].reject{|c| filters.include?(c)}.last\n end",
"def school\n School.find(params[:id])\n end",
"def show\n session.delete(:return_path)\n @wrestlers = @school.wrestlers.includes(:deductedPoints,:matches,:weight,:school)\n @tournament = @school.tournament\n end",
"def available_grade_levels_json\n params.require(:workspace_id)\n\n # schools\n school_ids = queries.supported_schools.map(&:id).select do |school_id|\n queries.is_authorized_for_school_id?(school_id)\n end\n schools_json = School.find(school_ids).as_json(only: [:id, :name])\n\n # grade levels (include if any of their schools would allow it)\n grade_levels_next_year = queries.supported_grade_levels_next_year.select do |grade_level_next_year|\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n school_ids.any? {|school_id| queries.is_authorized_for_grade_level_now?(school_id, grade_level_now) }\n end\n\n render json: {\n schools: schools_json,\n grade_levels_next_year: grade_levels_next_year\n }\n end",
"def show\n @school = School.find_by(id: params[:id])\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def show\n @classtable = Classtable.find(params[:id])\n #@classtable = Classtable.find(:all, :conditions => { :school_id => @classtable1.id })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classtable }\n end\n end",
"def getSchoolRating\n\t\n\t\t\n\t\t@Ratings = Rating.select('(sum(rate1+rate2+rate3+rate4))/4.0 as Total_Rating').where(\"school_id = \"+params[:School_id]+\"\").group(\"school_id\")\n\t\trender json: @Ratings.to_json\n\t \t#head :no_content\n\tend",
"def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end",
"def school \n @school\n end",
"def set_school\n @school = School.where(:id => params[:id]).includes(:tournament,:wrestlers,:deductedPoints,:delegates).first\n end",
"def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Nces06School\n select = \"id, SCHNAM\"\n if params[:state_or_province]\n @nces06_schools = Portal::Nces06School.where(\"MSTATE = ?\", params[:state_or_province]).select(select).order('SCHNAM')\n # PUNDIT_REVIEW_SCOPE\n # PUNDIT_CHECK_SCOPE (found instance)\n # @nces06_schools = policy_scope(Portal::Nces06School)\n elsif params[:nces_district_id]\n @nces06_schools = Portal::Nces06School.where(\"nces_district_id = ?\", params[:nces_district_id]).select(select).order('SCHNAM')\n else\n @nces06_schools = Portal::Nces06School.select(select).order('SCHNAM')\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nces06_schools }\n format.json { render :json => @nces06_schools }\n end\n end",
"def index\n periods = current_user.school.periods.all\n\n render json: periods\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end",
"def secondary_school; end",
"def show_two\n\t\tif params[:operation].present?\n\t\t\toperation = params[:operation]\n\t\telse\n\t\t\toperation = \"undefined\"\n\t\tend\n\n\t\tschools = params[:schools]\n\t\tinternal_show_two(schools, operation)\n\tend",
"def show_by_school_id\n school = School.find_by_id(params[:school_id])\n if school.present? && school.status == 1\n orders = school.orders\n render json: orders\n else\n payload = {error: \"School does not exist\", status: 400}, 400\n render :json => payload, :status => :bad_request\n end\n end",
"def high_school_params\n params.require(:high_school).permit(:city, :state, :name, :uid, :county)\n end",
"def supported_schools\n @supported_schools ||= School.where(school_type: ['ECS', 'ESMS', 'ES', 'MS'])\n end",
"def skill_schools\r\n\t\t[\r\n\t\t\t'Tailoring', \r\n\t\t\t'Jewelcrafting', \r\n\t\t\t'Enchanting',\r\n\t\t\t'Blacksmithing',\r\n\t\t\t'Summoning',\r\n\t\t\t'Shadow',\r\n\t\t\t'Fire',\r\n\t\t\t'Holy',\r\n\t\t\t'Frost',\r\n\t\t\t'Melee',\r\n\t\t\t'Ranged'\r\n\t\t]\r\n\tend",
"def get_managed_school\n self.schools.first \n end",
"def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def show\n teacher = Teacher.find(params[:id])\n render json: {status: 'SUCCESS', message: 'Loaded teacher', data: teacher}, include:'school', status: :ok\n end",
"def index\n @countries = Country.has_cities\n @country = @countries.first\n @states = @country.states\n @state = @states.first\n @cities = @state.cities\n @city = @cities.first\n \n if params[:school]\n @school = School.new(params[:school])\n if params[:state]\n country_id = params[:state][:country_id]\n end\n if params[:city]\n state_id = params[:city][:state_id]\n end\n city_id = params[:school][:city_id]\n end\n \n if country_id\n country = Country.find_by_id(country_id)\n @states = country.states\n @state = State.new\n @state.country_id = country_id\n end\n\n if state_id\n state = State.find_by_id(state_id)\n @cities = state.cities\n @city = City.new\n @city.state_id = state_id\n end\n\n cond = School.paginated_schools_conditions_with_search(params)\n @schools = School.paginate :include => [{:city => {:state => :country}}], :conditions => cond.to_sql, :page => params[:page], :per_page => 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schools }\n end\n end",
"def top_five_schools(division, &block)\n leaderboard(division).top_schools(20, &block)\n end",
"def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end",
"def superhighways\n @client.get('/CycleSuperhighway')\n end",
"def show\n @supplysite = Supplysite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplysite }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\n end\n end",
"def index\n @employer_studies = @university.employer_studies.page(params[:page])\n @studies = @employer_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employer_studies }\n end\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def show_school\n\t\tschool = params[:id]\n\tend",
"def courses_json\n raise Exceptions::EducatorNotAuthorized unless current_educator.districtwide_access\n courses = Course.all\n .where(school_id: @school.id)\n .includes(sections: :students)\n\n courses_json = courses.as_json({\n :only => [:id, :course_number, :course_description],\n :include => {\n :sections => {\n :only => [:id, :section_number, :term_local_id, :schedule, :room_number],\n :include => {\n :students => {\n :only => [:id, :grade, :date_of_birth],\n :include => {\n :school => {\n :only => [:id, :name]\n }\n }\n }\n }\n }\n }\n })\n\n render json: {\n courses: courses_json,\n school: @school.as_json(only: [:id, :name])\n }\n end",
"def show\n render json: @shelter\n end",
"def index\n authorize HigherEducationInstitution\n @higher_education_institutions = HigherEducationInstitution.order(:name).search(params[:search]).page(params[:page])\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 @gss = @grade_section.students_for_academic_year(params[:year])\n end",
"def info\n\t\t# Param needed to use Education.com API\n\t\t@schoolid = params[:schoolid]\n\t\t# Param used to create a back button\n\t\t@zip = params[:zip]\n\t\t# This time running a Typhoeus request for a specific school, by schoolid\n\t\trequest = Typhoeus::Request.new(\n\t\t\t'http://api.education.com/service/service.php?f=schoolSearch&key=650b9a01197f504b095d5c9c6c4e283a&sn=sf&v=4',\n\t\t\tmethod: :get,\n\t\t\tparams: {schoolid: @schoolid, Resf: \"json\"}).run\n\t\t\t@info = JSON.parse(request.body)\n\t\t# Pulling out all of the related messages with the school\n\t\t# Created database so every message that is created stores the unique schoolid\n\t\t# @messages = Message.find_by_schoolid(@schoolid)\n\t\t# @messages = Message.find(1)\n\t\t@messages = Message.where(\"schoolid = '\"+params[:schoolid]+\"'\")\n\tend",
"def new\n @school_setup = SchoolSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_setup }\n end\n end",
"def school\n @school = School.find(params[:id])\n\n\tyear = params[:date][:year]\n\tgrade = params[:grade_name]\n\t\n\tdefault_params = {\n\t\t:date_year => year,\n\t\t:grade_name => grade,\n\t\t:school_id => @school.id\n\t}\n\t\n\t@classroom = Classroom.new(default_params)\n\t@staff = Staff.new(default_params)\n\t\n\t@classrooms = @school.classrooms.find_all_by_date_year_and_grade_name(year, grade)\n\t@staff_members = @school.teachers.find_all_by_date_year_and_grade_name(year, grade)\n end",
"def search\n\t\t# Params needed to use Education.com API\n\t\t@search_by = params[:search_by]\n\t\t@search = params[:search]\n\t\t# Typhoeus request that returns an array with all of the schools in the ZIP code \n\t\trequest = Typhoeus::Request.new(\n\t\t\t'http://api.education.com/service/service.php?f=schoolSearch&key=650b9a01197f504b095d5c9c6c4e283a&sn=sf&v=4',\n\t\t\tmethod: :get,\n\t\t\tparams: {@search_by => @search, Resf: \"json\"}).run\n\t\t\t@result = JSON.parse(request.body)\n\t\t# Pulling the last 7 messages that have the zip code to display on views\n\t\t# So users can see messages across the schools in the zip before selecting a specific school\n\t\t# Limit to seven so it looks nice\n\t\t@messages = Message.where(\"zip = '\"+params[:search]+\"'\").last(7)\n\tend"
] |
[
"0.7190601",
"0.7041431",
"0.6871373",
"0.6644633",
"0.653639",
"0.64757884",
"0.6472032",
"0.6472032",
"0.6472032",
"0.6472032",
"0.6472032",
"0.6472032",
"0.6472032",
"0.64653105",
"0.6441137",
"0.638774",
"0.63849664",
"0.6382589",
"0.63516265",
"0.63516265",
"0.6349064",
"0.6330873",
"0.63264",
"0.6297866",
"0.62784135",
"0.6262958",
"0.6237593",
"0.6212825",
"0.6209773",
"0.6188581",
"0.61876696",
"0.61835724",
"0.6182867",
"0.6170009",
"0.61197287",
"0.6098964",
"0.6069479",
"0.60474586",
"0.60474586",
"0.60470307",
"0.6028582",
"0.6028235",
"0.6018617",
"0.595696",
"0.59422094",
"0.59032047",
"0.5894978",
"0.5892289",
"0.5873823",
"0.5871252",
"0.5861259",
"0.5848675",
"0.58382326",
"0.58348215",
"0.58283997",
"0.58228856",
"0.581851",
"0.5812524",
"0.5809816",
"0.579215",
"0.5790892",
"0.5779795",
"0.5776079",
"0.57679665",
"0.5766815",
"0.5758691",
"0.5754655",
"0.5745656",
"0.5744493",
"0.5744493",
"0.57389516",
"0.57340413",
"0.5707004",
"0.57057035",
"0.5698983",
"0.56967723",
"0.56932074",
"0.5676988",
"0.5666982",
"0.5666027",
"0.5659444",
"0.5646523",
"0.56449836",
"0.56439495",
"0.5633739",
"0.56303835",
"0.5608853",
"0.56051904",
"0.560213",
"0.5594174",
"0.55933326",
"0.55862033",
"0.55809796",
"0.5579682",
"0.5575677",
"0.55752313",
"0.55722034",
"0.5569111",
"0.55674684"
] |
0.741594
|
1
|
GET /high_schools/1 GET /high_schools/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end",
"def index\n @high_schools = HighSchool.all\n end",
"def index\n @high_schools = HighSchool.all\n end",
"def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school }\n end\n end",
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end",
"def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def show_location\n\t\trecords = University.where(['state LIKE ?', \"%#{params[:location]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend",
"def show\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_setup }\n end\n end",
"def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def index\n @schools = School.all\n end",
"def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end",
"def show\n @school = School.find(params[:id])\n @owner = User.find(@school.owned_by)\n \n @json = @school.to_gmaps4rails\n\n @school_types = [ \"District\", \"Charter\", \"Private\", \"Other\" ]\n @grades = [ \"Pre-K\", \"Elementary\", \"Middle\", \"High School\", \"Adult School\", \"Other\", \"K-6\", \"K-8\", \"6-12\", \"K-12\" ]\n @calendar = [ \"Year-round\", \"Track\", \"Semester\", \"Traditional\" ]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end",
"def index\n render json: serializer_class.new(paginate(ecf_schools), params: { cohort: }).serializable_hash.to_json\n end",
"def index\n @school_setups = SchoolSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_setups }\n end\n end",
"def index\n @schools = @city.schools\n end",
"def show\n render json: serializer_class.new(ecf_school, params: { cohort: }).serializable_hash.to_json\n end",
"def get_school\n @school = School.find_by_id(params[:school_id])\n end",
"def index\r\n @schools = School.all\r\n\r\n end",
"def index\n @schools = School.all\n end",
"def index\n @school_classes = SchoolClass.where('school_id = ?', current_user.user_info.school_id).order(\"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_classes }\n end\n end",
"def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end",
"def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end",
"def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end",
"def index\n @cms_schools = Cms::School.all\n end",
"def index\n @schools = School.default\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def overview_json\n safe_params = params.permit(:force_querying_on_demand)\n force_querying_on_demand = safe_params.has_key?(:force_querying_on_demand)\n query = SchoolOverviewQueries.new(force_querying_on_demand: force_querying_on_demand)\n overview_json = query.json_for_overview(current_educator, @school)\n\n render json: overview_json\n end",
"def index\n @schools = Admin::School.all\n end",
"def index\n @school_info = SchoolInfo.first\n end",
"def show\n @school = School.find(params[:id])\n end",
"def show\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @undergraduate_major }\n end\n end",
"def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end",
"def show\n @classtable = Classtable.find(params[:id])\n #@classtable = Classtable.find(:all, :conditions => { :school_id => @classtable1.id })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classtable }\n end\n end",
"def school\n School.find(params[:id])\n end",
"def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end",
"def show\n @school = School.find_by(id: params[:id])\n end",
"def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end",
"def show\n @community_health_station = CommunityHealthStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_health_station }\n end\n end",
"def show\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n render :layout => \"print\"\n \n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @inschool }\n # end\n end",
"def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end",
"def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @code_club_schools = CodeClubSchool.all\n end",
"def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end",
"def students_for_grade_level_next_year_json\n params.require(:workspace_id)\n params.require(:school_id)\n params.require(:grade_level_next_year)\n school_id = params[:school_id].to_i\n grade_level_next_year = params[:grade_level_next_year]\n\n # Check authorization by grade level, differently than normal.\n students = queries.authorized_students_for_next_year(school_id, grade_level_next_year)\n students_json = ClassListQueries.students_as_json(students)\n\n # educator names\n educators_json = Educator.where(school_id: school_id).as_json(only: [:id, :full_name])\n\n render json: {\n students: students_json,\n educators: educators_json,\n current_educator_id: current_educator.id\n }\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 show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end",
"def getSchoolRating\n\t\n\t\t\n\t\t@Ratings = Rating.select('(sum(rate1+rate2+rate3+rate4))/4.0 as Total_Rating').where(\"school_id = \"+params[:School_id]+\"\").group(\"school_id\")\n\t\trender json: @Ratings.to_json\n\t \t#head :no_content\n\tend",
"def set_school\n @school = School.where(:id => params[:id]).includes(:tournament,:wrestlers,:deductedPoints,:delegates).first\n end",
"def show_by_school_id\n school = School.find_by_id(params[:school_id])\n if school.present? && school.status == 1\n orders = school.orders\n render json: orders\n else\n payload = {error: \"School does not exist\", status: 400}, 400\n render :json => payload, :status => :bad_request\n end\n end",
"def show\n @supplysite = Supplysite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplysite }\n end\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def show\n @student_schools = @student.schools.order(:name => :asc)\n end",
"def show\n @education_level = EducationLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @education_level }\n end\n end",
"def show\n teacher = Teacher.find(params[:id])\n render json: {status: 'SUCCESS', message: 'Loaded teacher', data: teacher}, include:'school', status: :ok\n end",
"def new\n @school_setup = SchoolSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_setup }\n end\n end",
"def get_managed_school\n self.schools.first \n end",
"def high_school\n\tend",
"def new\n @inschool = Inschool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def show_school\n\t\tschool = params[:id]\n\tend",
"def index\n @user_in_schools = UserInSchool.all\n end",
"def index\n periods = current_user.school.periods.all\n\n render json: periods\n end",
"def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Nces06School\n select = \"id, SCHNAM\"\n if params[:state_or_province]\n @nces06_schools = Portal::Nces06School.where(\"MSTATE = ?\", params[:state_or_province]).select(select).order('SCHNAM')\n # PUNDIT_REVIEW_SCOPE\n # PUNDIT_CHECK_SCOPE (found instance)\n # @nces06_schools = policy_scope(Portal::Nces06School)\n elsif params[:nces_district_id]\n @nces06_schools = Portal::Nces06School.where(\"nces_district_id = ?\", params[:nces_district_id]).select(select).order('SCHNAM')\n else\n @nces06_schools = Portal::Nces06School.select(select).order('SCHNAM')\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nces06_schools }\n format.json { render :json => @nces06_schools }\n end\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def school \n @school\n end",
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end",
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end",
"def show\n period = current_user.school.periods.find(params[:id])\n render json: period\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def show\n @mostsmallskillcategory = Mostsmallskillcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallskillcategory }\n end\n end",
"def show\n @study_course = StudyCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @study_course }\n end\n end",
"def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\n end\n end",
"def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"def show\n session.delete(:return_path)\n @wrestlers = @school.wrestlers.includes(:deductedPoints,:matches,:weight,:school)\n @tournament = @school.tournament\n end",
"def show\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @studentset }\n end\n end",
"def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end",
"def schools_map\n @departments = @city.departments.schools\n render action: :department_map\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end",
"def index\n @students = Student.all\n render json: @students\n end",
"def show_two\n\t\tif params[:operation].present?\n\t\t\toperation = params[:operation]\n\t\telse\n\t\t\toperation = \"undefined\"\n\t\tend\n\n\t\tschools = params[:schools]\n\t\tinternal_show_two(schools, operation)\n\tend",
"def show\n render json: @shelter\n end",
"def show\n render json: @student\n end",
"def show\n @student_availability = StudentAvailability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_availability }\n end\n end",
"def index\n @employer_studies = @university.employer_studies.page(params[:page])\n @studies = @employer_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employer_studies }\n end\n end",
"def index\n @countries = Country.has_cities\n @country = @countries.first\n @states = @country.states\n @state = @states.first\n @cities = @state.cities\n @city = @cities.first\n \n if params[:school]\n @school = School.new(params[:school])\n if params[:state]\n country_id = params[:state][:country_id]\n end\n if params[:city]\n state_id = params[:city][:state_id]\n end\n city_id = params[:school][:city_id]\n end\n \n if country_id\n country = Country.find_by_id(country_id)\n @states = country.states\n @state = State.new\n @state.country_id = country_id\n end\n\n if state_id\n state = State.find_by_id(state_id)\n @cities = state.cities\n @city = City.new\n @city.state_id = state_id\n end\n\n cond = School.paginated_schools_conditions_with_search(params)\n @schools = School.paginate :include => [{:city => {:state => :country}}], :conditions => cond.to_sql, :page => params[:page], :per_page => 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schools }\n end\n end",
"def show\n @industry = Industry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @industry }\n end\n end"
] |
[
"0.7350893",
"0.729722",
"0.729722",
"0.7264609",
"0.7054956",
"0.69284385",
"0.6867495",
"0.6665839",
"0.6655831",
"0.6600115",
"0.65766007",
"0.6574666",
"0.6574666",
"0.6574666",
"0.6574666",
"0.6574666",
"0.6574666",
"0.6574666",
"0.6573847",
"0.6558147",
"0.65252066",
"0.6524302",
"0.6514192",
"0.65030205",
"0.6492414",
"0.6481174",
"0.64557225",
"0.6430823",
"0.6405205",
"0.6391059",
"0.6388992",
"0.63841105",
"0.637476",
"0.6369449",
"0.6369449",
"0.6351803",
"0.63445055",
"0.6301009",
"0.6296284",
"0.62821835",
"0.626351",
"0.6256858",
"0.6252117",
"0.623698",
"0.6232288",
"0.62053376",
"0.6194318",
"0.6182596",
"0.61790085",
"0.6154487",
"0.6154487",
"0.61450994",
"0.61450994",
"0.61085147",
"0.6105147",
"0.6091773",
"0.6081169",
"0.605859",
"0.6045893",
"0.6031351",
"0.6029022",
"0.60267264",
"0.6024783",
"0.6016417",
"0.6010908",
"0.59871966",
"0.59777725",
"0.5976627",
"0.5974194",
"0.59697133",
"0.5957473",
"0.59456885",
"0.59422225",
"0.5934825",
"0.59323484",
"0.5906459",
"0.58946836",
"0.58946836",
"0.5893389",
"0.589082",
"0.58893585",
"0.5888853",
"0.58789045",
"0.5873135",
"0.58704054",
"0.58619374",
"0.5856579",
"0.5856007",
"0.5851366",
"0.584809",
"0.5847871",
"0.5847539",
"0.58467764",
"0.58424354",
"0.5833788",
"0.5833735",
"0.5825271",
"0.58224976",
"0.58156425",
"0.5801241",
"0.58011216"
] |
0.0
|
-1
|
POST /high_schools POST /high_schools.json
|
def create
@high_school = HighSchool.new(high_school_params)
respond_to do |format|
if @high_school.save
format.html { redirect_to @high_school, notice: 'High school was successfully created.' }
format.json { render :show, status: :created, location: @high_school }
else
format.html { render :new }
format.json { render json: @high_school.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def high_school_params\n params.require(:high_school).permit(:city, :state, :name, :uid, :county)\n end",
"def create\n @school = School.new(school_params)\n respond_to do |format|\n if @school.save\n format.html { redirect_to schools_path }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n if @school.save\n render :show, status: :created, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end",
"def create\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def high_school_params\n params.require(:high_school).permit(:highSchoolName, :notes)\n end",
"def create\n @school = @city.schools.build(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to city_schools_path(@city), notice: \"School was successfully created.\" }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def create\n @cms_school = Cms::School.new(cms_school_params)\n\n respond_to do |format|\n if @cms_school.save\n format.html { redirect_to @cms_school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @cms_school }\n else\n format.html { render :new }\n format.json { render json: @cms_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inschool = Inschool.new(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n format.html { redirect_to @inschool, notice: 'Inschool was successfully created.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @high_schools = HighSchool.all\n end",
"def index\n @high_schools = HighSchool.all\n end",
"def create\n params[:school][:user_id] = session[:user_id]\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to \"/schools\", notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n # TODO show error\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n\n format.html { redirect_to @school, notice: 'School founding successful.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @todo deprecate?\n @school = School.new(params[:school])\n if self.current_user.is_shared\n u = SharedUsers.where(:user_id => self.current_user.id).first\n @school.owned_by = u.owned_by\n else\n @school.owned_by = self.current_user.id\n end\n @school.gmaps = 1\n\n respond_to do |format|\n count=self.current_user.organization.totalschools\n if self.current_user.organization.school_allowance <= count\n redirect_to :root, :notice => 'Your current school allowance is too small to create this school. Please contact support in order to increase it.'\n return\n end\n if @school.save\n self.current_user.organization.update_attribute(:totalschools,count+1)\n format.html { redirect_to(@school, :notice => 'School was successfully created.') }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.create(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n StudentMailer.mailer_inschool(@student, @inschool).deliver\n format.html { redirect_to :back, notice: 'Inschool was successfully created and an email sent was sent to the teacher.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n\n #-CONNECT THE SCHOOL AND THE STUDENT IF @school IS PRESENT\n @student.schools << @school if @school\n\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student creation successful.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schoolb = Schoolb.new(schoolb_params)\n\n if @schoolb.save\n render :show, status: :created, location: @schoolb\n else\n render json: @schoolb.errors, status: :unprocessable_entity\n end\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'La sede ha sido creada exitosamente.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(params[:school])\n @school.creator = \"sys_creator\"\n @school.modifier = \"sys_modifier\"\n respond_to do |format|\n if @school.save\n format.html { redirect_to cms_school_path(@school), notice: 'School was successfully created.' }\n format.json { render json: cms_school_path(@school), status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:headmaster_id, :name, :summary, :student_count)\n end",
"def create\n params[:school][:school_type] = params[:school][:school_type].strip.downcase.gsub(\" \",\"_\")\n @admin_school = City.find(session[:current_city_id]).utility.schools.new(admin_school_params)\n\n respond_to do |format|\n if @admin_school.save\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_school }\n else\n format.html { render :new }\n format.json { render json: @admin_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize HighschoolCompletion\n @highschool_completion = HighschoolCompletion.new(highschool_completion_params)\n\n respond_to do |format|\n if @highschool_completion.save\n format.html { redirect_to @highschool_completion, notice: 'Zaključek srednje šole je bil uspešno dodan.' }\n format.json { render :show, status: :created, location: @highschool_completion }\n else\n format.html { render :new }\n format.json { render json: @highschool_completion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @school = School.new(school_params)\r\n respond_to do |format|\r\n if @school.save\r\n format.html { redirect_to @school, notice: 'Skolan har skapats!' }\r\n format.json { render action: 'show', status: :created, location: @school }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def school_params\n params.require(:school).permit(:name, :state_rank, :national_rank, :college_readiness_score, :tested_ap_ib, :pass_ap_ib, :math_score, :math_proficient, :math_not_proficient, :reading_score, :reading_proficient, :reading_not_proficient, :student_teacher_ratio, :street_address, :city, :state, :zip, :latitude, :longitude, :total_enrollment, :total_economically_disadvantaged, :receives_title_i_funding, :ap_student_performance_participation_rate, :ap_student_performance_participant_passing_rate, :ap_student_performance_exam_per_test_taker, :ap_student_performance_exam_pass_rate, :district_id)\n end",
"def create\n @school_setup = SchoolSetup.new(params[:school_setup])\n\n respond_to do |format|\n if @school_setup.save\n format.html { redirect_to @school_setup, notice: 'School setup was successfully created.' }\n format.json { render json: @school_setup, status: :created, location: @school_setup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_setup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:name, :city, :state, :phone, :url, :rating)\n end",
"def create\n @school = School.new(school_params)\n @tournament = Tournament.find(school_params[:tournament_id])\n respond_to do |format|\n if @school.save\n format.html { redirect_to @tournament, notice: 'School was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school }\n else\n format.html { render action: 'new' }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school_info = SchoolInfo.new(school_info_params)\n\n respond_to do |format|\n if @school_info.save\n format.html { redirect_to @school_info, notice: 'School info was successfully created.' }\n format.json { render :show, status: :created, location: @school_info }\n else\n format.html { render :new }\n format.json { render json: @school_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schoolyear = Schoolyear.new(schoolyear_params)\n\n respond_to do |format|\n if @schoolyear.save\n format.html { redirect_to @schoolyear, notice: 'Schoolyear was successfully created.' }\n format.json { render :show, status: :created, location: @schoolyear }\n else\n format.html { render :new }\n format.json { render json: @schoolyear.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n get_school\n @school_vocational = @school.vocationals.create(params[:school_vocational])\n end",
"def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end",
"def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end",
"def school_params\n params.require(:school).permit(:name)\n end",
"def high_school_params\n\t\tparams.require(:profile_setting).permit( high_schools_attributes: [:id, :text, :_destroy])\n\tend",
"def school_params\n params.require(:school).permit(:full_name, :screen_name, :icon, :color, :email, :website, :description)\n end",
"def school_params\n params.require(:school).permit(:name, :schooldistrict_id)\n end",
"def school_params\n params.require(:school).permit(:name, :address, :capacity, :principal, :private_school)\n end",
"def create\n @code_club_school = CodeClubSchool.new(code_club_school_params)\n\n respond_to do |format|\n if @code_club_school.save\n format.html { redirect_to @code_club_school, notice: 'Code club school was successfully created.' }\n format.json { render action: 'show', status: :created, location: @code_club_school }\n else\n format.html { render action: 'new' }\n format.json { render json: @code_club_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_schools(tag, num_schools, total_num_students)\n if tag == \"elementary\"\n avg_num_students = @scenarioYAML[\"AVERAGE_ELEMENTARY_SCHOOL_NUM_STUDENTS\"]\n index = :elementary\n elsif tag == \"middle\"\n avg_num_students = @scenarioYAML[\"AVERAGE_MIDDLE_SCHOOL_NUM_STUDENTS\"]\n index = :middle\n elsif tag == \"high\"\n avg_num_students = @scenarioYAML[\"AVERAGE_HIGH_SCHOOL_NUM_STUDENTS\"]\n index = :high\n end\n\n if num_schools.nil?\n num_schools = 0\n return num_schools\n end\n\n avg_num_students_threshold = @scenarioYAML[\"AVERAGE_NUM_STUDENTS_THRESHOLD\"]\n min = avg_num_students - (avg_num_students * avg_num_students_threshold)\n max = avg_num_students + (avg_num_students * avg_num_students_threshold)\n school_counter = num_schools\n student_counter = 0\n while student_counter < total_num_students and max > min\n current_students = random_on_interval(min, max).round\n school_counter += 1\n current_students = (total_num_students - student_counter) if current_students > (total_num_students - student_counter)\n student_counter += current_students\n school_id = school_counter\n members = []\n\n school_id, members = @pre_requisites[index].shift if @pre_requisites[index].size > 0\n # Set the parent edOrg based on catalog, or keep nil and dump school into first LEA in list\n begin_year = @scenarioYAML[\"BEGIN_YEAR\"]\n num_years = @scenarioYAML[\"NUMBER_OF_YEARS\"]\n\n parent = nil\n\n unless members.empty?\n parent = members[\"staff\"].nil? ? nil : members[\"staff\"][0][:parent]\n catalog_students = members[\"students\"]\n end\n\n # remember the school's state organization id if it's a String --> pop off later when creating education organizations\n @schools << school_id if school_id.kind_of? String\n\n staff, teachers, students = create_staff_and_teachers_for_school(members)\n\n school = {\n \"id\" => school_id,\n \"parent\" => parent,\n \"sessions\" => [],\n \"staff\" => staff,\n \"teachers\" => teachers,\n \"offerings\" => {},\n \"catalog_students\" => {begin_year => catalog_students},\n \"students\" => {begin_year => assemble_students_into_waves(tag, current_students)},\n \"programs\" => create_programs_for_education_organization(tag, :SCHOOL),\n }\n if not @scenarioYAML['COURSES_ON_SEA']\n school[\"courses\"] = create_courses(school_id)\n end\n @world[tag] << school\n end\n school_counter\n end",
"def create\n @school_business = SchoolBusiness.new(school_business_params)\n\n respond_to do |format|\n if @school_business.save\n format.html { redirect_to @school_business.school, notice: 'School business was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school_business }\n else\n format.html { render action: 'new' }\n format.json { render json: @school_business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:code, :name, :address, :neighborhood, :zone, :contact_name, :contact_position, :phone, :email, :headquarter, :foundation_present, :establishment_id, :pic)\n end",
"def school_params\n params.require(:school).permit(:name, :score, :tournament_id, :baums_text)\n end",
"def add_student(student, school)\t\t\t\t\t\t\t\t\t\t\t\t#ci. create method to add stuents\n\tschool[:students].push({:name=>student})\nend",
"def school_params\n params.require(:school).permit(:name, :address, :city, :state, :zip)\n end",
"def create\n @school_type = SchoolType.new(school_type_params)\n\n respond_to do |format|\n if @school_type.save\n format.html { redirect_to @school_type, notice: 'School type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @school_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school_module = SchoolModule.new(school_module_params)\n\n respond_to do |format|\n if @school_module.save\n format.html { redirect_to @school_module, notice: 'School module was successfully created.' }\n format.json { render :show, status: :created, location: @school_module }\n else\n format.html { render :new }\n format.json { render json: @school_module.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.find_by(name: params[:name])\n # school_id = 0\n if @school\n params[:user_id] = current_user.id\n params[:school_id] = @school.id\n @bookmark = Bookmark.find_by(user_id: params[:user_id], school_id: params[:school_id])\n # byebug\n if @bookmark\n render json: {\n error: \"You have already bookmarked this school!\"\n }\n else\n @bookmark = Bookmark.create(:user_id => params[:user_id], :school_id => params[:school_id])\n render json: @bookmark, status: :created\n end\n else\n @school = School.new(school_params) \n if @school.save\n params[:user_id] = current_user.id\n params[:school_id] = @school.id\n @bookmark = Bookmark.create(:user_id => params[:user_id], :school_id => params[:school_id])\n render json: @school, status: :created\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end\n end",
"def new\n @inschool = Inschool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n @schools_students = SchoolsStudent.new\n @schools_students.student_id = @student.id\n @schools_students.school_id = params[:school_id]\n @schools_students.save!\n\n @contract = Contract.new\n @contract.student_id = @student.id\n @contract.save!\n\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student }\n else\n format.html { render action: 'new' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:name, :num, :lat, :lng)\n end",
"def school_params\n params.require(:admin_school).permit(:school)\n end",
"def highschool_completion_params\n params.require(:highschool_completion).permit(:code, :name, :is_valid)\n end",
"def create\n @user_in_school = UserInSchool.new(user_in_school_params)\n\n respond_to do |format|\n if @user_in_school.save\n format.html { redirect_to @user_in_school, notice: 'User in school was successfully created.' }\n format.json { render :show, status: :created, location: @user_in_school }\n else\n format.html { render :new }\n format.json { render json: @user_in_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t@school = School.new(model_params)\n \tif @school.save\n \t\tredirect_to schools_path\n \telse\n \t\trender :new\n \tend\n end",
"def create\n @school = School.new(school_params)\n \n if @school.save\n redirect_to @school\n else\n render 'new'\n end\n end",
"def new\n @school_setup = SchoolSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_setup }\n end\n end",
"def create\n @schoolclass = Schoolclass.new(params[:schoolclass])\n\n respond_to do |format|\n if @schoolclass.save\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }\n format.json { render json: @schoolclass, status: :created, location: @schoolclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school_day = SchoolDay.new(params[:school_day])\n respond_to do |format|\n if @school_day.save\n format.html { redirect_to @school_day, notice: 'School day was successfully created.' }\n format.json { render json: @school_day, status: :created, location: @school_day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:username, :email, :password, :name, :country_id, :responsible_school, :phone)\n end",
"def create\n params[:school][:department_ids] = params[:department_select]\n @school = School.new(params[:school])\n respond_to do |format|\n if @school.save\n flash[:notice] = 'School was successfully created.'\n format.html { redirect_to(@school) }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @high_school.update(high_school_params)\n format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }\n format.json { render :show, status: :ok, location: @high_school }\n else\n format.html { render :edit }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @high_school.update(high_school_params)\n format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }\n format.json { render :show, status: :ok, location: @high_school }\n else\n format.html { render :edit }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey = Survey.new(survey_params)\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey.school, notice: 'Survey was successfully created.' }\n else\n format.html { redirect_to School.find(survey_params[:school_id]) }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:name, :address, :telephone, :website, :logo, :education_level_id)\n end",
"def school_params\n params.require(:school).permit(:name, :address, :phone_no)\n end",
"def school_params\n params.require(:school).permit(:principal_id, :name, :state, :active)\n end",
"def school_params\n params.require(:school).permit(:name, :city_id)\n end",
"def school_params\n params.require(:school).permit(:IDSchool, :NameSchool, :Principal, :Street, :City, :State, :Zip, :Phone, :Fax, :District, :Region)\n end",
"def create\n @student_homework = StudentHomework.new(student_homework_params)\n\n respond_to do |format|\n if @student_homework.save\n format.html { redirect_to @student_homework, notice: 'Student homework was successfully created.' }\n format.json { render :show, status: :created, location: @student_homework }\n else\n format.html { render :new }\n format.json { render json: @student_homework.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_student(school, name)\n\tschool[:students].push({:name => name})\nend",
"def high_school\n\tend",
"def create\n get_school\n @school_request = @school.requests.create(params[:school_request])\n\n redirect_to school_school_request_path(@school, @school_request)\n end",
"def create\n @student_site = StudentSite.new(student_site_params)\n\n respond_to do |format|\n if @student_site.save\n format.html { redirect_to @student_site, notice: 'Student site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_site }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_student_schools(api_schools, school_list_type)\n # loop through the schools returned from the API, find the matching schools in the db,\n # save the eligibility variables on student_schools, and collect the coordinates for the matrix search, below\n if api_schools.present?\n self.send(\"#{school_list_type}_schools\".to_sym).clear\n self.update_column(\"#{school_list_type}_schools_json\".to_sym, api_schools.to_json) rescue nil\n\n # create the student schools\n\n school_coordinates = ''\n school_ids = []\n program_codes = []\n mid_codes = []\n school_names = []\n\n if school_list_type == \"choice\"\n Rails.logger.info \"****sorting**\"\n api_schools.sort_by{|c| c[:SortOrder]}\n end\n api_schools.each do |api_school|\n # schoolId = (school_list_type == \"choice\" || school_list_type == \"home\") ? api_school[:SchoolLocalId] : api_school[:SchoolID]\n if school_list_type == \"choice\" || school_list_type == \"home\"\n schoolId = api_school[:SchoolLocalId]\n elsif school_list_type == \"ell\"\n schoolId = api_school[:SchoolId]\n else\n schoolId = api_school[:SchoolID]\n end\n school = School.where(bps_id: schoolId).first\n if school_list_type == \"home\" || school_list_type == \"ell\"\n if school.present? && (!school_ids.include?(school.id))\n schools_with_school_list_type school, api_school,school_list_type, school_ids, school_coordinates\n end\n elsif school_list_type == \"sped\"\n if school.present? && (!school_ids.include?(school.id) || api_schools.map{ |mid_code| true if (!mid_codes.include?(mid_code[:MidCode]) )} )\n mid_codes.push(api_school[:MidCode])\n schools_with_school_list_type school, api_school,school_list_type, school_ids, school_coordinates\n end\n elsif school_list_type == \"choice\"\n if school.present?\n if !school_ids.include?(school.id) || api_schools.map{|x| true if (program_codes.include?(x[:ProgramId]) && school_names.include?(x[:SchoolName]))}.include?(true)\n school_names.push(api_school[:SchoolName])\n program_codes.push(api_school[:ProgramId])\n schools_with_school_list_type school, api_school,school_list_type, school_ids, school_coordinates\n end\n end\n end\n end\n\n # save distance, walk time and drive time on student_schools\n if longitude.present? && latitude.present?\n\n school_coordinates.gsub!(/\\|$/,'')\n walk_matrix = Google.walk_times(latitude, longitude, school_coordinates)\n drive_matrix = Google.drive_times(latitude, longitude, school_coordinates)\n\n api_schools.each_with_index do |api_school, i|\n # schoolId = (school_list_type == \"choice\" || school_list_type == \"home\") ? api_school[:SchoolLocalId] : api_school[:SchoolID]\n if school_list_type == \"choice\" || school_list_type == \"home\"\n schoolId = api_school[:SchoolLocalId]\n elsif school_list_type == \"ell\"\n schoolId = api_school[:SchoolId]\n else\n schoolId = api_school[:SchoolID]\n end\n school = School.where(bps_id: schoolId).first\n if school_list_type == \"choice\" || school_list_type == \"home\"\n if school.present?\n school.update_attributes(latitude: api_school[:Latitude], longitude: api_school[:Longitude])\n end\n end\n if school.present?\n walk_time = walk_matrix.try(:[], i).try(:[], :duration).try(:[], :text)\n drive_time = drive_matrix.try(:[], i).try(:[], :duration).try(:[], :text)\n\n student_school = self.student_schools.where(school_id: school.id).first_or_initialize\n student_school.walk_time = walk_time\n student_school.drive_time = drive_time\n student_school.save\n end\n end\n\n self.update_column(:schools_last_updated_at, Time.now)\n end\n\n return true\n else\n return false\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n respond_to do |format|\n if @teacher.save\n Employment.create(:teacher_id => @teacher[:id], :school_id => params[:employment][:school_id])\n format.html { redirect_to teachers_path(:teacher => @teacher.last_name), notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def admin_school_params\n params.require(:school).permit!\n\n end",
"def create\n @school_volunteer = SchoolVolunteer.new(school_volunteer_params)\n\n respond_to do |format|\n if @school_volunteer.save\n format.html { redirect_to @school_volunteer, notice: 'School volunteer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school_volunteer }\n else\n \n format.html { render action: 'new' }\n format.json { render json: @school_volunteer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_params\n params.require(:school).permit(:schoolname, :address, :city, :state, :pincode, :board)\n end",
"def create\n @student_major = StudentMajor.new(student_major_params)\n\n respond_to do |format|\n if @student_major.save\n format.html { redirect_to @student_major, notice: 'Student major was successfully created.' }\n format.json { render json: @student_major, status: :created, location: @student_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to schools_url, notice: 'Sekolah berhasil dibuat.' }\n else\n format.html { render :new }\n flash[\"alert\"] = @school.errors.full_messages\n end\n end\n end",
"def create\n @cohort_student = CohortStudent.new(cohort_student_params)\n\n respond_to do |format|\n if @cohort_student.save\n format.html { redirect_to students_path, notice: 'Student was successfully added.' }\n format.json { render :show, status: :created, location: @cohort_student }\n else\n format.html { redirect_to students_path, notice: \"Student not added\"}\n format.json { render json: @cohort_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @undergraduate_major = UndergraduateMajor.new(params[:undergraduate_major])\n\n respond_to do |format|\n if @undergraduate_major.save\n format.html { redirect_to @undergraduate_major, notice: 'Undergraduate major was successfully created.' }\n format.json { render json: @undergraduate_major, status: :created, location: @undergraduate_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @undergraduate_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(params[:student])\n @student.idSchool = current_user.teacher.idSchool \n\n respond_to do |format|\n if @student.save\n StdTeacher.create(idStd: @student.id, idTeacher: current_user.teacher.id, idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def create\n @engagement = current_user.engagements.new(engagement_params_with_school)\n if @engagement.save\n render :show, status: :created, location: api_v2_engagement_url(@engagement)\n else\n puts @engagement.errors.full_messages\n render json: @engagement.errors, status: :unprocessable_entity\n end\n end",
"def school_params\n params[:school]\n end",
"def create\n @science = Science.new(science_params)\n\n respond_to do |format|\n if @science.save\n format.html { redirect_to @science, notice: 'Science was successfully created.' }\n format.json { render :show, status: :created, location: @science }\n else\n format.html { render :new }\n format.json { render json: @science.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_student_major = Admin::StudentMajor.new(admin_student_major_params)\n\n respond_to do |format|\n if @admin_student_major.save\n format.html { redirect_to admin_student_majors_url, notice: 'Student major was successfully created.' }\n format.json { render :show, status: :created, location: admin_student_majors_url }\n else\n format.html { render :new }\n format.json { render json: @admin_student_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cms_school_params\n params.require(:cms_school).permit(:chapter_id, :name, :code, :website, :representative, :rep_email)\n end",
"def destroy\n @high_school.destroy\n respond_to do |format|\n format.html { redirect_to high_schools_url, notice: 'High school was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.66235936",
"0.64127934",
"0.63907987",
"0.63736504",
"0.6356734",
"0.6312544",
"0.63091415",
"0.63091415",
"0.63091415",
"0.6308481",
"0.62944937",
"0.6293078",
"0.6271033",
"0.6243532",
"0.6243532",
"0.6225897",
"0.6220088",
"0.62183994",
"0.6212547",
"0.620444",
"0.6152043",
"0.61285424",
"0.61285424",
"0.612431",
"0.61142516",
"0.6108433",
"0.6069397",
"0.6064989",
"0.60479146",
"0.60105914",
"0.5966569",
"0.595857",
"0.5957106",
"0.5936129",
"0.58712614",
"0.5866257",
"0.58265734",
"0.5797171",
"0.57903427",
"0.57903427",
"0.5787194",
"0.57866365",
"0.57804465",
"0.5775994",
"0.57753617",
"0.5766038",
"0.5762068",
"0.5758108",
"0.5751427",
"0.57471424",
"0.5745191",
"0.57411116",
"0.5737469",
"0.5729673",
"0.57199097",
"0.5703008",
"0.5697458",
"0.5697006",
"0.56953514",
"0.56947744",
"0.5686312",
"0.5683266",
"0.567807",
"0.5677622",
"0.5675458",
"0.56730604",
"0.5665688",
"0.56538576",
"0.5648752",
"0.5632229",
"0.5632229",
"0.56219673",
"0.5615394",
"0.5612134",
"0.56074196",
"0.5606893",
"0.55926037",
"0.55838907",
"0.55835474",
"0.5571127",
"0.55698067",
"0.55693686",
"0.5569012",
"0.5565164",
"0.55616844",
"0.5560327",
"0.5558448",
"0.5553426",
"0.5552643",
"0.55495214",
"0.5537681",
"0.5536019",
"0.5520922",
"0.55156785",
"0.5504272",
"0.54904956",
"0.54890794",
"0.5486746",
"0.5479916"
] |
0.7236414
|
1
|
PATCH/PUT /high_schools/1 PATCH/PUT /high_schools/1.json
|
def update
respond_to do |format|
if @high_school.update(high_school_params)
format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }
format.json { render :show, status: :ok, location: @high_school }
else
format.html { render :edit }
format.json { render json: @high_school.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to :back, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @school = School.find(params[:id])\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @school = School.find(params[:id])\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @school.update(school_params)\n render :show, status: :ok, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n @school = School.find(params[:id])\n params[:school][:creator] = \"sys_creator\"\n params[:school][:modifier] = \"sys_modifier\"\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to cms_school_path(@school), notice: 'School was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n get_school\n @school_vocational = @school.vocationals.find(params[:id])\n @school_vocational.update_attributes(params[:school_vocational])\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @schoolb.update(schoolb_params)\n render :show, status: :ok, location: @schoolb\n else\n render json: @schoolb.errors, status: :unprocessable_entity\n end\n end",
"def update\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to @inschool, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School update successful.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n if @school_setup.update_attributes(params[:school_setup])\n format.html { redirect_to @school_setup, notice: 'School setup was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_setup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'La sede ha sido actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n if @student_major.update_attributes(student_major_params)\n format.html { redirect_to @student_major, notice: 'Student major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @code_club_school.update(code_club_school_params)\n format.html { redirect_to @code_club_school, notice: 'Code club school was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @code_club_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to my_schools_path, notice: 'School class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @school.update(school_params)\r\n format.html { redirect_to @school, notice: 'Skolan har uppdaterats!' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @cms_school.update(cms_school_params)\n format.html { redirect_to @cms_school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_school }\n else\n format.html { render :edit }\n format.json { render json: @cms_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_volunteer.update(school_volunteer_params)\n format.html { redirect_to @school_volunteer, notice: 'School volunteer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_volunteer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to city_school_path(@city), notice: \"School was successfully updated.\" }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_business.update(school_business_params)\n format.html { redirect_to @school_business, notice: 'School business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize HighschoolCompletion\n respond_to do |format|\n if @highschool_completion.update(highschool_completion_params)\n format.html { redirect_to @highschool_completion, notice: 'Zaključek srednje šole je bil uspešno posodobljen.' }\n format.json { render :show, status: :ok, location: @highschool_completion }\n else\n format.html { render :edit }\n format.json { render json: @highschool_completion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_type.update(school_type_params)\n format.html { redirect_to @school_type, notice: 'School type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n if @undergraduate_major.update_attributes(params[:undergraduate_major])\n format.html { redirect_to @undergraduate_major, notice: 'Undergraduate major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @undergraduate_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_info.update(school_info_params)\n format.html { redirect_to school_infos_path, notice: 'School info was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_info }\n else\n format.html { render :edit }\n format.json { render json: @school_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n get_school\n @school_request = @school.requests.find(params[:id])\n @school_request.update_attributes(params[:school_request])\n\n redirect_to school_school_request_path(@school, @school_request)\n end",
"def update\n respond_to do |format|\n if @schoolyear.update(schoolyear_params)\n format.html { redirect_to @schoolyear, notice: 'Schoolyear was successfully updated.' }\n format.json { render :show, status: :ok, location: @schoolyear }\n else\n format.html { render :edit }\n format.json { render json: @schoolyear.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n params[:school][:school_type] = params[:school][:school_type].strip.downcase.gsub(\" \",\"_\")\n @school_types = ((SCHOOL_DEFAULTS + City.find(session[:current_city_id]).utility.schools.map(&:school_type)).uniq.sort!).join(\",\").humanize.titleize\n if @admin_school.update(admin_school_params)\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola è stato aggiornato con successo.' }\n format.json { render :show, status: :ok, location: @admin_school }\n else\n format.html { render :edit }\n format.json { render json: @admin_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = \"#{@school.name} was successfully updated.\"\n format.html { redirect_to @person }\n format.xml { head :ok }\n format.js { @school.reload and render :layout => false }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end",
"def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @school.update(school_params)\n redirect_to super_path\n else\n redirect_to schools_path\n end\n end",
"def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student update successful.' }\n format.json { render :show, status: :ok, location: @student }\n else\n format.html { render :edit }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_module.update(school_module_params)\n format.html { redirect_to @school_module, notice: 'School module was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_module }\n else\n format.html { render :edit }\n format.json { render json: @school_module.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n if @schoolclass.update_attributes(params[:schoolclass])\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end",
"def update\n @tournament = @school.tournament\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @tournament, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n if @socioeconomic_study.update_attributes(params[:socioeconomic_study])\n format.html { redirect_to @socioeconomic_study, notice: 'Socioeconomic study was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socioeconomic_study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_in_school.update(user_in_school_params)\n format.html { redirect_to @user_in_school, notice: 'User in school was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_in_school }\n else\n format.html { render :edit }\n format.json { render json: @user_in_school.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @scientific_work = ScientificWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @scientific_work.update_attributes(params[:scientific_work])\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work 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: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @cohorts_student.update(cohorts_student_params)\n format.html { redirect_to @cohorts_student, notice: 'Cohorts student was successfully updated.' }\n format.json { render :show, status: :ok, location: @cohorts_student }\n else\n format.html { render :edit }\n format.json { render json: @cohorts_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @school = School.find(params[:id])\n if @school.update(model_params)\n redirect_to school_path(@school)\n else\n render :edit\n end\n end",
"def update\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = 'School was successfully updated.'\n format.html { redirect_to(@school) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @school = School.find(params[:id])\n @school.gmaps = 1\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to(@school, :notice => 'School was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @school_day = SchoolDay.find(params[:id])\n\n respond_to do |format|\n if @school_day.update_attributes(params[:school_day])\n format.html { redirect_to @school_day, notice: 'School day was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @studentset = Studentset.find(params[:id])\n\n respond_to do |format|\n if @studentset.update_attributes(params[:studentset])\n format.html { redirect_to @studentset, notice: 'Studentset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @studentset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @ref_pysician.update(ref_pysician_params)\n format.html { redirect_to @ref_pysician, notice: 'Ref pysician was successfully updated.' }\n format.json { render :show, status: :ok, location: @ref_pysician }\n else\n format.html { render :edit }\n format.json { render json: @ref_pysician.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @university = UniversityDecorator.decorate @employer_study.university\n respond_to do |format|\n if @employer_study.update_attributes(params[:employer_study])\n format.html { redirect_to @employer_study, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer_study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_type = StudentType.find(params[:id])\n\n if @student_type.update(student_type_params)\n head :no_content\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @yearly_info.update(yearly_info_params)\n format.html { redirect_to @yearly_info, notice: 'Yearly info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @yearly_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_homework.update(student_homework_params)\n format.html { redirect_to @student_homework, notice: 'Student homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_homework }\n else\n format.html { render :edit }\n format.json { render json: @student_homework.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @college = College.find(params[:id])\n\n respond_to do |format|\n if @college.update_attributes(params[:college])\n format.html { redirect_to '/colleges', notice: 'College was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @college.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n if @mostsmallroad.update_attributes(params[:mostsmallroad])\n format.html { redirect_to @mostsmallroad, notice: 'Mostsmallroad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallroad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:student_id])\n @lunchdetention = @student.lunchdetentions.find(params[:id])\n\n respond_to do |format|\n if @lunchdetention.update_attributes(params[:lunchdetention])\n format.html { redirect_to :back, notice: 'lunchdetention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lunchdetention.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def set_high_school\n @high_school = HighSchool.find(params[:id])\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_classes_url, notice: 'Class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cohort_student.update(cohort_student_params)\n format.html { redirect_to cohorts_path, notice: 'Cohort student was successfully updated.' }\n format.json { render :show, status: :ok, location: @cohort_student }\n else\n format.html { render :edit }\n format.json { render json: @cohort_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @satisfaction_score.update(university_params)\n format.html { redirect_to @satisfaction_score, notice: 'SatisfactionScore was successfully updated.' }\n format.json { render :show, status: :ok, location: @satisfaction_score }\n else\n format.html { render :edit }\n format.json { render json: @satisfaction_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_howuknowusship = StudentHowuknowusship.find(params[:id])\n\n respond_to do |format|\n if @student_howuknowusship.update_attributes(params[:student_howuknowusship])\n format.html { redirect_to(@student_howuknowusship, :notice => 'Student howuknowusship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_howuknowusship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shelter = Shelter.find(params[:id])\n @shelter.update_attributes(params[:shelter])\n \n respond_with(@shelter, :location => admin_shelter_path(@shelter))\n end",
"def update\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n if @mostsmallresource.update_attributes(params[:mostsmallresource])\n format.html { redirect_to @mostsmallresource, notice: 'Mostsmallresource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallresource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @university = UniversityDecorator.decorate @other_study.university\n respond_to do |format|\n if @other_study.update_attributes(params[:other_study])\n format.html { redirect_to @other_study, notice: t2('update.notice')}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @other_study.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = Student.find(params[:id])\n\n if (@student.family_id && @student.family_id > 0)\n @family = Family.find(@student.family_id)\n end\n\n @resound_process = ResoundProcess.find_by_student_id(@student.id)\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lookup_cohort = LookupCohort.find(params[:id])\n\n respond_to do |format|\n if @lookup_cohort.update(lookup_cohort_params)# params[:lookup_cohort], :without_protection => true)\n format.html { redirect_to(@lookup_cohort, :notice => 'Lookup cohort was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_cohort.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @strain = Strain.find(params[:id])\n\n respond_to do |format|\n if @strain.update_attributes(params[:strain])\n format.html { redirect_to @strain, :notice => 'Strain was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @strain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n if @school_rating.update_attributes(params[:school_rating])\n format.html { redirect_to @school_rating, notice: 'School rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if @admin_student_major.update(admin_student_major_params)\n redirect_to admin_student_majors_path, notice: 'Student major was successfully updated.' \n \n end\n \n end",
"def update\n respond_to do |format|\n if @cohort_fellow.update(cohort_fellow_params)\n format.html { redirect_to admin_cohort_fellow_path(@cohort_fellow), notice: 'Cohort fellow was successfully updated.' }\n format.json { render :show, status: :ok, location: @cohort_fellow }\n else\n format.html { render :edit }\n format.json { render json: @cohort_fellow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scholarship_guide.update(scholarship_guide_params)\n format.html { redirect_to @scholarship_guide, notice: 'Scholarship guide was successfully updated.' }\n format.json { render :show, status: :ok, location: @scholarship_guide }\n else\n format.html { render :edit }\n format.json { render json: @scholarship_guide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @holy_book = HolyBook.find(params[:id])\n\n respond_to do |format|\n if @holy_book.update_attributes(params[:holy_book])\n format.html { redirect_to @holy_book, notice: 'Holy book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @holy_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @people_student.update(people_student_params)\n format.html { redirect_to @people_student, notice: 'Student was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_student }\n else\n format.html { render :edit }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to school_classes_path, notice: 'School class was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student_availability = StudentAvailability.find(params[:id])\n\n respond_to do |format|\n if @student_availability.update_attributes(params[:student_availability])\n format.html { redirect_to @student_availability, notice: 'Student availability was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_availability.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @education_service_provided_typology.update(education_service_provided_typology_params)\n format.html { redirect_to @education_service_provided_typology, notice: 'Education service provided typology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_service_provided_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schools_user = SchoolsUser.find(params[:id])\n\n respond_to do |format|\n if @schools_user.update_attributes(params[:schools_user])\n format.html { redirect_to(schools_users_path, :notice => 'Schools user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schools_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student_improveship = StudentImproveship.find(params[:id])\n\n respond_to do |format|\n if @student_improveship.update_attributes(params[:student_improveship])\n format.html { redirect_to(@student_improveship, :notice => 'Student improveship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_improveship.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @subsidy = Subsidy.find(params[:id])\n\n respond_to do |format|\n if @subsidy.update_attributes(params[:subsidy])\n format.html { redirect_to @subsidy, notice: 'Заявка на материальную выплату успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subsidy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @academic_work = AcademicWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @academic_work.update_attributes(params[:academic_work])\r\n format.html { redirect_to @academic_work, notice: 'Academic work 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: @academic_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @science.update(science_params)\n format.html { redirect_to @science, notice: 'Science was successfully updated.' }\n format.json { render :show, status: :ok, location: @science }\n else\n format.html { render :edit }\n format.json { render json: @science.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @relation_industry.update(relation_industry_params)\n format.html { redirect_to @relation_industry, notice: 'Relation industry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @relation_industry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_high_school\n\t\tif !params[:profile_setting].present?\n\t\t\tredirect_to user_profile_data_profile_path \n\t\telse\n\t\t\t# update the user school with high school params\n\t\t\t@high_school = @user.update_attributes(high_school_params)\n\t\t\tif @high_school\n\t\t\t\t# redirect to the profile app page\n\t\t\t\tredirect_to user_profile_data_profile_path\n\t\t\telse\n\t\t\t\t# redirect to the user high school page\n\t\t\t\tredirect_to high_school_profiles_path\n\t\t\t\tflash[:notice] = \"High school name can't be blank\"\n\t\t\tend\n\t\tend\n\tend",
"def update\n @schooling = Schooling.find(params[:id])\n\n respond_to do |format|\n if @schooling.update_attributes(params[:schooling])\n format.html { redirect_to(@schooling, :notice => 'Schooling was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schooling.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_interest.update(student_interest_params)\n format.html { redirect_to @student_interest, notice: 'Student interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @office_career.update(office_career_params)\n head :no_content\n end",
"def update\n respond_to do |format|\n if @science_instance.update(science_instance_params)\n format.html { redirect_to @science_instance, notice: 'Science instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @science_instance }\n else\n format.html { render :edit }\n format.json { render json: @science_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @school.update(school_params)\n redirect_to @school, notice: t('notice.updated',{model: \"#{t('activerecord.models.admin/school')}\"})\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @wise.update(wise_params)\n format.html { redirect_to @wise, notice: 'Wise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wise.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6817056",
"0.6743827",
"0.6743827",
"0.6704701",
"0.6696226",
"0.66632456",
"0.6616371",
"0.6563845",
"0.6563845",
"0.6563845",
"0.6563845",
"0.6558982",
"0.6539282",
"0.6526617",
"0.64916337",
"0.6483248",
"0.6470588",
"0.64704317",
"0.6466912",
"0.64638954",
"0.6459862",
"0.6445486",
"0.6398213",
"0.63844097",
"0.636587",
"0.63653284",
"0.63228416",
"0.6313849",
"0.6298295",
"0.6270048",
"0.62566364",
"0.62388283",
"0.62031853",
"0.6199984",
"0.6164991",
"0.6155519",
"0.6150652",
"0.61400396",
"0.6112303",
"0.61119616",
"0.6109681",
"0.6099795",
"0.6096539",
"0.6096356",
"0.6094136",
"0.6081576",
"0.60740066",
"0.6064126",
"0.6050294",
"0.6032782",
"0.60288966",
"0.60270226",
"0.6023814",
"0.60235107",
"0.6018526",
"0.6013308",
"0.6006671",
"0.6001329",
"0.5999466",
"0.5988333",
"0.59832424",
"0.59778845",
"0.59778845",
"0.59776545",
"0.59768987",
"0.59581417",
"0.59538066",
"0.59520656",
"0.5951443",
"0.59487873",
"0.59487355",
"0.59434587",
"0.5941551",
"0.59383774",
"0.593275",
"0.5929677",
"0.5920944",
"0.5917401",
"0.59095424",
"0.5905327",
"0.5904952",
"0.59041476",
"0.5901718",
"0.58981955",
"0.5896459",
"0.5893152",
"0.5887291",
"0.5887113",
"0.5886676",
"0.5884809",
"0.5883226",
"0.5883073",
"0.5876373",
"0.58742476",
"0.58717775",
"0.58631766",
"0.58593357",
"0.5857029",
"0.5849847"
] |
0.7044703
|
1
|
DELETE /high_schools/1 DELETE /high_schools/1.json
|
def destroy
@high_school.destroy
respond_to do |format|
format.html { redirect_to high_schools_url, notice: 'High school was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_schools_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to schools_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to schools_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to inschools_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @code_club_school.destroy\n respond_to do |format|\n format.html { redirect_to code_club_schools_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School deletion successful.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to my_schools_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_school.destroy\n respond_to do |format|\n format.html { redirect_to cms_schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_setup = SchoolSetup.find(params[:id])\n @school_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to school_setups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to city_schools_path(@city), notice: \"School was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to establishments_url, notice: 'La sede y todos sus estudiantes han sido borrados' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n @undergraduate_major.destroy\n\n respond_to do |format|\n format.html { redirect_to undergraduate_majors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_site.destroy\n respond_to do |format|\n format.html { redirect_to student_sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:student_id])\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_type.destroy\n respond_to do |format|\n format.html { redirect_to school_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_major = StudentMajor.find(params[:id])\n @student_major.destroy\n\n respond_to do |format|\n format.html { redirect_to student_majors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_business.destroy\n respond_to do |format|\n format.html { redirect_to school_businesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_info.destroy\n respond_to do |format|\n format.html { redirect_to school_infos_url, notice: 'School info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to @student.school, notice: 'Student deletion successful.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_site.destroy\n respond_to do |format|\n format.html { redirect_to study_sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n @socioeconomic_study.destroy\n\n respond_to do |format|\n format.html { redirect_to socioeconomic_studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @district_chief = DistrictChief.find(params[:id])\n @district_chief.destroy\n\n respond_to do |format|\n format.html { redirect_to district_chiefs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'Sekolah berhasil dihapus.' }\n end\n end",
"def destroy\n get_school\n @school_request = @school.requests.find(params[:id])\n @school_request.destroy\n end",
"def destroy\n student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_student_major.destroy\n respond_to do |format|\n format.html { redirect_to admin_student_majors_url, notice: 'Student major was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_volunteer.destroy\n respond_to do |format|\n format.html { redirect_to school_volunteers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schoolyear.destroy\n respond_to do |format|\n format.html { redirect_to schoolyears_url, notice: 'Schoolyear was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @community_health_station = CommunityHealthStation.find(params[:id])\n @community_health_station.destroy\n\n respond_to do |format|\n format.html { redirect_to community_health_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schoolclass = Schoolclass.find(params[:id])\n @schoolclass.destroy\n\n respond_to do |format|\n format.html { redirect_to schoolclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n get_school\n @school_vocational = @school.vocationals.find(params[:id])\n @school_vocational.destroy\n end",
"def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully deactivated/destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_school.destroy\n respond_to do |format|\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola cancellata con successo!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tournament = @school.tournament\n @school.destroy\n respond_to do |format|\n format.html { redirect_to @tournament }\n format.json { head :no_content }\n end\n end",
"def destroy\n @studentset = Studentset.find(params[:id])\n @studentset.destroy\n\n respond_to do |format|\n format.html { redirect_to studentsets_url }\n format.json { head :no_content }\n end\n end",
"def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @school.destroy\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cohort_student.destroy\n respond_to do |format|\n format.html { redirect_to cohorts_path, notice: 'Student was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @undergraduate.destroy\n respond_to do |format|\n format.html { redirect_to undergraduates_url, notice: 'Undergraduate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @woodensofaset.destroy\n respond_to do |format|\n format.html { redirect_to woodensofasets_url, notice: 'Woodensofaset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@school = School.find(params[:id])\n \t@school.destroy\n \tredirect_to schools_path\n end",
"def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_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 @mostsmallskillcategory = Mostsmallskillcategory.find(params[:id])\n @mostsmallskillcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallskillcategories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_rating = SchoolRating.find(params[:id])\n @school_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to school_ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_day = SchoolDay.find(params[:id])\n @school_day.destroy\n\n respond_to do |format|\n format.html { redirect_to school_days_url, notice: \"School day was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @supplysite = Supplysite.find(params[:id])\n @supplysite.destroy\n\n respond_to do |format|\n format.html { redirect_to supplysites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cohorts_student.destroy\n respond_to do |format|\n format.html { redirect_to cohorts_students_url, notice: 'Cohorts student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wise.destroy\n respond_to do |format|\n format.html { redirect_to wises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @strain = Strain.find(params[:id])\n @strain.destroy\n\n respond_to do |format|\n format.html { redirect_to strains_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ref_pysician.destroy\n respond_to do |format|\n format.html { redirect_to ref_pysicians_url, notice: 'Ref pysician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @htscdt.destroy\n respond_to do |format|\n format.html { redirect_to htscdts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_hour_transfer.destroy\n respond_to do |format|\n format.html { redirect_to student_hour_transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_module.destroy\n respond_to do |format|\n format.html { redirect_to school_modules_url, notice: 'School module was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schoolb.destroy\n end",
"def destroy\r\n @admin_heuristic.destroy\r\n respond_to do |format|\r\n format.html { redirect_to admin_heuristics_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @college = College.find(params[:id])\n @college.destroy\n\n respond_to do |format|\n format.html { redirect_to colleges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @samochod.destroy\n respond_to do |format|\n format.html { redirect_to samochods_url, notice: 'Samochod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:student_id])\n @lunchdetention = Lunchdetention.find(params[:id])\n @lunchdetention.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_student.destroy\n respond_to do |format|\n format.html { redirect_to class_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_level = EducationLevel.find(params[:id])\n @education_level.destroy\n\n respond_to do |format|\n format.html { redirect_to education_levels_url, :notice => t('controllermessage.delete') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_in_school.destroy\n respond_to do |format|\n format.html { redirect_to user_in_schools_url, notice: 'User in school was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wash = Wash.find(params[:id])\n @wash.destroy\n\n respond_to do |format|\n format.html { redirect_to washes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @studygroup.destroy\n respond_to do |format|\n format.html { redirect_to studygroups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_service_provided_typology.destroy\n respond_to do |format|\n format.html { redirect_to education_service_provided_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dojo_student = DojoStudent.find(params[:id])\n @dojo_student.destroy\n\n respond_to do |format|\n format.html { redirect_to dojo_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallconstruction = Mostsmallconstruction.find(params[:id])\n @mostsmallconstruction.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallconstructions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @casestudy = Casestudy.find(params[:id])\n @casestudy.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_casestudies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shorty = Shorty.find(params[:id])\n @shorty.destroy\n\n respond_to do |format|\n format.html { redirect_to shorties_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @online_student = OnlineStudent.find(params[:id])\n @online_student.destroy\n\n respond_to do |format|\n format.html { redirect_to online_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_entry.destroy\n respond_to do |format|\n format.html { redirect_to education_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @electoral_district = ElectoralDistrict.find(params[:id])\n @electoral_district.destroy\n\n respond_to do |format|\n format.html { redirect_to electoral_districts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @he = He.find(params[:id])\n @he.destroy\n\n respond_to do |format|\n format.html { redirect_to hes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_howuknowusship = StudentHowuknowusship.find(params[:id])\n @student_howuknowusship.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_howuknowusships_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.7446309",
"0.73377365",
"0.73377365",
"0.7284948",
"0.72463757",
"0.7223396",
"0.7195795",
"0.71851903",
"0.70984054",
"0.7093525",
"0.70910907",
"0.70910907",
"0.70910907",
"0.70910907",
"0.70576614",
"0.70258963",
"0.70234764",
"0.6968764",
"0.6954573",
"0.6947198",
"0.6945338",
"0.69421345",
"0.6907038",
"0.6880176",
"0.6844045",
"0.6839173",
"0.6829473",
"0.6825011",
"0.6805193",
"0.678211",
"0.67785096",
"0.6772436",
"0.6769954",
"0.67665327",
"0.67582315",
"0.6755367",
"0.6753786",
"0.67461854",
"0.6744135",
"0.6741795",
"0.6740924",
"0.6726328",
"0.6725045",
"0.6721844",
"0.6716748",
"0.6704827",
"0.6701751",
"0.6698789",
"0.66948193",
"0.66945785",
"0.66939926",
"0.66858214",
"0.667974",
"0.6673455",
"0.66701436",
"0.66629815",
"0.6648213",
"0.6648213",
"0.6646123",
"0.6634291",
"0.6634291",
"0.6634291",
"0.6634291",
"0.66244256",
"0.6609987",
"0.660908",
"0.6604135",
"0.6604002",
"0.6594449",
"0.6590558",
"0.6586623",
"0.65857834",
"0.65852535",
"0.6583171",
"0.6582356",
"0.6580986",
"0.6578022",
"0.6576534",
"0.65753806",
"0.6574358",
"0.65718657",
"0.65709823",
"0.6570652",
"0.6568649",
"0.656756",
"0.6567302",
"0.6566526",
"0.6563534",
"0.65615535",
"0.65600353",
"0.6560015",
"0.65596133",
"0.6557926",
"0.6554312",
"0.65533173",
"0.6548614",
"0.6547896",
"0.65449095",
"0.65438163"
] |
0.7578352
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_high_school
@high_school = HighSchool.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 high_school_params
params.require(:high_school).permit(:highSchoolName, :notes)
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
|
GET /pickup_point_time_details GET /pickup_point_time_details.json
|
def index
@pickup_point_time_details = PickupPointTimeDetail.includes(:route, :location, :pickup_route_start_time)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_pickup_point_time_detail\n @pickup_point_time_detail = PickupPointTimeDetail.find(params[:id])\n end",
"def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end",
"def create\n @pickup_point_time_detail = PickupPointTimeDetail.new(pickup_point_time_detail_params)\n\n respond_to do |format|\n if @pickup_point_time_detail.save\n format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully created.' }\n format.json { render :show, status: :created, location: @pickup_point_time_detail }\n else\n format.html { render :new }\n format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pickup_point_time_detail_params\n #params[:pickup_point_time_detail]\n params.require(:pickup_point_time_detail).permit(:route_id, :location_id, :pickup_route_start_time_id, :pickup_time)\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 show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\n end\n end",
"def show\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def show\n @planned_time = PlannedTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planned_time }\n end\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def show\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_time }\n end\n end",
"def new\n @touchpoint = Touchpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def update\n respond_to do |format|\n if @pickup_point_time_detail.update(pickup_point_time_detail_params)\n format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @pickup_point_time_detail }\n else\n format.html { render :edit }\n format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @offset_time = OffsetTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offset_time }\n end\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }\n format.json { render json: @time_point, status: :created, location: @time_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @trip\n end",
"def show\n render json: @trip\n end",
"def show\n @pickup = Pickup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pickup }\n end\n end",
"def show\n @tripdate = Tripdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tripdate }\n end\n end",
"def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n @planning_time = PlanningTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planning_time }\n end\n end",
"def show\n @hurdle_time = HurdleTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hurdle_time }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clock_time }\n end\n end",
"def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end",
"def show\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stop_time }\n end\n end",
"def show\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end",
"def getPickUpTime()\n @tripViaPoint.pickUp.time ;\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_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 show\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wait_time }\n end\n end",
"def show\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @working_time }\n end\n end",
"def get_pickup_time\n pickup_time.strftime(\"%H:%M %p\") if pickup_time.present?\n end",
"def show\n @m_get_point = MGetPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_slot }\n end\n end",
"def show\n @receiver_time = ReceiverTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receiver_time }\n end\n end",
"def show\n\n \t\t\trespond_with @teetime\n\n \t\tend",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end",
"def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end",
"def show\n @member_time = MemberTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member_time }\n end\n end",
"def getTripTime()\n return Trip.new(getPickUpTime(), getDropOffTime()) ;\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reservation = Reservation.new\n @image_tag_string = \"/assets/slideshow-rest.jpg\"\n\n @google_map = \"http://maps.google.com/maps/api/staticmap?key=AIzaSyC77WBfl-zki0vS7h9zyKyYg3htKcERvuo&size=400x300\"\n @google_map << \"&markers=icon:http://i42.tinypic.com/rj2txf.png%7C#{@restaurant.lat}%2C#{@restaurant.lng}\"\n @google_map << '&sensor=false&zoom=16'\n\n @today = true\n if @restaurant.inventories.available.size >= 3\n @times = @restaurant.inventories.available.limit(3).map{|inv| inv.start_time.to_s.slice(11..15)}\n else\n @today = false\n @times = @restaurant.inventories.available((Time.zone.today + 1.day), \"00:00\").limit(3).map{|inv| inv.start_time.to_s.slice(11..15)}\n end\n\n @times = [\"18:30\",\"19:00\",\"19:30\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end",
"def show\n\n set_no_cache\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_frame }\n end\n end",
"def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n @nursing_time = NursingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nursing_time }\n end\n end",
"def show\n if request.referer =~ /\\/embed\\/parks/ && request.format == 'html'\n redirect_to \"/embed\" + request.path\n return\n end\n\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n @trip['start_lat'] = @trip.starting_trailhead.latitude\n @trip['start_lng'] = @trip.starting_trailhead.longitude\n @trip['end_lat'] = @trip.ending_trailhead.latitude\n @trip['end_lng'] = @trip.ending_trailhead.longitude\n render json: @trip\n end\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 show\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @point_consumption }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end",
"def new\n @service_time = ServiceTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_time }\n end\n end",
"def show\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_time }\n end\n end",
"def show\n @touchpoint = Touchpoint.find(params[:id])\n @queue = CallQueue.find(params[:call_queue_id])\n \n @lead = @touchpoint.lead\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @touchpoint }\n end\n end",
"def show\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_driver }\n end\n end",
"def new\n @trip = Trip.new\n @author_info = AuthorInfo.new\n @location_val = \"\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @tripdate = Tripdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tripdate }\n end\n end",
"def show\n @meeting_point = MeetingPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting_point }\n end\n end",
"def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end",
"def show\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_point }\n end\n end",
"def show\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_section }\n end\n end",
"def show\n render json: @timer\n end",
"def pickup_date_print(request)\n request.pickup_time.strftime(\"%A %d-%m-%Y %H:%M\")\n end",
"def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end",
"def show\n if @trip_point.nil?\n render :json => {:success => \"false\"}\n else\n render :json => {:success => \"true\", :point => @trip_point, :images => @trip_point.trip_images}\n end\n end",
"def destroy\n @pickup_point_time_detail.destroy\n respond_to do |format|\n format.html { redirect_to pickup_point_time_details_url, notice: 'Pickup point time detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end",
"def show\n respond_with(@time_bank)\n end",
"def create\n @timing = Timing.new(timing_params)\n\n if @timing.save\n render :show, status: :created, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end",
"def get_trip_listing \n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif current_user.trips_driving.include?(trip_params[:trip_id]) || current_user.past_trips_driven.include?(trip_params[:trip_id])\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: {\n\t\t\t\t\ttrip_details: @trip,\n\t\t\t\t\tuser_requests: @user_requests,\n\t\t\t\t\taccepted_users: @accepted_users\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user is not the driver for this trip'\n\t\t\t}\n\t\tend\n\tend",
"def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end",
"def create\n @p_time = PTime.new(p_time_params)\n\n respond_to do |format|\n if @p_time.save\n format.html { redirect_to @p_time, notice: 'P time was successfully created.' }\n format.json { render :show, status: :created, location: @p_time }\n else\n format.html { render :new }\n format.json { render json: @p_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_time_stop }\n end\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def show\n @user_point = UserPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_point }\n end\n end",
"def get_pickup_schedule_with_http_info(date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CompanyApi.get_pickup_schedule ...\"\n end\n # verify the required parameter 'date' is set\n fail ArgumentError, \"Missing the required parameter 'date' when calling CompanyApi.get_pickup_schedule\" if date.nil?\n # resource path\n local_var_path = \"/company/pick-up-schedule\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'date'] = date\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20025')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CompanyApi#get_pickup_schedule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def plan(from, to, trip_datetime, arrive_by=true, options={})\n\n url = build_url(from, to, trip_datetime, arrive_by, options)\n\n begin\n resp = Net::HTTP.get_response(URI.parse(url))\n rescue Exception=>e\n return {'id'=>500, 'msg'=>e.to_s}\n end\n\n return resp\n\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def create\n @punchtime = current_user.punchtimes.build(punchtime_params)\n respond_to do |format|\n if @punchtime.save\n format.html { redirect_to( current_user, notice: 'Punchtime was successfully created.') }\n format.json { render :show, status: :created, location: @punchtime }\n else\n format.html { render :new }\n format.json { render json: @punchtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @clock_event\n end",
"def show\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n @trip = Trip.find(params[:id])\n @meta_title = \" Thrill Engine - #{@trip.categories.map(&:name).to_sentence} in #{@trip.location} staying at #{@trip.title} \"\n @meta_description = @trip.description\n @meta_keywords = \" #{@trip.location}, #{@trip.categories.map(&:name).to_sentence}, #{@trip.title}, #{@trip.categories.map(&:name).to_sentence} in #{@trip.location}, #{@trip.categories.map(&:name).to_sentence} travel, #{@trip.categories.map(&:name).to_sentence} trips, best #{@trip.categories.map(&:name).to_sentence} spots, top #{@trip.categories.map(&:name).to_sentence} resorts, Adventure Holidays, #{@trip.categories.map(&:name).to_sentence} Holidays, #{@trip.categories.map(&:name).to_sentence} vacations \" \n @json = Trip.find(params[:id]).to_gmaps4rails\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trip }\n end\n end",
"def get_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def new\n @planning_time = PlanningTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planning_time }\n end\n end",
"def index\n @p_times = PTime.all\n end",
"def venue_times\n\n end",
"def new\n @time_track = TimeTrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_track }\n end\n end",
"def time_url\n base_url + time_path + build_query(time_params)\n end",
"def flight_time; end",
"def get_trip_time trip_id, otp_response=nil\n\n otp_response = otp_response || self.otp_response\n\n if otp_response.nil? or otp_response['tripTimes'].nil?\n return nil\n end\n trip_times = otp_response['tripTimes']\n return trip_times.detect{|hash| hash['tripId'] == trip_id}\n end",
"def show\n @points_spent = PointsSpent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @points_spent }\n end\n end",
"def details\n options = {}\n # include=driver\n # fields[driver]=average_rating\n if params[:fields]\n driver_fields = params[:fields].permit(:driver).to_h.\n inject({}) { |h, (k,v)| h[k.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: driver_fields)\n end\n\n # multiple associated resources are comma-separated\n if params[:include]\n options[:include] = params[:include].split(\",\").map(&:to_sym)\n end\n\n @trip = Trip.includes(:driver).find_by(id: params[:id])\n\n render json: TripSerializer.new(@trip, options).serializable_hash\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trip.to_json, :callback => params[:callback] }\n end\n end"
] |
[
"0.73081887",
"0.7270402",
"0.71565807",
"0.688972",
"0.6757597",
"0.67381096",
"0.6684565",
"0.6590121",
"0.65166855",
"0.6437241",
"0.64303213",
"0.64291006",
"0.63696826",
"0.6330444",
"0.63184285",
"0.63182986",
"0.63182986",
"0.6307483",
"0.6300095",
"0.62642473",
"0.62642473",
"0.62631524",
"0.6218343",
"0.62010944",
"0.61852264",
"0.61715096",
"0.61648643",
"0.61529046",
"0.61363196",
"0.61363196",
"0.612769",
"0.61219245",
"0.6121254",
"0.61036944",
"0.6098247",
"0.6059378",
"0.60551095",
"0.60551095",
"0.60320234",
"0.601662",
"0.60110104",
"0.59977955",
"0.5987537",
"0.5986417",
"0.59777606",
"0.59639984",
"0.5944741",
"0.5944279",
"0.5939709",
"0.5926512",
"0.5921523",
"0.5921451",
"0.5918508",
"0.58976674",
"0.5893383",
"0.58921117",
"0.58890873",
"0.5881024",
"0.5878046",
"0.5877589",
"0.58692515",
"0.58572924",
"0.58535445",
"0.58509475",
"0.5847377",
"0.58449185",
"0.5842937",
"0.58257675",
"0.58254915",
"0.58114076",
"0.58084995",
"0.580357",
"0.5800866",
"0.57944536",
"0.5793889",
"0.5778877",
"0.57741475",
"0.5773708",
"0.57708865",
"0.57662195",
"0.5759267",
"0.5759209",
"0.57455355",
"0.57398856",
"0.57398856",
"0.5734092",
"0.57332414",
"0.5720521",
"0.5717325",
"0.57132983",
"0.5711737",
"0.5702552",
"0.5693937",
"0.56913567",
"0.5687299",
"0.56822145",
"0.5678257",
"0.56755126",
"0.5672181",
"0.5663345"
] |
0.76053977
|
0
|
GET /pickup_point_time_details/1 GET /pickup_point_time_details/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @pickup_point_time_details = PickupPointTimeDetail.includes(:route, :location, :pickup_route_start_time)\n end",
"def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end",
"def set_pickup_point_time_detail\n @pickup_point_time_detail = PickupPointTimeDetail.find(params[:id])\n end",
"def create\n @pickup_point_time_detail = PickupPointTimeDetail.new(pickup_point_time_detail_params)\n\n respond_to do |format|\n if @pickup_point_time_detail.save\n format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully created.' }\n format.json { render :show, status: :created, location: @pickup_point_time_detail }\n else\n format.html { render :new }\n format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\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 show\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def show\n @planned_time = PlannedTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planned_time }\n end\n end",
"def pickup_point_time_detail_params\n #params[:pickup_point_time_detail]\n params.require(:pickup_point_time_detail).permit(:route_id, :location_id, :pickup_route_start_time_id, :pickup_time)\n end",
"def show\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_time }\n end\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def show\n @offset_time = OffsetTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offset_time }\n end\n end",
"def new\n @touchpoint = Touchpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def show\n @tripdate = Tripdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tripdate }\n end\n end",
"def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def update\n respond_to do |format|\n if @pickup_point_time_detail.update(pickup_point_time_detail_params)\n format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @pickup_point_time_detail }\n else\n format.html { render :edit }\n format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @planning_time = PlanningTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planning_time }\n end\n end",
"def show\n @pickup = Pickup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pickup }\n end\n end",
"def show\n render json: @trip\n end",
"def show\n render json: @trip\n end",
"def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end",
"def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }\n format.json { render json: @time_point, status: :created, location: @time_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @hurdle_time = HurdleTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hurdle_time }\n end\n end",
"def show\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wait_time }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clock_time }\n end\n end",
"def show\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stop_time }\n end\n end",
"def show\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end",
"def show\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_time }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @working_time }\n end\n end",
"def show\n @m_get_point = MGetPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def show\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_slot }\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 show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @receiver_time = ReceiverTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receiver_time }\n end\n end",
"def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def show\n @nursing_time = NursingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nursing_time }\n end\n end",
"def show\n @member_time = MemberTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member_time }\n end\n end",
"def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_frame }\n end\n end",
"def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end",
"def show\n @tsp = Tsp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@tsp }\n end\n end",
"def show\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_time_stop }\n end\n end",
"def show\n\n set_no_cache\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n\n end",
"def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end",
"def show\n @meeting_point = MeetingPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting_point }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def show\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @point_consumption }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reservation = Reservation.new\n @image_tag_string = \"/assets/slideshow-rest.jpg\"\n\n @google_map = \"http://maps.google.com/maps/api/staticmap?key=AIzaSyC77WBfl-zki0vS7h9zyKyYg3htKcERvuo&size=400x300\"\n @google_map << \"&markers=icon:http://i42.tinypic.com/rj2txf.png%7C#{@restaurant.lat}%2C#{@restaurant.lng}\"\n @google_map << '&sensor=false&zoom=16'\n\n @today = true\n if @restaurant.inventories.available.size >= 3\n @times = @restaurant.inventories.available.limit(3).map{|inv| inv.start_time.to_s.slice(11..15)}\n else\n @today = false\n @times = @restaurant.inventories.available((Time.zone.today + 1.day), \"00:00\").limit(3).map{|inv| inv.start_time.to_s.slice(11..15)}\n end\n\n @times = [\"18:30\",\"19:00\",\"19:30\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\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 show\n\n \t\t\trespond_with @teetime\n\n \t\tend",
"def show\n if request.referer =~ /\\/embed\\/parks/ && request.format == 'html'\n redirect_to \"/embed\" + request.path\n return\n end\n\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n @trip['start_lat'] = @trip.starting_trailhead.latitude\n @trip['start_lng'] = @trip.starting_trailhead.longitude\n @trip['end_lat'] = @trip.ending_trailhead.latitude\n @trip['end_lng'] = @trip.ending_trailhead.longitude\n render json: @trip\n end\n end\n end",
"def get_pickup_time\n pickup_time.strftime(\"%H:%M %p\") if pickup_time.present?\n end",
"def get_pickup_schedule_with_http_info(date, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CompanyApi.get_pickup_schedule ...\"\n end\n # verify the required parameter 'date' is set\n fail ArgumentError, \"Missing the required parameter 'date' when calling CompanyApi.get_pickup_schedule\" if date.nil?\n # resource path\n local_var_path = \"/company/pick-up-schedule\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'date'] = date\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20025')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CompanyApi#get_pickup_schedule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @touchpoint = Touchpoint.find(params[:id])\n @queue = CallQueue.find(params[:call_queue_id])\n \n @lead = @touchpoint.lead\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @touchpoint }\n end\n end",
"def new\n @tripdate = Tripdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tripdate }\n end\n end",
"def new\n @service_time = ServiceTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_time }\n end\n end",
"def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end",
"def show\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_driver }\n end\n end",
"def getPickUpTime()\n @tripViaPoint.pickUp.time ;\n end",
"def show\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_point }\n end\n end",
"def show\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_section }\n end\n end",
"def show\n render json: @timer\n end",
"def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end",
"def show\n if @trip_point.nil?\n render :json => {:success => \"false\"}\n else\n render :json => {:success => \"true\", :point => @trip_point, :images => @trip_point.trip_images}\n end\n end",
"def new\n @trip = Trip.new\n @author_info = AuthorInfo.new\n @location_val = \"\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_time }\n end\n end",
"def getTripTime()\n return Trip.new(getPickUpTime(), getDropOffTime()) ;\n end",
"def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end",
"def show\n @user_point = UserPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_point }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def show\n @doctor_timing = DoctorTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doctor_timing }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def get_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def destroy\n @pickup_point_time_detail.destroy\n respond_to do |format|\n format.html { redirect_to pickup_point_time_details_url, notice: 'Pickup point time detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def plan(from, to, trip_datetime, arrive_by=true, options={})\n\n url = build_url(from, to, trip_datetime, arrive_by, options)\n\n begin\n resp = Net::HTTP.get_response(URI.parse(url))\n rescue Exception=>e\n return {'id'=>500, 'msg'=>e.to_s}\n end\n\n return resp\n\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def new\n @m_get_point = MGetPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def show\n\n redirect_to :action => \"index\"\n # @deadlift_data_point = DeadliftDataPoint.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @deadlift_data_point }\n # end\n end",
"def show\n render json: @clock_event\n end",
"def show\n objid = params[:id]\n obj = PickupLocation.find_by_id(objid)\n if obj\n render json: {pickup_location: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end",
"def new\n @planning_time = PlanningTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planning_time }\n end\n end",
"def get_trip_listing \n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif current_user.trips_driving.include?(trip_params[:trip_id]) || current_user.past_trips_driven.include?(trip_params[:trip_id])\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: {\n\t\t\t\t\ttrip_details: @trip,\n\t\t\t\t\tuser_requests: @user_requests,\n\t\t\t\t\taccepted_users: @accepted_users\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user is not the driver for this trip'\n\t\t\t}\n\t\tend\n\tend",
"def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end",
"def new\n @time_track = TimeTrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_track }\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @point }\n end\n end",
"def get_trip_time trip_id, otp_response=nil\n\n otp_response = otp_response || self.otp_response\n\n if otp_response.nil? or otp_response['tripTimes'].nil?\n return nil\n end\n trip_times = otp_response['tripTimes']\n return trip_times.detect{|hash| hash['tripId'] == trip_id}\n end",
"def show\n @trip = Trip.find(params[:id])\n @meta_title = \" Thrill Engine - #{@trip.categories.map(&:name).to_sentence} in #{@trip.location} staying at #{@trip.title} \"\n @meta_description = @trip.description\n @meta_keywords = \" #{@trip.location}, #{@trip.categories.map(&:name).to_sentence}, #{@trip.title}, #{@trip.categories.map(&:name).to_sentence} in #{@trip.location}, #{@trip.categories.map(&:name).to_sentence} travel, #{@trip.categories.map(&:name).to_sentence} trips, best #{@trip.categories.map(&:name).to_sentence} spots, top #{@trip.categories.map(&:name).to_sentence} resorts, Adventure Holidays, #{@trip.categories.map(&:name).to_sentence} Holidays, #{@trip.categories.map(&:name).to_sentence} vacations \" \n @json = Trip.find(params[:id]).to_gmaps4rails\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trip }\n end\n end",
"def new\n @time_record = TimeRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_record }\n end\n end",
"def new\n @my_time_trial = MyTimeTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @my_time_trial }\n end\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def show\n @data_point = DataPoint.find(params[:id])\n\n if @data_point\n render json: @data_point\n else\n render json: @data_point, status: 404\n end\n end",
"def show\n @punch = Punch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punch }\n end\n end",
"def show\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trip.to_json, :callback => params[:callback] }\n end\n end"
] |
[
"0.7552405",
"0.7360442",
"0.7295135",
"0.7019691",
"0.6847505",
"0.68133426",
"0.6767781",
"0.6653837",
"0.66423935",
"0.65563494",
"0.6537323",
"0.64888066",
"0.64761895",
"0.6466538",
"0.639411",
"0.639411",
"0.63795376",
"0.6366404",
"0.63595194",
"0.6343129",
"0.6317913",
"0.6317913",
"0.62923956",
"0.6282948",
"0.6276525",
"0.6270824",
"0.6270463",
"0.6268967",
"0.62641215",
"0.6239038",
"0.62145454",
"0.62145454",
"0.6212134",
"0.6196903",
"0.6167359",
"0.61561894",
"0.615491",
"0.615491",
"0.6152079",
"0.61364067",
"0.6117152",
"0.6081182",
"0.6079132",
"0.6064551",
"0.6063874",
"0.60630894",
"0.60593",
"0.605052",
"0.6046082",
"0.6034658",
"0.6026584",
"0.60253876",
"0.60226446",
"0.6008712",
"0.60023063",
"0.5979667",
"0.5975058",
"0.5974782",
"0.59712046",
"0.59700906",
"0.59667414",
"0.595754",
"0.5955304",
"0.5930861",
"0.5922216",
"0.5918681",
"0.59176433",
"0.59172845",
"0.589713",
"0.58761036",
"0.5871885",
"0.5870522",
"0.58664566",
"0.5860869",
"0.583798",
"0.5836016",
"0.58182925",
"0.5805247",
"0.5805247",
"0.5800905",
"0.5798021",
"0.57969105",
"0.57848287",
"0.57831",
"0.5778088",
"0.577246",
"0.5770321",
"0.57640165",
"0.57606024",
"0.57598084",
"0.57434416",
"0.5742044",
"0.5741043",
"0.5740291",
"0.5737657",
"0.5732387",
"0.57318807",
"0.57303125",
"0.5727804",
"0.5724619",
"0.5723959"
] |
0.0
|
-1
|
POST /pickup_point_time_details POST /pickup_point_time_details.json
|
def create
@pickup_point_time_detail = PickupPointTimeDetail.new(pickup_point_time_detail_params)
respond_to do |format|
if @pickup_point_time_detail.save
format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully created.' }
format.json { render :show, status: :created, location: @pickup_point_time_detail }
else
format.html { render :new }
format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pickup_point_time_detail_params\n #params[:pickup_point_time_detail]\n params.require(:pickup_point_time_detail).permit(:route_id, :location_id, :pickup_route_start_time_id, :pickup_time)\n end",
"def set_pickup_point_time_detail\n @pickup_point_time_detail = PickupPointTimeDetail.find(params[:id])\n end",
"def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }\n format.json { render json: @time_point, status: :created, location: @time_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pickup_point_time_detail.update(pickup_point_time_detail_params)\n format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @pickup_point_time_detail }\n else\n format.html { render :edit }\n format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @touchpoint = Touchpoint.new(params[:touchpoint])\n\n respond_to do |format|\n if @touchpoint.save\n format.html { redirect_to @touchpoint, notice: 'Touchpoint was successfully created.' }\n format.json { render json: @touchpoint, status: :created, location: @touchpoint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @touchpoint.errors, status: :unprocessable_entity }\n end\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 create\n @p_time = PTime.new(p_time_params)\n\n respond_to do |format|\n if @p_time.save\n format.html { redirect_to @p_time, notice: 'P time was successfully created.' }\n format.json { render :show, status: :created, location: @p_time }\n else\n format.html { render :new }\n format.json { render json: @p_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pickup_point_time_details = PickupPointTimeDetail.includes(:route, :location, :pickup_route_start_time)\n end",
"def create\n @punchtime = current_user.punchtimes.build(punchtime_params)\n respond_to do |format|\n if @punchtime.save\n format.html { redirect_to( current_user, notice: 'Punchtime was successfully created.') }\n format.json { render :show, status: :created, location: @punchtime }\n else\n format.html { render :new }\n format.json { render json: @punchtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timing = Timing.new(timing_params)\n\n if @timing.save\n render :show, status: :created, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end",
"def create\n @time_tracker = TimeTracker.new({ started_at: Time.current, status: 'running' }.merge(time_tracker_params))\n\n respond_to do |format|\n if @time_tracker.save\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully created.' }\n format.json { render :show, status: :created, location: @time_tracker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planned_time = PlannedTime.new(params[:planned_time])\n\n respond_to do |format|\n if @planned_time.save\n format.html { redirect_to @planned_time, notice: 'Planned time was successfully created.' }\n format.json { render json: @planned_time, status: :created, location: @planned_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @planned_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @outcome_timepoint = OutcomeTimepoint.new(params[:outcome_timepoint])\n\t@outcome_timepoint.save\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 create\n @poi_time = PoiTime.new(poi_time_params)\n\n respond_to do |format|\n if @poi_time.save\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully created.' }\n format.json { render :show, status: :created, location: @poi_time }\n else\n format.html { render :new }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @touchpoint = Touchpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @touchpoint }\n end\n end",
"def create\n @drop_route_start_time = DropRouteStartTime.new(drop_route_start_time_params)\n\n respond_to do |format|\n if @drop_route_start_time.save\n format.html { redirect_to drop_route_start_times_path, notice: 'Drop route start time was successfully created.' }\n format.json { render :show, status: :created, location: @drop_route_start_time }\n else\n format.html { render :new }\n format.json { render json: @drop_route_start_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @workSegment = @workday.workSegments.last\n puts @workSegment.workday.dayDate\n # if @workSegment.timePunches.count == 0\n # @currentStatus = false\n # else\n # @lastTimePunch = @workSegment.timePunches.last\n # @currentStatus = @lastTimePunch.status\n # end\n\n @time_punch = @workSegment.timePunches.new(punch: Time.current, status: true)\n\n respond_to do |format|\n if @time_punch.save\n format.html { redirect_to dashboard_path, notice: 'Time punch was successfully created.' }\n # format.json { render :show, status: :created, location: @time_punch }\n else\n format.html { redirect_to dashboard_path, notice: 'clock record was not created(from tp controller).' }\n # format.json { render json: @time_punch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @offset_time = OffsetTime.new(params[:offset_time])\n\n respond_to do |format|\n if @offset_time.save\n format.html { redirect_to @offset_time, notice: 'Offset time was successfully created.' }\n format.json { render json: @offset_time, status: :created, location: @offset_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @offset_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @outcome_timepoint = OutcomeTimepoint.new(params[:outcome_timepoint])\n\n respond_to do |format|\n if @outcome_timepoint.save\n format.html { redirect_to(@outcome_timepoint, :notice => 'Outcome timepoint was successfully created.') }\n format.xml { render :xml => @outcome_timepoint, :status => :created, :location => @outcome_timepoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outcome_timepoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cooking_time = CookingTime.new(cooking_time_params)\n\n respond_to do |format|\n if @cooking_time.save\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cooking_time }\n else\n format.html { render action: 'new' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ride = Ride.new(ride_params)\n @ride.assembly_time = params[:ride][:assembly_time]\n @ride.destination_time = params[:ride][:destination_time]\n @ride.check_points = params[:ride][:check_points]\n if @ride.save\n @ride.delay.call_notification(I18n.t('Notification.ride_created'), I18n.t('Email.ride_created'))\n render json: @ride, status: :created\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end",
"def create\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.value = (@time_record.ended_at - @time_record.started_at) / 1.hour\n @time_record.recorded_on = @time_record.started_at.to_date\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to time_records_path, notice: 'Time record was successfully created.' }\n format.json { render json: @time_record.to_json, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_off_instance = TimeOffInstance.new(time_off_instance_params)\n #@time_off_instance.employee.hours_left -= @time_off_instance.hours_used\n respond_to do |format|\n if @time_off_instance.save\n self.use_pto_hours\n #print \"HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE\"\n format.html { redirect_to @time_off_instance, notice: 'Time off instance was successfully created.' }\n format.json { render :show, status: :created, location: @time_off_instance }\n else\n format.html { render :new }\n format.json { render json: @time_off_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @selected_time = SelectedTime.new(selected_time_params)\n\n respond_to do |format|\n if @selected_time.save\n format.html { redirect_to @selected_time, notice: 'Selected time was successfully created.' }\n format.json { render :show, status: :created, location: @selected_time }\n else\n format.html { render :new }\n format.json { render json: @selected_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @allocated_time = AllocatedTime.new(allocated_time_params)\n\n respond_to do |format|\n if @allocated_time.save\n format.html { redirect_to @allocated_time, notice: 'Allocated time was successfully created.' }\n format.json { render :show, status: :created, location: @allocated_time }\n else\n format.html { render :new }\n format.json { render json: @allocated_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @way_point = WayPoint.new(way_point_params)\r\n respond_to do |format|\r\n if @way_point.save\r\n format.html { redirect_to my_maps_path, notice: 'Way point was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @way_point }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @breadcrumb = 'create'\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.created_by = current_user.id if !current_user.nil?\n @time_record.source_ip = request.remote_ip\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to @time_record, notice: crud_notice('created', @time_record) }\n format.json { render json: @time_record, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @providers_opening_time = Providers::OpeningTime.new(providers_opening_time_params)\n\n respond_to do |format|\n if @providers_opening_time.save\n format.html { redirect_to providers_opening_times_path, notice: 'Opening time was successfully created.' }\n format.json { render :show, status: :created, location: @providers_opening_time }\n else\n format.html { render :new }\n format.json { render json: @providers_opening_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location_time = LocationTime.new(location_time_params)\n\n respond_to do |format|\n if @location_time.save\n format.html { redirect_to @location_time, notice: 'Location time was successfully created.' }\n format.json { render action: 'show', status: :created, location: @location_time }\n else\n format.html { render action: 'new' }\n format.json { render json: @location_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id)\n end",
"def create\n @trip = Trip.new(user_id: params[:user_id], trip_name: params[:trip_name], distance: params[:distance], walked_at: Time.now)\n @origin = Place.new(user_id: params[:user_id], place_name: params[:origin_name], latitude: params[:origin_lat], longitude: params[:origin_long])\n @destination = Place.new(user_id: params[:user_id], place_name: params[:dest_name], latitude: params[:dest_lat], longitude: params[:dest_long])\n if @trip.save && @origin.save && @destination.save\n @origin_point = TripPoint.new(trip_id: @trip.id, place_id: @origin.id, place_type: \"Origin\")\n @destination_point = TripPoint.new(trip_id: @trip.id, place_id: @destination.id, place_type: \"Destination\")\n @origin_point.save\n @destination_point.save\n else\n render :json => {:success => false, :errors => [\"Trip creation failed.\"]}\n end\n end",
"def getPickUpTime()\n @tripViaPoint.pickUp.time ;\n end",
"def create\n @service_time = ServiceTime.new(params[:service_time])\n\n respond_to do |format|\n if @service_time.save\n format.html { redirect_to @service_time, notice: 'Service time was successfully created.' }\n format.json { render json: @service_time, status: :created, location: @service_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.user_id = current_user.id\n\n if @trip.roundtrip\n @trip2 = Trip.new()\n @trip2.start_date = @trip.end_date\n @trip2.start_time = @trip2.end_time\n\n @trip2.origin = @trip.destiny\n @trip2.destiny = @trip2.origin\n\n @trip2.passcities = @trip.passcities\n\n @trip2.save\n else\n end\n \n respond_to do |format|\n if @trip.save\n #format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.html { redirect_to :controller=>\"costs\", :action=> \"new\", :trip_id=>@trip.id}\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tea_time = TeaTime.new(tea_time_params)\n respond_to do |format|\n if @tea_time.save\n format.html { redirect_to profile_path, notice: 'Tea time was successfully created.' }\n format.json { render :show, status: :created, location: @tea_time }\n else\n format.html { render :new }\n format.json { render json: @tea_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_break_time = OrderBreakTime.new(order_break_time_params)\n\n respond_to do |format|\n if @order_break_time.save\n format.html { redirect_to @order_break_time, notice: 'Order break time was successfully created.' }\n format.json { render 'show', status: :created, location: @order_break_time }\n else\n format.html { render 'new' }\n format.json { render json: @order_break_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planning_time = PlanningTime.new(params[:planning_time])\n\n respond_to do |format|\n if @planning_time.save\n format.html { redirect_to @planning_time, notice: 'Planning time was successfully created.' }\n format.json { render json: @planning_time, status: :created, location: @planning_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @planning_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end",
"def create\n set_user\n @time_off = TimeOff.new(time_off_params)\n\n respond_to do |format|\n if @time_off.save\n format.html { redirect_to user_time_off_path(@user, @time_off), notice: 'Time off was successfully created.' }\n format.json { render action: 'show', status: :created, location: @time_off }\n else\n format.html { render action: 'new' }\n format.json { render json: @time_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_slot = TimeSlot.new(time_slot_params)\n\n if @time_slot.save\n render :show, status: :created, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end",
"def create\n @time_registration = TimeRegistration.create(time_registration_params)\n respond_to do |format|\n if @time_registration.save\n format.json { render :show, status: :created, location: @time_registration }\n else\n format.json { render json: @time_registration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @drop_off_location_time = DropOffLocationTime.new(params[:drop_off_location_time])\n if @drop_off_location_time.save\n respond_to do |format|\n format.html { redirect_to :controller => \"drop_off_locations\", :action => \"index\" }\n end\n end\n end",
"def create\n @get_options\n @showtime = Showtime.new(showtime_params)\n\n respond_to do |format|\n if @showtime.save\n format.html { redirect_to @showtime, notice: \"Showtime was successfully created.\" }\n format.json { render :show, status: :created, location: @showtime }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @showtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip_waypoint = TripWaypoint.new\n @trip_waypoint.place_id = params[:place_id]\n @trip_waypoint.trip_id = params[:trip_id]\n @trip_waypoint.save\n\n respond_to do |format|\n if @trip_waypoint.save\n format.html { redirect_to edit_partner_trip_path(params[:trip_id]), notice: \"Le lieu a été ajouté à l'itinéraire\" }\n # format.json { render :show, status: :created, location: @trip_waypoint }\n else\n format.html { render :new }\n # format.json { render json: @trip_waypoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @pickup_point_time_detail.destroy\n respond_to do |format|\n format.html { redirect_to pickup_point_time_details_url, notice: 'Pickup point time detail was successfully destroyed.' }\n format.json { head :no_content }\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 trip_params\n params.require(:trip).permit(:name, :description, :starts_at, :ends_at, :image, :image_cache, :place, :promo_cache, :promo, :default_time_zone)\n end",
"def create\n @time_record = WorkTimeRecord.new(time_record_params)\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to @time_record, notice: 'Time record was successfully created.' }\n format.json { render :show, status: :created, location: @time_record }\n else\n format.html { render :new }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n start_time = \"#{params[:start_time_hour]}:#{params[:start_time_min]}\"\n end_time = \"#{params[:end_time_hour]}:#{params[:end_time_min]}\"\n if params[:location].present?\n params[:location][:start_time] = start_time\n params[:location][:end_time] = end_time\n end\n @location = Location.new(params[:location])\n respond_to do |format|\n if @location.save\n format.js\n format.html { redirect_to @location, notice: '门店信息建立成功.' }\n format.json { render json: @location, status: :created, location: @location }\n else \n format.js {render 'new'}\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(user_id: current_user.id)\n @trip.start_point = Station.find_by(uid: params[:station_id])\n #Defined current user and updated credits. This change may cause issues.\n @current_user = current_user\n @current_user.credits = (@current_user.credits - 1)\n\n if @trip.save\n @current_user.save\n #This is where the change ends\n render json: @trip.attributes.merge(station: @trip.start_point.attributes), status: :created, location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.find(session[:user_id])\n coordinates = Geocoder.coordinates(future_trip_params[:name])\n @future_trip = @user.future_trips.new(future_trip_params)\n FutureTrip.set_coordinates(@future_trip)\n\n respond_to do |format|\n if @future_trip.save\n\n format.html { redirect_to @future_trip, notice: 'Future trip was successfully created.' }\n format.json { render json: @future_trip }\n else\n format.html { render :new }\n format.json { render json: @future_trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_track = TimeTrack.new(params[:time_track])\n\n respond_to do |format|\n if @time_track.save\n format.html { redirect_to @time_track, notice: 'Time track was successfully created.' }\n format.json { render json: @time_track, status: :created, location: @time_track }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @work_order_time = WorkOrderTime.new(work_order_time_params)\n\n respond_to do |format|\n if @work_order_time.save\n format.html { redirect_to @work_order_time, notice: 'Work order time was successfully created.' }\n format.json { render :show, status: :created, location: @work_order_time }\n else\n format.html { render :new }\n format.json { render json: @work_order_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @travel_datum = TravelDatum.new\n @travel_datum.start_time = Time.now.beginning_of_day + 9.hours\n @travel_datum.end_of_business_time = Time.now.beginning_of_day+17.hours\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @travel_datum }\n format.xml { render :xml => @travel_data }\n end\n end",
"def create\n @stop_time = StopTime.new(params[:stop_time])\n\n respond_to do |format|\n if @stop_time.save\n format.html { redirect_to @stop_time, notice: 'Stop time was successfully created.' }\n format.json { render json: @stop_time, status: :created, location: @stop_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stop_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:location, :trip_start_date, :trip_end_date, :description)\n end",
"def create\n @member_time = MemberTime.new(params[:member_time])\n\n respond_to do |format|\n if @member_time.save\n format.html { redirect_to @member_time, notice: 'Member time was successfully created.' }\n format.json { render json: @member_time, status: :created, location: @member_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @member_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # binding.pry\n\n unless params[:name].nil?\n\n if Task.where(name: params[:name]).exists?\n\n task = Task.find_by_name(params[:name])\n else\n task = Task.create(name: params[\"name\"])\n end\n @time_record = TimeRecord.new(state: \"open\", task_id: task.id)\n\n else\n @time_record = TimeRecord.new(state: \"open\")\n\n end\n\n\n\n respond_to do |format|\n if @time_record.save\n if task\n task.time_records << @time_record\n end\n format.html { redirect_to edit_time_record_path(@time_record), notice: 'Time record was successfully created.' }\n format.json { render json: @time_record, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add task_details\n\n #prepare payload\n now = Time.now.to_i \n defaults = {\n \"method\" => \"task.save\",\n \"id\" => UUID.generate,\n \"type\" => 0,\n \"_type\" => now,\n \"state\" => 0,\n \"_state\" => now,\n }\n\n task = defaults.merge(task_details)\n self.post [task].to_json\n end",
"def bus_trip_params\n params.require(:bus_trip).permit(:trip_start_time, :trip_end_time, :start_location, :end_location, :price)\n # \"trip_start_time(1i)\"=>\"2021\", \"trip_start_time(2i)\"=>\"6\", \"trip_start_time(3i)\"=>\"15\", \n # \"trip_start_time(4i)\"=>\"06\", \"trip_start_time(5i)\"=>\"00\", \"trip_end_time(1i)\"=>\"2021\", \"trip_end_time(2i)\"=>\"6\", \"trip_end_time(3i)\"=>\"15\", \"trip_end_time(4i)\"=>\"06\", \n # \"trip_end_time(5i)\"=>\"30\", \"start_location\"=>\"New York\", \"end_location\"=>\"Queens\"\n end",
"def create\n @meal_time = MealTime.new(params[:meal_time])\n\n respond_to do |format|\n if @meal_time.save\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully created.' }\n format.json { render json: @meal_time, status: :created, location: @meal_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_point_params\n params.require(:trip_point).permit(:descricao, :lat, :lon, :trip_id)\n end",
"def create\n t_start = params[:item][:start_time].to_date.to_s + ' ' + params[:start_hour]\n t_end = params[:item][:end_time].to_date.to_s + ' ' + params[:end_hour]\n params[:item][:start_time] = DateTime.parse(t_start)\n params[:item][:end_time] = DateTime.parse(t_end)\n params[:item][:start_time] = params[:item][:start_time].change(:offset => \"-5\")\n params[:item][:end_time] = params[:item][:end_time].change(:offset => \"-5\")\n\n @item = Item.new(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timeslot = Timeslot.new(timeslot_params)\n @timeslot.save!\n render :json => @timeslot.as_json\n end",
"def create\n @wait_time = WaitTime.new(wait_time_params)\n\n respond_to do |format|\n if @wait_time.save\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully created.' }\n format.json { render :show, status: :created, location: @wait_time }\n else\n format.html { render :new }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tour = Tour.new()\n @tour.firstname = params[:tour][:firstname]\n @tour.lastname = params[:tour][:lastname]\n @tour.user_id = params[:tour][:user_id]\n @tour.tourtype = params[:tour][:tourtype]\n @tour.day = Date.new(params[:tour][\"day(1i)\"].to_i,params[:tour][\"day(2i)\"].to_i,params[:tour][\"day(3i)\"].to_i)\n @tour.time = params[:tour][:time]\n \n # create an instance/object of a BasicTour\n mytour = BasicTour.new(@tour.tourtype, @tour.day, @tour.time)\n \n # add the extra features to the new tour\n if params[:tour][:audio].to_s.length > 0 then\n mytour = AudioGuide.new(mytour)\n end\n \n # add the extra features to the new tour\n if params[:tour][:interest].to_s.length > 0 then\n mytour = TicketInterestPlace.new(mytour)\n end\n \n # add the extra features to the new tour\n if params[:tour][:pick_drop].to_s.length > 0 then\n mytour = PickUpDropOff.new(mytour)\n end\n \n ## populate the cost and the description details\n @tour.cost = mytour.cost\n @tour.description = mytour.details\n \n \n # retrieve the instance/object of the TourLogger class\n logger = TourLogger.instance\n logger.logInformation(\"A new tour added: \" + @tour.description )\n logger.logInformation(\"----------------------------------------\")\n \n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wait_time = WaitTime.new(params[:wait_time])\n\n respond_to do |format|\n if @wait_time.save\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully created.' }\n format.json { render json: @wait_time, status: :created, location: @wait_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def punchtime_params\n params.require(:punchtime).permit(:punch_type, :description, :time)\n end",
"def time_tracker_params\n params.require(:time_tracker).permit(:time, :desc)\n end",
"def create\n @receiver_time = ReceiverTime.new(params[:receiver_time])\n\n respond_to do |format|\n if @receiver_time.save\n format.html { redirect_to @receiver_time, notice: 'Receiver time was successfully created.' }\n format.json { render json: @receiver_time, status: :created, location: @receiver_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @receiver_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @t_correcteddatum = TCorrecteddatum.new(t_correcteddatum_params)\n @t_correcteddatum.attributes = { m_user_id: current_user.id }\n if params[:punchdata]\n @t_correcteddatum.corrected_time = nil\n end\n\n respond_to do |format|\n if @t_correcteddatum.save\n format.html { redirect_to root_path, notice: 'T correcteddatum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @t_correcteddatum }\n else\n format.html { render action: 'new' }\n format.json { render json: @t_correcteddatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:name, :start_date, :end_date, :location)\n end",
"def create\n @deadlift_data_point = DeadliftDataPoint.new(params[:deadlift_data_point])\n\n respond_to do |format|\n if @deadlift_data_point.save\n format.html { redirect_to @deadlift_data_point, notice: 'Deadlift data point was successfully created.' }\n format.json { render json: @deadlift_data_point, status: :created, location: @deadlift_data_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deadlift_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timeslot = Timeslot.new(timeslot_params)\n\n if @timeslot.save\n render :show, status: :created, location: @timeslot\n else\n render json: @timeslot.errors, status: :unprocessable_entity\n end\n end",
"def trip_params\n params.require(:trip).permit(:employee_id, :lovedone_id, :status, :state, :latitude, :longitude)\n end",
"def create\n @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n format.html { render :new }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_and_place = TimeAndPlace.new(time_and_place_params)\n\n # create path for page to be rendered if save is successful\n new_path = '/trucks/' + @time_and_place.truck_id.to_s\n\n respond_to do |format|\n if @time_and_place.save\n format.html { redirect_to new_path, notice: 'Location was successfully saved.' }\n format.json { render :show, status: :created, location: @time_and_place }\n else\n format.html { render :new }\n format.json { render json: @time_and_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def future_trip_params\n params.require(:future_trip).permit(:name, :user_id, :latitude, :longitude, :month, :year, :description)\n end",
"def get_pickup_time\n pickup_time.strftime(\"%H:%M %p\") if pickup_time.present?\n end",
"def create\n @tripdate = Tripdate.new(params[:tripdate])\n\n respond_to do |format|\n if @tripdate.save\n format.html { redirect_to @tripdate, notice: 'Tripdate was successfully created.' }\n format.json { render json: @tripdate, status: :created, location: @tripdate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tripdate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:origin, :destination, :latitude, :longitude, :number_of_people, :departure_time)\n end",
"def uber_pickup_params\n params.require(:uber_pickup).permit(:pickup_time, :pickup_place)\n end",
"def create\n @nursing_time = NursingTime.new(params[:nursing_time])\n\n respond_to do |format|\n if @nursing_time.save\n format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully created.' }\n format.json { render json: @nursing_time, status: :created, location: @nursing_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nursing_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:employee_id, :lovedone_id, :status, :state, :latitude, :longitude)\n end",
"def time_and_place_params\n params.require(:time_and_place).permit(:start_time, :end_time, :street_address, :city, :state, :zip_code, :truck_id)\n end",
"def create\n @time_line = TimeLine.new(time_line_params)\n\n respond_to do |format|\n if @time_line.save\n format.html { redirect_to @time_line, notice: 'Time line was successfully created.' }\n format.json { render :show, status: :created, location: @time_line }\n else\n format.html { render :new }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new({\"name\" => \"New Trip\",\n \"beginning\" => Time.now.strftime(\"%d/%m/%Y\"),\n \"duration\" => \"0\",\n \"user\" => current_user})\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render home_path }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @milking = Milking.new(milking_params)\n @milking.user_id = @current_user.id\n # @milking.milking_time_id = milk_timeable\n @milking.milking_datetime = Time.now\n @milking.type = milking_period\n\n #if Time.now - milking.milking_datetime > 4.hours\n if @milking.save\n render :show, status: :created, location: v1_milking_url(@milking)\n else\n render json: @milking.errors, status: :unprocessable_entity\n end\n #else\n\n #end\n end",
"def create\n temp = []\n cust_iti_detail_id = params[\"iti_cust_dest_poa_detail\"][\"cust_iti_detail_id\"]\n preferred_time_of_arrival = params[\"preferred_time_of_arrival\"].each_slice(2).to_a\n preferred_time_of_departure = params[\"preferred_time_of_departure\"].each_slice(2).to_a\n params[\"dest_iti_detail_id\"].each_with_index do |arg,i|\n iti_cust_dest_poa_detail = ItiCustDestPoaDetail.new\n iti_cust_dest_poa_detail.cust_iti_detail_id = cust_iti_detail_id\n iti_cust_dest_poa_detail.dest_iti_detail_id = arg.to_i\n iti_cust_dest_poa_detail.points_of_attraction_id = params[\"points_of_attraction_id\"][i]\n iti_cust_dest_poa_detail.preferred_time_of_arrival = preferred_time_of_arrival[i].map{ |k| \"#{k}\"}.join(\":\")\n iti_cust_dest_poa_detail.preferred_time_of_departure = preferred_time_of_departure[i].map{ |k| \"#{k}\"}.join(\":\")\n iti_cust_dest_poa_detail.day_number = params[\"day_number\"][i]\n iti_cust_dest_poa_detail.save\n end\n respond_to do |format|\n flash.now[:notice] = 'All Details Added successfully'\n format.html { redirect_to iti_cust_dest_poa_details_path, notice: 'All Details Added successfully'}\n format.json { render action: 'show', status: :created, location: iti_cust_dest_poa_detail }\n end\n end",
"def create\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.build(params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id))\n if @trip.save\n redirect_to profile_trip_url(@profile, @trip)\n else\n render :action => \"new\"\n end\n end",
"def create\n @tombstone_timehold = TombstoneTimehold.new(tombstone_timehold_params)\n\n respond_to do |format|\n if @tombstone_timehold.save\n format.html { redirect_to @tombstone_timehold, notice: 'Tombstone timehold was successfully created.' }\n format.json { render :show, status: :created, location: @tombstone_timehold }\n else\n format.html { render :new }\n format.json { render json: @tombstone_timehold.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @work_time = WorkTime.new(work_time_params)\n\n respond_to do |format|\n if @work_time.save\n format.html { redirect_to @work_time, notice: 'Work time was successfully created.' }\n format.json { render :show, status: :created, location: @work_time }\n else\n format.html { render :new }\n format.json { render json: @work_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @working_start_time = WorkingStartTime.new(working_start_time_params)\n\n respond_to do |format|\n if @working_start_time.save\n format.html { redirect_to @working_start_time, notice: 'Working start time was successfully created.' }\n format.json { render action: 'show', status: :created, location: @working_start_time }\n else\n format.html { render action: 'new' }\n format.json { render json: @working_start_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def poi_time_params\n params.require(:poi_time).permit(:start_time, :end_time, :itinerary_id, :poi_id)\n end",
"def create\n @time_control = TimeControl.new(time_control_params)\n\n respond_to do |format|\n if @time_control.save\n format.html { redirect_to @time_control, notice: 'Time control was successfully created.' }\n format.json { render action: 'show', status: :created, location: @time_control }\n else\n format.html { render action: 'new' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @time_slot = TimeSlot.create(time_slot_params)\n\n respond_to do |format|\n if @time_slot.save\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully created.' }\n format.json { render :show, status: :created, location: @time_slot }\n else\n format.html { render :new }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.76083297",
"0.7414556",
"0.7245251",
"0.67128",
"0.6640143",
"0.66362816",
"0.6511833",
"0.64674044",
"0.6441322",
"0.64413005",
"0.64108527",
"0.6384961",
"0.6375037",
"0.6370077",
"0.6355481",
"0.6317949",
"0.62920445",
"0.6280445",
"0.625384",
"0.62518287",
"0.62374717",
"0.6204758",
"0.61843807",
"0.61725605",
"0.61635256",
"0.61458707",
"0.614156",
"0.6111871",
"0.6098438",
"0.6084581",
"0.60826504",
"0.60793614",
"0.6059569",
"0.60538405",
"0.6048408",
"0.60480416",
"0.6047225",
"0.60439247",
"0.6036426",
"0.6033064",
"0.60043",
"0.5995608",
"0.59883094",
"0.59793216",
"0.59692013",
"0.59562415",
"0.5921719",
"0.5911377",
"0.58926463",
"0.58861834",
"0.5884486",
"0.5876863",
"0.5858599",
"0.585855",
"0.5857877",
"0.58577466",
"0.5856386",
"0.5836813",
"0.58354676",
"0.5832467",
"0.5827073",
"0.5820402",
"0.58200854",
"0.5814216",
"0.5814177",
"0.5810717",
"0.5808979",
"0.5807359",
"0.5807045",
"0.5802173",
"0.580021",
"0.579935",
"0.5794777",
"0.57910645",
"0.5790522",
"0.57898605",
"0.5786524",
"0.5781867",
"0.578169",
"0.57800156",
"0.5778561",
"0.5775608",
"0.5773997",
"0.57603633",
"0.5759791",
"0.575825",
"0.5756807",
"0.57561564",
"0.57554007",
"0.57504565",
"0.57401526",
"0.5739195",
"0.5738809",
"0.5738806",
"0.57356805",
"0.5734566",
"0.57286143",
"0.5727779",
"0.5727529",
"0.5720399"
] |
0.7998177
|
0
|
PATCH/PUT /pickup_point_time_details/1 PATCH/PUT /pickup_point_time_details/1.json
|
def update
respond_to do |format|
if @pickup_point_time_detail.update(pickup_point_time_detail_params)
format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully updated.' }
format.json { render :show, status: :ok, location: @pickup_point_time_detail }
else
format.html { render :edit }
format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_pickup_point_time_detail\n @pickup_point_time_detail = PickupPointTimeDetail.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @trip_point.update(trip_point_params)\n format.html { redirect_to @trip_point, notice: 'Trip point was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_point }\n else\n format.html { render :edit }\n format.json { render json: @trip_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n if @touchpoint.update_attributes(params[:touchpoint])\n format.html { redirect_to @touchpoint, notice: 'Touchpoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @touchpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pickup_point_time_detail_params\n #params[:pickup_point_time_detail]\n params.require(:pickup_point_time_detail).permit(:route_id, :location_id, :pickup_route_start_time_id, :pickup_time)\n end",
"def update\n respond_to do |format|\n if @poi_time.update(poi_time_params)\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_time }\n else\n format.html { render :edit }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n self.unuse_pto_hours\n if @time_off_instance.update(time_off_instance_params)\n self.use_pto_hours\n format.html { redirect_to @time_off_instance, notice: 'Time off instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_off_instance }\n else\n format.html { render :edit }\n format.json { render json: @time_off_instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_punch.update(time_punch_params)\n format.html { redirect_to @time_punch, notice: 'Time punch was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_punch }\n else\n format.html { render :edit }\n format.json { render json: @time_punch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pickup.update(pickup_params)\n format.html { redirect_to @pickup, notice: 'Pickup was successfully updated.' }\n format.json { render :show, status: :ok, location: @pickup }\n else\n format.html { render :edit }\n format.json { render json: @pickup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pickup_point_time_detail = PickupPointTimeDetail.new(pickup_point_time_detail_params)\n\n respond_to do |format|\n if @pickup_point_time_detail.save\n format.html { redirect_to pickup_point_time_details_path, notice: 'Pickup point time detail was successfully created.' }\n format.json { render :show, status: :created, location: @pickup_point_time_detail }\n else\n format.html { render :new }\n format.json { render json: @pickup_point_time_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @future_trip.update(future_trip_params)\n format.html { redirect_to @future_trip, notice: 'Future trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @future_trip }\n else\n format.html { render :edit }\n format.json { render json: @future_trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n if @time_off_request.update_attributes(params[:time_off_request])\n format.html { redirect_to admin_time_off_requests_url, notice: 'Time off request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_off_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pickup = Pickup.find(params[:id])\n\n respond_to do |format|\n if @pickup.update_attributes(params[:pickup])\n format.html { redirect_to @pickup, notice: 'Pickup was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pickup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @punchtime.update(punchtime_params)\n format.html { redirect_to current_user, notice: 'Punchtime was successfully updated.' }\n format.json { render :show, status: :ok, location: @punchtime }\n else\n format.html { render :edit }\n format.json { render json: @punchtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @p_time.update(p_time_params)\n format.html { redirect_to @p_time, notice: 'P time was successfully updated.' }\n format.json { render :show, status: :ok, location: @p_time }\n else\n format.html { render :edit }\n format.json { render json: @p_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\t@outcome_timepoint.update_attributes(params[:outcome_timepoint])\n end",
"def update\n respond_to do |format|\n if @way_point.update(way_point_params)\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @drop_route_start_time.update(drop_route_start_time_params)\n format.html { redirect_to drop_route_start_times_path, notice: 'Drop route start time was successfully updated.' }\n format.json { render :show, status: :ok, location: @drop_route_start_time }\n else\n format.html { render :edit }\n format.json { render json: @drop_route_start_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @timing.update(timing_params)\n render :show, status: :ok, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end",
"def update\n set_time_params\n respond_to do |format|\n if @stage_order.update(stage_order_params)\n format.html { redirect_to @stage_order, notice: 'Stage order was successfully updated.' }\n format.json { render :show, status: :ok, location: @stage_order }\n else\n format.html { render :edit }\n format.json { render json: @stage_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cooking_time.update(cooking_time_params)\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offset_time = OffsetTime.find(params[:id])\n\n respond_to do |format|\n if @offset_time.update_attributes(params[:offset_time])\n format.html { redirect_to @offset_time, notice: 'Offset time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offset_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:task][:time] = parse_task_time(params[:task][:time], params[:anytime][:anytime])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\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 update\n @trip = Trip.find(params[:id])\n\n if @trip.end_point = Station.find_by(uid: params[:station_id])\n render json: @trip.attributes.merge(station: @trip.end_point.attributes), location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end",
"def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\n respond_to do |format|\n if @outcome_timepoint.update_attributes(params[:outcome_timepoint])\n format.html { redirect_to(@outcome_timepoint, :notice => 'Outcome timepoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outcome_timepoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @providers_opening_time.update(providers_opening_time_params)\n format.html { redirect_to providers_opening_times_path, notice: 'Opening time was successfully updated.' }\n format.json { render :show, status: :ok, location: @providers_opening_time }\n else\n format.html { render :edit }\n format.json { render json: @providers_opening_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @planned_time = PlannedTime.find(params[:id])\n\n respond_to do |format|\n if @planned_time.update_attributes(params[:planned_time])\n format.html { redirect_to @planned_time, notice: 'Planned time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planned_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @way_point.update(way_point_params)\r\n format.html { redirect_to @way_point, notice: 'Way point 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: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @time_tracker.update(time_tracker_params)\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_tracker }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_break_time.update(order_break_time_params)\n format.html { redirect_to @order_break_time, notice: 'Order break time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order_break_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ride = Ride.find(params[:id])\n if @ride.update(ride_params)\n @ride.update(assembly_time: params[:ride][:assembly_time])\n @ride.update(destination_time: params[:ride][:destination_time])\n @ride.update(check_points: params[:ride][:check_points])\n render json: @ride\n \n @ride.delay.call_notification(I18n.t('Notification.ride_updated'), I18n.t('Email.ride_updated'))\n #head :no_content\n\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end",
"def update\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n if @service_time.update_attributes(params[:service_time])\n format.html { redirect_to @service_time, notice: 'Service time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @selected_time.update(selected_time_params)\n format.html { redirect_to @selected_time, notice: 'Selected time was successfully updated.' }\n format.json { render :show, status: :ok, location: @selected_time }\n else\n format.html { render :edit }\n format.json { render json: @selected_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if UpdateTeaTime.call(@tea_time, tea_time_params)\n format.html { redirect_to profile_path, notice: 'Tea time was successfully updated.' }\n format.json { render json: @tea_time, status: :ok, location: @tea_time }\n else\n format.html { render :edit }\n format.json { render json: @tea_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end",
"def update\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n if @meal_time.update_attributes(params[:meal_time])\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @business_trip_info.update(business_trip_info_params)\n format.html { redirect_to @business_trip_info, notice: 'Business trip info was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_trip_info }\n else\n format.html { render :edit }\n format.json { render json: @business_trip_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meeting_point = MeetingPoint.find(params[:id])\n\n respond_to do |format|\n if @meeting_point.update_attributes(params[:meeting_point])\n format.html { redirect_to @meeting_point, notice: 'Meeting point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @time_slot.update(time_slot_params)\n render :show, status: :ok, location: @time_slot\n else\n render json: @time_slot.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @location_time.update(location_time_params)\n format.html { redirect_to @location_time, notice: 'Location time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tripdate = Tripdate.find(params[:id])\n\n respond_to do |format|\n if @tripdate.update_attributes(params[:tripdate])\n format.html { redirect_to @tripdate, notice: 'Tripdate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tripdate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @planning_time = PlanningTime.find(params[:id])\n\n respond_to do |format|\n if @planning_time.update_attributes(params[:planning_time])\n format.html { redirect_to @planning_time, notice: 'Planning time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planning_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @check_point.update(check_point_params)\n format.html { redirect_to @check_point, notice: 'Check point was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_point }\n else\n format.html { render :edit }\n format.json { render json: @check_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @timeslot.update(timeslot_params)\n render :show, status: :ok, location: @timeslot\n else\n render json: @timeslot.errors, status: :unprocessable_entity\n end\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 @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n if @point_consumption.update_attributes(params[:point_consumption])\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_slot.update(time_slot_params)\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_slot }\n else\n format.html { render :edit }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n if @wait_time.update_attributes(params[:wait_time])\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @working_start_time.update(working_start_time_params)\n format.html { redirect_to @working_start_time, notice: 'Working start time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @working_start_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_trial.update(time_trial_params)\n format.html { redirect_to @time_trial, notice: 'Time trial was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_trial }\n else\n format.html { render :edit }\n format.json { render json: @time_trial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @time_control.update(time_control_params)\n format.html { redirect_to @time_control, notice: 'Time control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_waypoint.update(trip_waypoint_params)\n format.html { redirect_to @trip_waypoint, notice: 'Trip waypoint was successfully updated.' }\n # format.json { render :show, status: :ok, location: @trip_waypoint }\n else\n format.html { render :edit }\n # format.json { render json: @trip_waypoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to trips_path, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @teetime.update(teetime_params)\n\n render json: @teetime,status: :ok\n\n else\n\n render json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spiffy_task.update(spiffy_task_params)\n format.html { redirect_to @spiffy_task, notice: 'Spiffy task was successfully updated.' }\n format.json { render :show, status: :ok, location: @spiffy_task }\n else\n format.html { render :edit }\n format.json { render json: @spiffy_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_record = TimeRecord.find(params[:id])\n\n # binding.pry\n\n if @time_record.task_id.nil?\n\n if Task.all.count == 1\n # binding.pry\n\n @task = Task.find_by_name(\"unallocated\")\n\n else\n\n\n if params[:Task].empty?\n # binding.pry\n\n\n @task = Task.find_by_name(\"unallocated\")\n\n else \n # binding.pry\n\n\n @task = Task.find(params[:Task])\n\n end\n\n end\n else\n\n @task = Task.find(@time_record.task.id)\n\n end\n\n # @time_record.task = @task\n\n respond_to do |format|\n if @time_record.update_attributes(state: params[\"status\"])\n # binding.pry\n @time_record.calculate_time(@time_record)\n\n # binding.pry\n if @time_record.task_id.nil?\n @time_record.task = @task\n @time_record.save\n end\n\n\n format.html { redirect_to @task, notice: 'Time record was successfully updated with more time.' }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end",
"def update\n respond_to do |format|\n if @allocated_time.update(allocated_time_params)\n format.html { redirect_to @allocated_time, notice: 'Allocated time was successfully updated.' }\n format.json { render :show, status: :ok, location: @allocated_time }\n else\n format.html { render :edit }\n format.json { render json: @allocated_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n if @working_time.update_attributes(params[:working_time])\n format.html { redirect_to time_tables_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { render :show, status: :ok, location: @point }\n else\n format.html { render :edit }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @workpoint.update(workpoint_params)\n format.html { redirect_to @workpoint, notice: 'Данные сохранены' }\n format.json { render :show, status: :ok, location: @workpoint }\n else\n format.html { render :edit }\n format.json { render json: @workpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @punch_clock.update(punch_clock_params)\n format.html { redirect_to @punch_clock, notice: t('punch_clocks.updated_ok') }\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @punch_clock }\n else\n format.html { render :edit }\n format.json { render json: @punch_clock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wait_time.update(wait_time_params)\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { render :show, status: :ok, location: @wait_time }\n else\n format.html { render :edit }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @timeslot.update(timeslot_params)\n format.html { redirect_to @timeslot, notice: 'Timeslot was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeslot }\n else\n format.html { render :edit }\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @viewpoint.update(viewpoint_params)\n format.html { redirect_to @viewpoint, notice: 'Viewpoint was successfully updated.' }\n format.json { render :show, status: :ok, location: @viewpoint }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @viewpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @receiver_time = ReceiverTime.find(params[:id])\n\n respond_to do |format|\n if @receiver_time.update_attributes(params[:receiver_time])\n format.html { redirect_to @receiver_time, notice: 'Receiver time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receiver_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to oj_path, notice: 'Trip was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @event = Event.from_param(params[:event_id])\n @time_table = @event.time_tables.where(:permalink => params[:id]).first\n success = params[:time_table] && params[:time_table][:times] && \n @time_table.update_attributes(:times => JSON.parse(params[:time_table][:times]))\n success ? update_success : update_failure\n rescue JSON::ParserError\n update_failure\n end",
"def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n offset = -1\n @trip.days.all.each do |day|\n offset += 1\n day.update_attribute(:date, @trip.beginning + offset)\n end\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @touch = Touch.find(params[:id])\n\n respond_to do |format|\n if @touch.update_attributes(touch_params)\n format.html { redirect_to coral_observation_area_path(@touch.area.observation.coral, @touch.area.observation, @touch.area), notice: 'Touch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @touch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.first\n @first_time = @site.first_time\n respond_to do |format|\n if @first_time.update(first_time_params)\n format.html { redirect_to backstage_index_path, notice: 'first_time was successfully updated.' }\n # format.json { render :show, status: :ok, location: @first_time }\n else\n format.html { render :edit }\n # format.json { render json: @first_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cal_time.update(cal_time_params)\n format.html { redirect_to @cal_time, notice: 'Cal time was successfully updated.' }\n format.json { render :show, status: :ok, location: @cal_time }\n else\n format.html { render :edit }\n format.json { render json: @cal_time.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_plan.update(trip_plan_params)\n format.html { redirect_to @trip_plan, notice: 'Trip plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_plan }\n else\n format.html { render :edit }\n format.json { render json: @trip_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n if @location_point.update_attributes(params[:location_point])\n format.html { redirect_to @location_point, notice: 'Location point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:user_id])\n @trip.start = params[:trip][:start]\n @trip.end = params[:trip][:end]\n respond_to do |format|\n if @trip.update\n format.html { redirect_to [@user,@trip], notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \">>>>>>>>>>>>> updated photo\"\n puts params[:data_point].inspect\n @data_point = DataPoint.find(params[:id])\n # if there is no photo in parameter, we remove it to not create an empty photo\n if (params[:data_point].has_key?(:photo) && params[:data_point][:photo].blank?)\n params[:data_point].delete(:photo)\n end\n\n @data_point.editor_id = current_user.id\n # if params[:data_point][\"uploaded_at\"]\n # puts \"uploaded at in params: #{params[:data_point]['uploaded_at']}\"\n # params[:data_point][\"uploaded_at\"] = Time.zone.parse(params[:data_point][\"uploaded_at\"])\n # puts \"uploaded at parsed: #{params[:data_point]['uploaded_at']}\"\n # end\n # puts \"user: #{@data_point.user.username}\"\n # puts \"time.now: #{Time.now}\"\n # puts \"time.zone: #{Time.zone}\"\n # puts \"time.zone.now: #{Time.zone.now}\"\n respond_to do |format|\n if @data_point.update_attributes(params[:data_point])\n puts \"data point after saved: #{@data_point.inspect}\"\n format.html { redirect_to @data_point, notice: 'Data point was successfully updated.' }\n format.json { render json: @data_point }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_point.errors }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pick.update(pick_params)\n format.html { redirect_to @pick, notice: 'Pick was successfully updated.' }\n format.json { render :show, status: :ok, location: @pick }\n else\n format.html { render :edit }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.js {}\n else\n format.html { render action: 'edit' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @get_in_touch.update(get_in_touch_params)\n format.html { redirect_to @get_in_touch, notice: 'Get in touch was successfully updated.' }\n format.json { render :show, status: :ok, location: @get_in_touch }\n else\n format.html { render :edit }\n format.json { render json: @get_in_touch.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7049888",
"0.7009255",
"0.67103887",
"0.66318226",
"0.65971214",
"0.64411294",
"0.6431845",
"0.6430065",
"0.6395657",
"0.6385543",
"0.6366297",
"0.63523287",
"0.6340919",
"0.6332876",
"0.6331364",
"0.63246447",
"0.6321546",
"0.6306469",
"0.6304709",
"0.6286071",
"0.6271091",
"0.6256234",
"0.62460124",
"0.624474",
"0.624013",
"0.62354076",
"0.6219181",
"0.62136257",
"0.6197076",
"0.6196084",
"0.61818594",
"0.6158591",
"0.61568487",
"0.61488926",
"0.6125717",
"0.61122966",
"0.610685",
"0.6076673",
"0.6073991",
"0.605042",
"0.6028525",
"0.6020352",
"0.6017098",
"0.60120696",
"0.60103303",
"0.60089654",
"0.6000618",
"0.59997207",
"0.5995892",
"0.5987816",
"0.59863466",
"0.59825164",
"0.5981373",
"0.5979766",
"0.5975366",
"0.59743655",
"0.59670687",
"0.5956832",
"0.5949759",
"0.59488845",
"0.59488845",
"0.59488845",
"0.59488845",
"0.59488845",
"0.59488845",
"0.59475046",
"0.5945056",
"0.5945056",
"0.59388477",
"0.593168",
"0.59313416",
"0.59287244",
"0.5923847",
"0.5923579",
"0.59220934",
"0.59187675",
"0.5910973",
"0.59080863",
"0.5904076",
"0.59008604",
"0.5900183",
"0.5897084",
"0.58925164",
"0.5892479",
"0.58924574",
"0.5889784",
"0.5880551",
"0.58778316",
"0.58774614",
"0.587426",
"0.587426",
"0.5874115",
"0.5872481",
"0.5869045",
"0.5866425",
"0.58644485",
"0.5861572",
"0.58571994",
"0.58491606",
"0.5842546"
] |
0.7767961
|
0
|
DELETE /pickup_point_time_details/1 DELETE /pickup_point_time_details/1.json
|
def destroy
@pickup_point_time_detail.destroy
respond_to do |format|
format.html { redirect_to pickup_point_time_details_url, notice: 'Pickup point time detail was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @time_point = TimePoint.find(params[:id])\n @time_point.destroy\n\n respond_to do |format|\n format.html { redirect_to time_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @touchpoint = Touchpoint.find(params[:id])\n @touchpoint.destroy\n\n respond_to do |format|\n format.html { redirect_to touchpoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip_point.destroy\n respond_to do |format|\n format.html { redirect_to trip_points_url, notice: 'Trip point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poi_time.destroy\n respond_to do |format|\n format.html { redirect_to poi_times_url, notice: 'Poi time 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 @pickup = Pickup.find(params[:id])\n @pickup.destroy\n\n respond_to do |format|\n format.html { redirect_to pickups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order_break_time.destroy\n respond_to do |format|\n format.html { redirect_to order_break_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @deadlift_data_point = DeadliftDataPoint.find(params[:id])\n @deadlift_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to deadlift_data_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_time = ServiceTime.find(params[:id])\n @service_time.destroy\n\n respond_to do |format|\n format.html { redirect_to service_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\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 @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @drop_route_start_time.destroy\n respond_to do |format|\n format.html { redirect_to drop_route_start_times_url, notice: 'Drop route start time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_time = MealTime.find(params[:id])\n @meal_time.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offset_time = OffsetTime.find(params[:id])\n @offset_time.destroy\n\n respond_to do |format|\n format.html { redirect_to offset_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pickup.destroy\n respond_to do |format|\n format.html { redirect_to pickups_url, notice: 'Pickup 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 @tripdate = Tripdate.find(params[:id])\n @tripdate.destroy\n\n respond_to do |format|\n format.html { redirect_to tripdates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooking_time.destroy\n respond_to do |format|\n format.html { redirect_to cooking_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @p_time.destroy\n respond_to do |format|\n format.html { redirect_to p_times_url, notice: 'P time was successfully destroyed.' }\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 destroy\n @planning_time = PlanningTime.find(params[:id])\n @planning_time.destroy\n\n respond_to do |format|\n format.html { redirect_to planning_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @planned_time = PlannedTime.find(params[:id])\n @planned_time.destroy\n\n respond_to do |format|\n format.html { redirect_to planned_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_consumption = PointConsumption.find(params[:id])\n @point_consumption.destroy\n\n respond_to do |format|\n format.html { redirect_to point_consumptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @punchtime.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Punchtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @location_point = LocationPoint.find(params[:id])\n @location_point.destroy\n\n respond_to do |format|\n format.html { redirect_to location_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n @outcome_timepoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(outcome_timepoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @wait_time = WaitTime.find(params[:id])\n @wait_time.destroy\n\n respond_to do |format|\n format.html { redirect_to wait_times_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 @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to data_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_time = MemberTime.find(params[:id])\n @member_time.destroy\n\n respond_to do |format|\n format.html { redirect_to member_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allocated_time.destroy\n respond_to do |format|\n format.html { redirect_to allocated_times_url, notice: 'Allocated time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_punch.destroy\n respond_to do |format|\n format.html { redirect_to time_punches_url, notice: 'Time punch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_trip_info.destroy\n respond_to do |format|\n format.html { redirect_to business_trip_infos_url, notice: 'Business trip info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ecopoint.destroy\n respond_to do |format|\n format.html { redirect_to ecopoints_url, notice: 'Ecopoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n self.unuse_pto_hours\n @time_off_instance.destroy\n respond_to do |format|\n format.html { redirect_to time_off_instances_url, notice: 'Time off instance was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @check_point.destroy\n respond_to do |format|\n format.html { redirect_to check_points_url, notice: 'Check point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_point = MeetingPoint.find(params[:id])\n @meeting_point.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @showtime.destroy\n respond_to do |format|\n format.html { redirect_to showtimes_url, notice: \"Showtime was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meeting_time.destroy\n respond_to do |format|\n format.html { redirect_to meeting_times_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\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 destroy\n @time_clock.destroy\n respond_to do |format|\n format.html { redirect_to time_sheet_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_point = CollectionPoint.find(params[:id])\n @collection_point.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m_get_point = MGetPoint.find(params[:id])\n @m_get_point.destroy\n\n respond_to do |format|\n format.html { redirect_to m_get_points_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apartment_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to apartment_geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @points_transaction.destroy\n respond_to do |format|\n format.html { redirect_to points_transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n respond_to do |format|\r\n format.html { redirect_to way_points_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @trip_item = TripItem.find(params[:id])\n @trip_item.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @working_start_time.destroy\n respond_to do |format|\n format.html { redirect_to working_start_times_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selected_time.destroy\n respond_to do |format|\n format.html { redirect_to selected_times_url, notice: 'Selected time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @business_geopoint.destroy\n respond_to do |format|\n format.html { redirect_to business_geopoints_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 @getoff_info = GetoffInfo.find(params[:id])\n @getoff_info.destroy\n\n respond_to do |format|\n format.html { redirect_to getoff_infos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\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 @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_request.destroy\n respond_to do |format|\n format.html { redirect_to @back_path, notice: 'Travel request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_visitor = TimeVisitor.find(params[:id])\n @time_visitor.destroy\n\n respond_to do |format|\n format.html { redirect_to tour_visitor_time_visitors_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @time_record.destroy\n respond_to do |format|\n format.html { redirect_to time_records_url, notice: 'Time record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @punch_clock.destroy\n respond_to do |format|\n format.html { redirect_to punch_clocks_url, notice: t('punch_clocks.deleted_ok') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill_point = BillPoint.find(params[:id])\n @bill_point.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_points_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to @trip.parent || trips_url, change: 'trip' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip_waypoint.destroy\n respond_to do |format|\n format.html { redirect_to edit_partner_trip_path(@trip), notice: \"L'étape a été supprimée.\" }\n #format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n\n head :no_content\n end",
"def destroy\n @gf_travel_request.destroy\n respond_to do |format|\n format.html { redirect_to @back_path, notice: 'Grant funded travel request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cal_time.destroy\n respond_to do |format|\n format.html { redirect_to cal_times_url, notice: 'Cal time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geopoint = Geopoint.find(params[:id])\n @geopoint.destroy\n\n respond_to do |format|\n format.html { redirect_to geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tombstone_timehold.destroy\n respond_to do |format|\n format.html { redirect_to tombstone_timeholds_url, notice: 'Tombstone timehold was successfully destroyed.' }\n format.json { head :no_content }\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 @time_tracker.destroy\n respond_to do |format|\n format.html { redirect_to time_trackers_url, notice: 'Time tracker was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_point = RoutePoint.find(params[:id])\n @route_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n puts @iot_datum.count\n if @iot_datum.count > 0\n @deleted_rec = IotDatum.new\n @deleted_rec.workbench_number = @iot_datum.workbench_number\n @deleted_rec.part_number = @iot_datum.part_number\n @deleted_rec.target = @iot_datum.target\n @deleted_rec.lot_size = @iot_datum.lot_size\n @deleted_rec.employee_name = @iot_datum.employee_name\n @deleted_rec.shift = @iot_datum.shift\n @deleted_rec.device_id = @iot_datum.device_id\n @deleted_rec.count = @iot_datum.count\n @deleted_rec.status = 'Deleted'\n @deleted_rec.save!\n @iot_datum.destroy\n else\n @iot_datum.destroy\n end\n respond_to do |format|\n format.html { redirect_to iot_data_url, notice: 'Planner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tourpoint = Tourpoint.find(params[:id])\n @tourpoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(tourpoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @providers_opening_time.destroy\n respond_to do |format|\n format.html { redirect_to providers_opening_times_url, notice: 'Opening time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @access_point = AccessPoint.find(params[:id])\n @access_point.destroy\n\n respond_to do |format|\n format.html { redirect_to access_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n trip = Trip.find(params[:id])\n trip.destroy\n render json: {message: \"Successfully deleted trip\"}\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url, notice: 'Point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.71817905",
"0.6950857",
"0.68433964",
"0.6753407",
"0.6737451",
"0.6728959",
"0.67184174",
"0.6683086",
"0.6678557",
"0.6666907",
"0.66424465",
"0.66377705",
"0.66283524",
"0.6628253",
"0.6627046",
"0.66243964",
"0.66201854",
"0.6614446",
"0.66093975",
"0.6606172",
"0.65714794",
"0.65611017",
"0.6539529",
"0.65328276",
"0.6526191",
"0.652182",
"0.65214723",
"0.6520172",
"0.65117115",
"0.65117115",
"0.65117115",
"0.65097994",
"0.6501803",
"0.6498139",
"0.6497766",
"0.648317",
"0.6481393",
"0.64766526",
"0.64714384",
"0.64698917",
"0.64672065",
"0.64652586",
"0.64623326",
"0.64617586",
"0.6460003",
"0.6454846",
"0.64542097",
"0.6445669",
"0.6445669",
"0.6438518",
"0.6436443",
"0.6432294",
"0.6426616",
"0.64203614",
"0.64203614",
"0.64203614",
"0.642012",
"0.64194185",
"0.6417886",
"0.6416766",
"0.6414619",
"0.6413928",
"0.64136726",
"0.64123106",
"0.6411825",
"0.64086014",
"0.64086014",
"0.64063895",
"0.6406026",
"0.6393797",
"0.6388703",
"0.6385546",
"0.63848585",
"0.63822573",
"0.63808745",
"0.63794094",
"0.6375986",
"0.63756794",
"0.6369516",
"0.63689005",
"0.6368884",
"0.63614583",
"0.635492",
"0.6353176",
"0.6351304",
"0.6347669",
"0.63455397",
"0.6341539",
"0.6340502",
"0.63401914",
"0.63359886",
"0.6335295",
"0.63348836",
"0.6329423",
"0.63285613",
"0.6324108",
"0.63186675",
"0.63162124",
"0.6310891",
"0.6310891"
] |
0.7754922
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_pickup_point_time_detail
@pickup_point_time_detail = PickupPointTimeDetail.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 pickup_point_time_detail_params
#params[:pickup_point_time_detail]
params.require(:pickup_point_time_detail).permit(:route_id, :location_id, :pickup_route_start_time_id, :pickup_time)
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
|
=begin def start_date start_date end def rental_days rental_days end =end
|
def last_day
start_date + rental_days.days
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def day_calculations\n\t\t@prev_beg_range = @beg_range.to_date-1.day\n\t\t@prev_end_range = @beg_range.to_date-1.day\n\t\t@next_beg_range = @beg_range.to_date+1.day\n\t\t@next_end_range = @beg_range.to_date+1.day\n\tend",
"def estimated_end_date\n start_date + 12.days\n end",
"def number_of_days(rental)\n\tnumber_of_days = (rental.end_date - rental.start_date)\n\tnumber_of_days = number_of_days.to_i + 1\nend",
"def get_end_date\n \n \nend",
"def days\n 1 + (@end_date - @start_date).to_i\n end",
"def get_end_date\n end_date\n end",
"def pro_rated_days\n _date_begin = pro_rata_start_date\n _date_end = subscription_start_date\n if _date_begin.blank? || _date_end.blank?\n 0\n else\n ((_date_end - _date_begin) / 1.day).round(0).to_i # n days\n end\n end",
"def total_trip_days\n start_date = self.start_date\n end_date= self.end_date\n (end_date - start_date).to_i\n end",
"def estimated_end_date\n Date.today + remaining_days\n end",
"def determine_end_date\n self.end_date = start_date.next_month.yesterday\n end",
"def change_dates start_date, finish_date\n set_dates start_date, finish_date\n\n set_calendar\n end",
"def set_dates_and_duration\n if start_date && end_date && !duration\n self.duration = (end_date - start_date).to_i + 1 # if it's same date, duration should be 1\n elsif start_date && !end_date && duration\n self.end_date = start_date + (duration - 1).days\n elsif !start_date && end_date && duration\n self.start_date = end_date - (duration - 1).days\n end\n end",
"def end_date\n \"Calculate End Date\"\n end",
"def enrollment_dates\n if start_date\n \"#{start_date_formatted} - #{end_date_formatted}\"\n end\n end",
"def end_date\n self.start_date + self.length.month\n end",
"def date_end # originally date_start\n\tdate = Date.today\n\t(1..7).each do |n|\n\t\tdate = Date.today - n#.days\n\t\tbreak if date.wday == 6 # 0 = Sun, 1 = Mon ... 6 = Sat\n\tend\n\tdate\nend",
"def event_start_end_dates\n esdate and eedate\n end",
"def calculate_start_date\n if !@end_date.blank? && @data_amount > 0\n @start_date = @end_date - (@data_amount-1).month\n @start_date.end_of_month\n end\n end",
"def calcs_for_date_range(start_date, end_date, abandon_rate)\n puts \"\\tFrom #{start_date} to #{end_date} inclusive:\"\n\n total_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day\n ).count\n total_registrations_s = number_with_delimiter(total_registrations)\n puts \"\\tTotal registrations: #{total_registrations}, of which:\"\n\n assisted_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: \"full\"\n ).count\n assisted_digital_registrations_s = number_with_delimiter(assisted_digital_registrations)\n puts \"\\t... assisted digital: #{assisted_digital_registrations_s}\"\n\n fully_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: nil\n ).count\n fully_digital_registrations_s = number_with_delimiter(fully_digital_registrations)\n puts \"\\t... fully digital: #{fully_digital_registrations}\"\n\n delta = total_registrations - assisted_digital_registrations - fully_digital_registrations\n puts \"\\t(delta of #{delta} is due to some registrations not having metaData.route set)\" unless delta.zero?\n\n abandon_rate_s = number_to_percentage(100.0 * abandon_rate, precision: 0)\n non_abandon_rate_s = number_to_percentage(100.0 * (1 - abandon_rate), precision: 0)\n\n total_registrations_started = (total_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_s = number_with_delimiter(total_registrations_started.to_i)\n\n total_registrations_completed = fully_digital_registrations + assisted_digital_registrations + delta\n total_registrations_completed_s = number_with_delimiter(total_registrations_completed)\n\n total_registrations_started_online = (fully_digital_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_online_s = number_with_delimiter(total_registrations_started_online)\n\n total_registrations_abandoned = total_registrations_started - total_registrations_completed\n total_registrations_abandoned_s = number_with_delimiter(total_registrations_abandoned)\n\n puts \"\\tSo including abandoned attempts, estimated orders started = \" \\\n \"#{total_registrations_s} / (1 - #{abandon_rate_s}) = #{total_registrations_started_s}, of which: \"\n puts \"\\t... completed: #{total_registrations_completed_s}\"\n puts \"\\t... abandoned: #{total_registrations_abandoned_s}\"\n\n puts \"\\nSummary:\"\n puts \"\\t1. Total number of transactions started and completed online only: #{fully_digital_registrations_s}\"\n puts \"\\t2. Total number of transactions started online: ESTIMATED: #{total_registrations_started_online_s}\"\n puts \"\\t\\t(Estimated dropoff rate for the last 30 days: #{abandon_rate_s}\"\n puts \"\\t\\t so estimated completion (non-abandoned) rate for the last 30 days: #{non_abandon_rate_s}\"\n puts \"\\t\\t so given #{fully_digital_registrations_s} fully digital orders, \" \\\n \"estimated total orders started online = \" \\\n \"(#{fully_digital_registrations_s}/#{non_abandon_rate_s}) = #{total_registrations_started_online_s})\"\n puts \"\\t3. Number of online claims: #{fully_digital_registrations_s}\"\n puts \"\\t4. Total number of claims (online + offline + unknown): \" \\\n \"#{fully_digital_registrations_s} + #{assisted_digital_registrations_s} + \" \\\n \"#{delta} = #{total_registrations_completed_s}\"\n\n puts \"====================================================================================================\"\n end",
"def set_dates(start_date = nil, end_date = nil)\n\n\t if (start_date.nil? and not end_date.nil?)\n\n\t\t start_date = (@utils.get_date_object(end_date)) - (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s\n\n\t elsif (not start_date.nil? and end_date.nil?)\n\n\t\t end_date =(@utils.get_date_object(start_date)) + (MAX_HISTORICAL_DAYS * (24 * 60 * 60))\n\n\t\t if end_date > Time.new.utc\n\t\t\tend_date = nil #Let API default to Now.\n\t\t end\n\n\t\t @start_date = start_date.to_s\n\t\t @end_date = end_date.to_s if not end_date.nil?\n\n\t end\n end",
"def dates\n start_s = start_date ? start_date.to_s : '?'\n end_s = end_date ? end_date.to_s : '?'\n \"#{start_s} to #{end_s}\"\n end",
"def time_days() (@time_end.jd - @time_start.jd) + 1; end",
"def days_validation\n @start_cycle = @vote_setting.start_cycle.to_date \n @end_cycle = @vote_setting.end_cycle.to_date\n @days_count = (@end_cycle - @start_cycle).round\n end",
"def days_count\n (@end_date - @start_date).to_i\n end",
"def days_of_rent\n (1..(Rules.compute_rental_duration(@rental_data))).to_a\n end",
"def lead_days\n 0\n end",
"def dates\n end",
"def more_advanced_date\n @end_date || @start_date || nil\n end",
"def effective_end_datetime\n end_date + 1.day + roster.switchover.minutes\n end",
"def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end",
"def choose_dates\n authorize! :choose_dates, :Reservation\n\n if(session[:rental_category_id].nil?)\n redirect_to shopping_path\n end\n\n @start_date = Date.today.next_month.beginning_of_month\n\n # pick_up_dates is the first full week of next month starting from the first weekday\n @pick_up_start_date = @start_date\n @pick_up_start_date += 1.days until @pick_up_start_date.wday == 1 # wday 1 is monday, etc.\n @pick_up_dates = @pick_up_start_date..(@pick_up_start_date + 5.days)\n\n # return_dates is the last full week of next month ending on the last weekday\n @return_end_date = Date.today.next_month.end_of_month\n @return_end_date -= 1.days until @return_end_date.wday == 1 # wday 1 is monday, etc.\n @return_dates = (@return_end_date)..(@return_end_date + 5.days)\n @end_date = @return_dates.last\n end",
"def setup_range(date)\n diff = date.wday - self.class.windex(start_wday)\n @first = date - (diff + ((diff < 0) ? DAYS : 0))\n @last = @first + DAYS - 1\n end",
"def range\n (start_date...end_date) #exclusive date range\n end",
"def gen_reps(start_date = Date.current,\n end_date = Date.current.advance(:weeks => 1), period = 1)\n\n # must be the rep_parent\n if !self.rep_parent.nil?\n self.rep_parent.gen_reps(start_date, end_date, period)\n return\n end\n\n # check dates are dates\n if !start_date.is_a?(Date) or !end_date.is_a?(Date)\n puts \"start_date and end_date must be dates\"\n return\n end\n\n # make sure start before end\n if start_date > end_date\n puts \"start_date after end_date\"\n return\n end\n\n #check each day in date range\n date_range = start_date..end_date\n date_range.each do |date|\n if is_repeated_day(date)\n new_act = self.dup\n new_act.show_date = date\n if period != NO_EXPIRATION\n new_act.expiration_date = \n date.advance(:days => period)\n end\n new_act.parent_id = nil\n new_act.save!\n self.repititions << new_act\n end\n end\n end",
"def end_date\n return (start and duration_days and duration_hours) ? (start + duration_days.days + duration_hours.hours) : nil\n end",
"def booked_date_range\n { from: :start_date, to: :end_date }\n end",
"def lead_days\n 1\n end",
"def lead_days\n 1\n end",
"def lead_days\n 1\n end",
"def lead_days\n 1\n end",
"def days\n # +1 because end_date is included in the duration range\n ((end_date - start_date) / 3600 / 24).to_i + 1\n end",
"def calculate_dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n end",
"def aoc_dates\n \"#{start_date.strftime('%d de %b')} al #{end_date.strftime('%d de %b')} de #{end_date.strftime('%Y')}\"\n end",
"def effective_age_calculation_base_date\n age_calculation_base_date || start_date\n end",
"def calculate_days\n\n data = BookingDataSystem::Booking.calculate_days(@date_from, @time_from, @date_to, @time_to)\n\n @days = data[:days]\n @date_to_price_calculation = data[:date_to_price_calculation]\n unless data[:valid]\n @valid = data[:valid]\n @error = data[:error]\n end\n\n end",
"def total\n number_of_days_rental = end_date - start_date\n daily_rate = car_category.daily_price\n\n number_of_days_rental * daily_rate\n end",
"def due_by\n #occurring_days = ae_definition.occurring_days\n dob = profile.kids_type.birthdate.to_date\n dob + (ae_definition.occurring_days + ae_definition.due_by_days )\n end",
"def end_time\n\t\tstart + 1.day\n\tend",
"def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend",
"def rent_params\n params.require(:rent).permit(:begin_date, :final_date)\n end",
"def check_rest_days\n\n\t\temp=Employee.find(employee_id)\n\t\tcalendar=Calendar.where(:department_id => emp.department_id,:anio => Date.parse(desde.to_s).year.to_i).first\n if !calendar.nil?\n\n \t\tdias_requested=weekdays_in_date_range(desde..hasta,calendar)\n \t\trt=RequestType.find(request_type_id)\n \t\tdias=0\n \t\t#get all requests from employee\n requests=Request.joins(:request_type).where(:employee_id => employee_id,status: [1,2],:request_type_id => request_type_id).where('extract(year from desde)= ?',\"#{desde.year.to_i}\")\n\n \t #working days requested.\n \t requests.each do |rq| \n \t dias+=weekdays_in_date_range(rq.desde..rq.hasta,calendar)\n \t end\n\n \t #get rest days\n \t num_dias_max=Request.rest_days(desde.year.to_i,employee_id,rt.num_dias_max)\n\n \t if dias_requested>(num_dias_max-dias)\n \t errors.add(:desde,\"Debe seleccionar un periodo igual o inferior a los días restantes. (#{(num_dias_max-dias)} dias)\")\n \t end\n end\n\tend",
"def number_of_days\n return ( end_date - start_date ).to_i\n end",
"def days(from_date = first_day.date, to_date = last_day.date)\n from_date = Date.new(2017, 1, 1)\n to_date = Date.new(2017, 12, 31)\n\n @days ||= workdays.select { |day| day.hours > 0 && (from_date..to_date).include?(day.date) }\n end",
"def tenders_ultimate(start, num, day)\n\nend",
"def makeDays\n\t\thowManyDaysAgo = (rand()*CONFERENCE_START).round(0)+18\n\t\tlengthDays = (rand()*CONFERENCE_DAYS_MAX_DIFF).round() + CONFERENCE_DAYS_BASIC\n\t\t@startDate = (Date.today-howManyDaysAgo)\n\t\t@endDate = (Date.today-howManyDaysAgo+lengthDays)\n\t\t# That's the end of fields you want to print\t\n\t\t@days = Array.new\n\t\t(howManyDaysAgo-lengthDays..howManyDaysAgo).each{|x| @days << (CDay.new((Date.today-x), self))\t}\n\t\t@days.reverse! # If we want them in correct order\n\t\t# Discounts, some weird stuff may happen here, like functional programming\n\t\t@discounts = Array.new\n\t\tdays = DISCOUNT_DAYS.map{|x| x+((rand()-0.5)*DISCOUNT_DAYS_MAX_DIFF).round(0)}\n\t\tammounts = DISCOUNT_AMMOUNTS.map{|x| x+((rand()-0.5)*DISCOUNT_AMMOUNTS_MAX_DIFF).round(2)}\n\t\t(0..2).each{|x| @discounts << Discount.new(((@startDate)-days[x].to_i-1), ((@startDate)-days[x+1].to_i), self, ammounts[x])}\n\tend",
"def calculate_end_date(start_date, end_date)\n end_date_from_start_date = start_date + 3.years\n\n return end_date_from_start_date if end_date.nil?\n\n end_date < end_date_from_start_date ? end_date : end_date_from_start_date\n end",
"def end_date\n Date.new(date.year, 12, 31)\n end",
"def set_start_end_dates\n # If the task is a schedule/appointment type then we need to set the start\n #+ and end time for it. We save them in the same fields start_date,\n #+ end_date. The start_time and end_time fields are deprecated and they \n #+ are used as place holders in form. They will be removed from table\n #+ definition.\n # Database migration and rake task is there to change field type for\n #+ start/end date. Now storing time and date in same fields.\n if self.category.eql?(\"appointment\")\n self.start_date = self.start_date_appointment unless self.start_date_appointment.blank?\n self.end_date = self.end_date_appointment unless self.end_date_appointment.blank? \n=begin\n if false && start_date && end_date\n sd = start_date.utc\n ed = end_date.utc\n st = start_time #.in_time_zone\n et = end_time \n p sd, ed, st, et\n self.start_date = DateTime.new(sd.year, sd.month, sd.day, st.hour, st.min, st.sec).utc\n self.end_date = DateTime.new(ed.year, ed.month, ed.day, et.hour, et.min, et.sec) \n p start_date\n p end_date\n end\n=end\n else\n #self.start_date = self.end_date_todo unless self.end_date_todo.blank? #self.start_date_todo unless self.start_date_todo.blank?\n self.start_date = self.start_date_todo unless self.start_date_todo.blank?\n self.end_date = self.end_date_todo unless self.end_date_todo.blank?\n end\n end",
"def handle_date\n today = DateTime.now.beginning_of_day.to_date\n @max_end = today + 400.days\n @inv_start = today\n @master_rates_start = today\n @agoda_rates_start = today\n @expedia_rates_start = today\n @bookingcom_rates_start = today\n @gta_travel_rates_start = today\n @orbitz_rates_start = today\n @ctrip_rates_start = today\n\n begin\n # set the date in inventory table\n @inv_start = Date.strptime(params[:inv_start]) unless params[:inv_start].blank?\n @inv_start = today if @inv_start < today\n @inv_start = @max_end if @inv_start > @max_end\n\n # set the date in master rate table\n @master_rates_start = Date.strptime(params[:master_rates_start]) unless params[:master_rates_start].blank?\n @master_rates_start = today if @master_rates_start < today\n @master_rates_start = @max_end if @master_rates_start > @max_end\n\n # set the date in agoda rates table\n @agoda_rates_start = Date.strptime(params[:agoda_rates_start]) unless params[:agoda_rates_start].blank?\n @agoda_rates_start = today if @agoda_rates_start < today\n @agoda_rates_start = @max_end if @agoda_rates_start > @max_end\n\n # set the date in expedia rates table\n @expedia_rates_start = Date.strptime(params[:expedia_rates_start]) unless params[:expedia_rates_start].blank?\n @expedia_rates_start = today if @expedia_rates_start < today\n @expedia_rates_start = @max_end if @expedia_rates_start > @max_end\n\n # set the date in booking.com table\n @bookingcom_rates_start = Date.strptime(params[:bookingcom_rates_start]) unless params[:bookingcom_rates_start].blank?\n @bookingcom_rates_start = today if @bookingcom_rates_start < today\n @bookingcom_rates_start = @max_end if @bookingcom_rates_start > @max_end\n\n # set the date in gta travel\n @gta_travel_rates_start = Date.strptime(params[:gta_travel_rates_start]) unless params[:gta_travel_rates_start].blank?\n @gta_travel_rates_start = today if @gta_travel_rates_start < today\n @gta_travel_rates_start = @max_end if @gta_travel_rates_start > @max_end\n\n # set the date in orbitz\n @orbitz_rates_start = Date.strptime(params[:orbitz_rates_start]) unless params[:orbitz_rates_start].blank?\n @orbitz_rates_start = today if @orbitz_rates_start < today\n @orbitz_rates_start = @max_end if @orbitz_rates_start > @max_end\n\n # set the date in ctrip\n @ctrip_rates_start = Date.strptime(params[:ctrip_rates_start]) unless params[:ctrip_rates_start].blank?\n @ctrip_rates_start = today if @ctrip_rates_start < today\n @ctrip_rates_start = @max_end if @ctrip_rates_start > @max_end\n \n rescue => ex\n flash[:alert] = ex.message\n end\n end",
"def return_days=(days)\n \tself.return_date = Date.today + days.to_i\n end",
"def stop_date\n\t\t#return Date.new(y=year+1, m=START_MONTH, d=START_DAY) - 1\n\t\treturn start_date.next_year.prev_day()\n\tend",
"def declare_beg_range\n\t\t@beg_range = @beg_range.to_date \n\t\t@end_range = @end_range.to_date \n\tend",
"def end_date\n return ends if support_deal.nil?\n self.ends ||= support_deal.end_date\n return support_deal.end_date < ends ? support_deal.end_date : ends\n end",
"def date_payroll\n\t\treturn created_at,init_date,end_date,fortnight\n\tend",
"def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkassetdepreciation][:period_type]\n\t\tperiod = session[:wkassetdepreciation][:period]\n\t\tfromdate = session[:wkassetdepreciation][:from]\n\t\ttodate = session[:wkassetdepreciation][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend",
"def set_defaults\n @start_date = Date.today - 2.weeks\n @end_date = Date.today\n end",
"def end_date\n @end_date ||= Date.new()\n end",
"def report_range(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n end",
"def date_range\n @date_range ||= start_at..end_at\n end",
"def w_day; end",
"def book_sales(period='enddate', basis, exclude)\n royalty_period = Period.where([\"currentperiod = ? and client_id = ?\", true, self.client_id])\n if period == 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, royalty_period.first.startdate, basis, exclude)\n else #if period isn't 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, \"1900-01-01\", basis, exclude)\n end\n end",
"def end_date\n Date.new((@number + 1), 1, 1).tuesday? ? Date.new((@number + 1), 1, 1) : Date.new(@number, 12, 31)\n end",
"def show\n @begin_date = Date.today - 5\n @end_date = Date.today + 5\n end",
"def revenue(date)\n end",
"def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkattendance][:period_type]\n\t\tperiod = session[:wkattendance][:period]\n\t\tfromdate = session[:wkattendance][:from]\n\t\ttodate = session[:wkattendance][:to]\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t when 'today'\n\t\t\t@from = @to = Date.today\n\t\t when 'yesterday'\n\t\t\t@from = @to = Date.today - 1\n\t\t when 'current_week'\n\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t@to = Date.today #@from + 6\n\t\t when 'last_week'\n\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t@to = @from + 6\n\t\t when '7_days'\n\t\t\t@from = Date.today - 7\n\t\t\t@to = Date.today\n\t\t when 'current_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = Date.today #(@from >> 1) - 1\n\t\t when 'last_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t@to = (@from >> 1) - 1\n\t\t when '30_days'\n\t\t\t@from = Date.today - 30\n\t\t\t@to = Date.today\n\t\t when 'current_year'\n\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t@to = Date.today #Date.civil(Date.today.year, 12, 31)\n\t\t end\n\t\t#elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = Date.today #(@from >> 1) - 1\n\t\tend \n\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend",
"def start_date\n @start_date ||= Date.today - Date.today.wday - 7 * 52\nend",
"def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end",
"def rents_params\n params.require(:rent).permit(:item_id, :beg_date, :end_date)\n end",
"def getEndDate\r\n\t\t\t\t\treturn @endDate\r\n\t\t\t\tend",
"def day_end\n\t\tself.at_beginning_of_day + 86399.999999\n\tend",
"def add_to_dates(start_date, end_date, new_occupancy)\n current_date = start_date.dup\n \n until current_date == end_date\n date_obj = find_date(current_date)\n \n if date_obj \n date_obj.add_occupancy(new_occupancy)\n else\n new_date_obj = Hotel::Date.new(current_date)\n @dates << new_date_obj\n new_date_obj.add_occupancy(new_occupancy)\n end\n \n current_date += 1\n end\n end",
"def determine_date\n if !params[:date_start].blank? && !params[:date_end].blank?\n @date_start = params[:date_start]\n @date_end = params[:date_end]\n else\n determine_date_now\n end\n end",
"def calculate(from_date, to_date)\n calendar_days_between(from_date, to_date)\n end",
"def init_days\n (start_time.to_date..end_time.to_date).each do |t|\n Day.create date: t, availability: self.aasm_state, boat: boat, booking: self\n end\n end",
"def setup_transaction_dates_step\n @lbtt_return.effective_date = @lbtt_return.effective_date&.to_date\n @lbtt_return.relevant_date = @lbtt_return.relevant_date&.to_date\n @lbtt_return.contract_date = @lbtt_return.contract_date&.to_date\n convert_lease_transaction_date\n end",
"def get_difference_days start_date, end_date\n days_difference = (((end_date.to_time - start_date.to_time) / 1.days ).round(2) - 1)\n days_difference *= -1 if days_difference < 0\n return days_difference\n end",
"def span\n ((end_date - start_date)*Numeric::DAYS).to_f\n end",
"def visa_date_overstay_days\n return nil unless exit_date\n return 0 unless visa_date_overstay?\n visa = schengen_visa\n return no_days unless visa\n exit_date <= visa.end_date ? 0 : exit_date - visa.end_date\n end",
"def initialize(end_date, data_amount)\n @end_date = end_date\n @data_amount = data_amount\n calculate_start_date\n end",
"def nights\n (end_date - start_date).to_i\n end",
"def day() end",
"def calorie_sum_by_day\n\n end",
"def workdays(calendar = Spok.default_calendar)\n (@start_date..@end_date).to_a.delete_if{ |date| Workday.restday?(date, calendar: calendar) }\n end",
"def calc_business_days_for_range(start_date, end_date)\n total = 0\n return total if start_date.blank? or end_date.blank?\n (start_date..end_date).each do |date|\n total += 1 unless date.saturday? or date.sunday? or \n date.thanksgiving? or date.labor_day? or date.memorial_day? or\n date.christmas? or date.christmas_eve? or date.independence_day? or\n date.black_friday? or date.new_years_day?\n end\n return total\n end",
"def query_user_for_date_range\n start_date = nil\n end_date = nil\n\n puts \"\\nFirst, we need a start date.\"\n start_date = query_user_for_date\n\n puts \"\\nNext, we need an end date.\"\n end_date = query_user_for_date\n\n return start_date, end_date\nend",
"def date_calc(start,day_start,day_duration,round)\n time=start;schedule=[]\n round.size.times do |r|\n#print day_start+day_duration;print \"\\n\"\n if time >= day_start + day_duration\n#print time;print \"\\n\"\n time=day_start+1.day\n day_start = time\n end\n schedule[r] = time\n time+=HEAT_INTERVAL\n end\n\n return schedule\n end",
"def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else\n @start_date = @today\n until @start_date.strftime(\"%a\") == \"Mon\"\n @start_date -= 1\n end\n end\n @end_date = @start_date+21\n @date_range = (@start_date..@end_date)\n @weeks = @date_range.to_a.in_groups_of(3)\n\n\n end",
"def start_date\n date\n end",
"def length\n end_date.days_from(start_date).to_i\n end",
"def date_range(past_day=nil, past_month=nil, past_year=nil, future_day=nil, future_month=nil,future_year=nil)\n if (past_day != nil || past_month != nil || past_year != nil) && (future_day != nil || future_month != nil || future_year != nil)\n start_date = get_date(past_day,past_month,past_year,-1)\n end_date = get_date(future_day,future_month,future_year, 1)\n elsif past_day == nil && past_month == nil && past_year == nil && future_day == nil && future_month == nil && future_year == nil\n start_date = get_date(nil,nil,nil,0)\n end_date = get_date(nil,nil,nil,0)\n elsif (past_day == nil && past_month == nil && past_year == nil) && (future_day != nil || future_month != nil || future_year != nil)\n start_date = get_date(nil,nil,nil,0)\n end_date = get_date(future_day,future_month,future_year,1)\n elsif (past_day != nil || past_month != nil || past_year == nil) && (future_day == nil && future_month == nil && future_year == nil)\n start_date = get_date(past_day,past_month,past_year, -1)\n end_date = get_date(nil,nil,nil,0)\n else\n fail(\"Invalid Argument Passed to date range method. Please enter correct arguments\")\n end\n return start_date,end_date\nend"
] |
[
"0.688894",
"0.6758236",
"0.6753731",
"0.666843",
"0.655105",
"0.6413499",
"0.6404946",
"0.63953614",
"0.63264555",
"0.6317546",
"0.63113",
"0.630452",
"0.6297992",
"0.62641895",
"0.6260592",
"0.624658",
"0.6229436",
"0.6225248",
"0.6224174",
"0.62112546",
"0.62010264",
"0.6198034",
"0.6193333",
"0.6190048",
"0.61867595",
"0.6168499",
"0.61628574",
"0.6143837",
"0.61352706",
"0.6121248",
"0.61077917",
"0.6105694",
"0.6102332",
"0.60940564",
"0.6092876",
"0.60635936",
"0.6059429",
"0.6059429",
"0.6059429",
"0.6059429",
"0.6044445",
"0.6039866",
"0.60345554",
"0.60301983",
"0.60144466",
"0.60130805",
"0.59976655",
"0.5986226",
"0.59825027",
"0.59742147",
"0.5972857",
"0.59652835",
"0.5958388",
"0.59559286",
"0.59513855",
"0.5941731",
"0.5933671",
"0.59336495",
"0.59283185",
"0.5923885",
"0.59182084",
"0.59168124",
"0.59100777",
"0.59095633",
"0.59076804",
"0.5888173",
"0.587356",
"0.5864168",
"0.5863258",
"0.5862219",
"0.5848381",
"0.58439183",
"0.5841368",
"0.5833263",
"0.58288187",
"0.5825847",
"0.58200425",
"0.5819519",
"0.5815572",
"0.5812941",
"0.58121544",
"0.5810182",
"0.5807508",
"0.5806383",
"0.5793186",
"0.57896304",
"0.5789412",
"0.5784707",
"0.57833225",
"0.57788235",
"0.5773459",
"0.57723784",
"0.57681644",
"0.576045",
"0.57446235",
"0.5743952",
"0.5740158",
"0.5738771",
"0.57326657",
"0.5716728"
] |
0.7659485
|
0
|
Remove writability checks in the install script. Homebrew checks that its install targets are writable, or fails with appropriate messaging if not. The check that luarocks does has been seen to have false positives, so remove it. TODO: better document the false positive cases, or remove this patch.
|
def patches
DATA
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shouldUseSudo(localOption, warnIfMismatch = true)\n if localOption\n\n unless DoSudoInstalls\n\n if warnIfMismatch\n\n warning \"Sudo is globally disabled, but a command should be ran as sudo.\\n\" \\\n 'If something breaks please rerun with sudo allowed.'\n end\n\n return false\n\n end\n\n return true\n\n end\n\n false\nend",
"def disable_homebrew\n return unless (config[:os] == 'osx')\n sh.cmd \"curl -fsSOL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh\"\n sh.cmd \"sudo /bin/bash uninstall.sh --force\"\n sh.cmd \"rm uninstall.sh\"\n sh.cmd \"hash -r\"\n sh.cmd \"git config --global --unset protocol.version || true\"\n end",
"def need_sudo?(dirs)\n dirs.each do |name|\n dir = install_dir(File.expand_path(name))\n\n until dir == \"/\"\n if File.directory? dir\n return true unless File.writable? dir\n break\n end\n\n dir = File.dirname dir\n end\n end\n\n return false\nend",
"def homebrew!()\n abort(\"Runtime error: Homebrew is required. Please start via `#{bin} ...`\") unless defined?(HOMEBREW_LIBRARY_PATH)\n %w[fileutils pathname tempfile formula utils].each { |req| require(req) }\n extend(FileUtils)\n end",
"def validate_is_writable\n errors.add_on_empty 'is_writable'\n end",
"def fix_permissions\n unless RUBY_PLATFORM =~ /mswin32/\n message \"Making scripts executable\"\n chmod 0555, File.join(install_directory,'public','dispatch.fcgi')\n chmod 0555, File.join(install_directory,'public','dispatch.cgi')\n chmod 0555, Dir[File.join(install_directory,'script','*')]\n end\n end",
"def hypothetically_writable?\n writable_real? || (!exists? && !root? && parent.hypothetically_writable?)\n end",
"def validate_permissions\n return if Gem.win_platform?\n\n @specification.files.each do |file|\n next unless File.file?(file)\n next if File.stat(file).mode & 0444 == 0444\n warning \"#{file} is not world-readable\"\n end\n\n @specification.executables.each do |name|\n exec = File.join @specification.bindir, name\n next unless File.file?(exec)\n next if File.stat(exec).executable?\n warning \"#{exec} is not executable\"\n end\n end",
"def checkpermissions()\n unless File.stat('/etc/hosts').writable?\n # We found it, log error and exit successfully\n @log.error('Can not write to /etc, missing required permissions.')\n abort('Can not write to /etc, are you root?')\n end\n end",
"def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n # Otherwise we check that the system supplied python will be sufficient\n check_system_python\n end\n end",
"def should_do_python_install?\n return (osx? and (not (File.exists?(python_directory))))\n end",
"def reinstall formula\n # Add the used_options for each named formula separately so\n # that the options apply to the right formula.\n ARGV.replace(@clean_ARGV)\n ARGV << formula.name\n tab = Tab.for_name(formula.name)\n tab.used_options.each { |option| ARGV << option.to_s }\n if tab.built_as_bottle and not tab.poured_from_bottle\n ARGV << '--build-bottle'\n end\n\n begin\n oh1 \"Reinstalling #{formula} #{ARGV.options_only*' '}\"\n opt_link = formula.opt_prefix\n if opt_link.exist?\n keg = Keg.new(opt_link.realpath)\n backup keg\n end\n Homebrew.install_formula formula\n rescue Exception\n ignore_interrupts { restore_backup(keg, formula) }\n raise\n else\n backup_path(keg).rmtree if backup_path(keg).exist?\n end\nend",
"def install_to_directory\n # Get the current directory\n curr_dir = FileUtils::pwd + '/'\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Tell the user\n puts \"Installing the files to \".green + $install_dir.yellow\n puts \" (Keeping the .rb extensions) \".green if $keep_extensions\n\n # Go through the files\n files = ['deleteemailalias.rb','addemailalias.rb','listemailaliases.rb',\n 'deleteemaildomain.rb','addemaildomain.rb','deleteemailaccount.rb',\n 'listemailaccounts.rb','addemailaccount.rb','generate_password.rb']\n files.each { |f|\n # Remove the extenstion (unless we should keep it)\n nf = $keep_extensions ? f : f[0..-4]\n\n # Tell the user\n puts \"> Linking \".green + \"#{curr_dir}#{f}\".yellow + ' to '.green + \"#{$install_dir}#{nf}\".yellow\n\n if $force_install\n puts \"Forcing the install of #{nf}!\".red\n # Link the file\n fu.ln_sf curr_dir + f, $install_dir + nf\n else\n begin\n # Link the file\n fu.ln_s curr_dir + f, $install_dir + nf\n rescue Exception => e\n puts \"Couldn't link the file:\".pink\n puts e.message.red\n next\n end\n end\n\n puts \"> Adding 'execute permission' to the file\".green\n # adding \"execute permission\"\n fu.chmod \"a+x\", $install_dir + nf\n }\n\nend",
"def perform_post_install_actions\n run_plugins_post_install_hooks\n warn_for_deprecations\n warn_for_installed_script_phases\n warn_for_removing_git_master_specs_repo\n print_post_install_message\n end",
"def writable?() end",
"def chmod_unauthorized_error(args)\n return false unless MANDATORY_DIRS.any? do |md|\n args.include?(\"'#{md}'\")\n end\n\n puts \"Tu n'as pas l'autorisation de modifier les droits de ce dossier.\".red\n true\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n # Remove unrecognized options if warned by configure\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--disable-macos-framework\", # as this is hardcoded to write to protected /library\n \"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\" # if this fails, try separate make/make install steps\n end",
"def install\n # Now the sources (from `url`) are downloaded, hash-checked and\n # Homebrew has changed into a temporary directory where the\n # archive has been unpacked or the repository has been cloned.\n\n # For Cmake, we have some necessary defaults in `std_cmake_args`:\n mkdir \"build\" do\n system \"cmake\", \"..\", *std_cmake_args\n system \"cmake\", \".\"\n system \"make\", \"install\"\n end\n\n\n # If the arguments given to configure (or make or cmake) are depending\n # on options defined above, we usually make a list first and then\n # use the `args << if <condition>` to append to:\n# args = \"-DCMAKE_BUILD_TYPE:STRING=RELEASE\"\n\n # The `build.with?` and `build.without?` are smart enough to do the\n # right thing with respect to defaults defined via `:optional` and\n # `:recommended` dependencies.\n\n # If you need to give the path to lib/include of another brewed formula\n # please use the `opt_prefix` instead of the `prefix` of that other\n # formula. The reasoning behind this is that `prefix` has the exact\n # version number and if you update that other formula, things might\n # break if they remember that exact path. In contrast to that, the\n # `$(brew --prefix)/opt/formula` is the same path for all future\n # versions of the formula!\n\n # A general note: The commands here are executed line by line, so if\n # you change some variable or call a method like ENV.deparallelize, it\n # only affects the lines after that command.\n\n\n # We are in a temporary directory and don't have to care about cleanup.\n\n # Instead of `system \"cp\"` or something, call `install` on the Pathname\n # objects as they are smarter with respect to correcting access rights.\n # (`install` is a Homebrew mixin into Ruby's Pathname)\n\n # Additional downloads can be defined as resources (see above).\n # The stage method will create a temporary directory and yield\n # to a block.\n #resource(\"additional_files\").stage { bin.install \"my/extra/tool\" }\n\n # `name` and `version` are accessible too, if you need them.\n end",
"def installable?\n uninstallable_reasons.empty?\n end",
"def fix_ownership\n return if Process.uid != 0\n begin\n uid = Etc.getpwnam(\"bixby\").uid\n gid = Etc.getgrnam(\"bixby\").gid\n # user/group exists, chown\n File.chown(uid, gid, Bixby.path(\"var\"), Bixby.path(\"etc\"))\n rescue ArgumentError\n end\n end",
"def make_certs_world_readable\n FileUtils.chmod(0644, [root_filename, cert_filename].compact)\n end",
"def install\n # If we're installing from the repo, then use GNU autotools to make\n # the ./configure script. Note that libtool is often installed with\n # a 'g' prefix by homebrew.\n if build.head?\n mkdir \"m4\"\n system \"autoreconf\", \"-i\"\n end\n\n # Set up CXXFLAGS\n if build.with? \"no-range-check\"\n if build.with? \"fast-test\"\n if build.with? \"python\"\n # no-range-check, fast-test, python\n ENV[\"CXXFLAGS\"] = \"-DO2SCL_NO_RANGE_CHECK -DO2SCL_FAST_TEST -I/usr/local/lib/python3.11/site-packages/numpy/core/include -I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11\"\n system \"echo\", \"e1\"\n else # else for if python\n # no-range-check, fast-test, no python\n ENV[\"CXXFLAGS\"] = \"-DO2SCL_NO_RANGE_CHECK -DO2SCL_FAST_TEST\"\n system \"echo\", \"e2\"\n end # end of if python\n else # else for fast-test\n if build.with? \"python\"\n # no-range-check, no fast-test, python\n ENV[\"CXXFLAGS\"] = \"-DO2SCL_NO_RANGE_CHECK -I/usr/local/lib/python3.11/site-packages/numpy/core/include -I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11\"\n system \"echo\", \"e3\"\n else # else for if python\n # no-range-check, no fast-test, no python\n ENV[\"CXXFLAGS\"] = \"-DO2SCL_NO_RANGE_CHECK\"\n system \"echo\", \"e4\"\n end # end of if python\n end # end of if fast-test\n else # else for if no-range-check\n if build.with? \"fast-test\"\n if build.with? \"python\"\n # with range-check, fast-test, python\n ENV[\"CXXFLAGS\"] = \"-DO2SCL_FAST_TEST -I/usr/local/lib/python3.11/site-packages/numpy/core/include -I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11\"\n system \"echo\", \"e5\"\n else # else for python\n # with range-check, fast-test, no python\n ENV[\"CXXFLAGS\"] = \"-DO2SCL_FAST_TEST\"\n system \"echo\", \"e6\"\n end # end of if python\n else # else for fast-test\n if build.with? \"python\"\n # with range-check, no fast-test, python\n ENV[\"CXXFLAGS\"] = \"-I/usr/local/lib/python3.11/site-packages/numpy/core/include -I/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11\"\n system \"echo\", \"e7\"\n else\n # with range-check, no fast-test, no python\n ENV[\"CXXFLAGS\"] = \"\"\n system \"echo\", \"e8\"\n end # end of if python\n end # end of if fast-test\n end # end of if no-range-check\n\n # ------------------------------------------------------------\n # Set up ./configure script\n \n if build.with? \"armadillo\"\n if build.with? \"eigen\"\n if build.with? \"openmp\"\n if build.with? \"python\"\n # armadillo, eigen, openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\", \"--enable-eigen\",\n \"--enable-python\",\"--enable-openmp\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n else\n # armadillo, eigen, openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\", \"--enable-eigen\",\n \"--enable-openmp\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n end\n else\n if build.with? \"python\"\n # armadillo, eigen, no openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\", \"--enable-eigen\",\n \"--enable-python\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n else\n # armadillo, eigen, no openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\", \"--enable-eigen\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n end\n end\n else \n if build.with? \"openmp\"\n if build.with? \"python\"\n # armadillo, no eigen, openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\",\n \"--enable-python\",\n \"--enable-openmp\",\"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n else\n # armadillo, no eigen, openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\",\n \"--enable-openmp\",\"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n end\n else\n if build.with? \"python\"\n # armadillo, no eigen, no openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\",\n \"--enable-python\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n else\n # armadillo, no eigen, no openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-armadillo\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n end\n end\n end\n else\n if build.with? \"eigen\"\n if build.with? \"openmp\"\n if build.with? \"python\"\n # no armadillo, eigen, openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-eigen\",\n \"--enable-python\",\n \"--enable-openmp\",\"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n else\n # no armadillo, eigen, openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-eigen\",\n \"--enable-openmp\",\"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n end\n else\n if build.with? \"python\"\n # no armadillo, eigen, no openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-python\",\n \"--enable-eigen\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n else\n # no armadillo, eigen, no openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-eigen\",\n \"--disable-silent-rules\",\"--prefix=#{prefix}\"\n end\n end\n else\n if build.with? \"openmp\"\n if build.with? \"python\"\n # no armadillo, no eigen, openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--enable-python\",\n \"--enable-openmp\",\"--prefix=#{prefix}\"\n else\n # no armadillo, no eigen, openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--enable-openmp\",\"--prefix=#{prefix}\"\n end\n else\n if build.with? \"python\"\n # no armadillo, no eigen, no openmp, python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--enable-python\",\n \"--prefix=#{prefix}\"\n else\n # no armadillo, no eigen, no openmp, no python\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n end\n end\n end\n end\n \n #\n # If there's no documentation, just add some blank files so\n # that the install target succeeds.\n #\n if build.head?\n system \"make\", \"blank-doc\"\n end\n \n #\n # Unfortunately if we do 'make' and then 'make install', it fails\n # to build acol properly (e.g. on antares), so we just do 'make\n # install'.\n #\n # 2/24/17: Actually this most recent time it worked better\n # with 'make' and 'make install' on antares, so I leave it\n # this way for now. Alternatively, there is an LDFLAGS\n # setting above which I can try if I'm still having problems.\n #\n # 9/28/17: I'm having problems with acol again on mimosa,\n # so I just do 'make install'\n\n ENV.deparallelize\n \n #system \"make\"\n system \"make\", \"install\"\n\n #\n # FIXME: should document why this is necessary\n #\n if build.with? \"check\"\n system \"make\", \"check\"\n end\n if build.with? \"examples\"\n system \"make\", \"o2scl-examples\"\n end\n include.install Dir[\"include/o2scl/*.h\"]\n if build.with? \"examples\"\n share.install Dir[\"examples/ex*.cpp\"]\n end\n end",
"def pretend_links_do_not_exist\n test_mode && remove_old_links\n end",
"def check_writable(path)\n raise Error, \"The path '#{path}' is not writable\" if (path.exist? && !path.writable?) || !path.parent.writable?\n end",
"def warnings?\n !gem?(\"shelly-dependencies\")\n end",
"def warn(*args)\n # eliminate ruby/gem warnings from output\nend",
"def warnings?\n !gem?(\"shelly-dependencies\") || gem?(\"shelly\")\n end",
"def post_install\n rm_f Dir[\"#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/scipy/**/*.pyc\"]\n end",
"def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end",
"def check_for_libraries; end",
"def patch_nokogiri\n rm_rf \"deps.rip\"\n end",
"def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"def clean!\n clean_installation if !local?\n end",
"def should_do_requirements_install\n if has_python_requirements\n if not install_date('pythonenv')\n # We've never done an install from requirements.txt before\n return true\n else\n return (requirements_edit_date > install_date('pythonenv'))\n end\n else\n return false\n end\n end",
"def clean_pod_sources\n return unless installation_options.clean?\n return if installed_specs.empty?\n pod_installers.each(&:clean!)\n end",
"def notify_writable\n logdebug \"notify_writable\", :state => @state\n notify_writable = false # disable it now. if we still need it, we'll renabled it.\n case @state\n when :initialized\n attempt_connection\n when :read_needs_to_write\n attempt_read\n when :write_needs_to_write\n attempt_write\n end\n\n # if we waiting to close and are not longer waiting to write, we can flush and close the connection.\n if @close_after_writing and not notify_writable?\n @sslsock.flush\n close_connection\n end\n end",
"def check_for_installed_software_only\n check_all_installed @options\n end",
"def warn_for_installed_script_phases\n pods_to_install = sandbox_state.added | sandbox_state.changed\n pod_targets.group_by(&:pod_name).each do |name, pod_targets|\n if pods_to_install.include?(name) && !sandbox.local?(name)\n script_phase_count = pod_targets.inject(0) { |sum, target| sum + target.script_phases.count }\n unless script_phase_count.zero?\n UI.warn \"#{name} has added #{script_phase_count} #{'script phase'.pluralize(script_phase_count)}. \" \\\n 'Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.'\n end\n end\n end\n end",
"def test_if_necessary\n # should return true\n assert Scripto.mkdir_if_necessary(DIR)\n assert Scripto.cp_if_necessary(SRC, DST)\n assert Scripto.ln_if_necessary(SRC, DST2)\n\n assert(File.directory?(DIR))\n assert_equal(File.read(SRC), File.read(DST))\n assert_equal(SRC, File.readlink(DST2))\n\n # should be silent\n assert_fu_output(nil, \"\") do\n assert_nil Scripto.mkdir_if_necessary(DIR)\n assert_nil Scripto.cp_if_necessary(SRC, DST)\n assert_nil Scripto.ln_if_necessary(SRC, DST2)\n end\n end",
"def poll_writable?\n false\n end",
"def complain_about_bad_flags!\n @complain_about_bad_flags = true\n end",
"def check_requirements!\n return unless Command.up?\n\n matomo_js = File.join(@config.get('source'), 'piwik.js')\n\n error_source_missing(@config.get('source')) unless File.exist?(matomo_js)\n end",
"def verify_writable_dir(dir)\n unless (File.directory?(dir) && File.writable?(dir)) ||\n FileUtils.mkdir_p(dir)\n raise IOError.new(\"Directory #{dir} must exist and be writable\")\n end\n end",
"def install_overwrite!\n\t\t\t# This may not happen because for a directory entry, an existing\n\t\t\t# target is either current (if it's a directory or a symlink to a\n\t\t\t# directory) or blocking (it it's anything else), and both must\n\t\t\t# be checked before calling this method.\n\t\t\traise \"Trying to overwrite a directory\"\n\t\tend",
"def permissions_for_web_writable(aPath)\n\t\trun \"#{sudo} chmod -R g+w #{MiscUtils.append_slash(aPath)}\"\n\tend",
"def should_remove_librun_and_stc_sources\n !(core_developer? or ENV['RETAIN_STX_AND_LIBRUN_SOURCE'] == 'yespleaseretain!')\nend",
"def install_dependencies\n raise 'Not implemented'\n end",
"def can_write?\n can?('w')\n end",
"def patch_kingfisher_for_ios10\n system(\"rm -rf ./Pods/Kingfisher/Sources/SwiftUI\")\n code_file = \"./Pods/Kingfisher/Sources/General/KFOptionsSetter.swift\"\n code_text = File.read(code_file)\n code_text.gsub!(/#if canImport\\(SwiftUI\\) \\&\\& canImport\\(Combine\\)(.|\\n)+#endif/,'')\n system(\"rm -rf \" + code_file)\n aFile = File.new(code_file, 'w+')\n aFile.syswrite(code_text)\n aFile.close()\nend",
"def require_set_write_concern\n before do\n if ClusterConfig.instance.topology == :sharded && ClusterConfig.instance.short_server_version >= '4.0'\n skip \"mongos 4.0+ overrides write concern\"\n end\n end\n end",
"def compilable?\n false\n end",
"def security_prevent_install_apps_from_unknown_sources\n return @security_prevent_install_apps_from_unknown_sources\n end",
"def forbid!\n forbid_lock_file_name = \"#{run_dir}.forbid.lock\"\n\n begin\n unless lock_file_present?(forbid_lock_file_name)\n if seq_complete?\n unless dir_forbidden?\n\n FileUtils.touch forbid_lock_file_name\n sleep 10\n File.chmod 0000, run_dir\n logger.info \"Changed permissions for #{run_dir} to 0000\"\n end\n end\n end\n rescue => e\n logger.error \"while forbidding access to deep seq data:\"\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n Mailer.notify_admins(self, 'forbid_dir', e)\n ensure\n FileUtils.rm forbid_lock_file_name if lock_file_present?(forbid_lock_file_name)\n end\n end",
"def install\n # Fix build per Makefile instructions\n inreplace \"Makefile\", \"-static\", \"\"\n\n system \"make\"\n bin.install \"muscle\"\n end",
"def teardown\n File.chmod( 0644, UNREADABLE_MARCXML_PATH)\n end",
"def verify_overwriting\n overwrite = ask_nicely\n\n while overwrite.empty?\n overwrite = ask_nicely\n end\n\n overwrite == 'y' ? FileUtils.rm_rf(Frank.export.path) : exit\n end",
"def check_install?\n @default_options[ :check_install ]\n end",
"def is_writable?\n any?(&:writable?)\n end",
"def adjust_permissions\n # adjust base directory permission\n subsection 'Adjust file and directory permissions', color: :green, prefix: @output_prefix unless @silent\n FileUtils.chown @owner, @group, \"#{ @destination_directory }/#{ @artifact }\"\n FileUtils.chmod \"u+w,g+ws\", \"#{ @destination_directory }/#{ @artifact }\"\n\n # adjust release directory permission\n FileUtils.chown_R @owner, @group, @release_directory\n end",
"def setup_sudo\n return if @sudo\n\n prompt = (1..10).map { rand(255) }.pack('c')\n code = <<-RUBY\n $stdout.sync = true\n $stdout.set_encoding 'ascii-8bit'\n $stdin.set_encoding 'ascii-8bit'\n $stdout.write #{prompt.inspect}\n\n while size = $stdin.read(4)\n action, args = Marshal.load($stdin.read(size.unpack('N').first))\n\n case action\n when 'rm'\n args.select! { |f| File.file?(f) }\n File.unlink(*args) unless args.empty?\n when 'rmdir'\n args.select! do |f|\n File.directory?(f) && Dir.entries(f) == ['.', '..']\n end\n Dir.unlink(*args) unless args.empty?\n when 'forget'\n fork do\n $stdout.reopen('/dev/null')\n $stderr.reopen('/dev/null')\n exec 'pkgutil', '--forget', *args\n end\n Process.wait\n when 'quit' then exit\n end\n end\n RUBY\n\n @sudo = IO.popen(['sudo', '-p', 'Password: ', RbConfig.ruby, '-e', \"eval(#{code.lines.count}.times.to_a.map { $stdin.readline }.join)\"], 'w+')\n @sudo.write code\n\n @sudo.write gets until @sudo.read(prompt.bytesize) == prompt\n\n @sudo.sync = true\n @sudo.set_encoding 'ascii-8bit'\n\n at_exit do\n data = Marshal.dump(['quit', []])\n @sudo.write [data.bytesize, data].pack('Na*')\n end\n rescue Errno::ENOENT\n Process.wait\n exit 1\n end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n\n # Remove unrecognized options if warned by configure\n # system \"./configure\", \"--disable-debug\",\n # \"--disable-dependency-tracking\",\n # \"--disable-silent-rules\",\n # \"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n # system \"make\", \"install\" # if this fails, try separate make/make install steps\n end",
"def install_prefs\n return false if File.exists?(prefs_dest)\n install_prefs!\n end",
"def purge_package(names, versions)\n brew_cmd_output(\"uninstall\", \"--force\", options, names.compact)\n end",
"def test_bad_rubinius_deps\n check_deps_fail BadRubiniusBall unless `/usr/bin/which rbx`.chomp.empty?\n end",
"def have_brew?\n have_command? :brew\n end",
"def iyyov_install_rundir\n sudo( <<-\"SH\", :user => user_run )\n mkdir -p #{iyyov_run_dir}\n if [ ! -e #{iyyov_run_dir}/jobs.rb ]; then\n touch #{iyyov_run_dir}/jobs.rb\n fi\n SH\n user_run_chown( '-R', iyyov_run_dir )\n end",
"def safe_system cmd, *args\n unless Homebrew.system cmd, *args\n args = args.map{ |arg| arg.to_s.gsub \" \", \"\\\\ \" } * \" \"\n raise \"Failure while executing: #{cmd} #{args}\"\n end\nend",
"def silence_deprecations; end",
"def check_for_dockutil\n\tif !File.exist?(\"/usr/local/bin/dockutil\")\n\t\tabort \"Dockutil is not installed\"\n\tend\nend",
"def update_all_packages(options = {})\n return true if update_all_packages_impl(options)\n \n return false if options[:no_proxy]\n update_all_packages options.merge(:no_proxy => true)\n end",
"def install\n # ENV.j1 # if your formula's build system can't parallelize\n\n # Remove unrecognized options if warned by configure\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\" # if this fails, try separate make/make install steps\n end",
"def writable?\n transient? || (filename && filename.writable?)\n end",
"def prepare_for_installation; end",
"def toggle\n harness_path = File.expand_path('../.git/security_harness', __dir__)\n\n if File.exist?(harness_path)\n FileUtils.rm(harness_path)\n\n puts \"#{SHELL_YELLOW}Security harness removed -- you can now push to all remotes.#{SHELL_CLEAR}\"\n else\n FileUtils.touch(harness_path)\n\n puts \"#{SHELL_GREEN}Security harness installed -- you will only be able to push to dev.gitlab.org or gitlab.com/gitlab-org/security!#{SHELL_CLEAR}\"\n end\nend",
"def _validate_compiler_flags(flags)\n if flags.join(' ').split(' ').any? { |flag| flag.start_with?('-Wno') }\n results.add_warning('compiler_flags', 'Warnings must not be disabled' \\\n '(`-Wno compiler` flags).')\n end\n end",
"def all_required_packages(selection, with_rock_release_prefix = false)\n raise RuntimeError, \"#{self.class} needs to overwrite all_required_packages\"\n end",
"def warn?\n raise NotImplementedError.new\n end",
"def writeable?\n status_flag?(:kSecWritePermStatus)\n end",
"def handle_silent_modification_failure?\n false\n end",
"def writeable?\n true\n end",
"def manage_symlink_access?\n false\n end",
"def manage_symlink_access?\n false\n end",
"def chmod_executables\n %w(jruby jgem gem jirb).each { |command| chmod_executable_for_others(bin_path(command)) } \n end",
"def writeable?\n !readonly?\n end",
"def install\n # Avoid references to shim\n inreplace Dir[\"**/*-config.in\"], \"@PKG_CONFIG@\", Formula[\"pkg-config\"].opt_bin/\"pkg-config\"\n\n\n # Add a symlink that points to the X11 include files provided by XQuartz.\n # This prevents the `display wizard` command from segfaulting.\n ln_s \"/opt/X11/include/X11\", \"#{buildpath}/X11\"\n\n\n # Adding -I/opt/X11/include and -L/opt/X11/lib via compiler flags is blocked\n # by the HOMEBREW_CCCFG=Osa setting. (=sa works, maybe)\n #\n # See the following for details:\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/extend/ENV/super.rb#L83-L88\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L36\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L108\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L140\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L171 <-- refurbish_arg,\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L252-L254 /opt/X11 is being filtered out\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L270\n # https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L357\n\n # Consider appending /opt/X11/lib/pkgconfig to PKG_CONFIG_PATH and/or\n # adding a symlink to /opt/X11/lib during build instead of depending on\n # libx11/xorgproto.\n\n # See also the \"x11\" method that was removed from brew recently:\n # (Library/Homebrew/extend/os/mac/extend/ENV/std.rb)\n # https://github.com/Homebrew/brew/commit/87dd13aea6691e9d5e0f3ba8d1d1f862a809212a#diff-ed4c0c77ea1a192666ae8a1758389fb65054649d71e0e39e14ee08e919fdb2b3L13-L34\n\n\n args = [\n \"--enable-osx-universal-binary=no\",\n \"--prefix=#{prefix}\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--disable-opencl\",\n \"--enable-shared\",\n \"--enable-static\",\n \"--with-freetype=yes\",\n \"--with-modules\",\n \"--with-openjp2\",\n \"--with-openexr\",\n \"--with-webp=yes\",\n \"--with-heic=yes\",\n \"--with-gslib\",\n \"--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts\",\n \"--with-lqr\",\n \"--without-fftw\",\n \"--without-pango\",\n \"--without-wmf\",\n \"--enable-openmp\",\n \"ac_cv_prog_c_openmp=-Xpreprocessor -fopenmp\",\n \"ac_cv_prog_cxx_openmp=-Xpreprocessor -fopenmp\",\n \"LDFLAGS=-lomp -lz\",\n ]\n\n # versioned stuff in main tree is pointless for us\n inreplace \"configure\", \"${PACKAGE_NAME}-${PACKAGE_BASE_VERSION}\", \"${PACKAGE_NAME}\"\n system \"./configure\", *args\n system \"make\", \"install\"\n end",
"def validate_no_abstract_only_pods!\n @podfile_dependency_cache.target_definition_list.each do |target_definition|\n dependencies = @podfile_dependency_cache.target_definition_dependencies(target_definition)\n next if dependencies.empty?\n next unless target_definition.abstract?\n\n children = target_definition.recursive_children\n next if children.any? { |child_target_definition| target_definition_inherits?(:parent => target_definition, :child => child_target_definition) }\n\n add_warning \"The abstract target #{target_definition.name} is not inherited by a concrete target, \" \\\n \"so the following dependencies won't make it into any targets in your project:\" \\\n \"\\n - #{dependencies.map(&:to_s).sort.join(\"\\n - \")}\"\n\n next if target_definition.platform\n\n add_error \"The abstract target #{target_definition.name} must specify a platform since its dependencies are not inherited by a concrete target.\"\n end\n end",
"def remove_obsolete_installed_orogen_package(name)\n post_install do\n path = File.join(prefix, 'lib', 'pkgconfig')\n Dir.glob(File.join(path, \"#{name}-*.pc\")) do |pcfile|\n Autoproj.message \" removing obsolete file #{pcfile}\", :bold\n FileUtils.rm_f pcfile\n end\n pcfile = File.join(path, \"orogen-project-#{name}.pc\")\n if File.exists?(pcfile)\n Autoproj.message \" removing obsolete file #{pcfile}\", :bold\n FileUtils.rm_f pcfile\n end\n end\n end",
"def check!\n Capistrano::Deploy::Dependencies.new(configuration) do |d|\n # d.remote.directory(configuration[:releases_path]).or(\"`#{configuration[:releases_path]}' does not exist. Please run `cap deploy:setup'.\")\n # d.remote.writable(configuration[:deploy_to]).or(\"You do not have permissions to write to `#{configuration[:deploy_to]}'.\")\n # d.remote.writable(configuration[:releases_path]).or(\"You do not have permissions to write to `#{configuration[:releases_path]}'.\")\n end\n end",
"def make_install\n run_with_failure_handler(\"cd #{@extracted_path} ; sudo make install\", 'make install')\n end",
"def test_bad_chicken_deps\n check_deps_fail BadChickenBall unless `/usr/bin/which csc`.chomp.empty?\n end",
"def install\n # Fix \"fatal error: 'os/availability.h' file not found\" on 10.11 and\n # \"error: expected function body after function declarator\" on 10.12\n if MacOS.version == :sierra || MacOS.version == :el_capitan\n ENV[\"SDKROOT\"] = MacOS.sdk_path\n end\n\n args = std_cmake_args\n\n args << \"-DCMAKE_PREFIX_PATH=#{Formula[\"qt\"].opt_lib}/cmake\"\n args << \"-DCMAKE_CXX_FLAGS=-Wno-error=narrowing\" # or: -Wno-c++11-narrowing\n args << \"-DCMAKE_OSX_ARCHITECTURES=#{Hardware::CPU.arch_64_bit}\"\n args << \"-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio\"\n args << \"-DOSG_WINDOWING_SYSTEM=Cocoa\"\n\n mkdir \"build\" do\n system \"cmake\", \"..\", *args\n system \"make\"\n system \"make\", \"install\"\n end\n end",
"def brew\n validate_attributes :name, :version\n\n stage do\n begin\n patch\n # we allow formulae to do anything they want to the Ruby process\n # so load any deps before this point! And exit asap afterwards\n yield self\n rescue RuntimeError, SystemCallError\n %w(config.log CMakeCache.txt).each do |fn|\n (HOMEBREW_LOGS/name).install(fn) if File.file?(fn)\n end\n raise\n end\n end\n end",
"def programChecker(cmd)\n if which(cmd).nil?\n abort(\"EXITING: Please install #{cmd} before continuing\")\n end\nend",
"def writable?\n current_user_role_names.each do |role_name|\n return true if Filesystem.test_dir role_name, self, :write\n end\n false\n end",
"def compilable?\n false\n end",
"def check_osx_ips(options)\n python_bin = \"/usr/bin/python\"\n pip_bin = \"/usr/bin/pip\"\n setup_url = \"https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py\"\n if not File.symlink?(pip_bin)\n message = \"Information:\\tInstalling Pip\"\n command = \"/usr/bin/easy_install --prefix=/usr pip\"\n execute_command(options,message,command)\n message = \"Information:\\tUpdating Setuptools\"\n command = \"wget #{setup_url} -O |sudo #{python_bin}\"\n execute_command(options,message,command)\n ['simplejson\",\"coverage\",\"pyOpenSSL\",\"mercurial'].each do |module_name|\n message = \"information:\\tInstalling Python module \"+module_name\n command = \"#{pip_bin} install #{module_name}\"\n execute_command(options,message,command)\n end\n end\n python_ver = %x[#{python_bin} --version |awk '{print $2}']\n python_ver = python_ver.chomp.split(/\\./)[0..1].join(\".\")\n module_dir = \"/usr/local/lin/python\"+python_ver+\"/site-packages\"\n pkg_dest_dir = module_dir+\"/pkg\"\n check_dir_exists(options,pkg_dest_dir)\n hg_bin = \"/usr/local/bin/hg\"\n if not File.exist?(hg_bin)\n message = \"Information:\\tInstalling Mercurial\"\n command = \"brew install mercurial\"\n execute_command(options,message,command)\n end\n pkgrepo_bin = \"/usr/local/bin/pkgrepo\"\n if not File.exist?(pkgrepo_bin)\n ips_url = \"https://hg.java.net/hg/ips~pkg-gate\"\n message = \"Information:\\tDownloading IPS source code\"\n command = \"cd #{options['workdir']} ; hg clone #{ips_url} ips\"\n execute_command(options,message,command)\n end\n return\nend",
"def all_required_rock_packages(selection)\n raise RuntimeError, \"#{self.class} needs to overwrite all_required_rock_packages\"\n end",
"def caveats\n <<~EOS\n This formula is very custom and needs editing before installation for the specific\n macOS version and cpu target (because it is faster than compiling\n for dynamic architecture).\n\n The motivation for it is from https://github.com/Homebrew/homebrew-core/issues/75506\n We would like to build without using gcc's libgomp since it is not fork-safe, and\n instead use libomp from llvm.\n\n What happens if we link to libomp AND libgomp (which comes with gcc)?\n According to man ld:\n ## By default all references resolved to a dynamic library record the library to which they\n ## were resolved.\n so probably no risk of linking to libomp AND libgomp...???\n\n For the cleanest most risk-averse installation,\n you should install homebrew gcc and either llvm or libomp first.\n Then replace gcc's libgomp with the respective libomp. Here is example\n using libomp (which is currently how formula is written):\n cd /usr/local/opt/libomp/lib\n ln -s libomp.dylib libgomp.dylib\n ln -s libomp.a libgomp.a\n brew unlink libomp\n brew link libomp\n\n I think using the gcc libgomp headers is ok (this is what conda does). The resulting openblas\n fails/warns on one of the tests, but the conda openblas also fails that one (and I think openblas\n compiled with gcc/libgomp does too?).\n\n Interestingly homebrew llvm symlinks libomp to libgomp! So, can symlink\n that instead. This will ensure that R libs are only linked against libomp.\n\n EOS\nend",
"def ensure_gem_installed(g)\n unless Gem.available? g\n run \"sudo gem install #{g}\"\n end\nend",
"def remove_def_python_cmd\n puts \"Removing 'python' command to preserve system native python...\"\n sudo_cmd = ''\n if !File.writable?(@prefix_dir)\n sudo_cmd = \"sudo -H\"\n end\n del_python_cmd = [\n File.join($prefix_dir, \"bin/python\"),\n File.join($prefix_dir, \"bin/ipython\")\n ]\n del_python_cmd.each do |c|\n FileUtils.rm_rf(c)\n end\n end",
"def check_writable(filename, constant_name)\n unless File.writable?(filename)\n raise MarkUsConfigError(\"The setting #{constant_name} with path #{filename} is not writable.\")\n end\n end"
] |
[
"0.5491674",
"0.54504997",
"0.5352602",
"0.53212565",
"0.53028977",
"0.5277081",
"0.51996326",
"0.51235723",
"0.5097927",
"0.49523583",
"0.49447295",
"0.49367172",
"0.49296775",
"0.48929352",
"0.48810324",
"0.4877049",
"0.48682562",
"0.48554957",
"0.4842242",
"0.483272",
"0.48255634",
"0.48128247",
"0.47904658",
"0.47777712",
"0.47765803",
"0.47631136",
"0.47621647",
"0.47605273",
"0.47420943",
"0.47342864",
"0.47332892",
"0.47326875",
"0.47244504",
"0.47243267",
"0.4687484",
"0.4683874",
"0.46793437",
"0.46780294",
"0.46758816",
"0.4673801",
"0.46723697",
"0.46612072",
"0.46522814",
"0.46486634",
"0.46145675",
"0.46058953",
"0.460536",
"0.46031943",
"0.45979142",
"0.45884472",
"0.45848286",
"0.45728543",
"0.4571777",
"0.45697254",
"0.45664927",
"0.4550708",
"0.45458332",
"0.45428157",
"0.45397237",
"0.45320413",
"0.45300853",
"0.45215765",
"0.45108476",
"0.44962698",
"0.44958124",
"0.44905537",
"0.44904566",
"0.44903657",
"0.4481091",
"0.44526023",
"0.44514388",
"0.4449454",
"0.4446552",
"0.44426754",
"0.44411916",
"0.4440494",
"0.443925",
"0.44384933",
"0.44308522",
"0.44215748",
"0.44196966",
"0.44196966",
"0.44154245",
"0.44137618",
"0.4403598",
"0.4403502",
"0.44033217",
"0.43934923",
"0.4388742",
"0.43828467",
"0.4377846",
"0.43772814",
"0.43761268",
"0.43756202",
"0.43755952",
"0.43739262",
"0.43736172",
"0.4373164",
"0.43720672",
"0.4371776",
"0.4371599"
] |
0.0
|
-1
|
find_by takes one hash argument, where key is lookup method, which starts with customer or product, and then after underscore must be existing attribute of customer or product f.e.: find_by(cutomer_name: 'Walter Latimer') => reutrns an array with customers purchases
|
def find_by(lookup)
resource, attribute = lookup.keys[0].to_s.split('_')
lookup_value = lookup.values[0]
@@transactions.select { |transaction| transaction.send(resource).send(attribute) == lookup_value }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_by()\n\n end",
"def test_it_finds_an_object_by_specific_column_data\n # --- Merchant Repo ---\n found = FinderClass.find_by(@merchants.all, :name, \"Shopin1901\")\n assert_equal @merchant1.name, found.name\n found = FinderClass.find_by(@merchants.all, :id, 12334112)\n assert_equal @merchant2.id, found.id\n found = FinderClass.find_by(@merchants.all, :id, 12)\n assert_nil found\n\n # --- Item Repo ---\n found = FinderClass.find_by(@items.all, :id, 263395237)\n assert_equal @item.id, found.id\n found = FinderClass.find_by(@items.all, :name, \"510+ RealPush Icon Set\")\n assert_equal @item.name, found.name\n found = FinderClass.find_by(@items.all, :id, 5237)\n assert_nil found\n end",
"def find_by(attributes = {}, options = {}, header = {})\n search = { search: attributes }.merge!(options)\n request = requester.new(:get, \"#{to_url}/find_by\", {}, search, header)\n request.resource.map do |element|\n build(element)\n end\n end",
"def find_by_name(name)\n # self.all.find do |customer|\n # customer.name == name\n # end\n Customer.find_by(name: name)\n end",
"def find_by(hash)\n # firebase does not have complex querying\n # so we have to grab all objects satisfying\n # first key/value\n init_key, init_value = hash.shift\n firebase_response = firebase_request :get,\n firebase_model,\n orderBy: \"\\\"#{init_key}\\\"\",\n equalTo: encode_init_value(init_value)\n\n # we then filter the remaining key/values with ruby\n hash.each do |key, value|\n firebase_response = firebase_response.select do |_firebase_key, firebase_hash|\n firebase_hash[key.to_s] == value\n end\n end\n\n firebase_hashes_array = normalize_firebase_hashes(firebase_response)\n\n firebase_hashes_array.map { |hash_item| create_firebase_object(hash_item) }\n end",
"def find_by_merchant_name(name)\n merchant_objects.find do |merchants|\n merchants.merchant_name == name\n end\nend",
"def find_by(field, value)\n @base.send('find_by_' + field, value)\n end",
"def find_by_key(key)\n result = nil\n @vendors.each do |vendor|\n result = vendor if vendor.vendor_keys.any? { |k| k.key == key }\n end\n result\n end",
"def search_customer_by_pur\n\t\t$tracer.trace(__method__)\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-wis-searchPUR\")), __method__)\n end",
"def get_with(hash)\n\t\tcolumn = hash.keys.first\n\t\tcheck_column(column.to_s)\n\t\tvalue = hash[column]\n\n\t\tresult = find_with(hash)\n\t\tif(!result)\n\t\t\traise \"#{@table} does not contain an item where #{column.to_s} is\" + \n\t\t\t\t \" #{value}\"\n\t\tend\n\n\t\t@item_class.new(*result)\n\tend",
"def find_by_key(key)\n find_by('key', key)\n end",
"def method_missing(method_id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n \n method_id.to_s.match(/^find_all_by_([_a-zA-Z]\\w*)$/)\n attributes = {}\n\n $1.split('_and_').each do |key|\n attributes.merge!({key.intern => args.shift})\n end\n \n find(:all, attributes.merge(options))\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by(attributes)\n id_match = attributes[:id_match]\n championship = attributes[:championship]\n serie = attributes[:serie]\n\n if @config.championship_associate?\n find_match_associated(id_match, championship)\n else\n find_match(id_match, championship, serie)\n end\n end",
"def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end",
"def create_or_update_by_some( attrs={} )\n attrs = extract_ar_object_ids( attrs )\n conditions = attrs.delete( :find_by )\n raise 'You must provide a :find_by hash of attributes to search with, ie. :find_by => {:id => 1}' unless conditions\n attrs.merge!( conditions )\n record = find( :first, :conditions => conditions ) || self.new\n record.attributes = attrs\n record.save!\n record\n end",
"def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end",
"def find_by(search = {}, &block)\n block = finder search unless block_given?\n find(&block)\n end",
"def find_by!(params = {})\n find_by(params) || begin\n message = params.map do |key, value|\n \"#{key}=#{value}\"\n end\n raise RecordNotFound, message.to_sentence\n end\n end",
"def find_by_attributes\n Hash[@ucrm_local_id_field, id]\n end",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def method_missing(m,*args)\n #find_by_name(\"John\") returns first YamlContentBase object that matches\n if m.to_s.index(\"find_by\") == 0\n attribute = m.to_s.gsub(\"find_by_\",\"\")\n return self.detect{|x| x.send(attribute) == args[0]}\n #find_all_by_name(\"John\") returns array of YamlContentBase objects that match\n elsif m.to_s.index(\"find_all_by\") == 0\n attribute = m.to_s.gsub(\"find_all_by_\",\"\")\n return self.select{|x| x.send(attribute) == args[0]}\n end\n raise \"'#{m}' is not a method\"\n end",
"def find_by(**args)\n where(**args).first\n end",
"def find_by_name(params, header = {})\n request = requester.new(:get, \"#{to_url}/find_by_name\", {}, params, header)\n request.resource.map do |model|\n build(model)\n end\n end",
"def find_all_merchant_name(name)\n merchant_objects.select do |merchants|\n merchants.merchant_name == name\n end\nend",
"def get_spicy_food_by_cuisine(spicy_foods, cuisine)\n spicy_foods.find { |spicy_food_hash| spicy_food_hash[:cuisine] == cuisine}\nend",
"def get_by(selector)\n\n end",
"def customer(customer)\n self.all.select {|rev| rev.customer == customer}\n end",
"def find_by(search, category=\"name\")\n #category is a string\n #search is a string\n output = all.select do |item|\n if category == \"moveset\" || category == \"type\"\n nil #forces partial matching\n else\n item.instance_variable_get(\"@#{category}\").downcase.gsub(/\\s+/, \"\") == search.downcase.gsub(/\\s+/, \"\")\n end\n end\n\n #returns the item or nil if not found\n\n if output.size < 1\n output = find_partial(search, category)\n end\n output\n end",
"def find_key(hash, key)\n\t\tproduct = {}\n\t\tif hash.key?(key)\n\t\t\tproduct[:quantity] = hash[key][\"quantity\"]\n\t\t\tproduct[:price] = hash[key][\"price\"]\n\t\telse\n\t\t\tproduct[:quantity] ||= 0\n\t\t\tproduct[:price] = Product.find(key).sale_price.present? ? Product.find(key).sale_price : Product.find(key).price\n\t\tend\n\t\treturn product\n\tend",
"def find_item_by_product(product, items)\n\t\tsku = product.sap_sku.to_s.upcase\n\t\tsku_options = sku.match(/\\-?[MV]$/) ? [sku, sku.gsub(/\\-?[MV]$/, '')] : sku_options = [\"#{sku}-V\", \"#{sku}-M\", \"#{sku}V\", \"#{sku}M\", sku]\n\n\t\titem = nil\n\t\tsku_options.each do |s|\n\t\t\tif item = items[s]\n\t\t\t\treturn item\n\t\t\tend\n\t\tend\n\t\titem\n\tend",
"def composers_hash\n search_by_itemprop_hash 'musicBy'\n end",
"def search_for(**search_by)\n search_by.keys.each do |key|\n raise \"Illegal search modifier: #{key}\" unless VALID_SEARCH_PARAMETERS.member?(key)\n end\n\n log.info \"[ACTION] Search with #{search_by.to_json}\"\n\n # Remove these 3 from search_by as they are used to next loop doesn't try to use them\n fill_in_if(:search_text, search_by.delete(:search_text))\n fill_in_if(:min_price, search_by.delete(:min_price))\n fill_in_if(:max_price, search_by.delete(:max_price))\n\n search_by.each do |locate_by, value|\n set_checkbox(locate_by, value)\n end\n\n click_search\n\n # Return WebPage object\n self.class.send(:given)\n end",
"def find_by(args)\n self.find{|el| !args.map{|a,b| el.send(a) == b }.include?(false)}\n end",
"def vendors ##DON'T NEED TO PASS IN AN ARGUMENT JUST THE VALUE FROM THE ARGUMENT!!!!\n # lookup every vendor that matches this market id\n FarMar::Vendor.by_market(@id)\n ##OMG YAY, REMEMBER THIS TO BRING IN CLASSES FOR DIFFERENT METHODS,\n ##bring in class object and method and pass in the id from market\n end",
"def find(input, property, value); end",
"def query_by(*attributes)\n @query_by = attributes\n end",
"def find_company_by_name companies, name = \"Beta\"\n companies.find {|company| company.name == name}\nend",
"def find(*args)\n raise ArgumentError unless args[0].is_a?(Hash)\n r = []\n # If args[0] has ALL of the class keys then look based on the key values\n # If args[0] does not have ALL of the class keys then drop to the table scan approach\n if args[0].has_keys?(keys)\n # If the keys of args are a subset of keys then look up by the key values\n key_record = records[build_key(args[0])]\n if key_record\n # Make sure the other elements of args[0] match the corresponding k/v pairs in key_record\n match = true\n args[0].each_pair do |k, v|\n match = false unless key_record[k] == v\n break unless match\n end\n r << key_record if match\n else\n # the record you are looking for isn't here, stop searching\n end\n else\n # look at each record in records individually - basically a table scan\n records.each_value do |record|\n match = true\n args[0].each do |k, v|\n match = false unless record.send(k) && record.send(k) == v\n break unless match\n end\n r << record if match\n end\n return r unless r.empty?\n nil\n end\n end",
"def find_from!(collection, identifier, find_by = :id)\n if identifier.present?\n collection.detect { |instance| instance.send(find_by) == identifier.to_i } || (raise ActiveRecord::RecordNotFound)\n else\n raise ActiveRecord::RecordNotFound\n end\n end",
"def find(key)\n new(key: key, name: TYPES[key.to_sym]) if TYPES.has_key?(key.to_sym)\n end",
"def find_for(_hash)\n hash = _hash.symbolize_keys\n conditions = {}\n @keys.each do |key|\n puts \"key = #{key.inspect}\"\n value = hash[key.column.to_sym]\n raise \"No value provided for #{key.column}\" unless value\n case key.type\n when :discrete\n conditions[key.column.to_sym] = value\n when :continuous\n conditions[:\"#{key.column}_begin\"] = value.begin\n conditions[:\"#{key.column}_end\"] = value.end\n conditions[:\"#{key.column}_exclusive\"] = value.exclude_end?\n end\n end\n puts \"conditions = #{conditions.inspect}\"\n partition_class.find(:first, :conditions => conditions)\n end",
"def find_by(distance_within:)\n if distance_within.nil?\n raise ArgumentError, 'Distance within must be provided'\n end\n\n # select and sort matching customers\n @customers.select do |customer_hash|\n customer_hash['distance_from_destination_in_radians'] <= distance_within\n end.sort_by { |hash| hash['user_id'] }\n end",
"def find_element\n raise \"Not a valid Finder: #{find_by.to_sym}\" unless FINDERS.include? find_by.to_sym\n\n case find_by.to_sym\n when :id\n $driver.find_element(find_by.to_sym, locator)\n when :value\n $driver.find(locator)\n when :xpath\n $driver.find_element(find_by.to_sym, locator)\n end\n end",
"def find_item(purchase_or_id)\n raise NotImplementedError\n end",
"def find(*criteria)\n criteria.flatten! if criteria.first.is_a?(Array)\n p criteria if Caesars.debug?\n # BUG: Attributes can be stored as strings and here we only look for symbols\n str = criteria.collect { |v| \"[:'#{v}']\" if v }.join\n eval_str = \"@caesars_properties#{str} if defined?(@caesars_properties#{str})\"\n val = eval eval_str\n val\n end",
"def find_all_by(attributes = {})\n raise NotImplementedError.new\n end",
"def find_student(name)\n @students.select { |student| student[:name] == name}\nend",
"def attribute_matching(key, data, property=:long_name)\n data[\"address_components\"].each do |comp|\n return comp[property.to_s] if comp[\"types\"].include?(key)\n end\n return nil\n end",
"def find_item_by_name(list, search_item)\n found_entry = {}\n list.each do |current_item|\n if current_item[\"productName\"] == search_item[\"productName\"]\n found_entry=current_item\n end\n end\n return found_entry\n end",
"def get_sell_by(code) \n @sell_by_for_codes.each do |key, value| \n return value if key.include?(code.to_i)\n end \n @default_sell_by\nend",
"def find_models key, rdfa=nil\n if rdfa\n model_groups = eval(\"configatron.rdfa_query\") ? eval(\"configatron.rdfa_query\").to_hash : eval(\"configatron.query\").to_hash \n else\n model_groups = eval(\"configatron.query\").to_hash\n end \n model_groups.each do |model_group_name,model_group|\n if model_group_name.to_s.downcase == key.downcase\n return {model_group_name=>model_group}\n end\n end\n nil\n end",
"def find_by_name(name)\n end",
"def find_relationship_by(attribute, value); end",
"def get_key(data)\n\t\t keys = data.keys\n\t\t if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }\n\t\t raise ArgumentError.new(\"`find_by` accepts only one of #{INDICES.join(\" or \")} as argument. none provided\")\n\t\t end\n\t\t keys.first\n\t\t end",
"def find_by_key(val)\n find(:first, :conditions => {:key => prepare_key(val)})\n end",
"def find_customer(c_id)\n Customer.find(:all,:conditions => {:C_Id => c_id})\n end",
"def where(attributes)\n # (class method) think about how to loop through hashes\n # try looping thru a test ruby file or within irb\n end",
"def salespeople(name,id)\n customer_salespeople.find_or_build(id) if name == 'customer_salesperson'\n end",
"def search(arg, by: nil)\n\t\t\tr={type: \"search\", arg: arg}\n\t\t\tr[:by]=by if by\n\t\t\t# if :by is not specified, aur defaults to name-desc\n\t\t\tself.query(r)\n\t\tend",
"def find_matching(collection, name, primary_key = :id)\n # Handle identity - so you can pass object, object_name\n return name if collection.include? name\n collection.each do |single|\n # It's usually id, but are other possibilities like device\n if single.respond_to? primary_key\n return single if single.send(primary_key) == name\n end\n if single.respond_to? :name\n return single if single.name == name\n return single if name.is_a?(Regexp) && name =~ single.name\n end\n end\n\n nil\n end",
"def locate_by\n options_by_type(:locate_by) || :element\n end",
"def find_by(**args)\n matches = list.select do |_key, hash|\n args.each_pair.map { |k, v| hash[k].casecmp?(v) }.all?\n end\n\n return [] if matches.empty?\n matches.map { |_key, hash| hash[:name] }\n end",
"def find_one_by(opts = {})\n list_all_products(opts)[0]\n end",
"def find_by(params)\n results = params.each_with_index.map do |param, position|\n if param.nil?\n nil\n elsif param.respond_to?(:include?)\n index[position].select { |key, _| param.include? key }.values.flatten\n else\n index[position].select { |key, _| param == key }.values.flatten\n end\n end.compact.inject(:&)\n data.values_at(*results)\n end",
"def find(key)\n items.find do |item|\n item.key == key\n end\n end",
"def find_all_by(opts = {})\n list_all_products(opts)\n end",
"def find_by attribute, value\n\n all.detect { |continent| continent.send(attribute) == value }\n\n end",
"def find_purchases\n \n if params[:id] \n purchase = Purchase.find_by_id(params[:id])\n @consumer_id = purchase.consumer_id if purchase\n elsif params[:consumer_id] \n @consumer_id = params[:consumer_id]\n else\n @consumer_id = nil\n end\n\n @purchases = Purchase.with_info(current_payer.id, @consumer_id) \n @pendings = @purchases.pending \n @pendings_count = @pendings.count\n \n end",
"def [](key)\n @attributes = Array.new if @attributes.nil?\n attributes_downcase =@attributes.map(&:downcase)\n key.downcase!\n if attributes_downcase.include? key\n return get(key)\n else\n raise 'El atributo no ha sido encontrado en el objecto '+ key\n end\nend",
"def for(name, obj = nil)\n on(obj).where(:name => name.to_s.downcase)\n end",
"def find_model(attributes)\n model.find(:first, :conditions => { key => attributes[key] })\n end",
"def func_find(hash)\n # Check and return the first object that satisfies either of the following properties:\n # 1. There is a [key, value] pair where the key and value are both Integers and the value is < 20\n # 2. There is a [key, value] pair where the key and value are both Strings and the value starts with `a`.\n hash.find do |key, value|\n if key.is_a?(Integer) && value.is_a?(Integer)\n return [key, value] if value < 20\n end\n\n if key.is_a?(String) && value.is_a?(String)\n return [key, value] if value[0].eql?('a')\n end\n\n []\n end\nend",
"def find_by_name(name = nil, &block)\n all.find { |p| p.name == name.to_s }\n end",
"def filter_by_brand(products, brand)\n products.select do |product| #o select fax«z o mesmo que o each e o map, apenas devolve o que é true.\n product[:brand] == brand #nos products que definimos no puts vai procurar dentro do array o que está na :brand\n end\nend",
"def name_search( type, search_for, order_by = 'name' )\n self.send(type.to_sym, { namesearch: search_for, order: order_by })\n end",
"def find_with(hash)\n\t\tcolumn = hash.keys.first\n\t\tcheck_column(column.to_s)\n\t\tvalue = hash[column]\n\t\tresult = @db.execute(\n\t\t\t\"SELECT * FROM #{@table} WHERE #{column.to_s} IS ?\", \n\t\t\tvalue\n\t\t)\n\n\t\tif(result.size == 0)\n\t\t\tnil\n\t\telse\n\t\t\tresult[0]\n\t\tend\n\tend",
"def customer(q)\n Customer.find(self, q)\n end",
"def find_by(*conditions)\n where(*conditions).take\n end",
"def select_by(how, what); end",
"def do_search_for(key, value)\n search_term = self.send(\"filter_by_#{key}\", value)\n prepare_search_term_for(key, search_term)\n end",
"def select_column_by_kv h, k, v, column = nil, method_name = :filter_by_kv\n filtered = method(method_name).call h, k, v\n column && filtered.map {|h1| h1[column]} || (!column) && filtered\n end",
"def customer_cash(customer)\nreturn customer[:cash]\nend",
"def from_param(*options)\n if param_column?\n send \"find_by_#{param_column}\", *options\n else\n find(*options) \n end\n end",
"def attribute_with_param(attr_name, param_name)\n attributes = self.attributes[attr_name.downcase]\n found_attributes = attributes.select { |attribute| attribute.params[param_name.downcase] }\n found_attributes.first\n end",
"def find_by_reference_key(class_name, record_id)\n find_by_reference_keys [class_name, record_id]\n end",
"def customer_cash(customers)\n return customers[:cash]\nend",
"def find_on_sale(name)\n flyer_items.find do |i|\n i.match?(name) unless i.nil?\n end\n end",
"def provider_by_name(provider_name)\n key = provider_name.to_s.downcase\n provider_list.detect{|p| key == p.name || provider_name == p.human_name}\n end",
"def find_collection_elements_with(*key_vals)\n self.collection.select do |elem|\n key_vals.all? do |kv|\n k, v = kv.first\n return unless elem.respond_to?(k.to_sym)\n elem.send(k.to_sym) == v\n end\n end\n end",
"def sku\n item_hash.deep_find(:sku)\n end",
"def find_item_by_name_in_collection(name, collection)\n collection.each{|items|\n if items[:item] === name\n return items \n end}\n nil\nend",
"def find_or_create_by(attrs = {}, &block)\n find_or(:create, attrs, &block)\n end",
"def find_for_show(find_by_conditions:)\n search.find_by(find_by_conditions)\n end",
"def obtain_items(column_value,nuix_case)\n\t\t# Run a search for the given property\n\t\tAnnotationCSVParser.log(\"Obtaining items based on property...\")\n\t\titems = nuix_case.search(\"properties:\\\"#{@property_name}:#{column_value}\\\"\")\n\t\t# Further refine matches to only items where the given property contains the exact\n\t\t# specified value\n\t\titems = items.select do |item|\n\t\t\tnext item.getProperties[@property_name] == column_value\n\t\tend\n\tend",
"def producers_hash\n search_by_itemprop_hash 'producer'\n end",
"def find_by(arg, *args)\n where(arg, *args).take\n end",
"def searchable_by *fields\n self.fields = process_fields(fields)\n end",
"def first_matching(key)\n @attributes.find do |a|\n a[0].downcase == key.downcase\n end\n end"
] |
[
"0.6217773",
"0.607036",
"0.6006252",
"0.60057706",
"0.5900803",
"0.5824234",
"0.5796892",
"0.56199753",
"0.5570208",
"0.55602634",
"0.5516516",
"0.55039614",
"0.5485317",
"0.5485317",
"0.54714483",
"0.5429326",
"0.5414795",
"0.53975606",
"0.53968984",
"0.5380491",
"0.5362616",
"0.53417754",
"0.5338808",
"0.5336053",
"0.53304535",
"0.53252304",
"0.5322774",
"0.53184175",
"0.53167665",
"0.52620095",
"0.5260677",
"0.5208858",
"0.51985264",
"0.5198233",
"0.5187974",
"0.5179571",
"0.51722527",
"0.5171636",
"0.51652664",
"0.5163702",
"0.51497436",
"0.5148755",
"0.51471305",
"0.51450217",
"0.5124553",
"0.5101073",
"0.50981",
"0.5087765",
"0.5068383",
"0.5056426",
"0.5038616",
"0.5036649",
"0.50347024",
"0.5031073",
"0.5023769",
"0.50198895",
"0.50143176",
"0.5014144",
"0.49904874",
"0.4972778",
"0.49719203",
"0.49701852",
"0.49671134",
"0.49573863",
"0.49524152",
"0.4949179",
"0.4942706",
"0.4940479",
"0.49350256",
"0.49220002",
"0.4910675",
"0.49087623",
"0.49008697",
"0.48981896",
"0.48952457",
"0.48903978",
"0.48843414",
"0.487995",
"0.48751685",
"0.48734325",
"0.4864778",
"0.48559496",
"0.48535898",
"0.48500684",
"0.4847524",
"0.48420125",
"0.48407543",
"0.4832678",
"0.4811559",
"0.48074153",
"0.4806329",
"0.4805915",
"0.48020315",
"0.47977793",
"0.47945172",
"0.4791184",
"0.47891936",
"0.4788555",
"0.47842932",
"0.47810647"
] |
0.5795165
|
7
|
Wait section ==================================================== This function wait for Freelancer page to be visible
|
def wait_for_freelancer_page_visible
sleep 15
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def wait_for_page\n sleep 0.7\n end",
"def wait_for_browser\r\n # NOTE: no need any more\r\n end",
"def wait_to_load\n activity_div.wait_until(&:exists?)\n @page = @bank_page.load_page\n end",
"def wait_for_ready(wait: 10)\n Support::Waiter.wait_until(max_duration: wait, reload_page: false, raise_on_failure: true) do\n ready?\n end\n end",
"def wait_for_page_to_load\n @wait_on.each { |element| wait_for_element(element) }\n loading_message.wait_while_present if loading_message.present?\n true\n rescue\n false\n end",
"def wait_page_load\n @browser.wait_for_load\n end",
"def wait_for_ready\n sleep 0.1 until ready?\n end",
"def confirm_on_page\n @browser.div(class: 'home').wait_until_present(5)\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def wait_for_page_and_verify_text(text)\n @selenium.wait_for_page_to_load(120000)\n check_page_and_verify_text(text)\n end",
"def wait_for_visible(locator, options={})\n builder = JavascriptExpressionBuilder.new\n wait_for_condition builder.visible(locator).script, options[:timeout_in_seconds]\n end",
"def wait_for_render(how, what)\n @wait.until {element_visible?(how, what)}\n end",
"def wait_visible!(timeout=@wait)\n self.el\n wait_for(timeout: timeout, message: \"Element at #{location} is not visible\") { visible? }\n end",
"def wait_until_page_loads(path)\n @wait.until { @driver.current_url == path}\n @wait.until { @driver.execute_script('return PAGE_RENDERED;') == true }\n $verbose ? puts(\"#{path} successfully loaded\") : nil\n end",
"def publish_wait\n page.wont_have_css 'publish-spinner'\n end",
"def wait_loading\n puts \"[BrowserOperator] wait_loading\" << '..' * 10\n browser.div(:id, 'pageLoading').wait_while_present()\n end",
"def wait_for_page_to_load(page)\n Logbook.message(\"Waiting for page #{page} to load...\")\n wait_for do\n @browser.execute_script(\"return document.querySelector('link[rel=\\\"icon\\\"]') !== null\")\n end\n end",
"def loading_wait\n \tcase ENV['BROWSER']\n \twhen \"iphone\",\"ipad\",\"android_phone\",\"android_tablet\" then\n \t\tWatir::Wait.until {\n \t\tnot @browser.element(xpath: '//div[contains(@class, \"load\")]').visible?\n \t\t}\n \telse\n \t\tWatir::Wait.until {\n \t\tnot @browser.iframe(:id, 'quote-frame').div(xpath: '//div[contains(@id, \"load\")]').visible?\n \t\t}\n \tend\n \tend",
"def wait_for_pdf_window(string)\n Timeout.timeout(Nenv.browser_timeout) do\n loading = true\n while loading\n check = url_match(string, RouteHelper.browser.windows.last.use.url)\n loading = false if check\n sleep(1)\n end\n return true\n end\n rescue Timeout::Error => e\n raise \"Timeout waiting for window to load - #{e}\"\n exit\n end",
"def wait_for_visible(locator)\n wait_for { find_element(locator).displayed? }\n end",
"def wait_for_element_to_be_visible(id, name, time)\n begin\n wait = [60, time].max\n element = get_element(id, name)\n !wait.times {\n break if element.displayed?\n sleep 1\n }\n rescue\n end\nend",
"def click_wait\n @webpage.click_wait(@locator)\n end",
"def wait_visible!(timeout=@wait)\n wait_for(timeout: timeout, message: \"Element at #{locator} is not visible\") { visible? }\n end",
"def wait_for_dom_has_loaded\n Capybara.default_max_wait_time = 40\n Timeout.timeout(Capybara.default_max_wait_time) do\n loop until page_has_loaded?\n end\n end",
"def wait_for_page_title()\n wait_for :page_title, \"Error waiting for page title to load\"\n end",
"def wait_for_page_title()\n wait_for :page_title, \"Error waiting for page title to load\"\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end",
"def wait_for_freelancer_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, FREELANCER_SKILLS)\n end",
"def wait\n true\n end",
"def wait\n sleep 0.0001\n end",
"def wait_for_page_to_load timeout\r\n command 'waitForPageToLoad', timeout\r\n end",
"def wait_for_page_to_load timeout\r\n command 'waitForPageToLoad', timeout\r\n end",
"def wait_for_ajax_complete\n wait_until { page.evaluate_script 'jQuery.active == 0' rescue true }\n end",
"def wait_for_shibboleth_form()\n wait_for :shibboleth_form, \"Error waiting for pds\"\n end",
"def wait_for_shibboleth_form()\n wait_for :shibboleth_form, \"Error waiting for pds\"\n end",
"def continue_when_ready\n wait_until(5, \"Continue element not visible in 5 seconds\") do\n continue_element.visible? \n end\n continue\n end",
"def wait_for_progress\n sleep 2\n wait_for(timeout: 60) { element_does_not_exist \"* marked:'#{loading_screen}'\" }\n end",
"def show_read\n find('#show-read').click\n\n # Ensure entries have finished loading\n expect(page).to have_no_css 'div#loading'\nend",
"def test_document_server(url)\n test_name = \"Test Document Server Connection\"\n puts test_name\n get_website(url)\n login_as_guest_test\n if @browser.find_element(:css=>'.focus') #Dismisses the splashscreen if present\n @wait.until{@browser.find_element(:css=>'.focus')}.click\n end\n login_toolshelf_button_test\n login_test\nend",
"def verify_if_searchresult_page_is_shown\n handle_captcha\n wait_until_element_displays(SEARCH_RESULT_CLEAR_BTN,15)\n puts \"Search Result is shown\"\n storeResultsInHash\n end",
"def wait(last_url = nil)\r\n #puts \"In wait function \"\r\n isLoadingDocument = \"\"\r\n start = Time.now\r\n \r\n while isLoadingDocument != \"false\"\r\n isLoadingDocument = js_eval(\"#{BROWSER_VAR}=#{WINDOW_VAR}.getBrowser(); #{BROWSER_VAR}.webProgress.isLoadingDocument;\")\r\n #puts \"Is browser still loading page: #{isLoadingDocument}\"\r\n \r\n # Derek Berner 5/16/08\r\n # Raise an exception if the page fails to load\r\n if (Time.now - start) > 300\r\n raise \"Page Load Timeout\"\r\n end\r\n end\r\n # Derek Berner 5/16/08\r\n # If the redirect is to a download attachment that does not reload this page, this\r\n # method will loop forever. Therefore, we need to ensure that if this method is called\r\n # twice with the same URL, we simply accept that we're done.\r\n $jssh_socket.send(\"#{BROWSER_VAR}.contentDocument.URL;\\n\", 0)\r\n url = read_socket()\r\n \r\n if(url != last_url)\r\n # Check for Javascript redirect. As we are connected to Firefox via JSSh. JSSh\r\n # doesn't detect any javascript redirects so check it here.\r\n # If page redirects to itself that this code will enter in infinite loop.\r\n # So we currently don't wait for such a page.\r\n # wait variable in JSSh tells if we should wait more for the page to get loaded\r\n # or continue. -1 means page is not redirected. Anyother positive values means wait.\r\n jssh_command = \"var wait = -1; var meta = null; meta = #{BROWSER_VAR}.contentDocument.getElementsByTagName('meta');\r\n if(meta != null)\r\n {\r\n var doc_url = #{BROWSER_VAR}.contentDocument.URL;\r\n for(var i=0; i< meta.length;++i)\r\n {\r\n\t\t\t\t\t\t \t\t\tvar content = meta[i].content;\r\n\t\t\t\t\t\t\t \t\tvar regex = new RegExp(\\\"^refresh$\\\", \\\"i\\\");\r\n\t\t\t\t\t\t\t\t \tif(regex.test(meta[i].httpEquiv))\r\n\t\t\t\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\t\t\t\t var arrContent = content.split(';');\r\n \t\t\t\t\t\t\t\t\t\tvar redirect_url = null;\r\n\t \t\t\t\t\t\t\t\t\tif(arrContent.length > 0)\r\n\t\t \t\t\t\t\t\t\t\t{\r\n\t\t\t \t\t\t\t\t\t\t\tif(arrContent.length > 1)\r\n\t\t\t\t \t\t\t\t\t\t\t\tredirect_url = arrContent[1];\r\n\t \r\n\t\t\t\t\t\t\t \t\t\t\tif(redirect_url != null)\r\n\t\t\t\t\t\t \t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t \t\t\t\tregex = new RegExp(\\\"^.*\\\" + redirect_url + \\\"$\\\");\r\n\t\t\t\t\t\t\t\t\t \t\t\tif(!regex.test(doc_url))\r\n\t\t\t\t\t\t\t\t\t\t \t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t \t\twait = arrContent[0];\r\n\t\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t\t\t break;\r\n\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t }\r\n }\r\n wait;\"\r\n #puts \"command in wait is : #{jssh_command}\" \r\n jssh_command = jssh_command.gsub(/\\n/, \"\")\r\n $jssh_socket.send(\"#{jssh_command}; \\n\", 0)\r\n wait_time = read_socket();\r\n #puts \"wait time is : #{wait_time}\"\r\n begin\r\n wait_time = wait_time.to_i\r\n if(wait_time != -1)\r\n sleep(wait_time)\r\n # Call wait again. In case there are multiple redirects.\r\n $jssh_socket.send(\"#{BROWSER_VAR} = #{WINDOW_VAR}.getBrowser(); \\n\",0)\r\n read_socket()\r\n wait(url)\r\n end \r\n rescue\r\n end\r\n\t\t\tend\r\n set_browser_document()\r\n run_error_checks()\r\n return self\r\n end",
"def Wait_For_Element(locator_type, locator_value)\n for iSecond in 0..$config['Longwait']\n sleep 1\n if(@driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?)\n\tbreak\n else \t\n if (iSecond >= $config['Longwait']) \n return false\n @driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?\n break\n end\n end \n end\n return true\nend",
"def wait_to_appear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def wait_for_element_to_load(locator)\n sleep 1\n puts \"Waiting for this locator to be visible on the page: #{locator}\"\n if isElementVisible(locator)\n return true\n else\n raise Selenium::WebDriver::Error::NoSuchElementError\n end\n sleep 1\n end",
"def wait_for_landing_page_load(timeout_ms = 1000)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n $tracer.trace(current_method_name)\n sleep timeout_ms/1000 # ruby sleep is in seconds\n return nil\n end",
"def wait_page_load()\n rc = nil\n Log.Debug(:h5, \"[#{self.class.to_s}.WAIT_PAGE_LOAD]\") {\n _check_repl_lock\n _compile_wait_page_load\n rc = exec\n rc = (rc.is_str? and rc.include?(READY_STATE_COMPLETE)) ? true : false\n }\n Log.Debug \"{#{self.class.to_s}.wait_page_load} :=> #{rc.safe_s}\"\n rc\n end",
"def wait_until_loaded(element)\n navigation = AppletCarousel.instance\n navigation.wait_until_action_element_visible(element, 60)\nend",
"def wait\n sleep WAIT_TIME unless @skip_wait\n end",
"def wait_for_recommended_page_load\n exp_text = 'Recommended for you'\n get_element(:xpath, \"//*[contains(text(), '#{exp_text}')]\")\n end",
"def wait_for_e(xpath)\n $browser.element(:xpath => xpath).wait_until(&:present?)\nend",
"def go_back_and_wait\n go_back\n assert_page_loaded\n end",
"def wait_for\n wait = Selenium::WebDriver::Wait.new(:timeout => 1000)\n wait.until { yield(@session) }\n end",
"def wait_page_load(criteria,value,expected_element_text,seconds_wait)\r\n\t \t\ttext_on_page = @driver.find_element(criteria.to_sym, value).text\r\n\t \t\twait_for(seconds_wait) { text_on_page.include?(expected_element_text)}\r\n\t \tend",
"def wait; end",
"def wait; end",
"def wait; end",
"def wait_for_ajax\n counter = 0\n while page.execute_script(\"return $.active\").to_i > 0\n counter += 1\n sleep(0.1)\n raise \"AJAX request took longer than 20 seconds.\" if counter >= 400\n end\n end",
"def wait_for_ajax\n # create inatnce of Wait provided by Selenium, time set to 60 secs or until AJAX requests == 0.\n Selenium::WebDriver::Wait.new(:timeout => 60).until do\n sleep 1\n @fox_driver.execute_script(\"return jQuery.active\") == 0\n end\n end",
"def wait_for_welcome_screen\n wait_for_elements_exist([trait])\n end",
"def wait *xpaths, &block\n #todo 3 raise_if_site_too_slow if respond_to?(:raise_if_site_too_slow)\n common_wait *xpaths, &block\n end",
"def wait_before_and_after\r\n wait_for_browser\r\n yield\r\n wait_for_browser\r\n end",
"def wait_for_ajax(&block)\n wait_until do\n page.driver.browser.execute_script(<<-JS)\n return !Ext.Ajax.isLoading();\n JS\n end\n yield\n end",
"def wait_for_element(element)\n @wait.until {\n bool = false\n\n if(element.displayed?)\n bool = true\n @element = element\n break\n end \n\n bool == true\n }\n end",
"def ajax_wait_for_element(element_id, seconds, status='show', check_interval = $testwise_polling_interval)\r\n count = 0\r\n check_interval = 1 if check_interval < 1 or check_interval > seconds\r\n while count < (seconds / check_interval) do\r\n search_indicator = @web_browser.element_by_id(element_id)\r\n search_indicator_outer_html = search_indicator.outerHtml if search_indicator\r\n if status == 'hide'\r\n return true if search_indicator_outer_html and !search_indicator_outer_html.include?('style=\"DISPLAY: none\"')\r\n else\r\n return true if search_indicator_outer_html and search_indicator_outer_html.include?('style=\"DISPLAY: none\"')\r\n end\r\n sleep check_interval if check_interval > 0 and check_interval < 5 * 60 # wait max 5 minutes\r\n count += 1\r\n end\r\n return false\r\n end",
"def wait_until_page_loaded(page_name, prev_url)\n time_secs = 0\n while Capybara.current_session.current_url == prev_url\n break if time_secs > PAGE_TIMEOUT_SECS\n sleep 1\n time_secs+=1\n end\n fail \"ERROR: Page #{page_name} failed to load after #{PAGE_TIMEOUT_SECS} secs\" if Capybara.current_session.current_url == prev_url\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def initialize\n # Wait for the page to be displayed with 30 seconds timeout\n raise 'The page was not loaded' unless self.displayed?(30)\n end",
"def waitForLoader\n element = @driver.find_element(:css, 'html')\n 45.times {\n if !element.attribute('css').include?(PAGELOADER_ELEMENT) # provide the loader class\n return\n else\n sleep 1\n end\n }\n raise 'Loading Spinner Timeout'\n end",
"def wait_not_visible!(timeout=@wait)\n self.el\n wait_for(timeout: timeout, message: \"Element at #{location} is still visible\") { !visible? }\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def wait_until_not_full; end",
"def wait!\n sleep(@sleep)\n end",
"def waitforCssAttributeToLoad(cssAttribute)\n !30.times{ break if (isElementVisible(:css, cssAttribute) == true); sleep 0.5 }\n end",
"def wait_until_displayed(element, timeout=10)\n wait_until(timeout) { element.displayed? }\nend",
"def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end",
"def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end",
"def wait_for_no_spinner\n sleep 0.01\n within(:xpath, '//html/body') do\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.fa-spinner' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.fa-spin' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.blockUI' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.blockMsg' }\n SitePrism::Waiter.wait_until_true { page.has_no_css? '.blockPage' }\n end\n sleep 0.01\n end",
"def wait_until timeout=10, &block\n wait = Selenium::WebDriver::Wait.new(:timeout => timeout)\n wait.until &block\nend",
"def waiting; end",
"def waiting; end",
"def open_and_wait( location)\n selenium.open(location)\n wait_for_page_to_load\n end",
"def wait\n\tend",
"def wait_for\n subject = nil\n wait.until { (subject = yield).displayed? }\n sleep(1.2) # FIXME: wait animations to complete\n subject\n end",
"def success_confirm_address_hp\n\tsleep 5\n\t page.has_content?('Su dirección ha sido guardada exitosamente')\nend",
"def wait_for_animation\n Selenium::WebDriver::Wait.new(:timeout => 60).until do\n sleep 1\n # jQuery(':animated').length is used to knwo how many animations are in the page\n @fox_driver.execute_script(\"return jQuery(':animated').length\") == 0\n end\n end",
"def ajax_wait_for_element(element_id, seconds, status='show', check_interval = @@default_polling_interval)\n count = 0\n check_interval = 1 if check_interval < 1 or check_interval > seconds\n while count < (seconds / check_interval) do\n search_indicator = @web_browser.element_by_id(element_id)\n search_indicator_outer_html = search_indicator.outerHtml if search_indicator\n if status == 'hide'\n return true if search_indicator_outer_html and !search_indicator_outer_html.include?('style=\"DISPLAY: none\"')\n else\n return true if search_indicator_outer_html and search_indicator_outer_html.include?('style=\"DISPLAY: none\"')\n end\n sleep check_interval if check_interval > 0 and check_interval < 5 * 60 # wait max 5 minutes\n count += 1\n end\n return false\n end",
"def wait_for_animations()\n wait_until { page.evaluate_script('$(\":animated\").length') == 0 }\nend",
"def wait_until_zero(js)\n wait_until { page.evaluate_script(js).zero? }\n end",
"def wait_for_modal_hidden\n wait_until { !page.find(modal_id).visible? }\nrescue Capybara::TimeoutError\n flunk 'Expected modal to be visible.'\nend",
"def wait_for_modal_visible\n wait_until { page.find(modal_id).visible? }\nrescue Capybara::TimeoutError\n flunk 'Expected modal to be visible.'\nend",
"def wait_for_url(url)\n wait_for { current_url.include?(url) }\n end",
"def wait_for_progress\n sleep 2\n wait_for_element_does_not_exist(\"* id:'#{loading_screen}'\",\n timeout: 60)\n end",
"def wait_not_visible!(timeout=@wait)\n wait_for(timeout: timeout, message: \"Element at #{locator} is still visible\") { !visible? }\n end",
"def wait_until\n Timeout.timeout(Capybara.default_wait_time) do\n loop until yield\n end\n end"
] |
[
"0.76040167",
"0.72971225",
"0.71547556",
"0.71169984",
"0.70667595",
"0.69891137",
"0.66882175",
"0.6648524",
"0.6646172",
"0.6641512",
"0.6608792",
"0.65810823",
"0.6574439",
"0.6566478",
"0.65220696",
"0.65143555",
"0.6474001",
"0.64476734",
"0.64396656",
"0.64186007",
"0.63922167",
"0.63908154",
"0.63812953",
"0.6378689",
"0.63784796",
"0.63784796",
"0.63748926",
"0.63438493",
"0.6333964",
"0.6321713",
"0.6312216",
"0.6312216",
"0.6270557",
"0.6264399",
"0.6262265",
"0.62526125",
"0.6223363",
"0.6217881",
"0.6189153",
"0.6176651",
"0.616413",
"0.61529934",
"0.61456627",
"0.61450803",
"0.613938",
"0.61337787",
"0.6131761",
"0.6131441",
"0.61279655",
"0.61268926",
"0.61089796",
"0.6089118",
"0.6072943",
"0.60706276",
"0.60706276",
"0.60706276",
"0.6070181",
"0.6068519",
"0.6067373",
"0.6060318",
"0.60518223",
"0.6048803",
"0.6034795",
"0.6030123",
"0.6022867",
"0.60218245",
"0.60218245",
"0.60218245",
"0.60218245",
"0.60218245",
"0.60218245",
"0.60218245",
"0.60218245",
"0.6005937",
"0.6005673",
"0.5992381",
"0.59882754",
"0.5985541",
"0.59830636",
"0.59582627",
"0.59507215",
"0.59507215",
"0.5949469",
"0.5944604",
"0.59439707",
"0.59439707",
"0.59412944",
"0.5938431",
"0.5936238",
"0.59107167",
"0.590832",
"0.5899918",
"0.58990127",
"0.58908075",
"0.5887228",
"0.5877831",
"0.58732945",
"0.58634335",
"0.58607596",
"0.58552366"
] |
0.8818552
|
0
|
This function wait for Freelancer Skills to Be displayed
|
def wait_for_freelancer_skills_displayed
wait_for_element_present@driver.find_elements(:xpath, FREELANCER_SKILLS)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def wait_for_freelancer_page_visible\n sleep 15\n end",
"def wait_for_company_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, COMPANY_SKILLS)\n end",
"def is_freelancer_skills_displayed\n @driver.find_element(:xpath, FREELANCER_SKILLS).displayed?\n end",
"def flash_card_th_wait\n\n #Terminal flash card thread, if running\n Thread.list.each {|t|\n if t[:thread_method_name].to_s == \"flash_card_th\"\n $test_logger.log(\"Waiting for flash card thread..\")\n #Wait for thread to exit\n t.join\n $test_logger.log(\"Flash card thread completed!\")\n end\n }\n\n end",
"def wait_for_shibboleth_form()\n wait_for :shibboleth_form, \"Error waiting for pds\"\n end",
"def wait_for_shibboleth_form()\n wait_for :shibboleth_form, \"Error waiting for pds\"\n end",
"def wait_for_welcome_screen\n wait_for_elements_exist([trait])\n end",
"def wait_for_launching\n sleep @delay\n end",
"def wait_for_elements\n super\n @wait_on << :return_button\n @wait_on << :circulation_desk_selector\n end",
"def wait\n true\n end",
"def wait_to_appear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def wait\n sleep 0.0001\n end",
"def wait_for_browser\r\n # NOTE: no need any more\r\n end",
"def wait_alert_accept_if_exist\n sleep 1.5 #should wait animation\n wait_true(timeout: 30, message: 'waiting alert dialog via wait_alert_accept_until_display_alert') {\n execute_script('$.mainApp().alert().buttons().length > 0')\n }\n alert_accept_if_exist\n end",
"def notification_confirm\n wait = Selenium::WebDriver::Wait.new(timeout: 5)\n wait.until {\n @driver.find_element(id: 'flash-messages').displayed?\n }\nend",
"def wait; end",
"def wait; end",
"def wait; end",
"def wait_for_page\n sleep 0.7\n end",
"def wait_for_ready\n sleep 0.1 until ready?\n end",
"def wait_for_prompt\n while !@prompted do\n sleep(0.2)\n end\n end",
"def wait_until_loaded(element)\n navigation = AppletCarousel.instance\n navigation.wait_until_action_element_visible(element, 60)\nend",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def wait_for_skill_sequence\n tsbs_wait_update\n tsbs_wait_update while @spriteset.skill_busy?\n end",
"def wait_for_progress\n sleep 2\n wait_for(timeout: 60) { element_does_not_exist \"* marked:'#{loading_screen}'\" }\n end",
"def waiting; end",
"def waiting; end",
"def wait_for_callback\n @turnstile.wait unless @paused\n end",
"def wait_for_callback\n turnstile.wait unless paused\n end",
"def wait_for_elements\n super\n @wait_on << :continue_button\n end",
"def wait_until_open_confirmed; end",
"def loading_wait\n \tcase ENV['BROWSER']\n \twhen \"iphone\",\"ipad\",\"android_phone\",\"android_tablet\" then\n \t\tWatir::Wait.until {\n \t\tnot @browser.element(xpath: '//div[contains(@class, \"load\")]').visible?\n \t\t}\n \telse\n \t\tWatir::Wait.until {\n \t\tnot @browser.iframe(:id, 'quote-frame').div(xpath: '//div[contains(@id, \"load\")]').visible?\n \t\t}\n \tend\n \tend",
"def wait_to_disappear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and !element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def wait\n\tend",
"def wait_for_recommended_page_load\n exp_text = 'Recommended for you'\n get_element(:xpath, \"//*[contains(text(), '#{exp_text}')]\")\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def wait_until_not_full; end",
"def clickOnSpeakers()\n el= @driver.find_element(:css, \"a.x-btn-speakers\")\n el.click\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until { @driver.find_element(:css => \"span.speaker-tag\").displayed? }\n end",
"def options_when_walking_away_from_desk\n# letting user know whats happening with the door\n puts \"\\nYou walk to the door and... \"\n sleep(2)\n if $items_collected.include?(\"key\") then\n puts \"You use the key to open the door\"\n sleep(2)\n opened_the_door_walked_outside\n else !$items_collected.include?(\"key\")\n puts \"Sorry you dont have the key, go back to the desk!\\n\\n\"\n sleep(2)\n remove_last_item_from_items_collected_at_desk\n end\nend",
"def wait_done\n sleep 0.01 until done?\n end",
"def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end",
"def click_on_free_trial\n\t\t\tself.free_trial_button\n\t\tend",
"def search_for_proffesional()\r\n @search_dropdown.is_element_present_with_wait?()\r\n @search_dropdown.click()\r\n end",
"def contact_info_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(CONTACT_INFO_TAB).displayed?}\n contact_info_tab = @driver.find_element(CONTACT_INFO_TAB)\n contact_info_tab.click\n end",
"def pause_for_poller\n logger.info \"Waiting for the Canvas poller for #{wait = Utils.canvas_poller_wait} seconds\"\n sleep wait\n end",
"def continue_when_ready\n wait_until(5, \"Continue element not visible in 5 seconds\") do\n continue_element.visible? \n end\n continue\n end",
"def wait_to_load\n activity_div.wait_until(&:exists?)\n @page = @bank_page.load_page\n end",
"def ready_player\n waiting_for_next_player = true\n invalid_ready = nil\n\n while waiting_for_next_player\n DisplayManager.prepare_ingame_display\n show_state(true)\n puts \"It's #{@current_player.name}'s turn! Are you #{@current_player.name}?\"\n puts InputManager.input_options({ affirmative: 'Yes! Display my Rack'}, invalid_ready)\n invalid_ready = nil\n\n response = InputManager.get\n\n if InputManager.affirmative?(response)\n waiting_for_next_player = false\n elsif InputManager.negative?(response)\n # do nothing\n else\n invalid_ready = response\n end\n end \n\n DisplayManager.prepare_ingame_display\n end",
"def app_sign_city_wait\r\n wait_for_appSignCity\r\n puts 'ERROR:NbLifeApplication: new life app elements not visible' unless (has_appSignCity? && appSignCity.visible?)\r\n end",
"def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mobilkies not nahodyatsya, smeni prices epta')\n end\n $driver.manage.timeouts.implicit_wait = 10\n end",
"def wait_for\n subject = nil\n wait.until { (subject = yield).displayed? }\n sleep(1.2) # FIXME: wait animations to complete\n subject\n end",
"def wait_for_panel\n puts \"Waiting for panel...\"\n RPi::GPIO.wait_for_edge(@busy, :falling)\n puts \"Panel is done!\"\n end",
"def simu_finger_th_wait\n wait_for_thread \"simu_finger_order_th\"\n end",
"def check_profile_attributes_match\n wait_for { displayed?(TITLES) }\n titles_array = get_array(TITLES)\n # @@n variable is a random integer that is used as index for selecting only one of the titles elements array\n @@n = rand(0...9)\n log \"STEP 9: Click on random freelancer's title.\"\n # For scrolling the page to the randomly selected title element it uses javascript executor instead of actions\n execute_script_on_element \"arguments[0].scrollIntoView(true);\", titles_array[@@n.to_i]\n # This fixed explicit sleep ensures reliability after scrolling and clicking on the element\n sleep 5\n log \"STEP 10: Get into that freelancer's profile (by clicking on desired Freelancer's title).\"\n # Following the same logic and strategy for scrolling, we use again this method for click\n execute_script_on_element \"arguments[0].click();\", titles_array[@@n.to_i]\n\n # After clicking on the freelancer's title we wait until the slide window is open and freelancer profile elements are present\n wait_for { displayed?(DESCRIPTION) }\n description = text_of(DESCRIPTION)\n log \"STEP 11: Check that each attribute value is equal to one of those stored in the structure created in STEPS 7 and 8.\"\n log \"STEP 12: Check whether at least one attribute contains #{$keyword}.\"\n\n if (description.to_s.eql? @@array[@@n.to_i][:description].to_s)\n $test_result = false\n error \"ERROR!!! => Description differs between profiles search results and freelancer profile for #{@@array[@@n.to_i][:name].to_s}.\"\n end\n wait_for { displayed?(TITLE) }\n description = text_of(TITLE)\n if (description.to_s.eql? @@array[@@n.to_i][:description].to_s)\n $test_result = false\n error \"ERROR: Title differs between profiles search results and freelancer profile for #{@@array[@@n.to_i][:name].to_s}.\"\n end\n end",
"def redirectToAvailability\n EnziUIUtility.wait(@driver, :id, 'MoreTabs_Tab', 100)\n @driver.find_element(id: 'MoreTabs_Tab').click\n @driver.find_element(:link, 'Reservable').click\n #sleep(10)\n end",
"def wait_for_element_to_be_visible(id, name, time)\n begin\n wait = [60, time].max\n element = get_element(id, name)\n !wait.times {\n break if element.displayed?\n sleep 1\n }\n rescue\n end\nend",
"def wait_for_effect_on(selector)\n wait_until_zero(\"$('#{selector}').queue().length\")\n end",
"def wait_until_displayed(element, timeout=10)\n wait_until(timeout) { element.displayed? }\nend",
"def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end",
"def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end",
"def contacts_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(CUSTOMER_CONTACTS_TAB).displayed?}\n contacts_tab = @driver.find_element(CUSTOMER_CONTACTS_TAB)\n contacts_tab.click\n end",
"def login_toolshelf_button_test\n #Click on Login as Guest button\n @login_toolshelf_button = @wait.until{@browser.find_element(:css=> '.dg-toolshelflogin-button')}\n\n if @login_toolshelf_button\n puts \"Found Login button on Toolshelf\"\n @login_toolshelf_button.click\n puts \"Just clicked the Login on Toolshelf button\"\n else\n puts \"Login button on Toolshelf not found\"\n end\nend",
"def click_on_freelancer_profile\n puts \"Step 9: Click on Freelancer Profile\"\n $freelancer.find_elements(css: \"a.freelancer-tile-name\").last.click\n puts \"Freelancer Profile clicked successfully\"\n\n end",
"def verifyInformationScreen()\n clickOnMoreTab()\n clickOnInformation()\n verifyMeeting()\n end",
"def is_company_skills_displayed\n @driver.find_element(:xpath, COMPANY_SKILLS).displayed?\n end",
"def finish_turn\n waiting_to_confirm_done = true\n invalid_confirmation = nil\n\n while waiting_to_confirm_done\n DisplayManager.prepare_ingame_display\n show_state\n puts 'Done! Your turn is now over.'\n puts InputManager.input_options({ affirmative: 'Hide my Rack'}, invalid_confirmation)\n invalid_confirmation = nil\n \n response = InputManager.get\n\n if InputManager.affirmative?(response)\n waiting_to_confirm_done = false\n elsif InputManager.negative?(response)\n # do nothing, wait\n else\n invalid_confirmation = response\n end\n end \n\n DisplayManager.prepare_ingame_display\n end",
"def test_document_server(url)\n test_name = \"Test Document Server Connection\"\n puts test_name\n get_website(url)\n login_as_guest_test\n if @browser.find_element(:css=>'.focus') #Dismisses the splashscreen if present\n @wait.until{@browser.find_element(:css=>'.focus')}.click\n end\n login_toolshelf_button_test\n login_test\nend",
"def open_profile_menu\n id(\"profile_menu_btn\").wait_until(&:present?)\n id(\"profile_menu_btn\").click\n @browser.nav(css: \".drop_menu_nav.active\").wait_until(&:present?)\n sleep 1\n end",
"def confirm_on_page\n @browser.div(class: 'home').wait_until_present(5)\n end",
"def create_wait_for_play_screen\r\n @log.error \"create_wait_for_play_screen: not implemented\\n\"\r\n end",
"def wait_for_shutdown\n until powered_off? do\n print \"Waiting for #{@vbox_name} to be finished shutdown...\\n\" if @verbose\n sleep 3\n end\n end",
"def flash_and_ensure_click(dom_element)\n dom_element.wait_until(&:present?)\n dom_element.flash\n dom_element.click\nend",
"def wait_for_ajax_complete\n wait_until { page.evaluate_script 'jQuery.active == 0' rescue true }\n end",
"def verify_if_searchresult_page_is_shown\n handle_captcha\n wait_until_element_displays(SEARCH_RESULT_CLEAR_BTN,15)\n puts \"Search Result is shown\"\n storeResultsInHash\n end",
"def cook_sink_eat\n delay = 4\n refresh\n HowMuch.amount(6) if click_on 'Mix/Add Honey'\n sleep delay\n refresh\n HowMuch.amount(1) if click_on 'Mix/Add Coconut'\n\n sleep delay\n refresh\n click_on 'Cook'\n popup = PopupWindow.find\n popup.click_on 'OK' if popup\n sleep delay\n\n # Eat!\n refresh\n click_on 'Enjoy'\n sleep delay\n end",
"def restrictions_option_popup_present?\n until @browser.section(:id, 'update-page-restrictions-dialog').exists? do\n sleep 1\n end\n # for some reason the div never appeared as visible, only existing, and only becamne existing when the functionality\n # was invoked. Given this the only ways to validate presence was to check the z access it the style attribute or the exist? flag\n # neither of which i like very much and would like to discuss a better solution with developers as html implementation may be causing issues.\n expect(@browser.div(:id, 'update-page-restrictions-dialog').attribute_value('style')).to include('z-index: 3000')\n # or\n expect(@browser.div(:id, 'update-page-restrictions-dialog').exist?).to eq(true)\nend",
"def wait_for_element(element)\n @wait.until {\n bool = false\n\n if(element.displayed?)\n bool = true\n @element = element\n break\n end \n\n bool == true\n }\n end",
"def wait!\n sleep(@sleep)\n end",
"def wait_until_present(context=nil)\n adapter.window.wait_until_present context\n end",
"def wait_for_ui_to_update\n sleep(UI_UPDATE_DELAY)\nend",
"def show_menu\n clear_screen\n\n puts \"[+] #{FreelancerFinder::Job.all.count} Jobs Scraped [+]\".magenta\n puts \"_____________________________________________________________\"\n return @prompt.select(\"Please Select a Menu Option: \") do |menu|\n menu.choice \"show recent\"\n menu.choice \"scrape more\"\n menu.choice \"search\"\n menu.choice \"search by pay\"\n if @last_results\n menu.choice \"results\"\n end\n menu.choice \"exit\"\n end\n\n end",
"def wait_for_provisioning\n while !self.provisioned?\n sleep Profitbricks::Config.polling_interval\n end\n end",
"def login_clark\n top_login_button.click\n login_page.text\n \n user_email.send_keys($test_data['prod_email'])\n user_password.send_keys($test_data['prod_password'])\n\n login_button.click\n sleep 3\n profile_displayed\n end",
"def wait_for_element_disappear(time)\n spinner=@driver.find_element(SPINNER)\n wait=Selenium::WebDriver::Wait.new(:timeout=>time)\n wait.until {\n !spinner.displayed?\n }\n end",
"def wait_for_page_to_load\n @wait_on.each { |element| wait_for_element(element) }\n loading_message.wait_while_present if loading_message.present?\n true\n rescue\n false\n end",
"def faab?\n free_agent? && !waiver_bid.nil?\n end",
"def show_read\n find('#show-read').click\n\n # Ensure entries have finished loading\n expect(page).to have_no_css 'div#loading'\nend",
"def wait\n sleep WAIT_TIME unless @skip_wait\n end",
"def wait_for_render(how, what)\n @wait.until {element_visible?(how, what)}\n end",
"def start\r\n #$driver=Selenium::WebDriver::Chrome::Service.driver_path=\"./Drivers/chromedriver\"\r\n $driver = Selenium::WebDriver.for :chrome\r\n $driver.get('https://lola-protected:LoLa_Access_4_Devsonly@app-staging.locationlive.co.uk/')\r\n #$driver.switch_to.window($driver.window_handles[1])\r\n $driver.manage.window.maximize\r\n $wait = Selenium::WebDriver::Wait.new(timeout:10)\r\n $wait.until{$driver.find_element(:id,\"sign-in-popover\").displayed? }\r\nend",
"def wait_for_active\n until details['status'] == 'ACTIVE'\n log \"Not online yet. Waiting...\"\n sleep 10\n end\n end",
"def Wait_For_Element(locator_type, locator_value)\n for iSecond in 0..$config['Longwait']\n sleep 1\n if(@driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?)\n\tbreak\n else \t\n if (iSecond >= $config['Longwait']) \n return false\n @driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?\n break\n end\n end \n end\n return true\nend",
"def question_pools\n #puts \"clicking question pools\"\n #10.times {frm.link(:text=>\"Question Pools\").flash}\n frm.link(:text=>\"Question Pools\").click\n #sleep 200\n #puts \"clicked...\"\n #frm.link(:text=>\"Add New Pool\").wait_until_present\n #frm.h3(:text=>\"Question Pools\").wait_until_present(120)\n QuestionPoolsList.new(@browser)\n end",
"def jobs_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(JOBS_TAB).displayed?}\n jobs_tab = @driver.find_element(JOBS_TAB)\n jobs_tab.click\n end",
"def jobs_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(JOBS_TAB).displayed?}\n jobs_tab = @driver.find_element(JOBS_TAB)\n jobs_tab.click\n end",
"def show_tab(name)\n @log.debug \" show_tab: Waiting up to #{DEFAULT_TIMEOUT} seconds to find_element(:xpath, \\\"//input[@title='open #{name}']\\\")...\"\n wait = Selenium::WebDriver::Wait.new(:timeout => DEFAULT_TIMEOUT)\n wait.until { driver.find_element(:xpath, \"//input[@title='open #{name}']\") }\n @driver.find_element(:xpath, \"//input[@title='open #{name}']\").click\n pause\n end",
"def wait_for_effects(timeout = 30)\n wait_for(timeout) { @browser.document.js_eval(\"document.defaultView.Effect.Queue.size()\").to_i == 0 }\n end",
"def game_finder\n puts\n puts \"Looking For An Empty Lobby!\"\n sleep(3)\n puts \"Oh Look, Game 1 Is Empty\"\n #Futrue version will display all empty games\n #Seeker will then start each round\nend",
"def wait_for_shutdown\n @rufus.join\n end"
] |
[
"0.7320436",
"0.6873017",
"0.6355161",
"0.63391227",
"0.61390126",
"0.6137762",
"0.6122016",
"0.6011918",
"0.59464854",
"0.59044504",
"0.5866783",
"0.585784",
"0.5830147",
"0.5822819",
"0.5813866",
"0.5791037",
"0.5791037",
"0.5791037",
"0.5778776",
"0.5774143",
"0.5770044",
"0.576972",
"0.57379895",
"0.5728035",
"0.57051146",
"0.57037365",
"0.57037365",
"0.5658926",
"0.5650144",
"0.5637273",
"0.56309485",
"0.56169",
"0.5610701",
"0.5608712",
"0.5602629",
"0.5600723",
"0.5590199",
"0.5589317",
"0.55864424",
"0.5585706",
"0.5585275",
"0.5574224",
"0.5573197",
"0.55703104",
"0.5562348",
"0.5561833",
"0.5560976",
"0.55560493",
"0.5552339",
"0.5537069",
"0.5535963",
"0.55339617",
"0.55312604",
"0.5503822",
"0.55019355",
"0.54873544",
"0.5485166",
"0.5479855",
"0.54784757",
"0.5476561",
"0.5476561",
"0.54749465",
"0.5474137",
"0.54634917",
"0.5459869",
"0.5458418",
"0.5458303",
"0.5457878",
"0.5453777",
"0.54536116",
"0.5447379",
"0.5446756",
"0.54437697",
"0.5437309",
"0.54287994",
"0.54237205",
"0.5422847",
"0.5420907",
"0.5412032",
"0.54116434",
"0.53887457",
"0.5387183",
"0.53843975",
"0.5383869",
"0.5382262",
"0.53818184",
"0.5370943",
"0.5368064",
"0.53645307",
"0.53639513",
"0.53572243",
"0.53568214",
"0.53365827",
"0.53319204",
"0.53235257",
"0.53235257",
"0.53124934",
"0.5299612",
"0.5289094",
"0.52773535"
] |
0.7697839
|
0
|
This function wait for Company Skills to bo visible
|
def wait_for_company_skills_displayed
wait_for_element_present@driver.find_elements(:xpath, COMPANY_SKILLS)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def wait_for_freelancer_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, FREELANCER_SKILLS)\n end",
"def is_company_skills_displayed\n @driver.find_element(:xpath, COMPANY_SKILLS).displayed?\n end",
"def wait_for_freelancer_page_visible\n sleep 15\n end",
"def app_sign_city_wait\r\n wait_for_appSignCity\r\n puts 'ERROR:NbLifeApplication: new life app elements not visible' unless (has_appSignCity? && appSignCity.visible?)\r\n end",
"def wait_for_elements\n super\n @wait_on << :return_button\n @wait_on << :circulation_desk_selector\n end",
"def contacts_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(CUSTOMER_CONTACTS_TAB).displayed?}\n contacts_tab = @driver.find_element(CUSTOMER_CONTACTS_TAB)\n contacts_tab.click\n end",
"def wait_for_search_category_dropdown_visible\n wait_for_element_present(@driver.find_element(:xpath, SEARCH_CATEGORY_BUTTON))\n end",
"def wait_for_shibboleth_form()\n wait_for :shibboleth_form, \"Error waiting for pds\"\n end",
"def wait_for_shibboleth_form()\n wait_for :shibboleth_form, \"Error waiting for pds\"\n end",
"def suspend_partner\n wait_until { change_status_link.visible? }\n change_status_link.click\n # wait for edit view\n wait_until { change_status_select.visible? }\n change_status_select.select('Suspended')\n submit_change_status_btn.click\n wait_until{ change_status_link.visible? }\n end",
"def search_for_proffesional()\r\n @search_dropdown.is_element_present_with_wait?()\r\n @search_dropdown.click()\r\n end",
"def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend",
"def contact_info_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(CONTACT_INFO_TAB).displayed?}\n contact_info_tab = @driver.find_element(CONTACT_INFO_TAB)\n contact_info_tab.click\n end",
"def is_freelancer_skills_displayed\n @driver.find_element(:xpath, FREELANCER_SKILLS).displayed?\n end",
"def click_obligations_fulfilled\n wait_for_element_and_click obligations_input\n end",
"def click_obligations_fulfilled\n wait_for_element_and_click obligations_input\n end",
"def wait_for_elements\n super\n @wait_on << :continue_button\n end",
"def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end",
"def make_visible\n ta_request.click\n wait_until_ta_request_visible\n end",
"def wait_to_appear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def loading_wait\n \tcase ENV['BROWSER']\n \twhen \"iphone\",\"ipad\",\"android_phone\",\"android_tablet\" then\n \t\tWatir::Wait.until {\n \t\tnot @browser.element(xpath: '//div[contains(@class, \"load\")]').visible?\n \t\t}\n \telse\n \t\tWatir::Wait.until {\n \t\tnot @browser.iframe(:id, 'quote-frame').div(xpath: '//div[contains(@id, \"load\")]').visible?\n \t\t}\n \tend\n \tend",
"def wait_for_skill_sequence\n tsbs_wait_update\n tsbs_wait_update while @spriteset.skill_busy?\n end",
"def question_pools\n #puts \"clicking question pools\"\n #10.times {frm.link(:text=>\"Question Pools\").flash}\n frm.link(:text=>\"Question Pools\").click\n #sleep 200\n #puts \"clicked...\"\n #frm.link(:text=>\"Add New Pool\").wait_until_present\n #frm.h3(:text=>\"Question Pools\").wait_until_present(120)\n QuestionPoolsList.new(@browser)\n end",
"def enter_provisos(test_data)\n hide_notifications_bar\n wait_for_element_and_type(provisos_text_area, test_data[UseOfCollections::PROVISOS.name])\n end",
"def wait_to_load\n activity_div.wait_until(&:exists?)\n @page = @bank_page.load_page\n end",
"def partner_info_verify(partner)\n h3_section.text.eql?(partner.company_info.name).present?\n expand(account_details_icon)\n pooled_resources_table.visible?\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def wait_for_welcome_screen\n wait_for_elements_exist([trait])\n end",
"def createOppEnt()\n puts \"in createOppEnt\"\n #@driver.find_element(:name, \"create_opportunity\").click\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n \n #select org\n if @testDataJSON['CreateOpportunity']['Opportunity'][0]['account'] == 'newOrg' then\n createNewOrg()\n elsif @testDataJSON['CreateOpportunity']['Opportunity'][0]['account'] == 'searchOrg' then\n puts 'search for org'\n #searh and select\n @driver.find_element(:id, \"searchOrg\").click\n @driver.find_element(:id, \"searchOrg\").clear\n @driver.find_element(:id, \"searchOrg\").send_keys @testDataJSON['CreateOpportunity']['Opportunity'][0]['accountName']\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n sleep(5)\n puts 'select from list'\n #@driver.find_element(:id, \"searchOrg\").click\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n @driver.find_element(:xpath, \"//div[@id='searchOrglist']/ul/li[2]/span/div/div\").click\n elsif @testDataJSON['CreateOpportunity']['Opportunity'][0]['account'] == 'checkOrg' then \n #check for correct org\n end\n \n #select opp role\n puts \"select opp role\"\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"OppRole\")).select_by(:text, @testDataJSON['CreateOpportunity']['Opportunity'][0]['opportunityRole'])\n\n #select building or geography\n if @testDataJSON['CreateOpportunity']['Opportunity'][0]['BuildingOrGeographyName'] == 'building' then\n selectBuilding() \n elsif @testDataJSON['CreateOpportunity']['Opportunity'][0]['BuildingOrGeographyName'] == 'geography' then\n selectGeography()\n end\n \n\n #@driver.find_element(:id, \"primaryBuilding\").click\n \n #@helper.getElementByAttribute(@driver,:tag_name ,\"button\",\"title\",@testDataJSON['Opportunity'][0]['building'])[0].click\n\n #select close date\n puts \"set close date\"\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n @driver.find_element(:id, \"closeDate\").click\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n puts \"#{Date.today.to_s}\"\n @wait.until {@driver.find_element(:id,\"2018-06-21\").displayed?}\n #@driver.find_element(:css, \"lightning-icon.slds-icon-utility-right.slds-icon_container > lightning-primitive-icon > svg.slds-icon.slds-icon-text-default.slds-icon_xx-small > use\").click\n @driver.find_element(:id, \"2018-06-21\").click\n\n\n #lead source\n if !@testDataJSON['CreateOpportunity']['Opportunity'][0]['LeadSource'] == '' || !@testDataJSON['CreateOpportunity']['Opportunity'][0]['LeadSource'] == nil then\n puts \"select lead source\"\n @driver.find_element(:id, \"leadSource\").click\n Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, \"leadSource\")).select_by(:text, @testDataJSON['CreateOpportunity']['Opportunity'][0]['LeadSource'])\n end\n \n\n #lead source details\n if !@testDataJSON['CreateOpportunity']['Opportunity'][0]['lead_Source_Detail'] == '' || !@testDataJSON['CreateOpportunity']['Opportunity'][0]['lead_Source_Detail'] == nil then\n puts \"set lead source details \"\n @driver.find_element(:id, \"leadSourceDetail\").click\n @driver.find_element(:id, \"leadSourceDetail\").clear\n @driver.find_element(:id, \"leadSourceDetail\").send_keys @testDataJSON['CreateOpportunity']['Opportunity'][0]['lead_Source_Detail']\n end\n \n #@driver.find_element(:id, \"Date.today.next_day(3)\").click\n\n #write description\n puts \"write description\"\n @driver.find_element(:id, \"description\").clear\n @driver.find_element(:id, \"description\").send_keys @testDataJSON['CreateOpportunity']['Opportunity'][0]['Description']\n puts \"action--->\"\n #click button save - add product - close\n if @testDataJSON['CreateOpportunity']['Opportunity'][0]['Action'] == 'save&close' then\n puts 'save&close'\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n\n @driver.find_element(:xpath, \"//div[@id='lightning']/div[3]/div/div[2]/div[10]/div/button[1]\").click\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[11]/div/button[1]\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[11]/div/button[1]\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[10]/div/button[1]\n #@helper.getElementByAttribute(@driver, :tag_name, 'button', 'title', 'Save & Close').click\n elsif @testDataJSON['CreateOpportunity']['Opportunity'][0]['Action'] == 'addProducts' then\n puts 'addProducts'\n\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[10]/div/button[2]\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[9]/div/button[2]\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[11]/div/button[2]\n @driver.find_element(:xpath, \"//div[@id='lightning']/div[3]/div/div[2]/div[10]/div/button[2]\").click\n #@helper.getElementByAttribute(@driver, :tag_name, 'button', 'title', 'Add Products').click\n addProducts()\n elsif @testDataJSON['CreateOpportunity']['Opportunity'][0]['Action'] == 'close' then\n puts 'close----->'\n @wait.until {!@driver.find_element(:id,\"spinner\").displayed?}\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[11]/div/button[3]\n #//*[@id=\"lightning\"]/div[3]/div/div[2]/div[10]/div/button[3]\n @driver.find_element(:xpath, \"//div[@id='lightning']/div[3]/div/div[2]/div[10]/div/button[3]\").click\n=begin\n lightningDiv = @driver.find_element(:id, \"lightning\")\n\n buttons = lightningDiv.find_elements(:tag_name, \"button\")\n puts buttons.size\n\n buttons.each do |button|\n puts \"121\"\n puts button.attribute('title')\n if button.attribute('title') == 'Close' then\n sleep(30)\n puts button.attribute('title')\n #@wait.until {button.displayed?}\n puts 'clicking on button'\n button.click\n break\n end\n end\n=end \n\n #button = @helper.getElementByAttribute(@driver, :tag_name, 'button', 'title', 'Close')\n #@wait.until {button.displayed?}\n #sleep(10)\n #button.click \n end\n \n\n\n #click on add product\n \n\n \n end",
"def jobs_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(JOBS_TAB).displayed?}\n jobs_tab = @driver.find_element(JOBS_TAB)\n jobs_tab.click\n end",
"def jobs_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(JOBS_TAB).displayed?}\n jobs_tab = @driver.find_element(JOBS_TAB)\n jobs_tab.click\n end",
"def activate_partner\n wait_until { change_status_link.visible? }\n change_status_link.click\n # wait for edit view\n wait_until { change_status_select.visible? }\n change_status_select.select('Active')\n submit_change_status_btn.click\n wait_until{ change_status_link.visible? }\n end",
"def start\r\n #$driver=Selenium::WebDriver::Chrome::Service.driver_path=\"./Drivers/chromedriver\"\r\n $driver = Selenium::WebDriver.for :chrome\r\n $driver.get('https://lola-protected:LoLa_Access_4_Devsonly@app-staging.locationlive.co.uk/')\r\n #$driver.switch_to.window($driver.window_handles[1])\r\n $driver.manage.window.maximize\r\n $wait = Selenium::WebDriver::Wait.new(timeout:10)\r\n $wait.until{$driver.find_element(:id,\"sign-in-popover\").displayed? }\r\nend",
"def activities_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(ACTIVITIES_TAB).displayed?}\n activities_tab = @driver.find_element(ACTIVITIES_TAB)\n activities_tab.click\n end",
"def activities_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(ACTIVITIES_TAB).displayed?}\n activities_tab = @driver.find_element(ACTIVITIES_TAB)\n activities_tab.click\n end",
"def wait_until_loaded(element)\n navigation = AppletCarousel.instance\n navigation.wait_until_action_element_visible(element, 60)\nend",
"def should_load_application_for(company)\n # wait until metrics page is loaded\n wait_until { page.has_css?('#metrics-container') }\n\n within('.head-buttons') do\n page.should have_button(company.name)\n end\n\n within 'button.user-settings' do\n page.should have_content(company.name)\n end\n end",
"def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mobilkies not nahodyatsya, smeni prices epta')\n end\n $driver.manage.timeouts.implicit_wait = 10\n end",
"def wait_for_render(how, what)\n @wait.until {element_visible?(how, what)}\n end",
"def expand_search_options\n wait_for_update_and_click search_options_toggle_button_element unless include_students_cbx_element.visible?\n include_students_cbx_element.when_visible 1\n end",
"def confirm_on_page\n @browser.div(class: 'home').wait_until_present(5)\n end",
"def wait_for_element_to_be_visible(id, name, time)\n begin\n wait = [60, time].max\n element = get_element(id, name)\n !wait.times {\n break if element.displayed?\n sleep 1\n }\n rescue\n end\nend",
"def redirectToAvailability\n EnziUIUtility.wait(@driver, :id, 'MoreTabs_Tab', 100)\n @driver.find_element(id: 'MoreTabs_Tab').click\n @driver.find_element(:link, 'Reservable').click\n #sleep(10)\n end",
"def is_company_title_displayed\n @driver.find_element(:xpath, COMPANY_TITLE).displayed?\n end",
"def addOpportunity()\n #puts \"AccountAssignmentFromLead::addOpportunity\"\n\n EnziUIUtility.wait(@driver, :id, \"lightning\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n #EnziUIUtility.wait(@driver,:title,\"Journey Name\",@timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n\n #puts \"1111111111111111222222\"\n #puts AccountAssignmentFromLead.getElementByAttribute(@driver,:tag_name,\"h1\",\"title\",\"Journey Name\").text\n @wait.until {AccountAssignmentFromLead.getElementByAttribute(@driver, :tag_name, \"h1\", \"title\", \"Journey Name\").displayed?}\n\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n\n sleep(5)\n\n\n #element = AccountAssignmentFromLead.getElementByAttribute(@driver,:tag_name,\"button\",\"title\",\"Add Opportunity\")\n #@wait.until {element.displayed?}\n #@driver.execute_script(\"return arguments[0];\" , element).click\n\n\n EnziUIUtility.wait(@driver, :id, \"header43\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n EnziUIUtility.wait(@driver, :id, \"Number_of_Full_Time_Employees__c\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n @driver.find_element(:id, \"Number_of_Full_Time_Employees__c\").clear\n EnziUIUtility.setValue(@driver, :id, \"Number_of_Full_Time_Employees__c\", \"#{@testDataJSON[\"AccountAssignment\"]['tour'][0]['companySize']}\")\n\n EnziUIUtility.wait(@driver, :id, \"Interested_in_Number_of_Desks__c\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n @driver.find_element(:id, \"Interested_in_Number_of_Desks__c\").clear\n EnziUIUtility.setValue(@driver, :id, \"Interested_in_Number_of_Desks__c\", \"#{@testDataJSON[\"AccountAssignment\"]['tour'][0]['numberOfDesks']}\")\n\n\n EnziUIUtility.wait(@driver, :id, \"Building__c\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n @driver.find_element(:id, \"Building__c\").clear\n EnziUIUtility.setValue(@driver, :id, \"Building__c\", \"#{@testDataJSON[\"AccountAssignment\"]['tour'][0]['building']}\")\n\n\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n\n EnziUIUtility.wait(@driver, :id, \"Building__clist\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n #puts AccountAssignmentFromLead.getElementByAttribute(@driver,:tag_name,\"li\",\"title\",\"MUM-BKC\")[2].attribute('title')\n #@wait.until {AccountAssignmentFromLead.getElementByAttribute(@driver,:tag_name,\"li\",\"title\",\"MUM-BKC\")[2].displayed?}\n\n sleep(2)\n AccountAssignmentFromLead.getElementByAttribute(@driver, :tag_name, \"mark\", \"text\", \"#{@testDataJSON[\"AccountAssignment\"]['tour'][0]['building']}\")[0].click\n\n AccountAssignmentFromLead.getElementByAttribute(@driver, :tag_name, \"button\", \"title\", \"Save\").click\n\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n\n return true\n rescue Exception => e\n puts e\n return false\n end",
"def restrictions_option_popup_present?\n until @browser.section(:id, 'update-page-restrictions-dialog').exists? do\n sleep 1\n end\n # for some reason the div never appeared as visible, only existing, and only becamne existing when the functionality\n # was invoked. Given this the only ways to validate presence was to check the z access it the style attribute or the exist? flag\n # neither of which i like very much and would like to discuss a better solution with developers as html implementation may be causing issues.\n expect(@browser.div(:id, 'update-page-restrictions-dialog').attribute_value('style')).to include('z-index: 3000')\n # or\n expect(@browser.div(:id, 'update-page-restrictions-dialog').exist?).to eq(true)\nend",
"def wait_for_element_disappear(time)\n spinner=@driver.find_element(SPINNER)\n wait=Selenium::WebDriver::Wait.new(:timeout=>time)\n wait.until {\n !spinner.displayed?\n }\n end",
"def test_transferJobVlaidation\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"checked\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_TRANSFER_JOBS_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_TRANSFER_JOBS_XPATH},\n {\"displayed\" => RequisitionMassTransfer::REQUISITIONS_MASS_TRANSFER_TRANSFER_TO_RECRUITER_XPATH },\n {\"click\" => RequisitionMassTransfer::REQUISITIONS_MASS_TRANSFER_BTN_TRANSFER_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionMassTransfer::ERROR_RECRUITER_MUST_BE_SELECTED_XPATH).displayed?\n }\nend",
"def quote_select(driver, contractTypeValue)\n\n #$bool_contract_found = false\n\n puts \" Current state of Contract Search #{$bool_contract_found}\"\n w = 0\n until $bool_contract_found\n\n puts \"Enter into the next 5 choices available\"\n\n x = 1\n y = 5\n z = 0\n\n\n while x <= y\n\n xpath = \"//*[@id='IdPage:j_id1:j_id195:IdPage:IdForm:IdQuotesBoxSectionOnly']/div/div[1]/div[#{x}]/div/div/a/span\"\n xpath_rel_cont = \"//*[@id='IdPage:j_id1:j_id195:IdPage:IdForm:IdQuotesBoxSectionOnly']/div/div[7]/div[#{x}]/div/div[1]\"\n xpath_rel_quote = \"//*[@id='IdPage:j_id1:j_id195:IdPage:IdForm:IdQuotesBoxSectionOnly']/div/div[1]/div[#{x}]/div/div/a/span\"\n xpath_rel_sel = \"//*[@id='dPage:j_id1:j_id195:IdPage:IdForm:Idquoßesbox8:#{z}:j_id499']\"\n xpath_rel_sel_1 = \"//*[@id='dPage:j_id1:j_id195:IdPage:IdForm:Idquoßesbox8:#{z}:j_id499']\"\n xpath_rel_sel_2 = \"//*[@id='IdPage:j_id1:j_id195:IdPage:IdForm:Idquotesbox8:#{z}:IdselectedQuoteRepeat1']\"\n xpath_rel_sel_att_1 = \"//*[@id='IdPage:j_id1:j_id195:IdPage:IdForm:attacgButtonRepeat']\"\n xpath_rel_sel_att_2 = \"//*[@id='IdPage:j_id1:j_id195:IdPage:IdForm:attacgButtonRepeat']\"\n\n ###########\n \n print x, \". Ruby while loop.\\n\"\n # wait_for_window($take_five)\n wait_for_window($take_five)\n is_element_present(:xpath, xpath_rel_cont)\n link_has_gone_stale(:xpath, xpath_rel_cont)\n contractType = driver.find_element(:xpath, xpath_rel_cont).text\n puts \"got contractType value of #{contractType}\"\n\n if contractType == contractTypeValue\n # Click on Select\n sequenceID = driver.find_element(:xpath, xpath_rel_quote).text\n puts \"Gotcha! sequenceID value of #{sequenceID}\"\n\n $bool_contract_found = true\n puts \"Found contractType value of #{sequenceID} : #{$bool_contract_found}\"\n\n if w != 0\n xpath_rel_sel = xpath_rel_sel_2\n xpath_rel_sel_att =xpath_rel_sel_att_2\n end\n driver.find_element(:xpath, xpath_rel_sel).click\n driver.find_element(:xpath, xpath_rel_sel_att).click\n\n\n break\n end\n x += 1\n z += 1\n end\n\n puts \"bool_contract_found #{$bool_contract_found}\"\n\n if $bool_contract_found == false\n # Click next 5 if the conditions are not met and we have completed 5 iterations\n puts \"Couldn't find #{contractType}. Please go the next 5 options : bool_contract_found #{$bool_contract_found}\"\n\n wait_for_window($take_five)\n # wait_for_window($take_five)\n driver.find_element(:id, \"IdPage:j_id1:j_id195:IdPage:IdForm:j_id864:IdNextPreviousAllNEXT\").click\n wait_for_window($take_five)\n end\n print w, \". Ruby w until loop.\\n\"\n\n w += 1\n end\n\nend",
"def selectReservables(val)\n #puts \"Val is: #{val}\"\n arrTable = @driver.find_elements(:tag_name, 'table')\n availabilityTable = nil\n arrTable.each do |table|\n if table.attribute('class') == 'slds-table slds-table--bordered slds-max-medium-table--stacked-horizontal'\n availabilityTable = table\n break\n end\n end\n #puts \"availabilityTable: #{availabilityTable}\"\n #puts \"availabilityTable class: #{availabilityTable.attribute('class')}\"\n #puts \"availabilityTable size: #{availabilityTable.size}\"\n tBodyEle = availabilityTable.find_element(:tag_name, 'tbody')\n\n arrRows = tBodyEle.find_elements(:tag_name, 'tr')\n #puts \"arrRows size #{arrRows.size}\"\n index = -1\n arrRows.each do |row|\n #puts \"row class: #{row.attribute('class')}\"\n row.find_elements(:tag_name, 'td').each do |col|\n #puts \"Column data lable: #{col.attribute('data-label')}\"\n if (col.attribute('data-label') == 'Unit')\n index = index + 1\n if (col.find_element(:class, 'slds-truncate').text == val)\n #puts \"Clicking on Checkbox, Index is: #{index}\"\n row.find_element(:id, \"checkbox-span:#{index}\").click\n @@selected_buildings.push(val)\n break\n end\n end\n end\n #index = index + 1\n end\n #puts \"selected_buildings: #{@@selected_buildings}\"\n @wait = Selenium::WebDriver::Wait.new(:timeout => 20)\n #return AvailabilityPage.new(@@driver)\n end",
"def wait_visible!(timeout=@wait)\n self.el\n wait_for(timeout: timeout, message: \"Element at #{location} is not visible\") { visible? }\n end",
"def wait_to_disappear(sym,id)\n @wait.until {\n element_arr = driver.find_elements(sym,id)\n element_arr.size > 0 and !element_arr[0].displayed? #wait until the element both exists and is displayed\n }\n end",
"def on_category_ok; @quest_list_window.activate; end",
"def select_hobby_option\n ran_num = rand(2)\n hobby = @chrome_driver.find_elements(:name, \"checkbox_5[]\")\n hobby.each do |hob|\n if hob['value'] == HOBBY_STATUS[ran_num]\n hob.click\n end\n end\n end",
"def wait_for_launching\n sleep @delay\n end",
"def wait_and_hover_click(sym,id)\n found = false\n #wait until an element with sym,id is displayed. When it is, hover click it\n @wait.until {\n elements = driver.find_elements(sym, id)\n elements.each do |element| \n if element.displayed?\n found = true\n @element = element\n end\n \n end\n found == true\n } \n self.hover_click(@element)\n end",
"def finish_prep\n @windows[Win_Help].hide\n if @ATB_Active\n setup_start_atb\n else\n choose_team_start\n end\n end",
"def show_uoc_info_form\n wait_for_element_and_click form_show_hide_button('Use of Collections Information')\n end",
"def user_items\n puts \"\\nLets see if you collected the correct items: \"\n#sleep arguement to build suspense\n puts \"Confirming please wait...\"\n sleep(4)\n puts \".........................\"\n sleep(3)\n puts \"...........in progress\"\n sleep(2)\n puts \"......complete\"\n sleep(2)\n\n# verification that the items_collected equal valid_items\n if $items_collected == [\"key\", \"ruby\"] or $items_collected == [\"key\", \"trolls_head\"]\n puts \"\\nYou have the correct combination!\\n\\n\"\n winner\n else\n puts \"\\nYou have the wrong combination\\n\\n\"\n game_over\n end\nend",
"def wait_for_visible(locator, options={})\n builder = JavascriptExpressionBuilder.new\n wait_for_condition builder.visible(locator).script, options[:timeout_in_seconds]\n end",
"def clickOnSpeakers()\n el= @driver.find_element(:css, \"a.x-btn-speakers\")\n el.click\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until { @driver.find_element(:css => \"span.speaker-tag\").displayed? }\n end",
"def on_list_ok\n @quest_category_window.deactivate if @quest_category_window\n @quest_data_window.activate\n end",
"def user_blocked\n @company = Company.find(params[:company_id])\n end",
"def scheduling_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(SCHEDULING_TAB).displayed?}\n scheduling_tab = @driver.find_element(SCHEDULING_TAB)\n scheduling_tab.click\n end",
"def test_changePriority\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" =>RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_CHANGE_PRIORITY_JOBS_XPATH},\n {\"displayed\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_NEW_PRIORITY_XPATH},\n {\"set_text\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_NEW_PRIORITY_XPATH, \"text\" => RequisitionsChangePriority::NEW_PRIORITY_TEXT},\n {\"click\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_BTN_UPDATE_PRIORITY_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsChangePriority::BACK_TO_LIST_BUTTON_ON_SUCCESS_PAGE_XPATH).displayed?\n } \nend",
"def company_blocked\n @company = Company.find(params[:company_id])\n end",
"def wait_for_visible(locator)\n wait_for { find_element(locator).displayed? }\n end",
"def visible?(title)\n @driver.wait { @driver.text(title).displayed? }\n @driver.wait do\n @driver.find_element(\n @rows[:type], @rows[:value]\n ).displayed?\n end\n end",
"def continue_when_ready\n wait_until(5, \"Continue element not visible in 5 seconds\") do\n continue_element.visible? \n end\n continue\n end",
"def wait_for_country_list\n \tcase ENV['BROWSER']\n \twhen \"iphone\",\"ipad\",\"android_phone\",\"android_tablet\" then\n \t\tWatir::Wait.until {\n \t\tself.country = \"Select Country\"\n \t\t}\n \telse\n \t\tWatir::Wait.until {\n \t\t@browser.iframe(:id, 'quote-frame').select_list(:id, 'destinationCountryID').text.eql? \"Select Country\"\n \t\t}\n \tend\n \tend",
"def wait\n true\n end",
"def test_transferJobs\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"checked\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_TRANSFER_JOBS_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_TRANSFER_JOBS_XPATH},\n {\"displayed\" => RequisitionMassTransfer::REQUISITIONS_MASS_TRANSFER_TRANSFER_TO_RECRUITER_XPATH },\n {\"set_text\" => RequisitionMassTransfer::REQUISITIONS_MASS_TRANSFER_TRANSFER_TO_RECRUITER_XPATH, \"text\" => RequisitionMassTransfer::RECRUITER_TO_TRANSFER_TEXT},\n {\"click\" => RequisitionMassTransfer::REQUISITIONS_MASS_TRANSFER_BTN_TRANSFER_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionMassTransfer::BACK_TO_LIST_BUTTON_ON_SUCCSESS_PAGE).displayed?\n }\nend",
"def test_sales_lead\n getElement_xpath(\"store_name\").click\n mouseHover(getElement_xpath(\"account_settings\"))\n getElement_xpath(\"pipeline\").click\n status = check_required(\"pipeline_name\")\n \n # creates required sales lead if not available\n if(!status)\n getElement_xpath(\"pipeline_new\").click\n getElement_id(\"pipeline_name_id\").send_keys Keys_CONFIG[\"pipeline_name\"]\n getElement_id(\"pipeline_description_id\").send_keys Keys_CONFIG[\"pipeline_description\"]\n getElement_xpath(\"commit\").click\n puts getElement_xpath(\"category_success\").text\n end\n\n getElement_text(\"sales_leads\").click\n getElement_text(\"sales_lead_new\").click\n\n getElement_placeholder(\"Title\").send_keys Keys_CONFIG[\"sales_lead_name\"]\n getElement_placeholder_text(\"Details\").send_keys Keys_CONFIG[\"sales_lead_description\"]\n\n getElement_placeholder(\"Customer Name\").send_keys Keys_CONFIG[\"company_name_data\"]\n\n sleep(3)\n xpath = \"//ul[@class='dropdown-menu ng-isolate-scope']/li[1]/a\"\n @driver.find_element(:xpath,xpath).click\n\n # not able to select as customer autoselect is still suggesting after selecting customer\n #getElement_placeholder(\"Select contact\").send_keys Keys_CONFIG[\"company_contact_data\"]\n\n # to select contact date\n #date_select(1)\n\n # to select close date\n #date_select(2,1)\n\n getElement_xpath(\"pipeline_select\").send_keys Keys_CONFIG[\"pipeline_name\"]\n \n getElement_xpath(\"save\").click\n sleep(5)\n sales_lead = getElement_xpath(\"company_name\").text\n puts \"Sales Lead name : #{sales_lead} created successfully\"\n end",
"def wait_until_present(context=nil)\n adapter.window.wait_until_present context\n end",
"def wait; end",
"def wait; end",
"def wait; end",
"def test_changePriorityValidation\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" =>RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_CHANGE_PRIORITY_JOBS_XPATH},\n {\"displayed\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_NEW_PRIORITY_XPATH},\n {\"click\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_BTN_UPDATE_PRIORITY_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsChangePriority::ERROR_PRIORITY_MUST_BE_SELECTED).displayed?\n } \nend",
"def verifyInformationScreen()\n clickOnMoreTab()\n clickOnInformation()\n verifyMeeting()\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def hide_skill_disp_win\n display_skill_tb(nil) if !TM.selecting_target && !@showing_temp_hls\n end",
"def show_tab(name)\n @log.debug \" show_tab: Waiting up to #{DEFAULT_TIMEOUT} seconds to find_element(:xpath, \\\"//input[@title='open #{name}']\\\")...\"\n wait = Selenium::WebDriver::Wait.new(:timeout => DEFAULT_TIMEOUT)\n wait.until { driver.find_element(:xpath, \"//input[@title='open #{name}']\") }\n @driver.find_element(:xpath, \"//input[@title='open #{name}']\").click\n pause\n end",
"def enable_cobranding\n change_cobranding_status_link.click\n cobranding_status_select.select('Yes')\n submit_cobranding_status_btn.click\n wait_until{ !submit_cobranding_status_btn.visible? }\n end",
"def duplicateAccountSelector(option, account)\n @wait.until {@driver.find_element(:id, \"header43\").displayed?}\n if account.eql? nil then\n EnziUIUtility.wait(@driver, :id, \"enzi-data-table-container\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n optionToselect = EnziUIUtility.selectElement(@driver, \"#{option}\", \"button\")\n @wait.until {optionToselect}\n optionToselect.click\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n EnziUIUtility.wait(@driver, :id, \"enzi-data-table-container\", @timeSettingMap['Wait']['Environment']['Lightening']['Min'])\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n sleep(@timeSettingMap['Sleep']['Environment']['Lightening']['Min'])\n else\n @wait.until {@driver.find_element(:class, \"slds-radio_faux\").displayed?}\n if !@driver.find_elements(:class, \"slds-radio_faux\").empty? then\n @driver.find_elements(:class, \"slds-radio_faux\")[0].click\n @driver.find_elements(:class, \"slds-radio_faux\")[0].click\n EnziUIUtility.selectElement(@driver, \"#{option}\", \"button\").click\n end\n\n @wait.until {!@driver.find_element(:id, \"spinner\").displayed?}\n end\n return true\n rescue\n return false\n end",
"def ios_purchasedList(client)\n\n\t\tbegin\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.HamburgerButton']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='購入済み']\", 0, 1)\n\t\t\t\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=購入済み\")\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"text=購入済みの作品がありません\")\n\t\t\t\t\tputs \"::MSG:: There is no item in purchased list!!!\"\n\t\t\t\telse\n\t\t\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.PlayingStateView' and @width>0 and ./parent::*[./parent::*[@class='UNextMobile_Protected.ThumbPlayButton']]]\", 0, 30000)\n\t\t \t\t\t# If statement\n\t\t\t\t\tend\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.PlayingStateView' and @width>0 and ./parent::*[./parent::*[@class='UNextMobile_Protected.ThumbPlayButton']]]\", 0, 1)\t\t\t\t\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.PlayingStateView' and ./parent::*[./preceding-sibling::*[@class='UNextMobile_Protected.UNGradientView'] and ./parent::*[@class='UNextMobile_Protected.ThumbPlayButton']]]\", 0, 1)\n\t\t\t\t\tclient.sleep(20000)\n\t\t\t\t\tPurchasePlay.new.ios_playbackCheckFromTitleDetails(client)\n\t\t\t\t\t$obj_histp.ios_leavingPlayer(client)\n\t\t\t\tend\n\t\t\tend\n\t\t\tclient.sleep(1000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityIdentifier='main_nav_close.png']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityLabel='戻る' and ./preceding-sibling::*[./*[@text='購入済み']]]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='ホーム']\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgBougt = \"::MSG:: Exception occurrred while finding ELEMENT \" + e.message\n\t\tend\t\t\t\n\tend",
"def wait_for_page_present(cls_name)\r\n case cls_name\r\n when 'data-manage'\r\n page_title = '视图管理列表'\r\n when 'shared-zones'\r\n page_title = '共享区列表'\r\n when 'share_zone_rr' # customized class_name\r\n page_title = '共享区记录列表'\r\n when 'zone_list' # customized class_name\r\n page_title = '区列表'\r\n when 'rr_list' # customized class_name\r\n page_title = '记录列表'\r\n when 'shared-rrs'\r\n page_title = '共享记录列表'\r\n when 'search'\r\n page_title = '全局搜索列表'\r\n when 'stub-zones'\r\n page_title = '存根区列表'\r\n when 'forward-zones'\r\n page_title = '转发区列表'\r\n when 'redirect-rrs'\r\n page_title = '重定向列表'\r\n when 'hint-zones'\r\n page_title = '根配置列表'\r\n when 'hint_zone_rr'\r\n page_title = '记录列表'\r\n when 'local-policies'\r\n page_title = '本地策略列表'\r\n when 'query-source'\r\n page_title = '请求源地址列表'\r\n when 'monitorsetting'\r\n page_title = '监测设置列表'\r\n when 'views'\r\n page_title = '视图管理列表'\r\n when 'sortlists' # customized class_name\r\n page_title = '记录排序列表'\r\n when 'acls'\r\n page_title = '访问控制列表'\r\n when 'ip-rrls'\r\n page_title = 'IP解析限速列表'\r\n when 'domain-rrls'\r\n page_title = '域名解析限速列表'\r\n when 'monitor_strategies'\r\n page_title = '策略列表'\r\n when 'redirections'\r\n page_title = 'URL转发列表'\r\n when 'users'\r\n page_title = '用户管理列表'\r\n when 'audit-logs'\r\n page_title = '操作日志列表'\r\n when 'warning_records'\r\n page_title = '告警记录'\r\n when 'data_backup_logs'\r\n page_title = '备份/恢复列表'\r\n end\r\n sleep 1\r\n begin\r\n page_open = Watir::Wait.until {ZDDI.browser.div(:id=>\"tableTitle\").span.text == page_title}\r\n return 'succeed' if page_open\r\n rescue\r\n # Watir::Wait.until 默认等待30s, 超时后报错.\r\n return 'fail'\r\n end\r\n end",
"def test_PreApproval_load\n @driver.get(@baseURL)\n #begin\n @Nexa_Util.loginAsNormalUser(@driver)\n # @wait.until { @driver.find_element(:id, 'leftNavigationContent') }\n\n # rescue Timeout::Error\n waitForPageFullyLoaded(60);\n @start = Time.now\n\n # Click at All Contacts\n @driver.find_element(:link_text, 'Pre-Approvals Expiring 2 Months').click\n # @wait.until { @driver.find_element(:class, 'resultTable') }\n waitForPageFullyLoaded(20);\n @stop = Time.now\n @sitePerformance.puts \"Page load time 'Pre-Approvals Expiring 2 Months': #{@Nexa_Util.time_diff_milli(@start, @stop)}\"\n assert_operator 60000.00, :>, @Nexa_Util.time_diff_milli(@start, @stop)\n # end\n end",
"def Wait_For_Element(locator_type, locator_value)\n for iSecond in 0..$config['Longwait']\n sleep 1\n if(@driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?)\n\tbreak\n else \t\n if (iSecond >= $config['Longwait']) \n return false\n @driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?\n break\n end\n end \n end\n return true\nend",
"def test_changeStatus\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" =>RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_CHANGE_STATUS_JOBS_XPATH},\n {\"displayed\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_NEW_STATUS_XPATH},\n {\"set_text\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_NEW_STATUS_XPATH, \"text\" => RequisitionsChangeStatus::REQUISITION_NEW_STATUS_TEXT},\n {\"click\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_BTN_UPDATE_STATUS_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsChangeStatus::BACK_TO_LIST_BUTTON_SUCCESS_PAGE_XPATH).displayed?\n } \nend",
"def pick_skills_for_lilly\n assigned_skills = []\n unassigned_skills = []\n unless params[:sp_id].nil? or params[:sp_id].blank?\n assigned_skills = ServiceProvider.find(params[:sp_id]).skills.collect {|e| e.skill}\n unassigned_skills = Physical::Liviaservices::SkillType.find(:all).find_all {|e| !assigned_skills.include?(e)}\n end\n\t\tsp_list = ServiceProvider.find(:all)\n sp_id = params[:sp_id]\n\t\trender :partial => \"assign_skill\", :locals=> {:sp_list=>sp_list, :sp_id=>sp_id, :assigned_skills=>assigned_skills,:unassigned_skills=>unassigned_skills}\n\tend",
"def wait\n sleep 0.0001\n end",
"def set_up_company\n @company = Company.friendly.find(params[:company_id] || params[:id])\n result = JointUserCompany.find_by(user_id: @user.id, company_id: @company.id)\n if result.nil?\n self.dashboard_function()\n end\n end",
"def hide_uoc_info_form\n wait_for_element_and_click form_show_hide_button('Use of Collections Information')\n end",
"def estimates_tab()\n wait = Selenium::WebDriver::Wait.new(:timeout => 5)\n wait.until {@driver.find_element(ESTIMATES_TAB).displayed?}\n estimates_tab = @driver.find_element(ESTIMATES_TAB)\n estimates_tab.click\n end",
"def wait_visible!(timeout=@wait)\n wait_for(timeout: timeout, message: \"Element at #{locator} is not visible\") { visible? }\n end",
"def open_profile_menu\n id(\"profile_menu_btn\").wait_until(&:present?)\n id(\"profile_menu_btn\").click\n @browser.nav(css: \".drop_menu_nav.active\").wait_until(&:present?)\n sleep 1\n end",
"def on_pou_ok\n @party_or_unit_win.hide\n @select_text_win.text = \"Select the items to give to #{@actor.name}\"\n @select_text_win.show\n @category_window.show\n deactivate_all_but(@category_window)\n @category_window.activate\n @item_window.show\n end",
"def hide_tab(name)\n @log.debug \" hide_tab: Waiting up to #{DEFAULT_TIMEOUT} seconds to find_element(:xpath, \\\"//input[@title='close #{name}']\\\")...\"\n wait = Selenium::WebDriver::Wait.new(:timeout => DEFAULT_TIMEOUT)\n wait.until { driver.find_element(:xpath, \"//input[@title='close #{name}']\") }\n @driver.find_element(:xpath, \"//input[@title='close #{name}']\").click\n pause\n end",
"def test_QuestionSetBuilderOptionalText\n randomName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n # 1 - Go to \"Question Sets\" Tab\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n \n # 2 - Click on the Question Set's name previously created from the list\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed? \n }\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 # 3 - Click on \"Question Builder\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_QUESTION_BUILDER_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_BTN_NEW_QUESTION_XPATH).displayed?\n }\n \n # 4 - Click on \"New Question\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_BTN_NEW_QUESTION_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).displayed?\n }\n sleep(3)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).displayed?\n }\n \n # 5 - Fill all fields\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_NAME_TEXT\n $browser.switch_to.frame(QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_TEXT_IFRAME_ID)\n $browser.find_element(:xpath => \"html/body\").send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_TEXT\n $browser.switch_to.default_content\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_ANSWER_1_TEXT\n \n #6 - Uncheck \"Optional\" and \"Text\" boxes\n elementText = $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_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 => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH)\n if elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # 7 - Click on \"Save\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_NEW_BTN_SAVE_XPATH).click\n sleep(1)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_FIRST_XPATH).displayed?\n }\n \n # 8 - Click on \"New Question\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_BTN_NEW_QUESTION_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).displayed?\n }\n sleep(3)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).displayed?\n }\n \n # 9 - Fill all fields\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_NAME_2_TEXT\n $browser.switch_to.frame(QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_TEXT_IFRAME_ID)\n $browser.find_element(:xpath => \"html/body\").send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_2_TEXT\n $browser.switch_to.default_content\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_ANSWER_2_TEXT\n \n elementOptional = $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH)\n # 10 - Check \"Optional\" box\n unless elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # 11 - Click on \"Save\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_NEW_BTN_SAVE_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_SECOND_XPATH).displayed?\n }\n \n # 12 - Click on \"New Question\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_BTN_NEW_QUESTION_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).displayed?\n }\n sleep(3)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).displayed?\n }\n \n # 13 - Fill all fields\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_NAME_4_TEXT\n $browser.switch_to.frame(QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_TEXT_IFRAME_ID)\n $browser.find_element(:xpath => \"html/body\").send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_4_TEXT\n $browser.switch_to.default_content\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_ANSWER_4_TEXT\n \n # 14 - Check \"Text\" box\n elementText = $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH)\n unless elementText.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH).click\n end\n elementOptional = $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH)\n unless elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # 15 - Click on \"Save\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_NEW_BTN_SAVE_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_THIRD_XPATH).displayed?\n }\n \n # 16 - Click on \"New Question\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_BTN_NEW_QUESTION_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).displayed?\n }\n sleep(2)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).displayed?\n }\n \n # 17 - Fill all fields\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_QUESTION_NAME_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_NAME_3_TEXT\n $browser.switch_to.frame(QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_TEXT_IFRAME_ID)\n $browser.find_element(:xpath => \"html/body\").send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_3_TEXT\n $browser.switch_to.default_content\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_ANSWER_1_XPATH).send_keys QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_ANSWER_3_TEXT\n \n # 18 - Uncheck \"Optional\" box\n elementText = $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH)\n unless elementText.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH).click\n end\n elementOptional = $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH)\n if elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # 19 - Click on \"Save\"\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_NEW_BTN_SAVE_XPATH).click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_FIRST_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_FOURTH_v2_XPATH).displayed?\n }\n \n #RESULTS Step 11\n assert_match \"Optional\", $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_SECOND_XPATH).text\n \n #RESULTS Step 15\n assert_match \"Optional\", $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_THIRD_XPATH).text\n assert_match $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_THIRD_XPATH + \"//label[3]\").text,\"A: Text\"\n \n #RESULTS Step 19\n assert_equal($browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTIONS_LIST_FOURTH_v2_XPATH).text, \"A: Text\") \n \n end",
"def test_changeStatusValidation\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" =>RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_CHANGE_STATUS_JOBS_XPATH},\n {\"displayed\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_NEW_STATUS_XPATH},\n {\"click\" => RequisitionsChangeStatus::REQUISITIONS_CHANGE_STATUS_BTN_UPDATE_STATUS_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsChangeStatus::ERROR_STATUS_MUST_BE_SELECTED).displayed?\n }\nend"
] |
[
"0.6856827",
"0.66906625",
"0.5963678",
"0.5916244",
"0.579606",
"0.5784677",
"0.5731739",
"0.5718268",
"0.5717535",
"0.56803304",
"0.56781155",
"0.5630464",
"0.56303316",
"0.55838555",
"0.5582438",
"0.5582438",
"0.55660903",
"0.5564731",
"0.5564731",
"0.55552554",
"0.5540803",
"0.54711914",
"0.544421",
"0.5440407",
"0.5417821",
"0.53921306",
"0.5361384",
"0.5341698",
"0.53408635",
"0.5334969",
"0.5334969",
"0.5334015",
"0.5323498",
"0.5319033",
"0.5319033",
"0.529419",
"0.5293875",
"0.52817404",
"0.52576125",
"0.5254434",
"0.52437735",
"0.5239037",
"0.52341914",
"0.5226444",
"0.5214725",
"0.5211204",
"0.5202422",
"0.51649755",
"0.5155641",
"0.5153082",
"0.5152168",
"0.5148607",
"0.5122041",
"0.51201797",
"0.5120092",
"0.5115118",
"0.51148224",
"0.51084083",
"0.50995576",
"0.5093927",
"0.50760907",
"0.5066992",
"0.50628495",
"0.50609136",
"0.50581175",
"0.5056654",
"0.50563115",
"0.50550246",
"0.50519854",
"0.50500643",
"0.5049392",
"0.5033065",
"0.5030475",
"0.503044",
"0.503031",
"0.503031",
"0.503031",
"0.5022139",
"0.50150627",
"0.5014472",
"0.5005373",
"0.5002724",
"0.5001909",
"0.5000245",
"0.4999186",
"0.49893308",
"0.49811682",
"0.4977457",
"0.497649",
"0.49737394",
"0.49719903",
"0.49709398",
"0.49703422",
"0.4964369",
"0.49627852",
"0.49606946",
"0.49576944",
"0.4953994",
"0.49532568",
"0.49370185"
] |
0.784874
|
0
|
Is Displayed Section ============================================ This function verifying is Freelancer title visible
|
def is_freelancer_title_displayed
@driver.find_element(:xpath, FREELANCER_TITLE).displayed?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def third_screen_visible?\n @third_screen_title.visible?\n end",
"def second_screen_visible?\n @second_screen_title.visible?\n end",
"def display_header?\n !@request.hide_title?\n end",
"def post_title_displayed?\n wait = Selenium::WebDriver::Wait.new(timeout: 15)\n wait.until { displayed? POST_TITLE }\n end",
"def is_freelancer_description_displayed\n @driver.find_element(:xpath, FREELANCER_DESCRIPTION).displayed?\n end",
"def is_company_title_displayed\n @driver.find_element(:xpath, COMPANY_TITLE).displayed?\n end",
"def visible?\n wd_element.displayed?\n end",
"def verified_screen\n begin\n @appium_driver.find_element(:id, \"title\").displayed?\n rescue\n return false\n end\n end",
"def visible?\n end",
"def visible?\n @style.display != 'none'\n end",
"def visible?(title)\n @driver.wait { @driver.text(title).displayed? }\n @driver.wait do\n @driver.find_element(\n @rows[:type], @rows[:value]\n ).displayed?\n end\n end",
"def displayed?\n static_module.displayed?\n end",
"def visible?\n true\n end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def is_visible?\n setup.show_all? || Date.today >= start_at\n end",
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def visible?\n el.displayed?\n end",
"def title?\n return false unless title\n return @display_title if defined?(@display_title)\n\n @display_title = (@text !~ %r!title=false!i)\n end",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def has_title?\n @title != nil\n end",
"def hasTitle\n if @title then\n true\n else\n false\n end\n end",
"def visible?\n\t\t\t@visible\n\t\tend",
"def present?\n exists? && visible?\n end",
"def window_title?\n window_title_set? and @_window_titles.any?\n end",
"def showTitle?(string)\n return string.start_with?(\"_\") ? false : true\n end",
"def cvv_help_displayed?\n cvv_help_div.visible?\n end",
"def window_title_set?\n defined?(@_window_titles)\n end",
"def display_featured_researcher?\n Flipflop.show_featured_researcher?\n end",
"def is_freelancer_skills_displayed\n @driver.find_element(:xpath, FREELANCER_SKILLS).displayed?\n end",
"def page_title?\n @_page_title.present?\n end",
"def titled?\n title.present? && (title != DEFAULT_TITLE)\n end",
"def page_title_set?\n defined?(@_page_title)\n end",
"def human_readable?\n display_component.blank?\n end",
"def displayed?\n as_page_class.displayed?\n end",
"def heading?\n self.is_heading?\n end",
"def visible?\n Waiter.wait_for do\n inst = presence\n !! inst && inst.visible?\n end\n end",
"def title?\n @assigned_paragraph_type == :title\n end",
"def display_name?\n !display_name.to_s.empty?\n end",
"def display?\n @document_self and not @ignored and\n (documented? or not @suppressed)\n end",
"def info_page_will_display_details\n if info_page_can_display_details && link.details_text_markup.to_s != ''\n true\n end\n end",
"def loaded?(*how)\n pageTitle_element.present?\n end",
"def title_check\n \n\n if self.title\n \n if !self.title.include? \"Believe\" || \"Won't\" || \"Secret\"\n true\n else\n false\n end\n else\n false\n end\n end",
"def can_i_read?(title)\n page_info_contains_key(title, 'readable', 'readable')\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"def is_title\n false\n end",
"def displayed?; end",
"def displayed?\n return (self.d_publish <= Time.zone.today) && (self.d_remove > Time.zone.today)\n end",
"def is_displayed_on_site?\n feed.feed_type.name == \"Article\"\n end",
"def inferred_title?(document); end",
"def displayed?(locator)\n find_element(locator).displayed?\n end",
"def showable?\n hidden? && hidden_origin.blank?\n end",
"def showable?\n hidden? && hidden_origin.blank?\n end",
"def show_on_carousel?\n if EventHost.show_on_carousel?(contact_email)\n true\n elsif EventHost.hide_on_carousel?(contact_email)\n false\n else\n sunrise_national_email? || (national_tag? && !volunteer_host?)\n end\n end",
"def title?\n !title.nil? && !title.empty?\n end",
"def title?\n !title.nil? && !title.empty?\n end",
"def display_navbar?\n return true if admin?\n return true if person.is_a?(Mentor) && person.passed_basics?\n return true if person.is_a?(Mentor) && person.current_lead?\n false\n end",
"def check_visible(obj)\n return obj.gr_is_visible?\n end",
"def has_visible_content?\n strong_memoize(:has_visible_content) do\n branches_filter(filter: :local).any? do |ref|\n begin\n ref.name && ref.target # ensures the branch is valid\n\n true\n rescue Rugged::ReferenceError\n false\n end\n end\n end\n end",
"def show_section_appraisal_moderated?\n subject.lead?(record) ||\n (\n record.assessor_assignments.moderated.submitted? &&\n (\n subject.primary?(record) ||\n (assessor? && record.from_previous_years?)\n )\n )\n end",
"def show?\n return true\n end",
"def visible?\n model.respond_to?(:visibility) && model.visibility.include?(Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)\n end",
"def title_enabled?(title)\n return true unless titles_filter.any?\n titles_filter.include? title\n end",
"def studium_generale?\n extended_title.nil?\n end",
"def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend",
"def hide_header?\n @web_view_mode || is_fullscreen_page?\n end",
"def title_only_by_default?(view)\n return false if %i[show enabled].include?(view)\n\n title_only = default_blacklight_config.view.send(:[], view)&.title_only_by_default\n title_only.nil? ? false : title_only\n end",
"def show?\n true\n end",
"def display?\n visible && (conditions.blank? || ((!conditions.blank?) && (eval(conditions))))\n end",
"def element_is_visible(name, tag, container, yes = true)\n elem = wait_visibility(name, tag, container, yes)\n elem ? true : false\n end",
"def tour_should_be_visible(title=nil)\n expect(page).to have_css 'div.hopscotch-bubble'\n if title.present?\n within 'div.hopscotch-bubble .hopscotch-title' do\n expect(page).to have_text title\n end\n end\nend",
"def part_of_title\n self.is_part_of && self.is_part_of.title ? self.is_part_of.title : nil\n end",
"def visible?\n @a.nonzero?\n end",
"def title?\n !name? && tagline\n end",
"def display?\n text? and super\n end",
"def splash_displayed?\n displayed? SPLASH_VIDEO\n end",
"def show?\n return true if user.admin? || is_in_company?(record)\n\n record.information_complete? ? true : false\n end",
"def screening?\n self.tip == \"screening\"\n end",
"def content_displayed?\n begin\n $session.wait_until(@driver.find_element(:xpath, '//*[@id=\"data\"]/tbody/tr/td[3]').displayed?)\n if @driver.find_element(:xpath, '//*[@id=\"data\"]/tbody/tr/td[3]').displayed?\n true\n end\n rescue\n false\n end\n end",
"def is_externally_visible\n return @is_externally_visible\n end",
"def include_in_menu?\n menu_options[:display] != false\n end",
"def display_embedded?\n display_as == 'embedded'\n end",
"def field_has_data(title, field, pregnant)\n\t\tif field_data_is_true(field) && title_should_be_shown(title, pregnant)\n\t\t\t\n\t\t\tif title == \"pregnant\" && !pregnant || title == \"pregnant_due_date\" && !pregnant\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\ttrue\t\t\t\n\t\tend\n\tend",
"def is_publicly_visible?\n return false if visibility.nil?\n return( visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC )\n end",
"def schedule_visible?\n schedule_public? || params[:preview]\n end",
"def none?\n self.display_on == \"none\"\n end",
"def show?\n true\n end",
"def show?\n true\n end",
"def show?\n true\n end",
"def show?\n true\n end",
"def intro_period?\n !is_intro_period.nil? && is_intro_period\n end",
"def shown_in_menu?\n false\n end",
"def title?\n !@title.to_s.empty?\n end",
"def search_result_page_existed?\r\n displayed?\r\n end",
"def sections?\n false\n end",
"def display_featured_works?\n Flipflop.show_featured_works?\n end",
"def check_list_title_should_be_displayed(title)\n expect(page).to have_selector 'h1', text: title\n end",
"def displayable_in_public_list?\n return true if human_readable?\n\n return true if filterable?\n end",
"def onScreen?\n return Squish::Object::exists(@symbolicName)\n end"
] |
[
"0.764265",
"0.740151",
"0.709556",
"0.6934321",
"0.6927972",
"0.68464124",
"0.68008417",
"0.6769768",
"0.67285717",
"0.66852236",
"0.66709924",
"0.6662933",
"0.6656356",
"0.66417414",
"0.66417414",
"0.6620933",
"0.6610969",
"0.65987206",
"0.6582707",
"0.65347195",
"0.65347195",
"0.6534709",
"0.6512783",
"0.64974505",
"0.64631",
"0.64630336",
"0.64536434",
"0.6440356",
"0.64393234",
"0.64120823",
"0.6398262",
"0.6381907",
"0.6362745",
"0.6320405",
"0.6317713",
"0.6310914",
"0.6301237",
"0.6277917",
"0.6268961",
"0.6248975",
"0.62364",
"0.6220715",
"0.6219101",
"0.6211",
"0.6210001",
"0.6204926",
"0.6172289",
"0.616264",
"0.6153437",
"0.615269",
"0.6151229",
"0.61448836",
"0.61256325",
"0.61256325",
"0.6121062",
"0.61148393",
"0.61148393",
"0.61138165",
"0.6104388",
"0.60950214",
"0.6087231",
"0.6078858",
"0.6071094",
"0.60636353",
"0.6056805",
"0.60512114",
"0.6046221",
"0.6043131",
"0.60370964",
"0.6034952",
"0.6030637",
"0.6019987",
"0.6011293",
"0.601045",
"0.60050064",
"0.596837",
"0.59505177",
"0.5948832",
"0.59453374",
"0.5943131",
"0.5941551",
"0.5941519",
"0.5923537",
"0.5918226",
"0.591594",
"0.59107494",
"0.5900415",
"0.5898613",
"0.5898613",
"0.5898613",
"0.5898613",
"0.5898374",
"0.5897551",
"0.58947337",
"0.588266",
"0.5881871",
"0.58802044",
"0.58780944",
"0.5872488",
"0.58721817"
] |
0.779525
|
0
|
This function verifying is Company title visible
|
def is_company_title_displayed
@driver.find_element(:xpath, COMPANY_TITLE).displayed?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def visible?(title)\n @driver.wait { @driver.text(title).displayed? }\n @driver.wait do\n @driver.find_element(\n @rows[:type], @rows[:value]\n ).displayed?\n end\n end",
"def title_check\n \n\n if self.title\n \n if !self.title.include? \"Believe\" || \"Won't\" || \"Secret\"\n true\n else\n false\n end\n else\n false\n end\n end",
"def is_freelancer_title_displayed\n @driver.find_element(:xpath, FREELANCER_TITLE).displayed?\n end",
"def third_screen_visible?\n @third_screen_title.visible?\n end",
"def post_title_displayed?\n wait = Selenium::WebDriver::Wait.new(timeout: 15)\n wait.until { displayed? POST_TITLE }\n end",
"def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend",
"def tour_should_be_visible(title=nil)\n expect(page).to have_css 'div.hopscotch-bubble'\n if title.present?\n within 'div.hopscotch-bubble .hopscotch-title' do\n expect(page).to have_text title\n end\n end\nend",
"def check_list_title_should_be_displayed(title)\n expect(page).to have_selector 'h1', text: title\n end",
"def verify_title(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::TITLE.name], element_value(title_input))\n end",
"def hasTitle\n if @title then\n true\n else\n false\n end\n end",
"def verify_title(test_data)\n verify_values_match(test_data[UseOfCollections::TITLE.name], element_value(title_input))\n end",
"def check_title\n @page_title = \"FauxTwitter\"\n end",
"def has_title?\n @title != nil\n end",
"def is_title\n false\n end",
"def bypass_title_validation?\n bypass_title_validation\n end",
"def page_title?\n @_page_title.present?\n end",
"def second_screen_visible?\n @second_screen_title.visible?\n end",
"def page_title_is_correct\n ( text =~ self.class.page_title_validation_value ) !=nil\n end",
"def title?\n !title.nil? && !title.empty?\n end",
"def title?\n !title.nil? && !title.empty?\n end",
"def title_enabled?(title)\n return true unless titles_filter.any?\n titles_filter.include? title\n end",
"def title_blank?\n self.title.blank?\n end",
"def company?\n directive.company?\n end",
"def titled?\n title.present? && (title != DEFAULT_TITLE)\n end",
"def check_page_title(text)\n $driver.title.should == text\n end",
"def part_of_title\n self.is_part_of && self.is_part_of.title ? self.is_part_of.title : nil\n end",
"def is_clickbait?\n if self.title\n clickbait_titles = [\"Won't Believe\", \"Secret\", \"Top\", \"Guess\"]\n if !clickbait_titles.any? {|cb| self.title.include?(cb)}\n errors.add(:title, \"no click bait\")\n end\n end\n end",
"def title?\n return false unless title\n return @display_title if defined?(@display_title)\n\n @display_title = (@text !~ %r!title=false!i)\n end",
"def display_header?\n !@request.hide_title?\n end",
"def verifynavpagetitle(pagetitle)\n customizedwait\n displayedpagetitle = $and_mob_driver.find_element(:id, XEBIATIMEPICKERPAGE[:pagetitle_id]).text\n if displayedpagetitle==pagetitle\n puts \"Actual page title #{displayedpagetitle} and Expected page title #{pagetitle} match\"\n else\n raise \"Expected page title #{pagetitle} but found actual title to be #{displayedpagetitle}\"\n end\n end",
"def window_title?\n window_title_set? and @_window_titles.any?\n end",
"def window_title_set?\n defined?(@_window_titles)\n end",
"def title_comp; end",
"def assert_valid_show_page(model, title: nil)\n ctrlr = controller_name(model)\n title = title ? sanitized_string(title) : property(ctrlr, :show, :title)\n heading = title ? { text: title } : {}\n body_css = property(ctrlr, :show, :body_css)\n assert_selector \"body#{body_css}\"\n assert_selector property(ctrlr, :show, :entry_css)\n assert_selector SHOW_HEADING_SELECTOR, **heading\n assert_title title if title\n end",
"def page_title_set?\n defined?(@_page_title)\n end",
"def verified_screen\n begin\n @appium_driver.find_element(:id, \"title\").displayed?\n rescue\n return false\n end\n end",
"def title?\n !@title.to_s.empty?\n end",
"def title?\n @assigned_paragraph_type == :title\n end",
"def is_title?(title)\n results = @client.find_game(title)\n title_names = results.collect{|game| game.name}\n title_names.uniq!\n title_names_downcase = title_names.map {|game| game.downcase}\n title_names_downcase.include? title.downcase\n end",
"def title_with_page_title_check\n return @page.title if @page && !@page.title.blank?\n title_without_page_title_check\n end",
"def check_title\n if self.title.blank? && st = (url && Site.by_link(self.url))\n self.title = (st.yield :Title, st.sampleURL)[:Title] || \"\"\n self.title = self.trimmed_title\n else\n self.title\n end\n end",
"def check_visibility\n if not @organisation.active?\n hidden = false\n if not current_user == @organisation\n hidden = true\n end\n\n current_user.is_a?(User) and current_user.has_role?(:admin) ? hidden = false : nil\n if hidden\n raise Helpedia::ItemNotVisible\n end\n end\n end",
"def visible?\n end",
"def assert_title(title)\n assert_seen title, :within => \"head title\"\n end",
"def partner_info_verify(partner)\n h3_section.text.eql?(partner.company_info.name).present?\n expand(account_details_icon)\n pooled_resources_table.visible?\n end",
"def has_title?(library, title)\n\nend",
"def cvv_help_displayed?\n cvv_help_div.visible?\n end",
"def check_visible(obj)\n return obj.gr_is_visible?\n end",
"def verify_landing_page\n @higgs.page_title_present?('Puppet Enterprise Installer')\n @higgs.link_present?('email the CEO.')\n @higgs.select_link(\"Let's get started\")\n @higgs.page_title_present?('Puppet Enterprise Installer - Choose your deployment')\n end",
"def company_name\n self.companies.count > 0 ? self.companies.first.title : ''\n end",
"def is_company_skills_displayed\n @driver.find_element(:xpath, COMPANY_SKILLS).displayed?\n end",
"def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end",
"def verify_page?(key, exit = true)\n base_title = wait_for_title(exit)\n puts \"Verify Title - Desired Prefix: #{site.get_title(key)} => Full Title: #{page_title}\" if exit\n if site.get_title(key) != base_title\n fail(\"Page title does not match expected result. EXPECTED: #{site.get_title(key)} FOUND: #{page_title}\") if exit\n return false\n end\n return true\n end",
"def enter_title(test_data)\n hide_notifications_bar\n wait_for_element_and_type(title_input, test_data[UseOfCollections::TITLE.name])\n end",
"def show?\n return true if user.admin? || is_in_company?(record)\n\n record.information_complete? ? true : false\n end",
"def title?\n !name? && tagline\n end",
"def user_has_role_in_company?\n \tif current_org_person.typ_position.blank?\n \t\tstore_location\n \tredirect_to edit_org_person_path(current_org_person.id), flash: {warning: \"You need to be approved by the company you have been assigned to first to access the requested page.\"}\n \tend \n end",
"def expected_title expected_title\n define_method 'has_expected_title?' do\n has_expected_title = expected_title.kind_of?(Regexp) ? expected_title =~ @browser.title : expected_title == @browser.title\n raise \"Expected title '#{expected_title}' instead of '#{@browser.title}'\" unless has_expected_title\n end\n end",
"def isCompany?\n self.category =~ /(company|index|currency)/i\n end",
"def validateMenuItem(item)\n case item.action\n when 'toggleDetailsWindow:'\n item.setTitle(@detailsController.window.isVisible ? \"Hide Details\" : \"Show Details\")\n true\n else\n true\n end\n end",
"def require_company?\n !!(self.brand && self.brand.name.to_s.match(/studer/i))\n end",
"def check_if_user_has_company\n if @user_company.nil?\n else\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.access_deny_text'\n end\n end",
"def showTitle?(string)\n return string.start_with?(\"_\") ? false : true\n end",
"def title_valid(title)\n if !title.empty?\n self.title = title\n return true\n else\n return false\n end\n end",
"def visible?\n true\n end",
"def verifySignupPageTitle\n pageurl = $browser.url\n if (pageurl.eql?\"https://www.slideshare.net/w/signup\")\n puts \"Signup page URL matched\"\n else puts \"Signup page URL mismatched\"\n end\n end",
"def aboutusActive?(page_title)\n 'class=\"active\"' if page_title == \"About Us\"\n end",
"def inferred_title?(document); end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def has_company?\n if self.group && self.group.company\n true\n else\n false\n end\n end",
"def verify_tooltip(text)\n return @page.has_content?(text)\n end",
"def is_externally_visible\n return @is_externally_visible\n end",
"def loaded?(*how)\n pageTitle_element.present?\n end",
"def is_visible?\n setup.show_all? || Date.today >= start_at\n end",
"def then_i_can_see_a_header_section\n expect(page).to have_content(I18n.t(\"coronavirus.pages.show.header_section.title\"))\n end",
"def visible?\n wd_element.displayed?\n end",
"def title_with_page_title_check\n return @content_node.title if @content_node && !@content_node.title.blank?\n title_without_page_title_check\n end",
"def basic_company_details_valid?\n return true unless AccountType.other_organisation?(account_type)\n\n company.valid?(account_type.registration_type.to_sym)\n end",
"def browsing_titles?\n model_table_name == 'name_titles'\n end",
"def display_open_title\n link = title_link\n if open_access \n \"<h3 class='open-title'> #{link} </h3>\".html_safe\n else\n \"<h3> #{link} </h3>\".html_safe\n end \n end",
"def display_navbar?\n return true if admin?\n return true if person.is_a?(Mentor) && person.passed_basics?\n return true if person.is_a?(Mentor) && person.current_lead?\n false\n end",
"def should_extract_title(doc)\n return true\n end",
"def allows_title?\n case kind\n when COVER, IMAGE1, AUDIO, VIDEO1, TITLE, TEXT then true\n else false\n end\n end",
"def valid?\n return false if @title.nil?\n true\n end",
"def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end",
"def title_comp=(_arg0); end",
"def visible?\n model.respond_to?(:visibility) && model.visibility.include?(Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC)\n end",
"def terms_conditions\r\n\t@title = \"Terms & Conditions\"\r\n end",
"def get_contract_filter\n\t get_contract\n\t @tabtitle = @contract.name unless @contract.nil?\n\t true\n\tend",
"def check_visibility\n raise Helpedia::ItemNotVisible unless @user.visible_for?(current_user)\n end",
"def errata_tool_qe_visible?\n errata_tool_qe_available? && cookies[:qe_menu_visible].to_bool\n end",
"def title\n t = nil\n # default to long title\n long_titles = self.courses.map(&:long_title)\n return t if (t = long_titles.find(&:present?)).present?\n\n # then try specific title. then short title\n return self.specific_title if self.specific_title.present?\n\n short_titles = self.courses.map(&:short_title)\n return t if (t = short_titles.find(&:present?)).present?\n\n return '(Title Unavailable)'\n end",
"def terms_conditions\n @title = \"Terms and Conditions\"\n end",
"def enter_title(test_data)\n hide_notifications_bar\n logger.info \"Entering title '#{test_data[CoreUseOfCollectionsData::TITLE.name]}'\"\n wait_for_element_and_type(title_input, test_data[CoreUseOfCollectionsData::TITLE.name])\n end",
"def has_visible_content?\n strong_memoize(:has_visible_content) do\n branches_filter(filter: :local).any? do |ref|\n begin\n ref.name && ref.target # ensures the branch is valid\n\n true\n rescue Rugged::ReferenceError\n false\n end\n end\n end\n end",
"def can_override_branding_for?(company)\n already_overridden = company.advisor_company_affiliations.with_access.where(:advisor_company_id.ne => id, override_branding: true).exists?\n not already_overridden\n end",
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def should_load_application_for(company)\n # wait until metrics page is loaded\n wait_until { page.has_css?('#metrics-container') }\n\n within('.head-buttons') do\n page.should have_button(company.name)\n end\n\n within 'button.user-settings' do\n page.should have_content(company.name)\n end\n end",
"def internal_frame_shown(title)\n append_to_script \"internal_frame_shown \\\"#{title}\\\"\"\n end"
] |
[
"0.67883676",
"0.672336",
"0.66816527",
"0.6651884",
"0.6413975",
"0.63672215",
"0.633768",
"0.62695855",
"0.62595093",
"0.62374586",
"0.62158734",
"0.6193987",
"0.61713064",
"0.61666167",
"0.6162868",
"0.61390465",
"0.6122508",
"0.6108706",
"0.6087422",
"0.6087422",
"0.60873675",
"0.60496765",
"0.60254645",
"0.5992756",
"0.59908235",
"0.59828836",
"0.5977742",
"0.5965051",
"0.59631443",
"0.59629905",
"0.5951273",
"0.5945623",
"0.59392864",
"0.5921653",
"0.590978",
"0.59012103",
"0.5887533",
"0.5878481",
"0.58671105",
"0.5858835",
"0.584737",
"0.5836996",
"0.5835161",
"0.582355",
"0.5813601",
"0.57884306",
"0.57866263",
"0.5782538",
"0.5780942",
"0.57716984",
"0.5754035",
"0.5743954",
"0.57406974",
"0.5739304",
"0.57350826",
"0.57287383",
"0.57250917",
"0.5721013",
"0.5688711",
"0.5687829",
"0.56779623",
"0.5672685",
"0.56691337",
"0.5668932",
"0.5666451",
"0.56655544",
"0.5643704",
"0.563218",
"0.56265664",
"0.56265664",
"0.56253",
"0.5615485",
"0.55857915",
"0.5575055",
"0.5571108",
"0.5570412",
"0.55702466",
"0.55665517",
"0.55554163",
"0.5552989",
"0.5524738",
"0.5514998",
"0.55095303",
"0.5507108",
"0.55045253",
"0.54863584",
"0.5478928",
"0.5474109",
"0.5473846",
"0.5467518",
"0.5460087",
"0.54539216",
"0.54529804",
"0.54504734",
"0.5449445",
"0.54490155",
"0.5441302",
"0.5438804",
"0.5433989",
"0.5431984"
] |
0.78528446
|
0
|
This function verifying is Freelancer description displayed
|
def is_freelancer_description_displayed
@driver.find_element(:xpath, FREELANCER_DESCRIPTION).displayed?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_description?\n true\n end",
"def compare_description?(freelancer_descr, profile_descr)\n serialized_freelance_descr = freelancer_descr.chomp(\"...\").split(\" \")\n serialized_profile_descr = profile_descr.gsub(\"\\n\", \" \").split(\" \")[0..serialized_freelance_descr.size-1]\n comparision = serialized_freelance_descr - serialized_profile_descr\n if comparision.empty?\n return true\n # case if last word in short description is cutted\n elsif comparision.size == 1 and serialized_profile_descr[-1].include? serialized_freelance_descr[-1]\n return true\n end\n false\n end",
"def description?\n !description.nil? && !description.empty?\n end",
"def has_description?\n @desc && @desc.is_a?(String) && !@desc.empty?\n end",
"def is_freelancer_title_displayed\n @driver.find_element(:xpath, FREELANCER_TITLE).displayed?\n end",
"def check_description(description)\r\n # Return error message if description is blank.\r\n return \"Description cannot be blank.\" if description == \"\"\r\n # Return error message if description is too long.\r\n if description.length > 140\r\n return \"Description was #{description.length} characters long; cannot exceed 140.\"\r\n end\r\n # Otherwise \"ok\"\r\n return \"ok\"\r\n end",
"def includes_description?\n !long_desc.empty? || !desc.empty?\n end",
"def description?\n !(@description.nil? || @description.empty?)\n end",
"def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end",
"def display_disclaimer()\n # Display Disclaimer\n puts 'The contents of this class must not be considered an offer,'\n puts 'proposal, understanding or agreement unless it is confirmed'\n puts 'in a document signed by at least five blood-sucking lawyers.'\n end",
"def validate_description\n if self.description.match(/<a[^<>]*>|\\<a[^<>]*\\>/i)\n return false \n else\n return true\n end\n end",
"def description?\n non_empty?(@description)\n end",
"def meta_description?\n meta_description.present?\n end",
"def generic_meta_description?\n [truncate(document.title, length: 30, omission: nil.to_s), meta_description].map{|d| d.downcase.split}.reduce(&:&).size > 0\n end",
"def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend",
"def has_description?\n !error.description.to_s.empty?\n end",
"def show_description (description)\n unless description.nil?\n puts \"Your description is: #{description}\"\n else \"This url needs description\"\n #description.split(\"\\s\").each do |i|\n #puts \"description: #{i}\"\n end\nend",
"def description\n description = puts \"Shelves containing food and other common supplies line the walls \"\\\n \"here. These things were probably stolen from the local village or nearby farms during \"\\\n \"raids. Although there doesn't seem to be anything of value here, you never know what a \"\\\n \"search will turn up.\"\n puts \"You can go back the way you came from.\"\n if @monster\n puts \"An evil #{@monster.monster} is here, ruffling for something to eat.\"\n else\n puts \"The squeek of a rat and pitter-patter of tiny rodent feet is all you hear.\"\n end\n end",
"def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend",
"def info_page_will_display_details\n if info_page_can_display_details && link.details_text_markup.to_s != ''\n true\n end\n end",
"def descriptive_text\n description.blank? && taxon ? taxon.descriptive_text : description\n end",
"def description; @text; end",
"def has_description?\n description_history.length > 0\n end",
"def pr_description\n danger_file.warn('Please provide a summary in the Pull Request description') if danger_file.github.pr_body.length < 3 && danger_file.git.lines_of_code > 10\n end",
"def markdown?\n defined?(RDiscount) or defined?(BlueCloth)\n end",
"def markdown?\n defined?(RDiscount) or defined?(BlueCloth)\n end",
"def get_description(n)\n description = Nokogiri::HTML(super(n)).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[0]\n description = description.split(\" \")[3..-1].join(\" \") # remove \"by 'author name'\"\n description.slice!(\"[ Subscribe to the comments on this story ] \")\n description\n else\n nil\n end\n end",
"def _validate_description(d)\n if d == spec.summary\n results.add_warning('description', 'The description is equal to' \\\n ' the summary.')\n end\n\n if d.strip.empty?\n results.add_error('description', 'The description is empty.')\n elsif spec.summary && d.length < spec.summary.length\n results.add_warning('description', 'The description is shorter ' \\\n 'than the summary.')\n end\n end",
"def description\n \"validate successfully\"\n end",
"def main_description; end",
"def greetingcard_description(greetingcard)\n description = if Spree::Config[:show_raw_greetingcard_description]\n greetingcard.description\n else\n greetingcard.description.to_s.gsub(/(.*?)\\r?\\n\\r?\\n/m, '<p>\\1</p>')\n end\n description.blank? ? Spree.t(:greetingcard_has_no_description) : raw(description)\n end",
"def brief_description\n call_proc_or_return_value(self::BRIEF_DESCRIPTION)\n end",
"def description\n document.at(\"[@id='description']/span[1]\").innerHTML.goodreads_strip_tags.goodreads_strip_bad_description_content rescue nil\n end",
"def description_present\n if description.blank?\n errors.add(:description, \"Can't be empty\")\n end\n end",
"def description_presence\n return if self[:description].present?\n\n self.flag_type = self[:flag_type].try(:to_i)\n\n case self.flag_type\n when FLAG_TYPE['terms_of_use_violation']\n errors.add(:description, I18n.t(\"image_flag.missing_description_terms_of_use_violation\"))\n when FLAG_TYPE['copyright']\n errors.add(:description, I18n.t(\"image_flag.missing_description_copyright\"))\n else\n errors.add(:description, \"Unknown violation type!\")\n end\n end",
"def show_description (url, description)\n if description.nil?\n puts \"Warning: (#{url}) needs a description.\"\n else \n puts \"Description of this URL (#{url}) is: #{description}.\"\n end\nend",
"def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is great design. We love interactive work like websites, games and apps because we get involved in building what we design.\"\n end\n end",
"def check_human_readable(feature, view=false)\n find('#Family').click unless view\n feature.expect(self).to feature.have_content 'Person, Spouse Middle'\n feature.expect(self).to feature.have_content 'Person, Father Middle Sr.'\n feature.expect(self).to feature.have_content 'Maiden, Mother Middle'\n end",
"def verify_admission_preview(options={})\n texts = get_text(\"css=#content\")\n texts.include?(options[:acct_class])== true\n #texts.include?(options[:patient]) == true\n #texts.include?(options[:pin]) == true\n #texts.include?(options[:nursing_display]) == true\n # (texts.include?(options[:package])) == true if options[:package] != \"Select Package\"\n (texts.include?(options[:diagnosis])) == true\n (texts.include?(options[:mobilization])) == true\n #texts.include?(options[:nursing_display]) == true\n (texts.include?(options[:guarantor_type])) == true\n end",
"def check_human_readable(feature, view=false)\n find('#Demographics').click unless view\n feature.expect(self).to feature.have_content 'Male'\n feature.expect(self).to feature.have_content '1970-01-01'\n feature.expect(self).to feature.have_content 'United States, Massachusetts, Bedford'\n feature.expect(self).to feature.have_content 'No'\n feature.expect(self).to feature.have_content 'Married'\n feature.expect(self).to feature.have_content 'Bachelor\\'s degree'\n feature.expect(self).to feature.have_content 'Known, White'\n feature.expect(self).to feature.have_content 'Example1'\n feature.expect(self).to feature.have_content 'Example2'\n end",
"def digital?\n @descriptive_detail.digital?\n end",
"def description\n page.render_part('description') rescue ''\n end",
"def description\n page.render_part('description') rescue ''\n end",
"def description\n desc = details.at(\"div.summary_text[itemprop='description']\").text.strip.clean_description rescue nil\n (desc.nil? || desc.empty?) ? nil : desc\n end",
"def set_description?\n description.nil? || description.empty?\n end",
"def sale_markdown\r\n if (sale)\r\n sale.markdown\r\n else\r\n false\r\n end\r\n end",
"def filter_description(text, readmore, url)\n if text\n _text = Sanitize.fragment(text[0...1000] + '…', Sanitize::Config::RELAXED)\n if readmore && url\n _text = \"#{_text} <p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\n _text\n else\n \"<p><a class=\\\"event-read-more\\\" href=\\\"#{url}\\\">#{readmore}</a></p>\"\n end\nend",
"def short_description(description)\n if description != nil\n \"#{description[0..25]}...\"\n else\n \"No description yet...\"\n end\n end",
"def has_meta_description?\n !!meta_description\n end",
"def verify_markup_options; end",
"def verify_project_desc(test_data)\n verify_values_match(test_data[UseOfCollections::PROJECT_DESC.name], element_value(project_desc_text_area))\n end",
"def display_delisted_description(organization)\n organization.removal_reason == RemovalReason.delisted ? 'Reason for expulsion' : 'Reason for delisting'\n end",
"def informational?; end",
"def author_worthy?\n notes?\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def viewable_description\n\t ''\n\tend",
"def short_description\n if self.description.nil?\n nil\n else\n self.description[%r{^[^\\n\\r]*}]\n end\n end",
"def best_description\n if description?\n description\n else\n additional_description\n end\n end",
"def verify_tooltip(text)\n return @page.has_content?(text)\n end",
"def has_remark?\n !remark_result.nil?\n end",
"def general_remark_enabled?\n settings[:general_remarks] == \"1\"\n end",
"def description\n @description = \"Espresso\"\n end",
"def check_description\n @repo_data ? @repo_data['description'] : nil\n end",
"def very_long_pollution_sources_description?\n bathing_water&.long_pollution_description?(VERY_LONG_DESCRIPTION_LIMIT) &&\n show_prf?\n end",
"def description\n description = \"\"\n end",
"def describe\n @description\n end",
"def describe\n @description\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def verify_project_desc(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::PROJECT_DESC.name], element_value(project_desc_text_area))\n end",
"def require_description_presence?\n self.can_send_email\nend",
"def require_description_presence?\n self.can_send_email\n end",
"def desc?\n @properties.key?(:desc) && !@properties[:desc].empty?\n end",
"def set_description(page)\n if !page.data['description']\n page.data['description'] = \"Check end-of-life, release policy and support schedule for #{page.data['title']}.\"\n end\n end",
"def description\n description = \"\"\n if @monster\n puts \"An evil #{@monster.monster} is here.\"\n else\n puts \"The room is eerily quite.\"\n end\n end",
"def claim_desc_required?\n @reason == 'OTHER'\n end",
"def description_for_google\n google_description.present? ? google_description : description\n end",
"def description\n \"testing\"\n end",
"def description\n \"testing\"\n end",
"def description\n end",
"def description\n @description = \"Dark Roast Coffee\"\n end",
"def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n parts << \"#{number_to_currency(sa)} setup fee\" if sa && sa > 0\n \n am = amount(false)\n parts << \"#{number_to_currency(am)}/mo\"\n \n if prepaid_message_count >= UNLIMITED\n texts = \"unlimited\"\n else\n texts = \"#{prepaid_message_count}/mo prepaid\"\n end\n \n @description = parts.join(', ') + \" and #{texts} texts after that.\"\n\n return @description\n end",
"def test_format_reason_code_description\n valid_rc_desc = \"The impact of prior payer(s) adjudication including payments and/or adjustments\"\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code1))\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code2))\n assert_equal(valid_rc_desc, @output_xml_obj.format_reason_code_description(@reason_code3))\n end",
"def description_html\n @description_html ||= RDiscount.new(original.body).to_html\n end",
"def formal_description\n @data['formalDescription']\n end",
"def product_description\n return product_presentation.description if product_presentation\n return \"\"\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def display_repel_check\n display_message(parse_text(39, 0))\n end",
"def true_false_rationale(text)\n frm.text_field(:name=>/:deliverTrueFalse:rationale/).value=text\n end",
"def _validate_summary(s)\n if s.length > 140\n results.add_warning('summary', 'The summary should be a short ' \\\n 'version of `description` (max 140 characters).')\n end\n if s =~ /A short description of/\n results.add_warning('summary', 'The summary is not meaningful.')\n end\n end",
"def human_readable?\n display_component.blank?\n end"
] |
[
"0.69349825",
"0.678449",
"0.65462655",
"0.65162784",
"0.64722085",
"0.6456985",
"0.6433818",
"0.6417562",
"0.640336",
"0.6402933",
"0.6396678",
"0.6365976",
"0.6354546",
"0.63342744",
"0.6312018",
"0.6241672",
"0.6222901",
"0.6215725",
"0.61958957",
"0.61919767",
"0.6135295",
"0.61342883",
"0.6118756",
"0.610791",
"0.6105262",
"0.6105262",
"0.6103147",
"0.60813564",
"0.60756433",
"0.6069279",
"0.6067351",
"0.6066427",
"0.6052063",
"0.60505897",
"0.6049831",
"0.6037851",
"0.60200334",
"0.6018827",
"0.6005804",
"0.60036254",
"0.5997187",
"0.5995147",
"0.5995147",
"0.599493",
"0.59924376",
"0.5979361",
"0.59741044",
"0.5968165",
"0.596573",
"0.59385526",
"0.5924993",
"0.590706",
"0.5906",
"0.5894167",
"0.5890733",
"0.5890733",
"0.5889357",
"0.5880759",
"0.58757514",
"0.5875047",
"0.58714324",
"0.58649975",
"0.58646995",
"0.5858209",
"0.5856855",
"0.5853102",
"0.58524996",
"0.58524996",
"0.58512884",
"0.5848948",
"0.58481437",
"0.58453846",
"0.5845016",
"0.58439523",
"0.58404046",
"0.58391625",
"0.583469",
"0.5809834",
"0.5809834",
"0.58076715",
"0.580411",
"0.5799909",
"0.579419",
"0.57907325",
"0.5788908",
"0.57882",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.578625",
"0.5780114",
"0.57788956",
"0.57783365",
"0.57764167"
] |
0.7505479
|
0
|
This function verifying is Freelancer Skills displayed
|
def is_freelancer_skills_displayed
@driver.find_element(:xpath, FREELANCER_SKILLS).displayed?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_company_skills_displayed\n @driver.find_element(:xpath, COMPANY_SKILLS).displayed?\n end",
"def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend",
"def verify_admission_preview(options={})\n texts = get_text(\"css=#content\")\n texts.include?(options[:acct_class])== true\n #texts.include?(options[:patient]) == true\n #texts.include?(options[:pin]) == true\n #texts.include?(options[:nursing_display]) == true\n # (texts.include?(options[:package])) == true if options[:package] != \"Select Package\"\n (texts.include?(options[:diagnosis])) == true\n (texts.include?(options[:mobilization])) == true\n #texts.include?(options[:nursing_display]) == true\n (texts.include?(options[:guarantor_type])) == true\n end",
"def wait_for_freelancer_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, FREELANCER_SKILLS)\n end",
"def show_selected_lawyer\n if is_secretary? && is_lawyer_selected?\n return true\n end\n return false\n end",
"def premium?\n product == \"premium\"\n end",
"def premium?\n premium\n end",
"def premium?\n \t! free?\n end",
"def is_freelancer_title_displayed\n @driver.find_element(:xpath, FREELANCER_TITLE).displayed?\n end",
"def showCareerBox()\n if !current_profession.blank? or \n !c_previous_professions.blank? or \n !current_class.blank? or \n !c_previous_classes.blank? or \n !paragon_path.blank? or \n !epic_destiny.blank? or\n !level.blank? or\n !server.blank? or\n !guild.blank?\n\n return true\n else\n return false\n end\n end",
"def errata_tool_qe_visible?\n errata_tool_qe_available? && cookies[:qe_menu_visible].to_bool\n end",
"def info_show_profession_of_faith\n chosen_baptized_catholic? && !baptized_catholic\n end",
"def verifySpeakersDisplayed()\n speakers= speakersDisplayed()\n #assert_equal speakers, true, \"In people>>speaker screen speakers should be shown\"\n end",
"def display_disclaimer()\n # Display Disclaimer\n puts 'The contents of this class must not be considered an offer,'\n puts 'proposal, understanding or agreement unless it is confirmed'\n puts 'in a document signed by at least five blood-sucking lawyers.'\n end",
"def verify_freelancer_profile(freelancers)\n Logbook.step(\"Verify freelancer #{@freelancer_profile[:name]} profile\")\n freelancer = freelancers.find { |freelancer| freelancer[:name] == @freelancer_profile[:name] }\n Logbook.message(\"*****Profile page of #{freelancer[:name]}*****\")\n @freelancer_profile.each do |key, value|\n if value.include?(freelancer[key.to_sym])\n Logbook.message(\"+ Profile field #{key} matches with the same field from preview.\")\n else\n Logbook.message(\"- Profile field #{key} does not match with the same field from preview.\")\n end\n end\n end",
"def is_freelancer_description_displayed\n @driver.find_element(:xpath, FREELANCER_DESCRIPTION).displayed?\n end",
"def show_draft_button?\n current_c100_application.try(:child_protection_cases)\n end",
"def can_accept_showing?\n profile.valid? && valid_bank_token? && !blocked?\n end",
"def show_lawyer\n end",
"def partner_info_verify(partner)\n h3_section.text.eql?(partner.company_info.name).present?\n expand(account_details_icon)\n pooled_resources_table.visible?\n end",
"def is_premium\n premium_tier > 0\n end",
"def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end",
"def smokes?\n userPreference.smokes?\n end",
"def show_prf?\n bathing_water['latestProfile.pollutionRiskForecasting'].val == 'true'\n end",
"def show_prize_ui?\n false\n end",
"def check_if_all_pop_ups_are_displayed\n\n your_league_pop_up_should_not_be_displayed\n make_your_predictions_pop_up_should_not_be_displayed\n join_private_league_pop_up_should_not_be_displayed\n join_public_league_pop_up_should_not_be_displayed\n create_your_own_league_pop_up_should_not_be_displayed\n\n end",
"def verify_landing_page\n @higgs.page_title_present?('Puppet Enterprise Installer')\n @higgs.link_present?('email the CEO.')\n @higgs.select_link(\"Let's get started\")\n @higgs.page_title_present?('Puppet Enterprise Installer - Choose your deployment')\n end",
"def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end",
"def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend",
"def is_korps?\n luser = current_user\n if luser.nil?\n flash[:error] = \"Snooping as usual, I see! (you need to be logged in to see this page)\"\n access_denied\n return\n end\n if not luser.state == \"active\"\n flash[:error] = \"Your account has not been activated yet. Check your email.\"\n end\n if not luser.is_korps\n flash[:error] = \"Your account hasn't been approved yet.\"\n access_denied\n end\n end",
"def alone?\n\t\t@warrior.feel.empty?\n end",
"def faab?\n free_agent? && !waiver_bid.nil?\n end",
"def double_faced?\n two_up? && mana_costs_shown.select(&:present?).count < 2\n end",
"def licensed?\n end",
"def valid_test_taking()\n if current_user.tenant.pricing_plan.plan_group == \"assessment_only_plan\" then\n if current_user.tenant.remaining_learner_credit > 0 then\n return true\n else\n return false\n end\n else\n return true\n end\n end",
"def wait_for_company_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, COMPANY_SKILLS)\n end",
"def show\n self.checklabo?\n self.checkspatioport?\n self.checkministere?\n end",
"def viewing_players_tab?\n ! viewing_scouts_tab?\n end",
"def previewable?\n if self.root.assigned_theme_ids.include?(0)\n return !self.assigned_theme_ids.include?(0)\n else\n return true \n end\n end",
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def price_consented?\n price_consent_status == 1\n end",
"def skill_ok?\n check_ok?(:skill) || all_ok?\n end",
"def show_policies\n\t\tputs \"asddmas\"\n\tend",
"def claimed_for_final_exam?\n claimed_final_application?\n end",
"def is_premium\n return @is_premium\n end",
"def third_screen_visible?\n @third_screen_title.visible?\n end",
"def pain_generation_enabled?\n creditor_detail.present?\n end",
"def skill_wtype_ok?(skill)\r\n return true\r\n end",
"def has_honors\n if @gpa >= 3.5\n return true\n end\n return false\n end",
"def approved?\n Weam.match('aprvd', poo_status) && \n !Weam.match(\"^(#{ALC1}|#{ALC2})\", applicable_law_code) &&\n (\n institution_of_higher_learning_indicator || \n ojt_indicator ||\n correspondence_indicator ||\n flight_indicator ||\n non_college_degree_indicator\n )\n end",
"def allow_entry?\n #current_financial_year.is_freezed?\n @financial_year.is_freezed?\n end",
"def on_saling?\n return false if flash_sale_detail_id.nil?\n\n !FlashSaleDetail.find_by(id: flash_sale_detail_id).nil?\n end",
"def rech_bonus?\n has_feature?(:esper_recharger)\n end",
"def premium?\r\n category.premium? rescue nil\r\n end",
"def approve_initial_requirements?\n approve_step?('#2')\n end",
"def approve_initial_requirements?\n approve_step?('#2')\n end",
"def has_discounts?\n rpg_shop.permit_sales\n end",
"def can_assimilate?\n skills.select { |skill| skill.assimilate? }.any?\n end",
"def person_award?\n !store_award?\n end",
"def offers_reward?\n !self.rewards.visible.empty?\n end",
"def need_details?\r\n admin? || purchasing? || popv_admin?\r\n end",
"def display_personal_info_and_disclaimer\n display_personal_information()\n display_disclaimer()\n end",
"def verify!\n raise \"Payment details not active anymore\" if active == false\n end",
"def reseller_allowed_to_view_hgc_stats?\n if !self.is_reseller?\n raise \"User type error\"\n else\n Confline.get_value('Show_HGC_for_Resellers').to_i == 1 and (self.reseller_allow_providers_tariff? or !rs_active?)\n end\n end",
"def confirm_pur_number_warning()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n gsm_error_message.should_exist\n invalid_gc_msg = gsm_error_message.inner_text\n invalid_gc_msg.should match(\"Please enter a valid loyalty card number\")\n end",
"def claim_amount_required?\n @full_repayment_of_ads != 'Y'\n end",
"def has_enough_points\n if !@signed_in\n return false\n elsif current_user.sk.admin?\n return true\n else\n return (current_user.sk.rating >= 200)\n end\n end",
"def check_accessibility\n end",
"def daf_trial_length_ignorable?\n daf_retrial_combo_ignorable || @record.claim.hardship?\n end",
"def cap? ; prod_type == 'cap' end",
"def experience?\n experiences.present?\n end",
"def user_consenting?; end",
"def self_auditor_checked?\n self.designer_result != 'None'\n end",
"def show_profile?\n if controller.controller_name == 'hackers'\n true\n else\n false\n end\n end",
"def on_display?\n is_sold && ( !discontinued? || has_stock? ) && ( has_stock? || Spree::Config[:show_zero_stock_products] )\n end",
"def rank_officer?\n !rank_id.nil? && rank.rate > 2\n end",
"def cvv_help_displayed?\n cvv_help_div.visible?\n end",
"def show?\n !@proposal.nil?\n end",
"def show?\n return true if user.admin? || is_in_company?(record)\n\n record.information_complete? ? true : false\n end",
"def laid_off_reason_found(arg_prescreen_household_id)\n \tif PrescreenAssessmentAnswer.where(\"prescreen_household_id = ?\n \t\t and assessment_question_id = 892\n \t\t and answer_value = 'Laid off due to company downsizing or poor company performance'\",\n \t\t arg_prescreen_household_id ).count > 0\n \t\treturn 'Y'\n \t\t# YES self_sufficient\n \telse\n \t\treturn 'N'\n \t\t# NOT self_sufficient\n\n \tend\n end",
"def is_customize_preview\n # TS_INFO: Customizer not implemented\n false\n end",
"def has_free_trial?\n return (trial and trial.free?)\n end",
"def loan_officers?\n\t\t!!current_admin || !!current_loan_manager || !!current_accountant\n\tend",
"def scores_enabled?\n session[:show_scores] != false\n end",
"def premium?\n status?(UserStatuses::PREMIUM)\n end",
"def hasEnoughFunds?\n available = @mturk.availableFunds\n puts \"Got account balance: %.2f\" % available\n return available > 0.055\nend",
"def trial?\n (plan_type == 'free_trial')\n end",
"def display_navbar?\n return true if admin?\n return true if person.is_a?(Mentor) && person.passed_basics?\n return true if person.is_a?(Mentor) && person.current_lead?\n false\n end",
"def renewal_or_review_mandatory?\n existing_agreement? && waste_producer_water_discount?\n end",
"def factoring_enabled\n [\n self.CustomerProfileNo == VISMA_CONFIG['factoring_customer_profile_number'],\n self.FormProfileCustNo == VISMA_CONFIG['factoring_form_profile_number'],\n self.RemittanceProfileNo == VISMA_CONFIG['factoring_remittance_profile_number'],\n self.CustomerNo == self.FactCustomerNo.to_i\n ].all?\n end",
"def in_law; end",
"def check_profile_enabled(u)\n fn = u.first_name\n ln = u.last_name\n un = u.username\n e = u.email\n visit user_path(u)\n assert page.has_css?('title', text: full_title(\"User: #{fn} #{ln}\"),\n visible: false)\n assert page.has_css?('h1', text: \"User: #{fn} #{ln}\",\n visible: false)\n assert page.has_text?(\"Username: #{un}\")\n assert page.has_text?(\"Email: #{e}\")\n end",
"def screening?\n self.tip == \"screening\"\n end",
"def judge_scores?\n standard_skill_score_entries.any?\n end",
"def cheatsEnabled \n \"cheatsEnabled\" \n end",
"def display_featured_researcher?\n Flipflop.show_featured_researcher?\n end",
"def current_user_is_pal?\n current_user && current_user.person && current_user.person.is_pal?\n end"
] |
[
"0.6313923",
"0.6224503",
"0.6219658",
"0.61862093",
"0.61831677",
"0.59142196",
"0.5908934",
"0.5901913",
"0.58925664",
"0.5890618",
"0.5883302",
"0.5859034",
"0.580531",
"0.5792772",
"0.57713014",
"0.5737664",
"0.5715716",
"0.56702536",
"0.5661672",
"0.56448835",
"0.5631394",
"0.5625567",
"0.56188905",
"0.5617394",
"0.5607209",
"0.55916935",
"0.5580842",
"0.55758625",
"0.55614126",
"0.5516145",
"0.5515771",
"0.54918003",
"0.5476446",
"0.54762024",
"0.5468566",
"0.5437918",
"0.5433349",
"0.5431804",
"0.5426599",
"0.5418477",
"0.5415548",
"0.5415548",
"0.5415548",
"0.54128057",
"0.5411246",
"0.54067814",
"0.5400087",
"0.53992146",
"0.53743917",
"0.5374219",
"0.53635716",
"0.5361358",
"0.53603727",
"0.53509367",
"0.5346988",
"0.53402156",
"0.53305805",
"0.5322055",
"0.5322055",
"0.5315451",
"0.5304044",
"0.5297105",
"0.52959687",
"0.5294781",
"0.5258657",
"0.5257241",
"0.52526784",
"0.5249842",
"0.52462333",
"0.52454674",
"0.524526",
"0.5238971",
"0.5236284",
"0.52344215",
"0.5232021",
"0.52299935",
"0.52201736",
"0.52143043",
"0.52113426",
"0.52038705",
"0.5203196",
"0.52009857",
"0.519932",
"0.5199207",
"0.5198177",
"0.5192409",
"0.5186814",
"0.51862484",
"0.5181073",
"0.5173874",
"0.5171733",
"0.51692295",
"0.51657337",
"0.5160442",
"0.5158584",
"0.5155927",
"0.51515543",
"0.51460147",
"0.51448524",
"0.5144798"
] |
0.7369797
|
0
|
This function verifying is Company Skills displayed
|
def is_company_skills_displayed
@driver.find_element(:xpath, COMPANY_SKILLS).displayed?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def wait_for_company_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, COMPANY_SKILLS)\n end",
"def is_freelancer_skills_displayed\n @driver.find_element(:xpath, FREELANCER_SKILLS).displayed?\n end",
"def partner_info_verify(partner)\n h3_section.text.eql?(partner.company_info.name).present?\n expand(account_details_icon)\n pooled_resources_table.visible?\n end",
"def is_company_title_displayed\n @driver.find_element(:xpath, COMPANY_TITLE).displayed?\n end",
"def show_selected_lawyer\n if is_secretary? && is_lawyer_selected?\n return true\n end\n return false\n end",
"def check_if_user_has_company\n if @user_company.nil?\n else\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.access_deny_text'\n end\n end",
"def verify_persinfo\n\t\t@browser.url == \"https://www.autogravity.com/credit/application/personal\"\n\t\t@browser.div(:visible_text, /Personal Information$/).present?\n\tend",
"def verify_admission_preview(options={})\n texts = get_text(\"css=#content\")\n texts.include?(options[:acct_class])== true\n #texts.include?(options[:patient]) == true\n #texts.include?(options[:pin]) == true\n #texts.include?(options[:nursing_display]) == true\n # (texts.include?(options[:package])) == true if options[:package] != \"Select Package\"\n (texts.include?(options[:diagnosis])) == true\n (texts.include?(options[:mobilization])) == true\n #texts.include?(options[:nursing_display]) == true\n (texts.include?(options[:guarantor_type])) == true\n end",
"def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end",
"def showCareerBox()\n if !current_profession.blank? or \n !c_previous_professions.blank? or \n !current_class.blank? or \n !c_previous_classes.blank? or \n !paragon_path.blank? or \n !epic_destiny.blank? or\n !level.blank? or\n !server.blank? or\n !guild.blank?\n\n return true\n else\n return false\n end\n end",
"def display_navbar?\n return true if admin?\n return true if person.is_a?(Mentor) && person.passed_basics?\n return true if person.is_a?(Mentor) && person.current_lead?\n false\n end",
"def verify_landing_page\n @higgs.page_title_present?('Puppet Enterprise Installer')\n @higgs.link_present?('email the CEO.')\n @higgs.select_link(\"Let's get started\")\n @higgs.page_title_present?('Puppet Enterprise Installer - Choose your deployment')\n end",
"def show?\n return true if user.admin? || is_in_company?(record)\n\n record.information_complete? ? true : false\n end",
"def share_cases?(account)\n if [AppConstants::PRIVILEGE[:super_user],AppConstants::PRIVILEGE[:admin],AppConstants::PRIVILEGE[:user_manager]].include?(portal_privilege) and account == company\n true\n else\n false\n end\n end",
"def view_admin_subtabs?\n check?(:manage_assessments?, user)\n end",
"def skill_ok?\n check_ok?(:skill) || all_ok?\n end",
"def check_if_all_pop_ups_are_displayed\n\n your_league_pop_up_should_not_be_displayed\n make_your_predictions_pop_up_should_not_be_displayed\n join_private_league_pop_up_should_not_be_displayed\n join_public_league_pop_up_should_not_be_displayed\n create_your_own_league_pop_up_should_not_be_displayed\n\n end",
"def errata_tool_qe_visible?\n errata_tool_qe_available? && cookies[:qe_menu_visible].to_bool\n end",
"def should_load_application_for(company)\n # wait until metrics page is loaded\n wait_until { page.has_css?('#metrics-container') }\n\n within('.head-buttons') do\n page.should have_button(company.name)\n end\n\n within 'button.user-settings' do\n page.should have_content(company.name)\n end\n end",
"def company_no_required?\n return false if overseas?\n return false if lower_tier?\n\n %w[limitedCompany limitedLiabilityPartnership].include?(business_type)\n end",
"def may_purchase?(_company)\n false\n end",
"def allowed_to_pay_hbrand_fee?(company)\n admin? || in_company?(company) #|| has_approved_app_for_company?(company)\n end",
"def need_details?\r\n admin? || purchasing? || popv_admin?\r\n end",
"def categorizing?\n instance_variable_defined?(:@required_forms)\n end",
"def show_draft_button?\n current_c100_application.try(:child_protection_cases)\n end",
"def require_company?\n !!(self.brand && self.brand.name.to_s.match(/studer/i))\n end",
"def is_company_the_account_holder_company?(company, current_user)\n company.id == current_user.company_id\n end",
"def pain_generation_enabled?\n creditor_detail.present?\n end",
"def show_prize_ui?\n false\n end",
"def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend",
"def isCompany?\n self.category =~ /(company|index|currency)/i\n end",
"def basic_company_details_valid?\n return true unless AccountType.other_organisation?(account_type)\n\n company.valid?(account_type.registration_type.to_sym)\n end",
"def user_has_role_in_company?\n \tif current_org_person.typ_position.blank?\n \t\tstore_location\n \tredirect_to edit_org_person_path(current_org_person.id), flash: {warning: \"You need to be approved by the company you have been assigned to first to access the requested page.\"}\n \tend \n end",
"def skill_wtype_ok?(skill)\r\n return true\r\n end",
"def cap? ; prod_type == 'cap' end",
"def show_policies\n\t\tputs \"asddmas\"\n\tend",
"def company_active?\n if !@company.blank? && !@company.active? && !@company.plan.free_plan?\n flash[:error] = \"Your subscription has been deactivated, renew your subscription to activate again.\".html_safe\n redirect_to \"/billing/index\"\n end\n end",
"def cvv_help_displayed?\n cvv_help_div.visible?\n end",
"def can_override_branding_for?(company)\n already_overridden = company.advisor_company_affiliations.with_access.where(:advisor_company_id.ne => id, override_branding: true).exists?\n not already_overridden\n end",
"def premium?\n product == \"premium\"\n end",
"def advised?\n advisor_company_affiliations.with_access.present?\n end",
"def price_consented?\n price_consent_status == 1\n end",
"def finance_office?\n current_user.role && current_user.role.upcase.split(',').include?('CO') && current_user.section_id==2\n end",
"def third_screen_visible?\n @third_screen_title.visible?\n end",
"def company_sellable(company)\n !company.owner.is_a?(Corporation)\n end",
"def other_tabs_remaining?\n category.tabs.count > 1\n end",
"def site_enable?\n self[:type] == \"CompanyZ\" && !self.layout.architecture_type.nil?\n end",
"def approved?\n Weam.match('aprvd', poo_status) && \n !Weam.match(\"^(#{ALC1}|#{ALC2})\", applicable_law_code) &&\n (\n institution_of_higher_learning_indicator || \n ojt_indicator ||\n correspondence_indicator ||\n flight_indicator ||\n non_college_degree_indicator\n )\n end",
"def company?\n directive.company?\n end",
"def mandatory_case_details?\n claim.court && claim.case_number && claim.external_user\n end",
"def info_show_profession_of_faith\n chosen_baptized_catholic? && !baptized_catholic\n end",
"def check_absorptance?()\n \n @construction.check_keyword?(\"ABSORPTANCE\") \n \n end",
"def check_company_signed_in\n redirect_to root_path, notice: 'Invalid permissions.' and return unless company_signed_in?\n end",
"def wait_for_freelancer_skills_displayed\n wait_for_element_present@driver.find_elements(:xpath, FREELANCER_SKILLS)\n end",
"def show_lawyer\n end",
"def can_disable_affiliate_branding?\n !self.invitation.nil? && \n !self.affiliate.nil? && \n (!self.subscription.trial? || !self.invitation_subscription?)\n end",
"def btl_enabled?\n primary_employment.present? && primary_employment.restaurant_role.present?\n end",
"def logged_in?\n !current_company.nil?\n end",
"def current_user_is_pal?\n current_user && current_user.person && current_user.person.is_pal?\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def approve_initial_requirements?\n approve_step?('#3')\n end",
"def validateMenuItem(item)\n case item.action\n when 'toggleDetailsWindow:'\n item.setTitle(@detailsController.window.isVisible ? \"Hide Details\" : \"Show Details\")\n true\n else\n true\n end\n end",
"def terms_conditions\r\n\t@title = \"Terms & Conditions\"\r\n end",
"def create_account_displayed\n $tracer.trace(format_method(__method__))\n return @tag.call(\"style.marginLeft\").to_i < 0 ? true : false\n end",
"def user_consenting?; end",
"def show\n self.checklabo?\n self.checkspatioport?\n self.checkministere?\n end",
"def ensure_user_checked_terms\n account_required(nil)\n end",
"def premium?\n premium\n end",
"def checkaccount(user)\n return unless user\n\n link = user.service\n if (link == 'Both' && !user.sel_detail && !current_page?('/both_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\")) ||\n (link == 'customer' && !user.cus_detail && !current_page?('/cus_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\"))\n render 'layouts/checkaccount'\n end\n end",
"def experience?\n experiences.present?\n end",
"def check_customization_editor\n unless user_role_in?(:dmp_admin, :resource_editor, :institutional_admin)\n flash[:error] = \"You do not have permission to view this page.\"\n redirect_to dashboard_path and return\n end\n end",
"def mandatory_case_details?\n claim.court && claim.case_number && claim.supplier_number\n end",
"def has_discounts?\n rpg_shop.permit_sales\n end",
"def show_service_providers?\n\n # Get the specific Setting for the key Setting::USER_SELECTION,\n # specific to this business.\n setting = Setting.business(business).key(Setting::USER_SELECTION).first\n\n # Return the result of checking if the setting\n # value == Setting::USER_SELECTION_EXPRESS_I\n setting.is? Setting::USER_SELECTION_EXPRESS_I\n end",
"def viewing_players_tab?\n ! viewing_scouts_tab?\n end",
"def non_profit_admin?\n managed_organization.try(:type) == 'NonProfit'\n end",
"def business_decision_support \n end",
"def current_company?(company)\n company == current_company\n end",
"def company_selected?\n return unless company_number.blank? || company_name.blank? || address_line1.blank?\n\n errors.add(:company_number, :company_not_chosen)\n end",
"def company_edit_permitted?\n acting_user.administrator? || same_company\n end",
"def claim_desc_required?\n @reason == 'OTHER'\n end",
"def has_related_clinics?\n if under_supervision_clinics.count > 0 || clinics.count > 0\n return true\n end\n return false\n end",
"def volunteer_menu?\n cont = controller.controller_name\n act = controller.action_name\n\n volunteer_logged_in? ||\n cont == 'accounts' ||\n cont == 'volunteers' && (act == 'new') ||\n cont == 'self_reports' && (act == 'index' || act == 'create_report' || act == 'edit_report') ||\n cont == 'orientations' && (act == 'v_orientations' || act == 'v_register') ||\n cont == 'projects' && (act == 'index' || act == 'provide_feedback')\n end",
"def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end",
"def approve_initial_requirements?\n approve_step?('#2')\n end",
"def approve_initial_requirements?\n approve_step?('#2')\n end",
"def thorins_company; end",
"def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end",
"def licensed?\n end",
"def can_accept_showing?\n profile.valid? && valid_bank_token? && !blocked?\n end",
"def can_auction?(_company)\n true\n end",
"def has_app_for_company?(company)\n has_app_for_company_number?(company.company_number)\n end",
"def check_accessibility\n end",
"def affiliates_enabled?\n affiliate_account_types.present?\n end",
"def can_create_showing?\n profile.valid? && valid_credit_card? && !blocked?\n end",
"def display_trade_option?(user)\n trade = Trade.new(\"user1\" => @current_user, \"user2\" => user)\n trade.valid_trade\n end",
"def isInstructorFigureEnabled \n \"isInstructorFigureEnabled\" \n end",
"def has_unpaid_bills\r\n return self.get_unpaid_bills.size > 0\r\n end",
"def toolbars_visible?\n (@toolbars['history_tb'] || @toolbars['center_tb'] || @toolbars['view_tb']) &&\n (@toolbars['history_tb'] != 'blank_view_tb' && @toolbars['history_tb'] != 'blank_view_tb' && @toolbars['view_tb'] != 'blank_view_tb')\n end"
] |
[
"0.63267136",
"0.6303509",
"0.60321546",
"0.58982456",
"0.5890195",
"0.5854142",
"0.58538437",
"0.58419794",
"0.57609874",
"0.5738396",
"0.56913054",
"0.5656232",
"0.5619824",
"0.55785066",
"0.5562495",
"0.5556789",
"0.55514973",
"0.5525279",
"0.54784787",
"0.5469178",
"0.5459549",
"0.54579973",
"0.54553246",
"0.54329914",
"0.5430669",
"0.5427463",
"0.54267883",
"0.54245216",
"0.5423941",
"0.5410385",
"0.54042274",
"0.5396952",
"0.53785783",
"0.53668106",
"0.5363398",
"0.5362673",
"0.53172964",
"0.53155375",
"0.5307172",
"0.5306715",
"0.5302345",
"0.5296499",
"0.52915156",
"0.528897",
"0.5288554",
"0.5288512",
"0.5284741",
"0.52733463",
"0.52654546",
"0.5263889",
"0.5258985",
"0.5251246",
"0.52209604",
"0.52119225",
"0.5209589",
"0.5179739",
"0.51788545",
"0.5177933",
"0.517512",
"0.5167782",
"0.5167782",
"0.5167782",
"0.5167777",
"0.51670516",
"0.51653093",
"0.51586765",
"0.51491386",
"0.5145182",
"0.5142919",
"0.5136224",
"0.51356775",
"0.51288927",
"0.51266646",
"0.51151603",
"0.5114878",
"0.5106926",
"0.51025283",
"0.5091389",
"0.5086401",
"0.50832933",
"0.5078397",
"0.50776833",
"0.50747186",
"0.50680226",
"0.50668097",
"0.5066516",
"0.5066516",
"0.5063722",
"0.5062578",
"0.5062267",
"0.50614196",
"0.5054825",
"0.5047205",
"0.5036645",
"0.50254095",
"0.5023837",
"0.5020301",
"0.50188595",
"0.5018734",
"0.5015641"
] |
0.7352047
|
0
|
Get Text Section ===============================================
|
def get_freelancer_name_text
get_element_text('Get text from Freelancer name', @driver.find_element(:xpath, FREELANCER_NAME))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def text\n @text[range]\n end",
"def entry\n return @text_entry\n end",
"def get_text\n raise NotImplementedError\n end",
"def text(section_type: :default)\n img = @image \n \n # resample if an image 4\"x4\" is less than 300dpi \n if img.columns * img.rows < 144000\n img = img.resample(300)\n end\n \n params = SECTION_PARAMS[:default].merge(SECTION_PARAMS[section_type])\n r = RTesseract.new(img, params) \n @text = r.to_s.strip\n\n if @text == \"\"\n img = img.white_threshold(245)\n r = RTesseract.new(img, params) \n @text = r.to_s.strip\n end\n\n if @text == \"\"\n img = img.quantize(256,Magick::GRAYColorspace)\n r = RTesseract.new(img, params) \n @text = r.to_s.strip\n end\n\n @text\n end",
"def text_content\n body = doc.css(\"body\")\n text_table = body.css(\".grf-indent > div:nth-child(1)\")[0]\n if text_table.present?\n remove_metadata(text_table)\n remove_creator(text_table)\n text_table.inner_html\n end\n end",
"def text_part\n @text_part ||= begin\n return nil if full_text_part.nil?\n Envelope::MessageTools.remove_appended_messages(full_text_part)\n end\n end",
"def text\n @parts.join\n end",
"def text(align=0)\n return @text[align]\n end",
"def extract_text(offset, length)\n end",
"def text\n @text ||= @reader.pages.map! do |page|\n page.text\n end.flatten.map! do |line|\n line.split /\\n+/\n end.flatten\n end",
"def getText\n @text\n end",
"def getText\n @text\n end",
"def text\n @text\n end",
"def get_text\n return self.text\n end",
"def getText(text_id)\n\t\tdoc.search(\"text[@id='#{text_id}']\").first\n\tend",
"def text\n Text.where(:text_id => primary_key).first\n end",
"def text\n @text\n end",
"def text\n lines.join(\"\\n\")\n end",
"def tt_sections text\n flow = @am.flow text.dup\n\n flow.each do |item|\n case item\n when String then\n @res << item if in_tt?\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?\n else\n raise \"Unknown flow element: #{item.inspect}\"\n end\n end\n\n res\n end",
"def text\n return @edit_line.text\n end",
"def teaser_text\n\t\t# assumption: html_content always starts with '<section>'\n\t\t# therefore I will find the content of the next '<section>'\n\t\t# by starting our search at position 8\n\t\tintro_starting_index = self.html_content.index('<section>', 8)\n\t\t# but of course we don't want to include '<section>' in our\n\t\t# teaser text, so lets add 9 to this (length of '<section>')\n\t\tintro_starting_index += 9\n\t\t# ... and the index of the closing tag is\n\t\tintro_ending_index = self.html_content.index('</section>', intro_starting_index)\n\t\t# so here's our teaser, which will be '...' via css in cases\n\t\t# where it's longer than the space available\n\t\tteaser = self.html_content[intro_starting_index...intro_ending_index]\n\t\tteaser = teaser[0..240] if teaser.length > 240\n\t\t\"#{teaser}...\"\n\tend",
"def teaser_text\n\t\t# assumption: html_content always starts with '<section>'\n\t\t# therefore I will find the content of the next '<section>'\n\t\t# by starting our search at position 8\n\t\tintro_starting_index = self.html_content.index('<section>', 8)\n\t\t# but of course we don't want to include '<section>' in our\n\t\t# teaser text, so lets add 9 to this (length of '<section>')\n\t\tintro_starting_index += 9\n\t\t# ... and the index of the closing tag is\n\t\tintro_ending_index = self.html_content.index('</section>', intro_starting_index)\n\t\t# so here's our teaser, which will be '...' via css in cases\n\t\t# where it's longer than the space available\n\t\tteaser = self.html_content[intro_starting_index...intro_ending_index]\n\t\tteaser = teaser[0..240] if teaser.length > 240\n\t\t\"#{teaser}...\"\n\tend",
"def texts; end",
"def text(data, sectname='__text', segname='__TEXT')\n real_segname = nil\n unless @current_segment\n real_segname = segname_based_on_filetype(segname)\n segment(real_segname) do |seg|\n seg[:maxprot] = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE\n seg[:initprot] = VM_PROT_READ | VM_PROT_EXECUTE\n end\n end\n\n section(sectname, segname, data) do |sect|\n # reloff and nreloc are calculated later (in calculate_offsets)\n sect[:flags] = 0x400 # S_ATTR_SOME_INSTRUCTIONS\n end\n\n # Remember where section and data are so we can update them later.\n @text_segname = real_segname || segname\n @text_sect_index = @sections[@text_segname].length-1\n @text_data_index = @data.length-1\n\n return self\n end",
"def section\n section_test.section\n end",
"def text_document\n attributes.fetch(:textDocument)\n end",
"def text_document\n attributes.fetch(:textDocument)\n end",
"def text_document\n attributes.fetch(:textDocument)\n end",
"def text_document\n attributes.fetch(:textDocument)\n end",
"def text_document\n attributes.fetch(:textDocument)\n end",
"def full_text\n return self.text[:full_text]\n end",
"def get_text_only(doc)\n text = StringIO.new\n if doc.kind_of?(Hpricot::Text)\n text.printf(\"%s\\n\", doc.to_s.strip) unless doc.to_s.strip.empty?\n else\n if doc.respond_to?(:children)\n doc.children.each do |child|\n text.printf(\" %s\", get_text_only(child))\n end\n end\n end\n text.string.strip\n end",
"def inner_text; end",
"def inner_text; end",
"def text\n return @text if defined? @text\n\n @text = Henkei.read :text, data\n end",
"def\n getText\n @text\n end",
"def text\n self.entry\n end",
"def text\n document.text\n end",
"def get_main_section(string)\n string.split(\"[End of section] \\n\")[2]\n end",
"def getText(helpLevel)\n case helpLevel\n when 1\n return @textManager.getHelpsTexts(\"overlap\", helpLevel, 0)\n when 2\n return @textManager.getHelpsTexts(\"overlap\", helpLevel, 0)\n when 3\n return @textManager.getHelpsTexts(\"overlap\", helpLevel, 0) + @cell.to_s + @textManager.getHelpsTexts(\"overlap\", helpLevel, 1) + @cell2.to_s + @textManager.getHelpsTexts(\"overlap\", helpLevel, 2) + @cell3.to_s + @textManager.getHelpsTexts(\"overlap\", helpLevel, 3)\n else\n super(helpLevel)\n end\n end",
"def text\n\t\t\t\t::File.open(self.start.file, \"r\") do |file|\n\t\t\t\t\tfile.seek(self.start.offset)\n\t\t\t\t\treturn file.read(self.bytesize)\n\t\t\t\tend\n\t\t\tend",
"def find_text(id)\n @bibliography[id]\n end",
"def getText(helpLevel)\n case helpLevel\n when 1\n @helpText = @textManager.getHelpsTexts(\"toofaroftrees\", helpLevel, 0)\n when 2\n @helpText = @textManager.getHelpsTexts(\"toofaroftrees\", helpLevel, 0)\n when 3\n @helpText = @textManager.getHelpsTexts(\"toofaroftrees\", helpLevel, 0) + @cell.to_s + @textManager.getHelpsTexts(\"toofaroftrees\", helpLevel, 1)\n else\n super(helpLevel)\n end\n end",
"def extracted_text\n response = Crocodoc.connection.get 'download/text', :uuid => @uuid\n return response.body.split(\"\\f\")\n end",
"def section\n return @section unless @section.nil?\n\n comment_sections.each do |text|\n if text =~ /Styleguide \\d/i\n cleaned = text.strip.sub(/\\.$/, '') # Kill trailing period\n @section = cleaned.match(/Styleguide (.+)/)[1]\n end\n end\n\n @section\n end",
"def text(include_ocr: false)\n return @text if defined? @text\n\n @text = Henkei.read :text, data, include_ocr: include_ocr\n end",
"def text page\n @client.text page\n end",
"def get_text\n\n begin\n str_uri = $product_uri + '/words/' + @filename + '/textItems'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['TextItems']['List'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"def toc_text text\n toc.push(:item => self, :text => text, :id => nil)\n self\n end",
"def getText(helpLevel)\n case(helpLevel)\n when 1\n @helpText = @textManager.getHelpsTexts(\"allgrassonrow\", helpLevel, 0)\n when 2\n @helpText = @textManager.getHelpsTexts(\"allgrassonrow\", helpLevel, 0)\n when 3\n @helpText = @textManager.getHelpsTexts(\"allgrassonrow\", helpLevel, 0) + @row[0].getVisualRankColumn.to_s + @textManager.getHelpsTexts(\"allgrassonrow\", helpLevel, 1)\n else\n super(helpLevel)\n end\n end",
"def text\n metadata&.dig('event', 'text')\n end",
"def extract_text(offset, length)\n string.slice(offset, length)\n end",
"def text text\n end",
"def text_at(location, offset, length)\n line = lines[location[0] - 1]\n line[location[1] + offset, length]\n end",
"def get_text\n `#{@element}.textContent`\n end",
"def getText(helpLevel)\n case helpLevel\n when 1\n return @textManager.getHelpsTexts(\"celltouchatent\", helpLevel, 0)\n when 2\n return @textManager.getHelpsTexts(\"celltouchatent\", helpLevel, 0)\n when 3\n return @textManager.getHelpsTexts(\"celltouchatent\", helpLevel, 0) + @cell.to_s + @textManager.getHelpsTexts(\"celltouchatent\", helpLevel, 1) + @cell2.to_s+ @textManager.getHelpsTexts(\"celltouchatent\", helpLevel, 2)\n else\n super(helpLevel)\n end\n end",
"def section_of(file, section_name) \n File.read(file).split(/^(?==)/).each do |section|\n lines = section.split(\"\\n\")\n return lines[1..-1].join(\"\\n\").strip if lines.first =~ /#{section_name}/i\n end\n nil\n end",
"def text\n\t\t\t@data[\"extract\"]\n\t\tend",
"def text\n self.children.each do |node|\n if node.node_type == TEXT_NODE\n if node.content && node.content.rstrip.length > 0\n return node.content\n end\n end\n end\n\n return nil\n end",
"def text\n body.text\n end",
"def text *o\n if o.empty?\n a = []\n each do |e| a << e.get_inner_text end\n return(a)\n end\n \n each do |e| e.set_inner_text o[0] end\n end",
"def first_text\n first_ele TEXT_VIEW\n end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def text; end",
"def format_text(noko_element)\n text_array = noko_element.children.map do |node|\n if node.children.empty? \n node.text\n else\n node.children.map do |nested_node|\n nested_node.text\n end\n end\n end.flatten\n \n text_groups = text_array.chunk do |line|\n line != \"\" && line != \" \" && line != \"\\u00A0\"\n end.to_a\n \n paragraphs = text_groups.map do |group|\n group[1].join if group[0]\n end.compact\n \n # removes a reference to an image seen on webpage.\n paragraphs.delete_at(0) if paragraphs[0].downcase.include?(\"edition\")\n\n paragraph_lines = paragraphs.map do |paragraph|\n paragraph.scan(/(.{1,75})(?:\\s|$)/m)\n end\n \n paragraph_lines.map do |line|\n line.join(\"\\n\") \n end.join(\"\\n\\n\")\n end",
"def text\n text = [title, abstract].join(\"\\n\")\n\n Misc.fixutf8(text)\n end",
"def text\n # if the title is not present, show the code\n get_translation(self.text_translations, self.dataset.current_locale, self.dataset.default_language)\n end",
"def get_text_node(node)\n text = nil\n\n if node and node.text\n text = node.text\n end\n\n text\nend",
"def get_paragraph\n wo = self.words_from_markov_data\n\n self.paragraph_from_words(wo).strip\n end",
"def text_range\n body = get.gsub!(/\\s*/,'')\n pattern = /#{@before_element}.*#{@after_element}/\n results = pattern.match(body)\n return results[0] if results\n end",
"def extract_text_component(component)\n return nil if !component.has_key?(:content) || !component[:duration].kind_of?(Integer) || component[:duration] < 1\n return nil if !::SETTINGS['colors'].has_key?(component[:background_color]) || !::SETTINGS['colors'].has_key?(component[:text_color])\n {\n :type => TEXT_COMPONENT,\n :content => component[:content].to_s,\n :duration => component[:duration],\n :background_color => component[:background_color],\n :text_color => component[:text_color]\n }\n end",
"def text\n text = \"\"\n\n if html_part\n text = html_part.decode_body.to_s\n @is_text_html = true\n end\n\n if !text.present? && text_part\n text = text_part.decode_body.to_s \n @is_text_html = false\n end\n\n if !text.present?\n text = body.decoded.to_s \n @is_text_html = false\n end\n\n text\n end",
"def text\n result_hash['text']\n end",
"def text\n @text.join('')\n end",
"def text\n return unless reader\n\n xmin = if right_of\n if [Integer,Float].include?(right_of.class)\n right_of\n elsif xy = reader.text_position(right_of,page)\n xy[:x]\n end\n else\n 0\n end\n xmax = if left_of\n if [Integer,Float].include?(left_of.class)\n left_of\n elsif xy = reader.text_position(left_of,page)\n xy[:x]\n end\n else\n 99999 # TODO: figure out the actual limit?\n end\n\n ymin = if above\n if [Integer,Float].include?(above.class)\n above\n elsif xy = reader.text_position(above,page)\n xy[:y]\n end\n else\n 0\n end\n ymax = if below\n if [Integer,Float].include?(below.class)\n below\n elsif xy = reader.text_position(below,page)\n xy[:y]\n end\n else\n 99999 # TODO: figure out the actual limit?\n end\n\n reader.text_in_region(xmin,xmax,ymin,ymax,page,inclusive)\n end",
"def extract_sections(text)\n in_section = false\n sections = []\n text.each_line do |line|\n line = line.chomp\n case line\n # request/response header\n when /^\\** (Request|Response)+/\n in_section = true\n section_name = line\n sections << [section_name, []]\n # some other header\n when /^\\*+/\n in_section = false\n section_name = nil\n else\n if in_section\n sections[-1][-1] << line\n end\n end\n end\n sections\nend",
"def text()\n return @driver.get_sc_core_query_element_text(@handle, @index)\n end",
"def get_main_body_text_internal\n main_part = get_main_body_text_part\n return _convert_part_body_to_text(main_part)\n end",
"def text\n attributes.fetch(:text)\n end",
"def text\n attributes.fetch(:text)\n end",
"def text\n attributes.fetch(:text)\n end",
"def text\n @attributes.fetch('text', nil)\n end",
"def extract_aircraft_status_raw_text(section)\n # We are aiming at find detail string in a structure like:\n # ...\n # <th ...>Status</th>\n # <td ...>\n # <span ...>RAW TEXT</span>\n # ...\n # </td>\n # ...\n # ...\n status_ths = section.css('th').select { |node| node.text == 'Status' }\n return nil unless status_ths.count > 0\n status_th = status_ths[0]\n\n status_td = status_th.next_element\n return nil unless status_td\n\n status_td.text\n end",
"def text\n ignores = [\n :text, :to_solr, :contribs, :img_src, :media_srcs,\n :captions_src, :transcript_src, :rights_code,\n :access_level, :access_types, :title, :ci_ids, :display_ids,\n :instantiations, :outside_url,\n :reference_urls, :exhibits, :special_collection, :access_level_description,\n :img_height, :img_width, :player_aspect_ratio,\n :player_specs, :transcript_status, :transcript_content,\n :playlist_group, :playlist_order, :playlist_map,\n :playlist_next_id, :playlist_prev_id, :supplemental_content, :contributing_organization_names,\n :contributing_organizations_facet, :contributing_organization_names_display, :producing_organizations,\n :producing_organizations_facet, :build_display_title\n ]\n\n @text ||= (PBCore.instance_methods(false) - ignores)\n .reject { |method| method =~ /\\?$/ } # skip booleans\n .map { |method| send(method) } # method -> value\n .select { |x| x } # skip nils\n .flatten # flattens list accessors\n .map { |x| x.respond_to?(:to_a) ? x.to_a : x } # get elements of compounds\n .flatten.uniq.sort\n end",
"def text\n @tag_data[:text]\n end",
"def search_text_main(clipped = false)\n text = ''\n if self.event_type == 'sent' \n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'followup_sent'\n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'response'\n if clipped\n text = text + self.incoming_message.get_text_for_indexing_clipped + \"\\n\\n\"\n else\n text = text + self.incoming_message.get_text_for_indexing_full + \"\\n\\n\"\n end\n elsif self.event_type == 'comment'\n text = text + self.comment.body + \"\\n\\n\"\n else\n # nothing\n end\n return text\n end",
"def get_text(srt_file, num_chars)\n begin\n ccfile = File.open(srt_file, 'r:UTF-8', &:read)\n text_collection = false\n text_sample = \"\"\n ccfile.each_line do |line|\n if line =~ /^(\\d\\d:)\\d\\d:\\d\\d[,.]\\d\\d\\d.*-->.*(\\d\\d:)\\d\\d:\\d\\d[,.]\\d\\d\\d/\n text_collection = true\n elsif line.strip.empty?\n text_collection = false\n elsif text_collection && text_sample.length < (num_chars + 1)\n text_sample << line\n end\n break if text_sample.length > (num_chars + 1)\n end\n ensure\n ccfile.close rescue nil\n end\n return text_sample[0, num_chars]\n end",
"def as_text\n @text\n end",
"def status_text\n i = view_status\n if i == 1\n return self.text_before\n elsif i == 2\n return self.text_during\n else\n return self.text_after\n end\n end"
] |
[
"0.6577787",
"0.6419153",
"0.6394493",
"0.62899107",
"0.6284542",
"0.6281603",
"0.6253381",
"0.6242007",
"0.62102425",
"0.6183733",
"0.6175559",
"0.6175559",
"0.6168673",
"0.6143737",
"0.61370146",
"0.6123455",
"0.61049443",
"0.6087697",
"0.60389054",
"0.6019091",
"0.6015713",
"0.6015713",
"0.6014087",
"0.60112906",
"0.6002117",
"0.59997326",
"0.59997326",
"0.59997326",
"0.59997326",
"0.59997326",
"0.59919935",
"0.59886336",
"0.59771883",
"0.59771883",
"0.5973535",
"0.5961586",
"0.5954999",
"0.59535325",
"0.5952677",
"0.59286857",
"0.59218585",
"0.5904598",
"0.588962",
"0.5888214",
"0.5887296",
"0.58815426",
"0.5865152",
"0.58534366",
"0.5848848",
"0.5836547",
"0.5832961",
"0.5832117",
"0.58189976",
"0.5817435",
"0.58153796",
"0.58087474",
"0.57910824",
"0.5773877",
"0.57498753",
"0.57456505",
"0.574218",
"0.5737351",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.572059",
"0.57187307",
"0.5717887",
"0.5709131",
"0.5704045",
"0.57013106",
"0.56924343",
"0.5690856",
"0.5690629",
"0.5689859",
"0.568853",
"0.5682955",
"0.5682347",
"0.5675876",
"0.5672412",
"0.56722635",
"0.56722635",
"0.56722635",
"0.5643649",
"0.56424177",
"0.5636329",
"0.56336075",
"0.5632565",
"0.56307805",
"0.56251067",
"0.561254"
] |
0.0
|
-1
|
GET /users GET /users.json
|
def index
@users = User.all
respond_to do |format|
format.html
format.pdf do
pdf = PDF::Writer.new
@users.each do |user|
pdf.text user.name
end
send_data pdf.render, :filename => 'products.pdf', :type => 'application/pdf', :disposition => 'inline'
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def list_users\n self.class.get('/users')\n end",
"def users\n get('get_users')\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def index\n users = User.all\n render json: users \n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n json_response(User.all) \n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def index\n users = User.all \n render json: users \n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend",
"def list\n render json: User.all\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def index\n\n users = User.all \n render json: users\n\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end",
"def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end",
"def list\n get('users')['users']\n end",
"def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end",
"def index\n @users = User.all \n render json: @users, status: :ok \n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n render json: User.all\n end",
"def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end",
"def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def index \n render json: User.all\n end",
"def index\n @myusers = Myuser.all\n\n render json: @myusers\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end"
] |
[
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.7372414",
"0.736885",
"0.7368531",
"0.7367068",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7358582",
"0.7351495",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.7350187",
"0.73463756",
"0.73426867",
"0.7331111",
"0.73231107",
"0.73227614",
"0.73126787",
"0.7295692",
"0.7274169",
"0.7265484",
"0.72624177",
"0.72607577",
"0.722517",
"0.72189873",
"0.71941674",
"0.71883225",
"0.7187108",
"0.71815044",
"0.717089",
"0.71695215",
"0.7156781",
"0.71546155",
"0.71546155",
"0.7140691",
"0.7135879",
"0.7134857",
"0.71316093",
"0.71315825",
"0.712011",
"0.7114429",
"0.7112858",
"0.7107888",
"0.7098051",
"0.70957917",
"0.70957917",
"0.7093039",
"0.70904744",
"0.70890427",
"0.70889443",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7085115",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685",
"0.7081685"
] |
0.0
|
-1
|
GET /users/1 GET /users/1.json
|
def show
# puts "----------------------1-------"
# @pub_key = File.read("#{Rails.root}/public/public.pem")
# string = 'MDQ2YzhkZmM1YzQ5YTFjYzUzMDI3ZjNjNTU4MDljNjM5ZDhhNmVjNSZlbWFpbD1rcmlzdGluZS5laXNzaW5nQHJhbmVuZXR3b3JrLmNvbQ==';
# public_key = OpenSSL::PKey::RSA.new(@pub_key)
# encrypted_string = Base64.encode64(public_key.public_encrypt(string))
# puts encrypted_string
# puts "----------------------2-------"
@user = User.find(1)
respond_to do |format|
format.html
format.pdf do
pdf = UserPdf.new(@user)
send_data pdf.render, :filename => 'products.pdf', :type => 'application/pdf', :disposition => 'inline'
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def show\n user = User.find(params[:id])\n render json: @user\nend",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.find(params[:id])\n\n render json: user\n end",
"def show\n render json: Users.find(params[\"id\"])\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"def show\n render json: User.find(params[\"id\"])\n end",
"def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"def show\n @user = User.find(params[:id])\n render json: @user\nend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def show\n @user = User.find(params[:id])\n render json:@user\n end",
"def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"def show\n render json: User.find(params[:id])\n end",
"def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"def list_users\n self.class.get('/users')\n end",
"def show\n user = User.find(params[:id])\n render json: user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n render :json => User.find(params[:id])\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"def show\n @users = User.all\n json_response(@users)\n end",
"def index\n json_response(User.all) \n end",
"def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def index\n user= User.all\n render json: {users:user}\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def index\n users = User.all\n render json: users\n end",
"def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"def index\n users = User.all\n render json: users \n end",
"def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"def index\n users = User.all \n render json: users \n end",
"def list\r\n users = User.all\r\n render json: users\r\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"def index\n render :json => User.all, status: 200\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end",
"def index\n @users = User.all\n\n render json: @users\n end"
] |
[
"0.8105987",
"0.77028173",
"0.77012515",
"0.76255774",
"0.75825965",
"0.7481543",
"0.74611485",
"0.7446646",
"0.73058766",
"0.7299786",
"0.72892565",
"0.7277604",
"0.72351575",
"0.7232825",
"0.7232825",
"0.7232825",
"0.7232825",
"0.7232825",
"0.7232825",
"0.7232825",
"0.7224628",
"0.7224628",
"0.7224628",
"0.7224628",
"0.7224628",
"0.7224628",
"0.7224628",
"0.7224628",
"0.7222571",
"0.72157604",
"0.7214148",
"0.72089696",
"0.7192906",
"0.7182217",
"0.7181248",
"0.7181248",
"0.7179002",
"0.71749115",
"0.71728915",
"0.7163418",
"0.71628356",
"0.71449465",
"0.7144138",
"0.71309906",
"0.7124699",
"0.71149886",
"0.70950717",
"0.7094458",
"0.70779306",
"0.7071102",
"0.7070936",
"0.7063474",
"0.70558345",
"0.7023677",
"0.7015285",
"0.70042676",
"0.6997719",
"0.6990743",
"0.69840294",
"0.6979195",
"0.69727033",
"0.6971519",
"0.6967731",
"0.6966582",
"0.6956929",
"0.69513714",
"0.69446915",
"0.69429153",
"0.69341475",
"0.6932896",
"0.6932896",
"0.6932896",
"0.6932896",
"0.6927438",
"0.6924527",
"0.6924419",
"0.6917909",
"0.6908492",
"0.6894307",
"0.688337",
"0.6876536",
"0.6874944",
"0.68647164",
"0.68608004",
"0.68570316",
"0.68563235",
"0.68537605",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.68534243",
"0.6850562",
"0.68479246",
"0.68479246",
"0.68479246"
] |
0.0
|
-1
|
POST /users POST /users.json
|
def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
format.html { redirect_to @user, notice: 'User was successfully created.' }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end",
"def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end",
"def create\n user = User.create(user_params) \n render json: user, status: :created\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end",
"def create\n user= User.create(user_params)\n render json: user\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend",
"def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create(options = {})\n request(:post, '/users.json', default_params(options))\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end",
"def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end",
"def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end",
"def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend",
"def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end",
"def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end",
"def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end",
"def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end",
"def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end",
"def create\n puts params\n @user = User.new(params[:user])\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 json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end",
"def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end",
"def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend",
"def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend",
"def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_user(options = {})\n post \"/users\", options\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end",
"def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(body)\n post 'create_user', body\n end",
"def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end",
"def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end",
"def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end",
"def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end",
"def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\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 json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(attributes)\n post(\"/v1/users\", attributes)\n end",
"def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end",
"def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end",
"def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end",
"def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end",
"def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end",
"def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end",
"def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end",
"def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end"
] |
[
"0.77179813",
"0.75206673",
"0.73831296",
"0.72405374",
"0.719841",
"0.7140812",
"0.71038526",
"0.7058827",
"0.7041636",
"0.70236504",
"0.7003128",
"0.70021695",
"0.70021695",
"0.70021695",
"0.69936967",
"0.6990463",
"0.6980393",
"0.6979075",
"0.69788617",
"0.69788617",
"0.69762856",
"0.6962628",
"0.6952247",
"0.69454783",
"0.69454783",
"0.6920555",
"0.69181055",
"0.691467",
"0.6901315",
"0.6898759",
"0.689459",
"0.6889815",
"0.6880676",
"0.6880467",
"0.6880196",
"0.68797004",
"0.6877297",
"0.686924",
"0.6855058",
"0.6851115",
"0.6844058",
"0.6814104",
"0.6803589",
"0.6777842",
"0.6776859",
"0.67678535",
"0.6757897",
"0.67471397",
"0.6738628",
"0.6734963",
"0.6733872",
"0.6720612",
"0.6711659",
"0.6670256",
"0.66581875",
"0.66573423",
"0.6654514",
"0.6638977",
"0.66325235",
"0.66199607",
"0.6615226",
"0.66148156",
"0.65989614",
"0.65910506",
"0.65792614",
"0.6578957",
"0.6573529",
"0.6573351",
"0.6557221",
"0.6553408",
"0.6551572",
"0.65466446",
"0.6540912",
"0.65399504",
"0.6538697",
"0.6535891",
"0.6533581",
"0.6526114",
"0.65116656",
"0.65072525",
"0.6507116",
"0.6503024",
"0.6490388",
"0.6488653",
"0.64881754",
"0.6473845",
"0.64722794",
"0.64702916",
"0.64702916",
"0.6469406",
"0.64682525",
"0.6462379",
"0.64619774",
"0.646129",
"0.6455196",
"0.645272",
"0.6448271",
"0.6447503",
"0.64468706",
"0.64460355",
"0.6441883"
] |
0.0
|
-1
|
PATCH/PUT /users/1 PATCH/PUT /users/1.json
|
def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { render :show, status: :ok, location: @user }
else
format.html { render :edit }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update_user(options)\n patch(\"/user\", options, 3)\n end",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end",
"def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user.update(user_params)\n respond_with @user\n end",
"def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7225568",
"0.7129473",
"0.70036036",
"0.6903525",
"0.6821961",
"0.68157715",
"0.6708618",
"0.66936064",
"0.66810983",
"0.6673763",
"0.6672601",
"0.6664346",
"0.6664346",
"0.6659468",
"0.6659468",
"0.6654875",
"0.66486204",
"0.66436917",
"0.6641295",
"0.6635214",
"0.6618464",
"0.66153306",
"0.6610267",
"0.6607359",
"0.6583569",
"0.65825915",
"0.65820843",
"0.65801483",
"0.65615994",
"0.6558883",
"0.6558883",
"0.6543664",
"0.6537492",
"0.6515997",
"0.6514648",
"0.65062994",
"0.65054137",
"0.65054137",
"0.65015376",
"0.6468482",
"0.6466442",
"0.64641905",
"0.6453641",
"0.64496416",
"0.6443516",
"0.6441606",
"0.6437562",
"0.6428467",
"0.6428467",
"0.64279026",
"0.6427495",
"0.64269704",
"0.6424723",
"0.6424723",
"0.64239854",
"0.6418606",
"0.64156115",
"0.6411428",
"0.64053625",
"0.6405119",
"0.6398354",
"0.63945407",
"0.6390761",
"0.63903916",
"0.63876307",
"0.6383881",
"0.63834596",
"0.63829523",
"0.6382388",
"0.63776475",
"0.63752687",
"0.6374351",
"0.63735604",
"0.6373269",
"0.6370833",
"0.6363397",
"0.63607967",
"0.6360649",
"0.6356513",
"0.6356091",
"0.6350332",
"0.6342926",
"0.6334242",
"0.6333647",
"0.6328633",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188",
"0.6327188"
] |
0.0
|
-1
|
DELETE /users/1 DELETE /users/1.json
|
def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end",
"def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end",
"def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n format.json { head :no_content }\n end",
"def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end",
"def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7250935",
"0.7245172",
"0.7242216",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177",
"0.7232177"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_user
@user = User.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\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 startcompany(action)\n @done = true\n action.setup\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 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\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\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 init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 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 setup\n #implement in subclass;\n end",
"def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; 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 setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); 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",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] |
[
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def user_params
params.require(:user).permit(:name, :email)
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
|
GET /promotions GET /promotions.json
|
def index
@title = t('admin.promotions.index.title')
@promotions = ( @product ? @product.promotions : Promotion.all )
respond_to do |format|
format.html # index.html.erb
format.json { render json: @promotions }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end",
"def api_promotions_get(params, opts = {})\n data, _status_code, _headers = api_promotions_get_with_http_info(params, opts)\n return data\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def get_promotions_list\n # get params for paging\n unless params[:id].blank?\n @client_id = params[:id]\n else\n @client_id = @clients[0].id\n end\n\n rows = Array.new\n rows = get_rows(Promotion.get_by_client(@client_id).active.\n order_id_desc.page(params[:page]).per(params[:rp]), @client_id)\n count = Promotion.get_by_client(@client_id).active.order_by_promotion_name.count\n\n render json: {page: params[:page], total: count, rows: rows}\n end",
"def index\n @promotions = Promotion.where(active: true)\n @all_promotions = Promotion.all\n respond_to do |format|\n format.html \n format.json { render json: @all_promotions }\n end\n end",
"def promotions\n @promotions ||= order.promotions\n end",
"def index\n if current_user\n @user = User.find(current_user.id)\n end\n\n if current_user && @user.role == \"account_user\" #account_user - not currently used\n @venues = Venue.where(account_id: current_user.account_id)\n @promotions = Promotion.where(venue_id: @venues)\n elsif current_user && @user.role == \"admin\" #admin\n #get all promotions for all venues that the user is registered with\n @venues = Venue.where(account_id: current_user.account_id)\n @promotions = Promotion.where(venue_id: @venues)\n elsif current_user && @user.role == \"hypedrive_employee\"\n @promotions = Promotion.all\n else\n @promotions = Promotion.where('active=:isActive and (start_time >= :time_now or end_time >= :time_now)',\n :isActive => true,\n :time_now => Time.now)\n end\n render json: @promotions\n end",
"def index\n if @customer.nil?\n @promotions = Promotion.all\n else \n @promotions = @customer.promotions\n end\n render 'promotions/promotions', :locals => { :promotions => @promotions }\n end",
"def list(from_date: nil, to_date: nil, continuation_token: nil, headers: {})\n payload = {\n fromDate: from_date,\n toDate: to_date,\n continuationtoken: continuation_token\n }.select { |_, v| !v.nil? }\n\n @client.rest_get_with_token('/promotions', payload, headers)\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def new_promotions\n @new_promotions ||= []\n end",
"def index\n @cpanel_promotions = Cpanel::Promotion.all\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def index\n @product_promotions = ProductPromotion.all\n end",
"def api_promotions_get_with_http_info(params, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.api_promotions_get ...\"\n end\n # verify the required parameter 'params' is set\n if @api_client.config.client_side_validation && params.nil?\n fail ArgumentError, \"Missing the required parameter 'params' when calling DefaultApi.api_promotions_get\"\n end\n # resource path\n local_var_path = \"/api/promotions\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(params)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Promotion>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_promotions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @promotions = Promotion.paginate(:page => params[:page], :per_page => 10)\n .order(\"due_date DESC\")\n end",
"def index\n @promoters = Promoter.find(:all).sort_by{|p| p.name_or_contact_info}\n end",
"def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def show\n @promotersbind = Promotersbind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @promotersbind }\n end\n end",
"def checkout_promotions\n @checkout_promotions ||= Promotion.active.code_based\n end",
"def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end",
"def processed_promos\n respond_to do |format|\n @taken_promos = TakenPromo.get_taken_promos_for_user current_user\n format.html { }\n end\n end",
"def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end",
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def taken_promos\n respond_to do |format|\n @promos = Promo.get_taken_promos_for_user current_user\n format.html { render \"promos/content\" }\n end\n end",
"def show\n @promotion = Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion }\n end\n end",
"def index\n @mutations = Mutation.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mutations }\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @potos = Poto.all\n end",
"def index\n @occasions = current_user.occasions.sorteddesc.all.paginate(page: params[:page], :per_page => 10)\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occasions }\n end\n end",
"def users\n User.in(id: user_promotions.pluck(:user_id))\n end",
"def responses\n @proposal = current_user.proposals.find(params[:id])\n @responses = @proposal.responses\n\n respond_to do |format|\n format.html # responses.html.erb\n format.xml { render :xml => @responses }\n end\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def show\n render json: @promotion\n end",
"def show\n render json: @promotion\n end",
"def show\n render json: @prossumer\n end",
"def index\n # TODO\n ## for admins - all Motions\n ## for Reps - All Active Motions\n ## For Users - Only show for reps, and for managers and Reps of their teams that have active motions\n @motions = Motion.all\n end",
"def index\n @permisos = Permiso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @permisos }\n end\n end",
"def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end",
"def index\n @promotion_tags = PromotionTag.all\n end",
"def index\n @notions = Notion.all\n end",
"def index\n @pomodoros = current_user.pomodoros\n end",
"def index\n @role_permisions = RolePermision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permisions }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def list_pengaduan_proses\n pengaduan = Pengaduan.all.where(status: 'proses').where(user_id: @user.id).order(created_at: :desc)\n render json: {status: true, total: pengaduan.count, data: pengaduan}\n end",
"def index\n @permisos = Permiso.all\n end",
"def index\n if current_user == @user\n @poems = @user.poems.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poems }\n end\n else\n redirect_to root_path\n end\n end",
"def mpim_list(options = {})\n post('mpim.list', options)\n end",
"def new\n @mad_mimi_email = MadMimiEmail.new\n @mimi = MadMimi.new('sarahsponda902@gmail.com', 'df65cf0a215c2b3028fa7eaf89a6f2ba')\n @promotions = @mimi.promotions\n @emails = User.where(:notify => true).map(&:email)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mad_mimi_email }\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def index\n @promotion_boxes = PromotionBox.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @promotion_boxes }\n end\n end",
"def promoted\n @users = User.valid_users.promoted.page(params[:page])\n end",
"def promoter_shows\n Show.where(promoter_id: id)\n end",
"def set_promoter\n @promoter = Promoter.find(params[:id])\n end",
"def index\n @punishments = Punishment.all\n end",
"def promotions\n Spree::Promotion.find_by_sql(\"#{order.promotions.active.to_sql} UNION #{Spree::Promotion.active.where(code: nil, path: nil).to_sql}\")\n connected_order_promotions | sale_promotions\n end",
"def show\n @promotion = Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @promotions }\n end\n end",
"def index\n @proposals = current_user.proposals\n end",
"def index\n @pigeons = current_user.pigeons\n @shared_pigeons = current_user.shared_pigeons\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def index\n @pe_exchange_products = PeExchangeProduct.all.page(params[:page]).per(params[:per_page])\n respond_to do |format|\n format.html\n format.json { render json:\n list_json(@pe_exchange_products, :include => [:pe_product])\n }\n end\n end",
"def action_list_promotion_ft(input)\n response = do_list_promotion input,1\n #persist user request\n log_use_request {|request|\n request.lastaction = RequestAction::ACTION_PRO_LIST_FT\n request.lastpage = 1\n }\n response\n end",
"def index\n @pledges = if current_admin?\n User.find(params[:user_id]).pledges\n else\n current_user.pledges\n end\n respond_to do |format|\n format.html\n format.json { render json: @pledges }\n end\n end",
"def index\n @commands = Command.all\n render :json => @commands\n end",
"def index\n @punishes = Punish.all\n end",
"def current_promotions\n promotions.where([\"start_on IS NOT NULL AND start_on <= ? AND (end_on >= ? OR end_on IS NULL OR end_on = '')\", Date.today, Date.today]).order(\"start_on\")\n end",
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def index\n @puntajes = Puntaje.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def index\n @provisions = Provision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provisions }\n end\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end",
"def index\n @grams = Gram.all #if we wanted to make an app so that user can only see their own pin make = current_user.pins.all if not Gram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grams }\n end\n end",
"def index\n @proximities = Proximity.all\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def index\n @promotions = Promotion.order(\"created_at desc\").where('playerid=?' , current_player.playerid)\n\t@bulbs = Notification.where('playerid = ?' , current_player.playerid).sum('bulb')\n\n end",
"def show\n @promotion_demotion = PromotionDemotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion_demotion }\n end\n end",
"def show\n \n @protectora = Protectora.find(params[:id])\n @nombreProtectora = Protectora.find(params[:id]).nombre\n @mis_mascotas = Mascotum.find(:all, :conditions => {:protectora => @nombreProtectora})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protectora }\n end\n end",
"def related_promotions\n @related_promotions ||= Promotions::Relevance.to_category(self)\n end",
"def show\n @promotion = Promotion.find_all_by_id_and_playerid(params[:id], params[:playerid])[0]\n\t@promotion.read = 1\n\t@promotion.save\n\t\n\t@notification = Notification.find_all_by_notificationid_and_notification(@promotion.id, 'promotions')\n\t@notification[0].read = 1\n\t@notification[0].bulb = 0\n\t@notification[0].save\n\t\n\t@bulbs = Notification.where('playerid = ?' , params[:playerid]).sum('bulb')\n\t@promotion[\"total_bulbs\"] = @bulbs\n\t@promotion.save\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion }\n end\n end",
"def index\n @provedores = Provedor.all\n end",
"def show\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round_robin_promo }\n end\n end",
"def index\n @proverbes = Proverbe.all\n end",
"def index\n @pubs = Pub.all\n\n render json: @pubs\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def products\n request :public, :get, :products\n end",
"def get_current_occasions\n\n \tcurrent_occasions = Array.new\n recipients = current_user.recipients.live # only get the live recipients!\n\n recipients.each do |recipient|\n \tcurrent_occasions << recipient.recipient_occasions.live\n end\n\n respond_to do |format|\n format.json { render json: current_occasions }\n end\n end",
"def index\n #@portfolio = Portfolio.find(params[:portfolio_id])\n\n @opinionable = find_opinionable\n\n @opinion = @opinionable.opinions.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opinions }\n end\n end",
"def index\n @prospective_users = ProspectiveUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @prospective_users }\n end\n end",
"def pending_promotions?\n !pending_promotions.empty?\n end",
"def index\n @ventas_presupuestos = Ventas::Presupuesto.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_presupuestos }\n end\n end",
"def show\n @przedmiot = current_user.przedmioty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @przedmiot }\n end\n end",
"def list_action\n pattern = request[:pattern] || \".\"\n zombies = request[:just_zombies] || false\n\n reply[:pslist] = get_proc_list(pattern, zombies)\n end",
"def index\n if params[:profile_id].present?\n @poems = Profile.find(params[:profile_id]).user.poems.page(params[:page])\n else\n @poems = current_user.present? ? current_user.poems.page(params[:page]) : Poem.all.page(params[:page])\n end\n end",
"def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end"
] |
[
"0.7526315",
"0.7378621",
"0.7359634",
"0.72931325",
"0.72931325",
"0.72931325",
"0.6741252",
"0.67093587",
"0.64522964",
"0.640619",
"0.6332135",
"0.62668365",
"0.6240661",
"0.6093199",
"0.6066163",
"0.60601115",
"0.60323346",
"0.6001653",
"0.5979596",
"0.5902597",
"0.57557106",
"0.5685838",
"0.56164235",
"0.5564721",
"0.55541253",
"0.5527368",
"0.55227923",
"0.55082893",
"0.5482565",
"0.5475025",
"0.54343843",
"0.5432497",
"0.5410569",
"0.54000175",
"0.539367",
"0.53848124",
"0.5373732",
"0.53294545",
"0.53294545",
"0.53241074",
"0.5317128",
"0.53139293",
"0.5312387",
"0.5307131",
"0.5299744",
"0.5295234",
"0.5291552",
"0.5279715",
"0.527959",
"0.5266049",
"0.52525973",
"0.5251714",
"0.52443033",
"0.52408916",
"0.52373147",
"0.5220186",
"0.52078015",
"0.52057874",
"0.5191813",
"0.51905304",
"0.5179893",
"0.51765084",
"0.5175587",
"0.5170048",
"0.5164457",
"0.5149665",
"0.51486534",
"0.51383567",
"0.51373017",
"0.513372",
"0.5132554",
"0.51277393",
"0.51180965",
"0.5115129",
"0.5108366",
"0.51081854",
"0.5101699",
"0.5083452",
"0.50814515",
"0.5076984",
"0.50718355",
"0.50652075",
"0.5061009",
"0.50508666",
"0.5044189",
"0.5041035",
"0.503713",
"0.5030248",
"0.5028874",
"0.50254416",
"0.5019765",
"0.50176513",
"0.5013615",
"0.501316",
"0.50113696",
"0.5001647",
"0.499863",
"0.49960327",
"0.49949083",
"0.49932215"
] |
0.7152811
|
6
|
GET /promotions/1 GET /promotions/1.json
|
def show
@promotion = Promotion.includes(:promotion_lines).find(params[:id])
@promotion_lines = @promotion.promotion_lines
@title = "Promocion: #{@promotion.title}"
respond_to do |format|
format.html # show.html.erb
format.json { render json: @promotion }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end",
"def index\n @title = t('admin.promotions.index.title')\n @promotions = ( @product ? @product.promotions : Promotion.all )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promotions }\n end\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def api_promotions_get(params, opts = {})\n data, _status_code, _headers = api_promotions_get_with_http_info(params, opts)\n return data\n end",
"def index\n @promotions = Promotion.where(active: true)\n @all_promotions = Promotion.all\n respond_to do |format|\n format.html \n format.json { render json: @all_promotions }\n end\n end",
"def get_promotions_list\n # get params for paging\n unless params[:id].blank?\n @client_id = params[:id]\n else\n @client_id = @clients[0].id\n end\n\n rows = Array.new\n rows = get_rows(Promotion.get_by_client(@client_id).active.\n order_id_desc.page(params[:page]).per(params[:rp]), @client_id)\n count = Promotion.get_by_client(@client_id).active.order_by_promotion_name.count\n\n render json: {page: params[:page], total: count, rows: rows}\n end",
"def index\n if @customer.nil?\n @promotions = Promotion.all\n else \n @promotions = @customer.promotions\n end\n render 'promotions/promotions', :locals => { :promotions => @promotions }\n end",
"def index\n if current_user\n @user = User.find(current_user.id)\n end\n\n if current_user && @user.role == \"account_user\" #account_user - not currently used\n @venues = Venue.where(account_id: current_user.account_id)\n @promotions = Promotion.where(venue_id: @venues)\n elsif current_user && @user.role == \"admin\" #admin\n #get all promotions for all venues that the user is registered with\n @venues = Venue.where(account_id: current_user.account_id)\n @promotions = Promotion.where(venue_id: @venues)\n elsif current_user && @user.role == \"hypedrive_employee\"\n @promotions = Promotion.all\n else\n @promotions = Promotion.where('active=:isActive and (start_time >= :time_now or end_time >= :time_now)',\n :isActive => true,\n :time_now => Time.now)\n end\n render json: @promotions\n end",
"def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end",
"def show\n @promotersbind = Promotersbind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @promotersbind }\n end\n end",
"def promotions\n @promotions ||= order.promotions\n end",
"def show\n @promotion = Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion }\n end\n end",
"def api_promotions_get_with_http_info(params, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.api_promotions_get ...\"\n end\n # verify the required parameter 'params' is set\n if @api_client.config.client_side_validation && params.nil?\n fail ArgumentError, \"Missing the required parameter 'params' when calling DefaultApi.api_promotions_get\"\n end\n # resource path\n local_var_path = \"/api/promotions\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(params)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Promotion>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_promotions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @product_promotions = ProductPromotion.all\n end",
"def index\n @cpanel_promotions = Cpanel::Promotion.all\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def index\n @promotions = Promotion.paginate(:page => params[:page], :per_page => 10)\n .order(\"due_date DESC\")\n end",
"def new_promotions\n @new_promotions ||= []\n end",
"def show\n render json: @prossumer\n end",
"def index\n @promoters = Promoter.find(:all).sort_by{|p| p.name_or_contact_info}\n end",
"def list(from_date: nil, to_date: nil, continuation_token: nil, headers: {})\n payload = {\n fromDate: from_date,\n toDate: to_date,\n continuationtoken: continuation_token\n }.select { |_, v| !v.nil? }\n\n @client.rest_get_with_token('/promotions', payload, headers)\n end",
"def show\n render json: @promotion\n end",
"def show\n render json: @promotion\n end",
"def show\n @promotion = Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @promotions }\n end\n end",
"def set_promoter\n @promoter = Promoter.find(params[:id])\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end",
"def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end",
"def show\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round_robin_promo }\n end\n end",
"def show\n @promotion_type = PromotionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion_type }\n end\n end",
"def show\n @promo = Promo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promo }\n end\n end",
"def new\n @title = t('admin.promotions.new.title')\n @promotion = Promotion.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end",
"def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def new\n @mad_mimi_email = MadMimiEmail.new\n @mimi = MadMimi.new('sarahsponda902@gmail.com', 'df65cf0a215c2b3028fa7eaf89a6f2ba')\n @promotions = @mimi.promotions\n @emails = User.where(:notify => true).map(&:email)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mad_mimi_email }\n end\n end",
"def taken_promos\n respond_to do |format|\n @promos = Promo.get_taken_promos_for_user current_user\n format.html { render \"promos/content\" }\n end\n end",
"def show\n @home_promotion = Home::Promotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_promotion }\n end\n end",
"def set_promocion\n @promocion = Promocion.find(params[:id])\n end",
"def show\n @promotion_demotion = PromotionDemotion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion_demotion }\n end\n end",
"def show\n \n @protectora = Protectora.find(params[:id])\n @nombreProtectora = Protectora.find(params[:id]).nombre\n @mis_mascotas = Mascotum.find(:all, :conditions => {:protectora => @nombreProtectora})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protectora }\n end\n end",
"def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end",
"def show\n @promotion = Promotion.find_all_by_id_and_playerid(params[:id], params[:playerid])[0]\n\t@promotion.read = 1\n\t@promotion.save\n\t\n\t@notification = Notification.find_all_by_notificationid_and_notification(@promotion.id, 'promotions')\n\t@notification[0].read = 1\n\t@notification[0].bulb = 0\n\t@notification[0].save\n\t\n\t@bulbs = Notification.where('playerid = ?' , params[:playerid]).sum('bulb')\n\t@promotion[\"total_bulbs\"] = @bulbs\n\t@promotion.save\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion }\n end\n end",
"def processed_promos\n respond_to do |format|\n @taken_promos = TakenPromo.get_taken_promos_for_user current_user\n format.html { }\n end\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def show\n @przedmiot = current_user.przedmioty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @przedmiot }\n end\n end",
"def responses\n @proposal = current_user.proposals.find(params[:id])\n @responses = @proposal.responses\n\n respond_to do |format|\n format.html # responses.html.erb\n format.xml { render :xml => @responses }\n end\n end",
"def set_promotion\n @promotion = current_shop_owner.promotions.find(params[:id])\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\r\n @promotion = Promotion.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @promotion }\r\n end\r\n end",
"def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end",
"def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end",
"def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end",
"def new\n @promotersbind = Promotersbind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @promotersbind }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pto }\n end\n end",
"def index\n @potos = Poto.all\n end",
"def show\n @promotion = Promotion.where('id=? and playerid=?', params[:id], current_player.playerid)[0]\n\t@promotion.read = 1\n\t@promotion.save\n\t\n\n\t@notification = Notification.where('notificationid=? and notification=?', @promotion.id, 'promotions')\n\tunless @notifcation.nil?\n\t\t@notification[0].read = 1\n\t\t@notification[0].bulb = 0\n\t\t@notification[0].save\n\tend\n\t\n\t@bulbs = Notification.where('playerid = ?' , current_player.playerid).sum('bulb')\n\t#@promotion[\"total_bulbs\"] = @bulbs\n\t#@promotion.save\n\t\n\trespond_with @promotion\n\n end",
"def get_proselint_json path\n json = `proselint \"#{path}\" --json`.strip\n if json[0] == \"{\" and json[-1] == \"}\"\n JSON.parse json\n else\n {}\n end\n end",
"def update\n respond_to do |format|\n if @promoter.update(promoter_params)\n format.html { redirect_to root_url, notice: 'Promoter was successfully updated.' }\n format.json { render :show, status: :ok, location: @promoter }\n else\n format.html { render :edit }\n format.json { render json: @promoter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pun = Pun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pun }\n end\n end",
"def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end",
"def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end",
"def index\n @provisions = Provision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provisions }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index\n @proposals = Proposal.all\n\n render json: @proposals\n end",
"def index\n @permisos = Permiso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @permisos }\n end\n end",
"def show\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opinion }\n end\n end",
"def show\n @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def index\n @votes = @proposal.votes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @votes }\n end\n end",
"def show\n @promos = Promos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @promos }\n end\n end",
"def index\n @promotion_boxes = PromotionBox.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @promotion_boxes }\n end\n end",
"def index\n @mutations = Mutation.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mutations }\n end\n end",
"def show\n @pem = Pem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pem }\n end\n end",
"def show\n @preguntum = Preguntum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preguntum }\n end\n end",
"def index\n @notions = Notion.all\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def show\n @pmessage = Pmessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pmessage }\n end\n end",
"def index\n @commands = Command.all\n render :json => @commands\n end",
"def show\n @po = Po.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @po }\n end\n end",
"def promoter_shows\n Show.where(promoter_id: id)\n end",
"def show\n @produkt = Produkt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produkt }\n end\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def new\n @message = Message.new(params[:message])\n @message.send(:find_apropos)\n @message.send(:find_to_user)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n @role_permisions = RolePermision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permisions }\n end\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def show\n @potluck = Potluck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck }\n end\n end",
"def index\n @props = Prop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @props }\n end\n end",
"def index\n @proyectominero2s = Proyectominero2.all\n end",
"def show\n @protein = Protein.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protein }\n end\n end",
"def checkout_promotions\n @checkout_promotions ||= Promotion.active.code_based\n end",
"def index\n @proverbes = Proverbe.all\n end",
"def show\n @parasitic_interaction = ParasiticInteraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parasitic_interaction }\n end\n end",
"def index\n @promotion_tags = PromotionTag.all\n end",
"def list_pengaduan_proses\n pengaduan = Pengaduan.all.where(status: 'proses').where(user_id: @user.id).order(created_at: :desc)\n render json: {status: true, total: pengaduan.count, data: pengaduan}\n end"
] |
[
"0.7495955",
"0.7160924",
"0.713132",
"0.713132",
"0.713132",
"0.7083866",
"0.7001781",
"0.6545356",
"0.63462114",
"0.62295157",
"0.6149369",
"0.6104724",
"0.60289294",
"0.5991333",
"0.59727514",
"0.59671384",
"0.5879082",
"0.5832251",
"0.57910156",
"0.57566065",
"0.5746031",
"0.57019347",
"0.5672766",
"0.562995",
"0.56152034",
"0.56152034",
"0.56122285",
"0.55926347",
"0.5590905",
"0.5582499",
"0.5561124",
"0.552127",
"0.54964507",
"0.54812133",
"0.547737",
"0.54742634",
"0.54548085",
"0.54407275",
"0.5431016",
"0.5428447",
"0.5405008",
"0.5396291",
"0.53808206",
"0.53721267",
"0.5353005",
"0.5345742",
"0.53361684",
"0.5325126",
"0.5313384",
"0.5287001",
"0.5286389",
"0.5276877",
"0.5274556",
"0.5272147",
"0.5272147",
"0.5271496",
"0.5268371",
"0.52644444",
"0.52548987",
"0.5247481",
"0.52348995",
"0.52282584",
"0.5208685",
"0.5206819",
"0.5206819",
"0.52020687",
"0.51967824",
"0.51948416",
"0.5194647",
"0.51939416",
"0.5188245",
"0.51808083",
"0.5179901",
"0.51741886",
"0.51741236",
"0.516586",
"0.5162576",
"0.5157892",
"0.5157582",
"0.51476765",
"0.5146188",
"0.5144094",
"0.5143519",
"0.5127083",
"0.51249146",
"0.5124652",
"0.51212543",
"0.51212543",
"0.5119384",
"0.5104054",
"0.5100909",
"0.5093835",
"0.5093122",
"0.5076562",
"0.5066944",
"0.5066895",
"0.50573736",
"0.5055831",
"0.50543314",
"0.5043405"
] |
0.5366916
|
44
|
GET /promotions/new GET /promotions/new.json
|
def new
@title = t('admin.promotions.new.title')
@promotion = Promotion.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @promotion }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end",
"def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\r\n @promotion = Promotion.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @promotion }\r\n end\r\n end",
"def new_promotions\n @new_promotions ||= []\n end",
"def new\n @promotersbind = Promotersbind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @promotersbind }\n end\n end",
"def new\n @promotion_type = PromotionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion_type }\n end\n end",
"def new\n @message = Message.new(params[:message])\n @message.send(:find_apropos)\n @message.send(:find_to_user)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @propose = Propose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @propose }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @przedmiot = Przedmiot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @przedmiot }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end",
"def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @promo = Promo.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo }\n end\n end",
"def new\n @pun = Pun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pun }\n end\n end",
"def new\n @promo = Promo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo }\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end",
"def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end",
"def new\n @proposal = listing.proposals.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @vote = Vote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: [@proposal, @vote] }\n end\n end",
"def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end",
"def new\n @pgn_file = PgnFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgn_file }\n end\n end",
"def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prop }\n end\n end",
"def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def new\n @promocion = Promocion.new\n\n respond_to do |format|\n format.html { render :layout => 'special_form'}# new.html.erb\n #format.json { render json: @promocion }\n end\n end",
"def new\n @round_robin_promo = RoundRobinPromo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round_robin_promo }\n end\n end",
"def new\n @pinn = current_user.pinns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinn }\n end\n end",
"def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def new\n @pmessage = Pmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pmessage }\n end\n end",
"def new\n @message = Message.new\n @projects = Project.all\n @pems = Pem.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promotion }\n end\n end",
"def new\n @promotion = Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promotion }\n end\n end",
"def new\n @home_promotion = Home::Promotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home_promotion }\n end\n end",
"def new\n @protein = Protein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protein }\n end\n end",
"def new\n @prob = Prob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prob }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\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 new\n @modifier = Modifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @modifier }\n end\n end",
"def create\n @title = t('admin.promotions.new.title')\n @promotion = Promotion.new params[:promotion]\n @promotion.state = 'not-published'\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to ['admin', @promotion], notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: 'new' }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pushup = Pushup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup }\n end\n end",
"def new\n @mad_mimi_email = MadMimiEmail.new\n @mimi = MadMimi.new('sarahsponda902@gmail.com', 'df65cf0a215c2b3028fa7eaf89a6f2ba')\n @promotions = @mimi.promotions\n @emails = User.where(:notify => true).map(&:email)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mad_mimi_email }\n end\n end",
"def new\n @promotion_demotion = PromotionDemotion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promotion_demotion }\n end\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\n end\n end",
"def new\n @page_id = \"opinions\"\n @opinion = Opinion.new\n @agents = Agent.all.collect {|item| [ item.name, item.id ]}\n @services = Service.find(:all).collect {|item| [ item.name, item.id ]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opinion }\n end\n end",
"def new\n @mutation = Mutation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mutation }\n end\n end",
"def new\n @push_notification = PushNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @push_notification }\n end\n end",
"def new\n @pub = Pub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pub }\n end\n end",
"def new\n @preguntum = Preguntum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preguntum }\n end\n end",
"def new\n @produktion_site = ProduktionSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produktion_site }\n end\n end",
"def new\n @proyect = Proyect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proyect }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end",
"def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end",
"def new\n @gossip = Gossip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gossip }\n end\n end",
"def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end",
"def new\n @core_nota = Core::Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @core_nota }\n end\n end",
"def new\n @poem = @user.poems.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poem }\n end\n end",
"def new\n @provision = Provision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provision }\n end\n end",
"def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contribution }\n end\n end",
"def new\n @pem = Pem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pem }\n end\n end",
"def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def new\n @prime = Prime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prime }\n end\n end",
"def new\n @portion = Portion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portion }\n end\n end",
"def new\n @repuestum = Repuestum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repuestum }\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t#@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end",
"def create\n @promocion = Promocion.new(params[:promocion])\n\n respond_to do |format|\n if @promocion.save\n format.html { redirect_to @promocion, :notice => 'Promocion was successfully created.' }\n format.json { render json: @promocion, status: :created, location: @promocion }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @promocion.errors }\n end\n end\n end",
"def new\n @potz = Potz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potz }\n end\n end",
"def new\n @mlp = Mlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mlp }\n end\n end",
"def new\n @ptrack = Ptrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ptrack }\n end\n end",
"def new\n @pubtype = Pubtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pubtype }\n end\n end",
"def new\n @partecipante = Partecipante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partecipante }\n end\n end",
"def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @photoid = Photoid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photoid }\n end\n end",
"def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\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 @pinit = Pinit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinit }\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @primer = Primer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @primer }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end",
"def new\n @intention = Intention.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intention }\n end\n end",
"def new\n if current_user\n\tif ((current_user.username == 'Administrator') || (current_user.username =='Moderator'))\n\t\t@produkt = Produkt.new\n\n\t\trespond_to do |format|\n \t\t\tformat.html # new.html.erb\n \t\t\tformat.json { render json: @produkt }\n \t\tend\n\telse\n\tredirect_to (:produkts), :notice => \"Nie masz uprawnien do dodania produktu!\"\n\tend\n else\n\tredirect_to (:produkts), :notice => \"Nie masz uprawnien do dodania produktu!\"\n end\n end",
"def new\n @ventas_presupuesto = Ventas::Presupuesto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end",
"def new\n @partecipanti_gruppo = PartecipantiGruppo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @promos = Promos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promos }\n end\n end",
"def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repository }\n end\n end"
] |
[
"0.6773825",
"0.6773825",
"0.6723257",
"0.67167276",
"0.6670944",
"0.66099197",
"0.6547896",
"0.6534966",
"0.6522893",
"0.6518899",
"0.6454145",
"0.6409984",
"0.64054096",
"0.6387803",
"0.6377172",
"0.6376353",
"0.6376353",
"0.63630754",
"0.6361718",
"0.6357101",
"0.6351314",
"0.63060117",
"0.63060117",
"0.6300787",
"0.62614244",
"0.6256761",
"0.6255487",
"0.6255432",
"0.6254931",
"0.62493503",
"0.6248908",
"0.62400603",
"0.623753",
"0.62363863",
"0.6232827",
"0.62286675",
"0.6227149",
"0.6216527",
"0.6216527",
"0.62134635",
"0.6204515",
"0.62008625",
"0.62002915",
"0.62002915",
"0.62002915",
"0.6187236",
"0.61795264",
"0.61710185",
"0.6170085",
"0.6168107",
"0.6166178",
"0.61659735",
"0.6163451",
"0.6162031",
"0.6159424",
"0.6134826",
"0.6134601",
"0.6133258",
"0.6124276",
"0.6118834",
"0.61169857",
"0.6112408",
"0.6105027",
"0.60942763",
"0.6094135",
"0.6088837",
"0.60882235",
"0.6083514",
"0.6082476",
"0.60791945",
"0.60766834",
"0.6073115",
"0.6072328",
"0.60699385",
"0.6059359",
"0.60553676",
"0.6047654",
"0.60431564",
"0.60412586",
"0.6036596",
"0.6034811",
"0.6033387",
"0.602922",
"0.6026596",
"0.6026392",
"0.6025263",
"0.60250145",
"0.6022732",
"0.6019286",
"0.6016234",
"0.6010634",
"0.60094625",
"0.6009275",
"0.6008261",
"0.60063004",
"0.6004224",
"0.6001992",
"0.5998939",
"0.59928757",
"0.59920573"
] |
0.7212576
|
0
|
POST /promotions POST /promotions.json
|
def create
@title = t('admin.promotions.new.title')
@promotion = Promotion.new params[:promotion]
@promotion.state = 'not-published'
respond_to do |format|
if @promotion.save
format.html { redirect_to ['admin', @promotion], notice: 'Promotion was successfully created.' }
format.json { render json: @promotion, status: :created, location: @promotion }
else
format.html { render action: 'new' }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_promotions\n @new_promotions ||= []\n end",
"def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t#@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_many\n ids = []\n promotions_errors = []\n promotionable_ids = params.require(:promotionable_ids)\n promotionable_type = promotion_params[:promotionable_type]\n promotionable_ids.each do |id|\n promotion = Promotion.where(promotionable_id: id, promotionable_type: promotionable_type).first\n if promotion.blank?\n promotion = Promotion.new(promotionable_id: id, promotionable_type: promotionable_type)\n unless promotion.save\n promotions_errors << promotion.errors\n end\n end\n ids << promotion.id\n end\n @promotions = Promotion.find(ids)\n respond_to do |format|\n unless promotions_errors.count > 0\n format.json { render :index, status: :created, location: promotions_url }\n else\n format.json { render json: promotions_errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n authorize @promotion\n if @promotion.save\n render json: {promotion: @promotion, status: :created }\n else\n render json: {errors: @promotion.errors, status: :unprocessable_entity }, status: :unprocessable_entity\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n if @promotion.save\n render json: @promotion, status: :created, location: @promotion\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def index\n @title = t('admin.promotions.index.title')\n @promotions = ( @product ? @product.promotions : Promotion.all )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promotions }\n end\n end",
"def promotions\n @promotions ||= order.promotions\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @promotion = current_shop_owner.promotions.new(promotion_params.merge(customer_ids: customer_ids))\n\n # @promotion.translate(@promotion.body)\n\n# make notes that belong to the current shop owner\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to shop_owner_promotion_path(current_shop_owner,@promotion), notice: 'Promotion was successfully created.' }\n # send_text.promotion\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post()\n # construct arguments to fetch\n args = {\n method: 'post',\n credentials: 'include',\n headers: {'Content-Type' => 'application/json'},\n body: {\n project: @ppmc.id,\n ids: @ppmc.mentors.join(','),\n action: 'add',\n targets: ['ldap', 'ppmc', 'committer']\n }.inspect\n }\n\n @disabled = true\n Polyfill.require(%w(Promise fetch)) do\n @create_disabled = true\n fetch(\"actions/ppmc\", args).then {|response|\n content_type = response.headers.get('content-type') || ''\n if response.status == 200 and content_type.include? 'json'\n response.json().then do |json|\n self.update(json)\n end\n else\n alert \"#{response.status} #{response.statusText}\"\n end\n @create_disabled = false\n }.catch {|error|\n alert error\n @create_disabled = false\n }\n end\n end",
"def create\n @puntuation = Puntuation.new(puntuation_params)\n\n respond_to do |format|\n if @puntuation.save\n @voted_contribution = Contribution.find(@puntuation.contribution_id)\n @voted_contribution.increment!(:puntuation, 1)\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @puntuation }\n else\n format.html { render :new }\n format.json { render json: @puntuation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def create\n @promocion = Promocion.new(params[:promocion])\n\n respond_to do |format|\n if @promocion.save\n format.html { redirect_to @promocion, :notice => 'Promocion was successfully created.' }\n format.json { render json: @promocion, status: :created, location: @promocion }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @promocion.errors }\n end\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promocion = Promocion.new(promocion_params)\n\n respond_to do |format|\n if @promocion.save\n format.html { redirect_to @promocion, notice: 'Promocion ha sido creado.' }\n format.json { render :show, status: :created, location: @promocion }\n else\n format.html { render :new }\n format.json { render json: @promocion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n\n @promotion = Promotion.new(promotion_params)\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to adminpromotions_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @adminpromotion }\n else\n format.html { render :new }\n format.json { render json: @adminpromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :resume, :origin, :url, :text, :sended_at, :promoter)\n end",
"def promoter_params\n params.require(:promoter).permit(:name, :email, :password, :company_name, :phone_number, :picture_upload, station_ids: [])\n end",
"def new_promotions?\n !new_promotions.empty?\n end",
"def create\r\n @promotion = Promotion.new(params[:promotion])\r\n\r\n respond_to do |format|\r\n if @promotion.save\r\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\r\n format.json { render json: @promotion, status: :created, location: @promotion }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def list(from_date: nil, to_date: nil, continuation_token: nil, headers: {})\n payload = {\n fromDate: from_date,\n toDate: to_date,\n continuationtoken: continuation_token\n }.select { |_, v| !v.nil? }\n\n @client.rest_get_with_token('/promotions', payload, headers)\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n check_unlimited\n @promotion.advertiser = current_advertiser\n \n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully created.' }\n format.json { render :show, status: :created, location: @promotion }\n else\n format.html { render :new }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit!\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :description, :due_date,\n photos_attributes: [:id, :photo, :_destroy])\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n format.html {redirect_to @promotion, notice: 'Promotion was successfully created.'}\n format.json {render :show, status: :created, location: @promotion}\n else\n format.html {render :new}\n format.json {render json: @promotion.errors, status: :unprocessable_entity}\n end\n end\n end",
"def api_promotions_get(params, opts = {})\n data, _status_code, _headers = api_promotions_get_with_http_info(params, opts)\n return data\n end",
"def promotion_params\n params.require(:promotion).permit(:promotionable_id, :promotionable_type)\n end",
"def pushbullet_params\n params.require(:pushbullet).permit(:token, :email, :motivo)\n end",
"def create\n @promotion_tag = PromotionTag.new(promotion_tag_params)\n\n respond_to do |format|\n if @promotion_tag.save\n format.html { redirect_to @promotion_tag, notice: 'Promotion tag was successfully created.' }\n format.json { render action: 'show', status: :created, location: @promotion_tag }\n else\n format.html { render action: 'new' }\n format.json { render json: @promotion_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def promotion_params\n params.require(:promotion).permit(:english_promo, :body, :send_time)\n end",
"def create\n\t\tsuper\n\t\tif params[\"requestPromotion\"] == 'true'\n\t\t\tuser = User.where(:email => params[\"email\"]).first\n\t\t\trequest = PromotionRequest.create!(\n\t\t\t\t:user => user\n\t\t\t)\n\n\t\t\t@recipients = Professor.where(:toBeNotified => true)\n\t\t\t@recipients.each do |recipient|\n\t\t\t\tputs \"Sending an email about new account\"\n\t\t\t\tNotifyProfessorsOfPromotionRequestMailer.with(request: request, recipient: recipient).notify_professors_of_promotion_request.deliver_now\n\t\t\tend\n\t\tend\n\tend",
"def create\n id = current_user.uid\n @percorso = Percorso.find(params[:percorso])\n @partecipanti = Partecipanti.new(percorso: @percorso.id, utente: id)\n\n respond_to do |format|\n if @partecipanti.save\n conn = Bunny.new\n conn.start\n ch = conn.create_channel\n x = ch.topic(\"#{@percorso.id}\")\n queue = ch.queue(\"#{@percorso.id}#{id}\")\n queue.bind(x, :routing_key => \"all\")\n queue.bind(x, :routing_key => \"#{id}\")\n ch.close\n conn.close\n format.html { redirect_to percorso_path(percorso), notice: 'Adesso fai parte di questo percorso!.' }\n format.js {}\n format.json { render :show, status: :created, location: @partecipanti }\n else\n format.html { render :new }\n format.json { render json: @partecipanti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #raise params.inspect\n params.delete :target_id if params[:target_id].to_s == \"\" \n #raise params.inspect\n\n respond_to do |format| \n if @provisioningobject.save \n if @provisioningobject.provisioningtime == Provisioningobject::PROVISIONINGTIME_IMMEDIATE\n if @provisioningobject.provision(:create, @async)\n if @async \n @notice = \"#{@provisioningobject.class.name} is being created (provisioning running in the background).\"\n else\n @notice = \"#{@provisioningobject.class.name} is provisioned.\"\n end\n else # if @provisioningobject.provision(:create, @async)\n @notice = \"#{@provisioningobject.class.name} could not be provisioned\"\n end\n else # if @provisioningobject.provisioningtime == Provisioningobject::PROVISIONINGTIME_IMMEDIATE\n # only save, do not provision:\n @notice = \"#{@provisioningobject.class.name} is created and can be provisioned ad hoc.\"\n end\n \n format.html { redirect_to @provisioningobject, notice: @notice }\n format.json { render :show, status: :created, location: @provisioningobject } \n else # if @provisioningobject.save\n format.html { render :new } \n format.json { render json: @provisioningobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @punishment = Punishment.new(punishment_params)\n\n respond_to do |format|\n if @punishment.save\n format.html { redirect_to @punishment, notice: 'Punishment was successfully created.' }\n format.json { render :show, status: :created, location: @punishment }\n else\n format.html { render :new }\n format.json { render json: @punishment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Create Nudge for issueing user\n @nudge = Nudge.new\n @nudge.user_id = params[:user_id]\n @nudge.pet_id = params[:pet_id]\n @nudge.group_id = Pet.find(params[:pet_id]).group.id\n @nudge.response = -1\n @nudge.nudge_token = @nudge.generate_token\n\n respond_to do |format|\n if @nudge.save\n # Create Nudge for group memebers\n Group.find(@nudge.group_id).users.each do |user|\n next if user.id == @nudge.user_id || user.device.nil?\n @nudge_member = Nudge.new\n @nudge_member.user_id = user.id\n @nudge_member.pet_id = params[:pet_id]\n @nudge_member.group_id = Pet.find(params[:pet_id]).group.id\n @nudge_member.response = 0\n @nudge_member.nudge_token = @nudge.nudge_token\n\n if @nudge_member.save\n # Send push notification\n @apn = Houston::Client.development\n device_token = User.find(@nudge_member.user_id).device.device_token\n notification = Houston::Notification.new(device: device_token)\n notification.alert = User.find(@nudge.user_id).first_name + ': Has ' + Pet.find(@nudge.pet_id).name + ' been fed?'\n notification.category = 'fed.category'\n notification.content_available = true\n notification.sound = 'sosumi.aiff'\n notification.custom_data = { nudge_id: @nudge.id, nudge_token: @nudge.nudge_token }\n @apn.push(notification)\n end\n end\n format.json { render :show, status: :created, location: @nudge }\n else\n format.json { render json: @nudge.errors, status: :unprocessable_entity }\n end \n end\n end",
"def create\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:item_producto_id])\n @opinion = @item_producto.opinions.build(opinion_params)\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to empresa_producto_item_producto_opinions_path, notice: 'Item producto was successfully created.' }\n format.json { render :show, status: :created, location: @opinion }\n else\n format.html { render :new }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def probando_params\n params.require(:probando).permit(:user_id, :post_id, :parragraph, :number)\n end",
"def create\n @promotersbind = Promotersbind.new(params[:promotersbind])\n\n respond_to do |format|\n if @promotersbind.save\n format.html { redirect_to @promotersbind, :notice => 'Promotersbind was successfully created.' }\n format.json { render :json => @promotersbind, :status => :created, :location => @promotersbind }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @promotersbind.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_pm(args = {})\n args[:archetype] = \"private_message\"\n args =\n API\n .params(args)\n .required(:title, :raw, :target_recipients, :archetype)\n .optional(:category, :created_at, :api_username)\n post(\"/posts\", args.to_h)\n end",
"def create\n @property = Property.new(params[:property])\n\n respond_to do |format|\n if @property.save\n users = User.all\n users.each { |u|\n options = {\n :registration_id => u.registration_id,\n :message => \"New property added to Property Market!\",\n :id => @property.id,\n :name => @property.name,\n :ptype => @property.ptype,\n :collapse_key => @property.id.to_s\n }\n puts options.inspect\n response = SpeedyC2DM::API.send_notification(options)\n puts response.inspect\n }\n \n\n \n format.html { redirect_to @property, notice: 'Property was successfully created.' }\n format.json { render json: @property, status: :created, location: @property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def processed_promos\n respond_to do |format|\n @taken_promos = TakenPromo.get_taken_promos_for_user current_user\n format.html { }\n end\n end",
"def mottovote_params\n params.require(:mottovote).permit(:user_id, :motto_id, :note)\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :body, :start_at, :expire_at)\n end",
"def create_potions\n potion = Potion.create(name: 'Basic Healing Potion', heal_amount: 10, cost: 10, :merchant_id => self.id)\n\n potion1 = Potion.create(name: 'Superior Healing Potion', heal_amount: 25, cost: 20, :merchant_id => self.id)\n\n potion2 = Potion.create(name: 'Full Heal Potion', heal_amount: 50, cost: 45, :merchant_id => self.id )\n\n end",
"def pending_promotions?\n !pending_promotions.empty?\n end",
"def create\n params[:mentions].each do |men_params|\n men_params = men_params.permit(:ticker_id, :positive_count, :negative_count, :neutral_count)\n @mention = Mention.new(men_params)\n @mention.save\n end\n respond_to do |format|\n msg = { :status => :ok, :message => \"Success!\", :html => '<b></b>' }\n format.html do\n redirect_to '/'\n end\n format.json { render :json => msg }\n end\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :image, :image_cache, :body, :start_date, :end_date, :sent)\n end",
"def create\n if params[:propietario]\n @negocio_propio = Negocio.find(params[:negocio_id])\n @propietario = Usuario.find(params[:usuario_id])\n authorize! :update, @propietario\n if @propietario.negocios_propios << @negocio_propio\n render json: @propietario.negocios_propios, status: :created\n else\n render json: @propietario.negocios_propios.errors, status: :unprocessable_entity\n end\n else\n @negocio = Negocio.new(parametros_negocio)\n authorize! :create, Negocio\n if @negocio.save\n render json: @negocio, status: :created\n else\n render json: @negocio.errors, status: :unprocessable_entity\n end\n end\n end",
"def send(p)\n options = {} \n\n p.each do |k,v|\n\n case k\n when :reply_path\n # Automatically request delivery receipt if reply path is set\n options[sym_to_param(:confirm_delivery)] = 'on'\n options[sym_to_param(k)] = v\n when :scheduled_for\n # Set timestamp correctly for :scheduled_for\n options[sym_to_param(k)] = v.strftime('%Y%m%d%H%M%S')\n else\n options[sym_to_param(k)] = v\n end\n\n end\n\n res = self.class.post('/submit_sm', :basic_auth => @auth, :body => JSON.dump(options))\n\n responses = []\n res['sms'].each do |r|\n responses << Dialogue::Toolkit::Sms::Response.new(r)\n end\n\n responses\n end",
"def destroy_many\n promotionable_ids = params.require(:promotionable_ids)\n promotionable_type = promotion_params[:promotionable_type]\n @promotions = Promotion.where(promotionable_id: promotionable_ids, promotionable_type: promotionable_type)\n @promotions.destroy_all\n respond_to do |format|\n format.html { redirect_to after_destroy_path, notice: 'Promotions where successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @promotions = Promotion.where(active: true)\n @all_promotions = Promotion.all\n respond_to do |format|\n format.html \n format.json { render json: @all_promotions }\n end\n end",
"def create\n @motto = Motto.new(motto_params)\n\n respond_to do |format|\n if @motto.save\n format.html { redirect_to @motto, notice: 'Motto was successfully created.' }\n format.json { render :show, status: :created, location: @motto }\n else\n format.html { render :new }\n format.json { render json: @motto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mad_mimi_email = MadMimiEmail.new\n @mimi = MadMimi.new('sarahsponda902@gmail.com', 'df65cf0a215c2b3028fa7eaf89a6f2ba')\n @promotions = @mimi.promotions\n @emails = User.where(:notify => true).map(&:email)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mad_mimi_email }\n end\n end",
"def provision\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # provision.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n if @customer.nil?\n @promotions = Promotion.all\n else \n @promotions = @customer.promotions\n end\n render 'promotions/promotions', :locals => { :promotions => @promotions }\n end",
"def create\n @poem = Poem.new(poem_params)\n @poem.user = current_user\n\n if params[:tags_id].present?\n arr = params[:tags_id].split(',')\n @poem.tags = Tag.find(arr)\n end\n\n respond_to do |format|\n if @poem.save\n format.html { redirect_to @poem, notice: 'Poem was successfully created.' }\n format.json { render :show, status: :created, location: @poem }\n else\n format.html { render :new }\n format.json { render json: @poem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @opinion = current_user.opinions.build(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to root_path, notice: 'Opinion was successfully created.' }\n format.json { render :show, status: :created, location: @opinion }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_promotions_list\n # get params for paging\n unless params[:id].blank?\n @client_id = params[:id]\n else\n @client_id = @clients[0].id\n end\n\n rows = Array.new\n rows = get_rows(Promotion.get_by_client(@client_id).active.\n order_id_desc.page(params[:page]).per(params[:rp]), @client_id)\n count = Promotion.get_by_client(@client_id).active.order_by_promotion_name.count\n\n render json: {page: params[:page], total: count, rows: rows}\n end",
"def create\n @admin_promo = Admin::Promo.new(admin_promo_params)\n\n respond_to do |format|\n if @admin_promo.save\n format.html { redirect_to session['previous_url'] || admin_promos_path, notice: 'Promozioni è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_promo }\n else\n format.html { render :new }\n format.json { render json: @admin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_prowl(options)\n uri = URI.parse(\"https://prowl.weks.net/publicapi/add\")\n https = Net::HTTP.new(uri.host, uri.port)\n # We have to use SSL\n https.use_ssl = true\n # Avoid to get warning\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.path)\n # Default options for notifications\n options = {:apikey => $configure[:prowl][:apikey], :application => \"Twitter\", :priority => 0}.merge(options)\n req.set_form_data(options)\n https.request(req)\nend",
"def create\n @poem = @user.poems.build(params[:poem])\n @poem.user = current_user\n\n respond_to do |format|\n if @poem.save\n format.html { redirect_to user_poems_path, notice: 'Poem was successfully created.' }\n format.json { render json: @poem, status: :created, location: @poem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @poem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def puntuation_params\n params.require(:puntuation).permit(:user_id, :contribution_id)\n end",
"def post_commit(commit_obj)\n return if commit_obj.empty?\n uri = URI.parse(\"http://gitsvn.bioconductor.org/git-push-hook\")\n json = commit_obj.to_json\n response = Net::HTTP.post_form(uri, {\"payload\" => json})\nend",
"def create\n @przedmiot = Przedmiot.new(params[:przedmiot])\n @przedmiot.user_id = current_user.id\n respond_to do |format|\n if @przedmiot.save\n format.html { redirect_to @przedmiot, notice: 'Przedmiot został dodany.' }\n format.json { render json: @przedmiot, status: :created, location: @przedmiot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @przedmiot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit(:start_date, :end_date, :promotable_id, :promotable_type, :active, :priority, :image)\n end",
"def create\n @proposta = Propostum.new(propostum_params)\n\n respond_to do |format|\n if @proposta.save\n format.html { redirect_to @proposta, notice: 'Propostum was successfully created.' }\n format.json { render :show, status: :created, location: @proposta }\n else\n format.html { render :new }\n format.json { render json: @proposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @punish = Punish.new(punish_params)\n\n respond_to do |format|\n if @punish.save\n format.html { redirect_to @punish, notice: 'Punish was successfully created.' }\n format.json { render :show, status: :created, location: @punish }\n else\n format.html { render :new }\n format.json { render json: @punish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def checkout_promotions\n @checkout_promotions ||= Promotion.active.code_based\n end",
"def index\n @product_promotions = ProductPromotion.all\n end",
"def push_notifications\n # post \"/push\" do\n Webpush.payload_send(\n message: params[:message],\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n vapid: {\n subject: \"mailto:sender@example.com\",\n public_key: ENV['VAPID_PUBLIC_KEY'],\n private_key: ENV['VAPID_PRIVATE_KEY']\n }\n )\n end",
"def index\n @promotions = Promotion.paginate(:page => params[:page], :per_page => 10)\n .order(\"due_date DESC\")\n end",
"def create\n @opnion = Opnion.new(opnion_params)\n\n respond_to do |format|\n if @opnion.save\n format.html { redirect_to @opnion, notice: 'Opnion was successfully created.' }\n format.json { render :show, status: :created, location: @opnion }\n else\n format.html { render :new }\n format.json { render json: @opnion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promos = Promos.new(params[:promos])\n\n respond_to do |format|\n if @promos.save\n flash[:notice] = 'Promos was successfully created.'\n format.html { redirect_to(@promos) }\n format.xml { render :xml => @promos, :status => :created, :location => @promos }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @promos.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @micropot = Micropot.new(micropot_params)\n\n respond_to do |format|\n if @micropot.save\n format.html { redirect_to @micropot, notice: 'Micropot was successfully created.' }\n format.json { render :show, status: :created, location: @micropot }\n else\n format.html { render :new }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_preferences(params)\n mhv_params = MessagingPreference.new(params).mhv_params\n perform(:post, 'preferences/notification', mhv_params, token_headers)\n get_preferences\n # NOTE: email_address might return an MHV error for any validations we have not handled, these will result\n # in a mapped SM152 code in exceptions.en.yml\n end",
"def create\n @promo = Promo.new(params[:promo])\n\n respond_to do |format|\n if @promo.save\n format.html { redirect_to @promo, notice: 'Promo was successfully created.' }\n format.json { render json: @promo, status: :created, location: @promo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proverb = Proverb.new(proverb_params)\n\n respond_to do |format|\n if @proverb.save\n format.html { redirect_to @proverb, notice: \"Proverb was successfully created.\" }\n format.json { render :show, status: :created, location: @proverb }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @proverb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_promoter\n @promoter = Promoter.find(params[:id])\n end",
"def create\n @promotion_demotion = PromotionDemotion.new(params[:promotion_demotion])\n\n respond_to do |format|\n if @promotion_demotion.save\n format.html { redirect_to :back, notice: 'Promotion demotion was successfully created.' }\n format.json { render json: @promotion_demotion, status: :created, location: @promotion_demotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion_demotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home_promotion = Home::Promotion.new(params[:home_promotion])\n\n respond_to do |format|\n if @home_promotion.save\n format.html { redirect_to @home_promotion, notice: 'Promotion was successfully created.' }\n format.json { render json: @home_promotion, status: :created, location: @home_promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def poem_params\n params.require(:poem).permit(:title, :content, :metaphor)\n end",
"def create\n @reply_puntuation = ReplyPuntuation.new(reply_puntuation_params)\n\n respond_to do |format|\n if @reply_puntuation.save\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @reply_puntuation }\n else\n format.html { render :new }\n format.json { render json: @reply_puntuation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n msg=Message.new\n pick_list=PickListService.covert_order_to_pick_list(params[:user_id], params[:order_ids])\n if pick_list\n msg.result = true\n msg.content = pick_list\n end\n render json: msg\n end",
"def post_notification(attributes)\n begin\n response = notifications_api.post(encode_json(attributes))\n [parse_json(response), nil]\n rescue RestClient::UnprocessableEntity => e\n [parse_json(e.response), InvalidNotification]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def mass_create\n requests = []\n group_invite_params[:mass_requests].each do |element|\n requests << @current_user.requests_as_sender.new(:group_id => element[:group_id], :receiver_id => element[:receiver_id], :status => \"pending\")\n end\n\n @invites = Request.import requests\n\n if @invites\n render json: requests, status: :created\n else\n render json: requests.errors, status: :unprocessable_entity\n end\n end",
"def micropot_params\n params.require(:micropot).permit(:content, :user_id)\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def create\n @opinion = current_user.opinions.build(opinion_params)\n\n respond_to do |format|\n if @opinion.save\n format.html { redirect_to index, notice: 'Opinion was successfully created.' }\n format.json { render :index, status: :created, location: @opinion }\n else\n format.html { render :new }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notion = Notion.new(notion_params)\n\n respond_to do |format|\n if @notion.save\n format.html { redirect_to @notion, notice: 'Notion was successfully created.' }\n format.json { render :show, status: :created, location: @notion }\n else\n format.html { render :new }\n format.json { render json: @notion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.sponsors = params[:sponsors]\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'El pedido se creó correctamente.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.61129576",
"0.6003724",
"0.5930134",
"0.5900632",
"0.5900632",
"0.5900632",
"0.5849472",
"0.5800277",
"0.5748506",
"0.573991",
"0.5670667",
"0.56652546",
"0.558862",
"0.555045",
"0.55195886",
"0.5505017",
"0.550316",
"0.54850113",
"0.5484974",
"0.54847103",
"0.5421864",
"0.5421864",
"0.54196906",
"0.5390764",
"0.53843445",
"0.5363325",
"0.53338623",
"0.53054243",
"0.5297711",
"0.52477556",
"0.5224716",
"0.5205923",
"0.5193097",
"0.518293",
"0.51127243",
"0.50919914",
"0.50887096",
"0.50870943",
"0.5086982",
"0.50786006",
"0.500472",
"0.49753878",
"0.49730098",
"0.4964586",
"0.49475074",
"0.4936315",
"0.49311116",
"0.49273953",
"0.49121204",
"0.48951322",
"0.48948458",
"0.48944592",
"0.48924777",
"0.48905078",
"0.4885196",
"0.48849952",
"0.4882702",
"0.48824364",
"0.48820168",
"0.48814005",
"0.4880526",
"0.48796606",
"0.4873605",
"0.48707312",
"0.48684344",
"0.48610532",
"0.48559853",
"0.48546627",
"0.484262",
"0.48392084",
"0.48369813",
"0.48362684",
"0.4829033",
"0.48280835",
"0.48196465",
"0.48168412",
"0.48157403",
"0.48056325",
"0.4805014",
"0.47941688",
"0.47881487",
"0.47874516",
"0.4783799",
"0.47748217",
"0.47732842",
"0.4771353",
"0.4762637",
"0.4759165",
"0.4756687",
"0.47543696",
"0.47515893",
"0.47503495",
"0.47443962",
"0.4741165",
"0.47406417",
"0.4740009",
"0.4737261",
"0.4732928",
"0.4727693",
"0.47262377"
] |
0.531593
|
27
|
PUT /promotions/1 PUT /promotions/1.json
|
def update
@title = t('admin.promotions.edit.title')
@promotion = Promotion.find(params[:id])
params[:promotion][:state] = 'not-published'
respond_to do |format|
if @promotion.update_attributes(params[:promotion])
format.html { redirect_to ['admin', @promotion], notice: 'Promotion was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @promoter.update(promoter_params)\n format.html { redirect_to root_url, notice: 'Promoter was successfully updated.' }\n format.json { render :show, status: :ok, location: @promoter }\n else\n format.html { render :edit }\n format.json { render json: @promoter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promotion = Promotion.find(promotion_params[:id])\n authorize @promotion\n if @promotion.update(promotion_params)\n render json: { status: :ok, promotion: @promotion }\n else\n render json: { errors: @promotion.errors, status: :unprocessable_entity }\n end\n end",
"def update\n @promotion = Promotion.find(params[:id])\n\n if @promotion.update(promotion_params)\n head :no_content\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end",
"def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def set_promotion\n @promotion = current_shop_owner.promotions.find(params[:id])\n end",
"def update\n @promotion = Promotion.find(params[:id])\n\n respond_to do |format|\n if @promotion.update_attributes(params[:promotion])\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promotion = Promotion.find(params[:id])\n\n respond_to do |format|\n if @promotion.update_attributes(params[:promotion])\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promotion.attributes = promotion_params\n check_unlimited\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\n format.json { render :show, status: :ok, location: @promotion }\n else\n format.html { render :edit }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @promotion = Promotion.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @promotion.update_attributes(params[:promotion])\r\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def index\n @promotions = current_shop_owner.promotions.all\n end",
"def set_promoter\n @promoter = Promoter.find(params[:id])\n end",
"def update\n @promos = Promos.find(params[:id])\n\n respond_to do |format|\n if @promos.update_attributes(params[:promos])\n flash[:notice] = 'Promos was successfully updated.'\n format.html { redirect_to(@promos) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @promos.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\n format.json { render :show, status: :ok, location: @promotion }\n else\n format.html { render :edit }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\n format.json { render :show, status: :ok, location: @promotion }\n else\n format.html { render :edit }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html { redirect_to shop_owner_promotion_path(current_shop_owner,@promotion), notice: 'Promotion was successfully updated.' }\n format.json { render :show, status: :ok, location: @promotion }\n else\n format.html { render :edit }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @title = t('admin.promotions.index.title')\n @promotions = ( @product ? @product.promotions : Promotion.all )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promotions }\n end\n end",
"def create\n @promotion = Promotion.new(params[:promotion])\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promocion = Promocion.find(params[:id])\n logger.debug \"-------------------------------------------------------\"\n logger.debug params[:promocion][:formadepago_ids]\n logger.debug \"-------------------------------------------------------\"\n if (params[:promocion][:comercializable_ids] == nil)\n params[:promocion][:comercializable_ids] = []\n end\n\n if (params[:promocion][:formadepago_ids] == nil)\n params[:promocion][:formadepago_ids] = []\n end\n\n respond_to do |format|\n if @promocion.update_attributes(params[:promocion])\n format.html { redirect_to @promocion, :notice => 'Promocion was successfully updated.' }\n format.json { render json: @promocion}\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @promocion.errors }\n end\n end\n end",
"def update\n begin\n remember_event\n @promoter = Promoter.update(params['id'], params['promoter'])\n if @promoter.errors.empty?\n if @event\n redirect_to(edit_admin_promoter_path(@promoter, :event_id => @event.id))\n else\n redirect_to(edit_admin_promoter_path(@promoter))\n end\n else\n render(:action => :edit)\n end\n rescue Exception => e\n logger.error(e)\n flash['warn'] = e.message\n render(:action => :edit)\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n respond_to do |format|\n if @promotion.save\n\t\t@promotion.update_notification\n\t\t#@promotion.push\n format.html { redirect_to promotions_path(:playerid=>current_player.playerid), notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_promocion\n @promocion = Promocion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @promotions = args[:promotions] if args.key?(:promotions)\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @promotions = args[:promotions] if args.key?(:promotions)\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def update\n respond_to do |format|\n if @promocion.update(promocion_params)\n format.html { redirect_to @promocion, notice: 'Promocion ha sido actualizado.' }\n format.json { render :show, status: :ok, location: @promocion }\n else\n format.html { render :edit }\n format.json { render json: @promocion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html {redirect_to @promotion, notice: 'Promotion was successfully updated.'}\n format.json {render :show, status: :ok, location: @promotion}\n else\n format.html {render :edit}\n format.json {render json: @promotion.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @proverb.update(proverb_params)\n format.html { redirect_to @proverb, notice: \"Proverb was successfully updated.\" }\n format.json { render :show, status: :ok, location: @proverb }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @proverb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_promotion\n if params[:id].to_i >0\n @adminpromotion = Promotion.find(params[:id])\n end\n end",
"def set_promotion\n @promotion = Promotion.find(params[:id])\n end",
"def update\n @promotion_box = PromotionBox.find(params[:id])\n\n respond_to do |format|\n if @promotion_box.update_attributes(params[:promotion_box])\n flash[:notice] = 'PromotionBox was successfully updated.'\n format.html { redirect_to admin_promotion_boxes_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @promotion_box.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #raise params.inspect\n params.delete :target_id if params[:target_id].to_s == \"\" \n #raise params.inspect\n\n respond_to do |format| \n if !@provisioningobject.provisioned? && @provisioningobject.update(provisioningobject_params) \n if @provisioningobject.provisioningtime == Provisioningobject::PROVISIONINGTIME_IMMEDIATE\n if @provisioningobject.provision(:create, @async)\n if @async \n @notice = \"#{@provisioningobject.class.name} is being created (provisioning running in the background).\"\n else\n @notice = \"#{@provisioningobject.class.name} is provisioned.\"\n end\n else # if @provisioningobject.provision(:create, @async)\n @notice = \"#{@provisioningobject.class.name} could not be provisioned\"\n end\n else # if @provisioningobject.provisioningtime == Provisioningobject::PROVISIONINGTIME_IMMEDIATE\n # only save, do not provision:\n @notice = \"#{@provisioningobject.class.name} is created and can be provisioned ad hoc.\"\n @provisioningobject.update_attribute(:status, \"not provisioned\")\n end\n \n format.html { redirect_to @provisioningobject, notice: @notice }\n format.json { render :show, status: :created, location: @provisioningobject } \n else # if @provisioningobject.save\n flash[:error] = \"#{@provisioningobject.class.name} could not be updated (already provisioned?)\"\n format.html { render :edit } \n format.json { render json: @provisioningobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_promotions\n @new_promotions ||= []\n end",
"def update!(**args)\n @promotion_amount = args[:promotion_amount] if args.key?(:promotion_amount)\n @promotion_id = args[:promotion_id] if args.key?(:promotion_id)\n end",
"def update\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:item_producto_id])\n @opinion = @item_producto.opinions.find(params[:id])\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to empresa_producto_item_producto_opinions_path, notice: 'Item producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promo = Promo.find(params[:id])\n\n respond_to do |format|\n if @promo.update_attributes(params[:promo])\n format.html { redirect_to @promo, notice: 'Promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def propose\n response = CoachClient::Request.put(url, username: @user1.username,\n password: @user1.password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotProposed.new(self), 'Could not propose partnership'\n end\n set_user_confirmed(response.to_h)\n self\n end",
"def update\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n\n respond_to do |format|\n if @round_robin_promo.update_attributes(params[:round_robin_promo])\n format.html { redirect_to @round_robin_promo, notice: 'Round robin promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round_robin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @adminpromotion.update(promotion_params)\n format.html { redirect_to adminpromotions_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @adminpromotion }\n else\n format.html { render :edit }\n format.json { render json: @adminpromotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotions\n @promotions ||= order.promotions\n end",
"def set_promoted(promoted)\n @promoted = promoted\n @movetype = :promotion\n end",
"def update\n @promocao = Promocao.find(params[:id])\n\n respond_to do |format|\n if @promocao.update_attributes(params[:promocao])\n format.html { redirect_to(@promocao, :notice => 'Promoção aletrada com sucesso!') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @promocao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @promotion_type = PromotionType.find(params[:id])\n\n respond_to do |format|\n if @promotion_type.update_attributes(params[:promotion_type])\n format.html { redirect_to @promotion_type, notice: 'Promotion type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :resume, :origin, :url, :text, :sended_at, :promoter)\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @motto.update(motto_params)\n format.html { redirect_to @motto, notice: 'Motto was successfully updated.' }\n format.json { render :show, status: :ok, location: @motto }\n else\n format.html { render :edit }\n format.json { render json: @motto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promotersbind = Promotersbind.find(params[:id])\n\n respond_to do |format|\n if @promotersbind.update_attributes(params[:promotersbind])\n format.html { redirect_to @promotersbind, :notice => 'Promotersbind was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @promotersbind.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_promotion_tag\n @promotion_tag = PromotionTag.find(params[:id])\n end",
"def update\n raise UnprocessableEntityError.new(@promotion.errors) unless @promotion.update(promotion_params)\n render :partial => 'promotions/promotion', :locals => { :promotion => @promotion }\n end",
"def update\n respond_to do |format|\n if @opnion.update(opnion_params)\n format.html { redirect_to @opnion, notice: 'Opnion was successfully updated.' }\n format.json { render :show, status: :ok, location: @opnion }\n else\n format.html { render :edit }\n format.json { render json: @opnion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @micropot.update(micropot_params)\n format.html { redirect_to @micropot, notice: 'Micropot was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropot }\n else\n format.html { render :edit }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promotion = Promotion.find(params[:id])\n if @promotion.update_attributes(promotion_params)\n flash[:notice] = 'Promotion was successfully updated.'\n redirect_to promotions_path\n else\n flash[:error] = @promotion.errors.full_messages\n # format.js\n render \"edit\"\n end\n end",
"def update\n @user_promotion = UserPromotion.find(params[:id])\n\n respond_to do |format|\n if @user_promotion.update_attributes(params[:user_promotion])\n format.html { redirect_to(@user_promotion, :notice => 'User promotion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_promotion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def update\n @home_promotion = Home::Promotion.find(params[:id])\n\n respond_to do |format|\n if @home_promotion.update_attributes(params[:home_promotion])\n format.html { redirect_to @home_promotion, notice: 'Promotion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prominent.update(prominent_params)\n format.html { redirect_to @prominent, notice: 'Prominent was successfully updated.' }\n format.json { render :show, status: :ok, location: @prominent }\n else\n format.html { render :edit }\n format.json { render json: @prominent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n\n if @promotion.save\n render json: @promotion, status: :created, location: @promotion\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end",
"def create\n @title = t('admin.promotions.new.title')\n @promotion = Promotion.new params[:promotion]\n @promotion.state = 'not-published'\n respond_to do |format|\n if @promotion.save\n format.html { redirect_to ['admin', @promotion], notice: 'Promotion was successfully created.' }\n format.json { render json: @promotion, status: :created, location: @promotion }\n else\n format.html { render action: 'new' }\n format.json { render json: @promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notion.update(notion_params)\n format.html { redirect_to @notion, notice: 'Notion was successfully updated.' }\n format.json { render :show, status: :ok, location: @notion }\n else\n format.html { render :edit }\n format.json { render json: @notion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit(:title, :description, :due_date,\n photos_attributes: [:id, :photo, :_destroy])\n end",
"def update\n respond_to do |format|\n if @promotion_tag.update(promotion_tag_params)\n format.html { redirect_to @promotion_tag, notice: 'Promotion tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @promotion_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promo = Promo.find(params[:id])\n\n respond_to do |format|\n if @promo.update_attributes(params[:promo])\n flash[:notice] = \"Promo '#{@promo}' was successfully updated.\"\n format.html { redirect_to promo_url(@promo) }\n format.xml { head :ok }\n format.js { render :template => 'programming/promos/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @promo.errors.to_xml }\n format.js { render :template => 'programming/promos/error' }\n end\n end\n end",
"def update\n @provision = Provision.find(params[:id])\n\n respond_to do |format|\n if @provision.update_attributes(params[:provision])\n format.html { redirect_to(@provision, :notice => 'Provision was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provision.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @promotion_ids = args[:promotion_ids] if args.key?(:promotion_ids)\n @quantity = args[:quantity] if args.key?(:quantity)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def update\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n if @propose.update_attributes(params[:propose])\n format.html { redirect_to @propose, notice: 'Propuesta actualizada' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @propose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_promotions_get(params, opts = {})\n data, _status_code, _headers = api_promotions_get_with_http_info(params, opts)\n return data\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def create\n @promocion = Promocion.new(params[:promocion])\n\n respond_to do |format|\n if @promocion.save\n format.html { redirect_to @promocion, :notice => 'Promocion was successfully created.' }\n format.json { render json: @promocion, status: :created, location: @promocion }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @promocion.errors }\n end\n end\n end",
"def update\n @promotion=session[:promotion]\n respond_to do |format|\n if @product_promotion.update(product_params)\n \n format.html { redirect_to edit_promotion_path(@promotion), notice: 'Product was successfully updated.' }\n \n else\n format.html { render :edit }\n format.json { render json: @product_promotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puntuation = Puntuation.new(puntuation_params)\n\n respond_to do |format|\n if @puntuation.save\n @voted_contribution = Contribution.find(@puntuation.contribution_id)\n @voted_contribution.increment!(:puntuation, 1)\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @puntuation }\n else\n format.html { render :new }\n format.json { render json: @puntuation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_proverb\n @proverb = Proverb.find(params[:id])\n end",
"def update\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n\n respond_to do |format|\n if @vpn.update_attributes(params[:vpn])\n format.html { redirect_to @vpn, notice: 'Vpn was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vpn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @orphan.update(orphan_params)\n format.html { redirect_to @orphan, notice: 'Orphan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @orphan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @command.update(command_params)\n format.json { render :json => @command }\n else\n format.json { render json: @command.errors, status: 401 }\n end\n end\n end",
"def edit\n assign_previous\n @event.promoter = Person.find(params[\"promoter_id\"]) if params[\"promoter_id\"].present? && current_person.administrator?\n end",
"def create\n @promotion = Promotion.new(promotion_params)\n authorize @promotion\n if @promotion.save\n render json: {promotion: @promotion, status: :created }\n else\n render json: {errors: @promotion.errors, status: :unprocessable_entity }, status: :unprocessable_entity\n end\n end",
"def update\n @processo = Processo.find(params[:id])\n\n if @processo.update(processo_params)\n head :no_content\n else\n render json: @processo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @promotion_demotion = PromotionDemotion.find(params[:id])\n\n respond_to do |format|\n if @promotion_demotion.update_attributes(params[:promotion_demotion])\n format.html { redirect_to @promotion_demotion.rid, notice: 'Promotion demotion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion_demotion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @motivonegativa = Motivonegativa.find(params[:id])\n\n respond_to do |format|\n if @motivonegativa.update_attributes(params[:motivonegativa])\n format.html { redirect_to(@motivonegativa, :notice => 'Motivonegativa was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @motivonegativa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def promotion_params\n params.require(:promotion).permit!\n end",
"def destroy\r\n @promotion = Promotion.find(params[:id])\r\n @promotion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to promotions_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def set_mottovote\n @mottovote = Mottovote.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @admin_promo.update(admin_promo_params)\n format.html { redirect_to session['previous_url'] || admin_promos_path, notice: 'Promozioni è stato aggiornato con successo.' }\n format.json { render :show, status: :ok, location: @admin_promo }\n else\n format.html { render :edit }\n format.json { render json: @admin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mottovote_params\n params.require(:mottovote).permit(:user_id, :motto_id, :note)\n end",
"def update\n respond_to do |format|\n if @proyectominero2.update(proyectominero2_params)\n format.html { redirect_to @proyectominero2, notice: 'Proyectominero2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyectominero2 }\n else\n format.html { render :edit }\n format.json { render json: @proyectominero2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.63557005",
"0.60426205",
"0.60355294",
"0.6011776",
"0.584064",
"0.584064",
"0.584064",
"0.5823515",
"0.57860595",
"0.5748086",
"0.5730741",
"0.572601",
"0.5669982",
"0.56466687",
"0.5631083",
"0.559828",
"0.559828",
"0.55969816",
"0.558667",
"0.5583874",
"0.5571751",
"0.55680776",
"0.5560823",
"0.55397034",
"0.5520791",
"0.5520791",
"0.5501383",
"0.5501383",
"0.5489127",
"0.5481607",
"0.5473341",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5456876",
"0.5433675",
"0.5399182",
"0.53795487",
"0.5360203",
"0.5358079",
"0.5351407",
"0.5294145",
"0.525039",
"0.5242459",
"0.5235008",
"0.52273524",
"0.5223271",
"0.5213394",
"0.5185925",
"0.51746553",
"0.51742625",
"0.5128712",
"0.5121693",
"0.51162505",
"0.5106784",
"0.509684",
"0.5078458",
"0.50782776",
"0.5070982",
"0.50708276",
"0.50684726",
"0.5030357",
"0.50299096",
"0.5024289",
"0.50198954",
"0.5018144",
"0.5017709",
"0.5013348",
"0.4996877",
"0.49945408",
"0.49788088",
"0.49779755",
"0.4975554",
"0.4970829",
"0.496295",
"0.49541435",
"0.4950216",
"0.49494076",
"0.49406546",
"0.49388322",
"0.49300414",
"0.4928296",
"0.492665",
"0.4924156",
"0.4913233",
"0.49065357",
"0.49016714",
"0.48922494",
"0.48853433",
"0.48848277",
"0.4882754",
"0.4877764",
"0.48765028",
"0.4873181",
"0.48729104"
] |
0.56627405
|
13
|
DELETE /promotions/1 DELETE /promotions/1.json
|
def destroy
@promotion = Promotion.find(params[:id])
if @promotion.destroy
js_notify message: t('admin.promotions.destroy.success'), type: 'alert-error', time: 2500
render nothing: true, content_type: 'text/html'
else
message = "#{t('admin.promotions.destroy.error')}: #{@promotion.errors[:base].first}"
js_notify message: message, type: 'alert-info', time: 2500
render nothing: true
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @promotion = Promotion.find(params[:id])\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to promotions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @promotion = Promotion.find(params[:id])\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to promotions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @promotion = Promotion.find(params[:id])\r\n @promotion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to promotions_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @promotion = Promotion.find(params[:id])\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to(promotions_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @promocion = Promocion.find(params[:id])\n @promocion.destroy\n\n respond_to do |format|\n format.html { redirect_to promocions_url }\n #format.json { head :ok }\n end\n end",
"def destroy\n #@promotion = Promotion.find(params[:id])\n @promotion.destroy\n respond_to do |format|\n format.html { redirect_to promotions_url, notice: 'Promotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n @promotion = Promotion.find(params[:id])\n @client_id = @promotion.client.id\n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to(promotions_url(:client_id => @client_id)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n @round_robin_promo.destroy\n\n respond_to do |format|\n format.html { redirect_to round_robin_promos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vpn = Vpn.find(params[:id])\n checkaccountobject(\"vpns\",@vpn)\n @vpn.send_delete\n\n respond_to do |format|\n format.html { redirect_to vpns_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @promotion = Promotion.find(params[:id])\n\n BusinessPayment.find(:all, :conditions => {:promotion_id => @promotion.id}).each do |bp|\n bp.destroy\n end\n \n @promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_promotions_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @promocion.destroy\n respond_to do |format|\n format.html { redirect_to promocions_url, notice: 'Promocion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion.destroy\n respond_to do |format|\n format.html { redirect_to promotions_url, notice: 'Promotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion.destroy\n respond_to do |format|\n format.html { redirect_to promotions_url, notice: 'Promotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion.destroy\n respond_to do |format|\n format.html { redirect_to promotions_url, notice: 'Promotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cpanel_promotion.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_promotions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adminpromotion.destroy\n respond_to do |format|\n format.html { redirect_to adminpromotions_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_adminpromotion }\n end\n end",
"def destroy\n @promotion.destroy\n respond_to do |format|\n format.html {redirect_to promotions_url, notice: 'Promotion was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @promo = Promo.find(params[:id])\n @promo.destroy\n\n respond_to do |format|\n format.html { redirect_to promos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promo = Promo.find(params[:id])\n @promo.destroy\n\n respond_to do |format|\n format.html { redirect_to promos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promos = Promos.find(params[:id])\n @promos.destroy\n\n respond_to do |format|\n format.html { redirect_to(promos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @promotion.destroy\n\n head :no_content\n end",
"def destroy\n @promotion.destroy\n head :no_content\n end",
"def destroy\n @home_promotion = Home::Promotion.find(params[:id])\n @home_promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to home_promotions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prossumer.destroy\n head :no_content\n end",
"def destroy\n @promotion.destroy\n respond_to do |format|\n format.html { redirect_to shop_owner_promotions_path(current_shop_owner), notice: 'Promotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteProductProvisioning( product_id, gen_id)\n params = Hash.new\n params['product_id'] = product_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/product/provisioning\",params)\n end",
"def destroy\n @proverb.destroy\n respond_to do |format|\n format.html { redirect_to proverbs_url, notice: \"Proverb was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_promotion = UserPromotion.find(params[:id])\n @user_promotion.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_promotions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @przedmiot = Przedmiot.find(params[:id])\n @przedmiot.destroy\n\n respond_to do |format|\n format.html { redirect_to przedmioty_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @produccion = Produccion.find(params[:id])\n @produccion.destroy\n\n respond_to do |format|\n format.html { redirect_to produccions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion_demotion = PromotionDemotion.find(params[:id])\n @promotion_demotion.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @propose = Propose.find(params[:id])\n @propose.destroy\n\n respond_to do |format|\n format.html { redirect_to proposes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion_box = PromotionBox.find(params[:id])\n @promotion_box.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_promotion_boxes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @provision = Provision.find(params[:id])\n @provision.destroy\n\n respond_to do |format|\n format.html { redirect_to(provisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @promotion_tag.destroy\n respond_to do |format|\n format.html { redirect_to promotion_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n @promotion_type = PromotionType.find(params[:id])\n @promotion_type.destroy\n\n respond_to do |format|\n format.html { redirect_to promotion_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to commands_url, notice: 'La commande a été détruite.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @protein.destroy\r\n respond_to do |format|\r\n format.html { redirect_to proteins_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @promotion.destroy\n redirect_to promotions_url, notice: 'Promotion was successfully destroyed.'\n end",
"def destroy\n @produccion = Produccion.find(params[:id])\n @produccion.destroy\n\n respond_to do |format|\n format.html { redirect_to producciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mote = Mote.find(params[:id])\n @mote.destroy\n\n respond_to do |format|\n format.html { redirect_to motes_url }\n format.json { head :no_content }\n end\n end",
"def destroy_many\n promotionable_ids = params.require(:promotionable_ids)\n promotionable_type = promotion_params[:promotionable_type]\n @promotions = Promotion.where(promotionable_id: promotionable_ids, promotionable_type: promotionable_type)\n @promotions.destroy_all\n respond_to do |format|\n format.html { redirect_to after_destroy_path, notice: 'Promotions where successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pem = Pem.find(params[:id])\n @pem.destroy\n\n respond_to do |format|\n format.html { redirect_to pems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @protein = Protein.find(params[:id])\n @protein.destroy\n\n respond_to do |format|\n format.html { redirect_to proteins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @command.destroy\n respond_to do |format|\n msg = { :status => 'ok', message: 'Deleted Successfully'}\n format.json { render json: msg }\n end\n end",
"def destroy\n @admin_promo.destroy\n respond_to do |format|\n format.html { redirect_to session['previous_url'] || admin_promos_url, notice: 'Promozioni cancellata con successo!.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @proximity.destroy\n respond_to do |format|\n format.html { redirect_to proximities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion = Promotion.find(params[:id])\n @promotion.destroy\n get_paginated_promotions\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n if @promotion.delete \n render :nothing => true, :status => 200 \n else \n render :nothing => true, :status => 503\n end\n end",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def destroy\n @propuestum.destroy\n respond_to do |format|\n format.html { redirect_to propuesta_url, notice: 'Propuestum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_protein = RefProtein.find(params[:id])\n @ref_protein.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_proteins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storepromotion.destroy\n respond_to do |format|\n format.html { redirect_to storepromotions_url, notice: 'Storepromotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotersbind = Promotersbind.find(params[:id])\n @promotersbind.destroy\n\n respond_to do |format|\n format.html { redirect_to promotersbinds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tuhu_prodoct.destroy\n respond_to do |format|\n format.html { redirect_to tuhu_prodocts_url, notice: 'Prodoct was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prob.destroy\n respond_to do |format|\n format.html { redirect_to probs_url, notice: 'Prob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promocao = Promocao.find(params[:id])\n @promocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(promocoes_url) }\n format.xml { head :ok }\n end\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def destroy\n @preguntum = Preguntum.find(params[:id])\n @preguntum.destroy\n\n respond_to do |format|\n format.html { redirect_to pregunta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @po = Po.find(params[:id])\n @po.destroy\n\n respond_to do |format|\n format.html { redirect_to pos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proffesion = Proffesion.find(params[:id])\n @proffesion.destroy\n\n respond_to do |format|\n format.html { redirect_to(proffesions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pto = Pto.find(params[:id])\n @pto.destroy\n\n respond_to do |format|\n format.html { redirect_to ptos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proyectominero2.destroy\n respond_to do |format|\n format.html { redirect_to proyectominero2s_url, notice: 'Proyectominero2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @protein_complex = ProteinComplex.find(params[:id])\n @protein_complex.destroy\n\n respond_to do |format|\n format.html { redirect_to protein_complexes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prob = Prob.find(params[:id])\n @prob.destroy\n\n respond_to do |format|\n format.html { redirect_to probs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pv.destroy\n respond_to do |format|\n format.html { redirect_to proyect_pvs_path(@proyect), notice: 'Propuesta de Valor ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @permissao.destroy\n respond_to do |format|\n format.html { redirect_to permissoes_url, notice: 'As permissões do voluntário foram excluídas.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @progre = Progre.find(params[:id])\n @progre.destroy\n\n respond_to do |format|\n format.html { redirect_to(progres_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @motivonegativa = Motivonegativa.find(params[:id])\n @motivonegativa.destroy\n\n respond_to do |format|\n format.html { redirect_to(motivosnegativa_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mallet_command = MalletCommand.find(params[:id])\n @mallet_command.destroy\n\n respond_to do |format|\n format.html { redirect_to mallet_commands_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @push_notification = PushNotification.find(params[:id])\n @push_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to push_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_ot_presupuesto.destroy\n respond_to do |format|\n format.html { redirect_to detalle_ot_presupuestos_url, notice: 'Detalle ot presupuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @produccion.destroy\n respond_to do |format|\n format.html { redirect_to produccions_url, notice: 'Produccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\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 delete\n request(:delete)\n end",
"def destroy\n @policy = Policy.find(params[:id])\n @policy.destroy\n\n respond_to do |format|\n format.html { redirect_to motor_policies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_permissao.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_permissaos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @proceso = Proceso.find(params[:id])\n @proceso.destroy\n\n respond_to do |format|\n format.html { redirect_to(procesos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vpn = current_user.vpn\n @vpn.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puntuation.destroy\n @unvoted_contribution = Contribution.find(@puntuation.contribution_id)\n @unvoted_contribution.decrement!(:puntuation, 1)\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n Poem.find(params[:id]).destroy\n redirect_to(\"/users/#{current_user.id}\")\n end",
"def destroy\n @poligono.destroy\n respond_to do |format|\n format.html { redirect_to poligonos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selective_process.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Prcoesso deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @motto.destroy\n respond_to do |format|\n format.html { redirect_to mottos_url, notice: 'Motto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proposta.destroy\n respond_to do |format|\n format.html { redirect_to proposta_url, notice: 'Propostum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mutation = Mutation.find(params[:id])\n @mutation.destroy\n\n respond_to do |format|\n format.html { redirect_to mutations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @prodottos_operazione.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'prodottos', action: 'show', id: @prodottos_operazione.id_prodotto }\n format.json { head :no_content }\n end\n end",
"def destroy\n @procedure.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end"
] |
[
"0.6879028",
"0.68678474",
"0.68394583",
"0.67702013",
"0.6688265",
"0.6614795",
"0.6603827",
"0.660365",
"0.6586388",
"0.65862375",
"0.65211374",
"0.65166795",
"0.65166795",
"0.65166795",
"0.64893615",
"0.6456399",
"0.6427913",
"0.6420008",
"0.6420008",
"0.64042103",
"0.6393247",
"0.6389302",
"0.63713056",
"0.6337418",
"0.6331976",
"0.63270384",
"0.6324681",
"0.63182586",
"0.6265685",
"0.62652",
"0.6257185",
"0.6241092",
"0.623563",
"0.62293774",
"0.62272865",
"0.61890507",
"0.6186243",
"0.6167902",
"0.6136406",
"0.6135917",
"0.6135048",
"0.61296874",
"0.6127574",
"0.61207575",
"0.6113272",
"0.6107404",
"0.6106057",
"0.60986656",
"0.60899067",
"0.6089312",
"0.6084928",
"0.6078641",
"0.6070849",
"0.6066815",
"0.60385823",
"0.603139",
"0.6031281",
"0.60293466",
"0.60254085",
"0.6023626",
"0.6022676",
"0.60220855",
"0.6020026",
"0.6018534",
"0.60079604",
"0.6005203",
"0.60034657",
"0.60028785",
"0.6002288",
"0.60003865",
"0.5999486",
"0.5999008",
"0.59972453",
"0.5992673",
"0.5988563",
"0.59881216",
"0.5980702",
"0.59769243",
"0.59741676",
"0.59735346",
"0.5972052",
"0.59648365",
"0.5959295",
"0.59588647",
"0.59508044",
"0.59495187",
"0.59463364",
"0.5943001",
"0.594279",
"0.59405",
"0.5940378",
"0.5939193",
"0.5938605",
"0.5935386",
"0.59329015",
"0.5931282",
"0.5930384",
"0.59211177",
"0.591476",
"0.5911096"
] |
0.59750915
|
78
|
Return the current loggedin author (if any)
|
def current_author
Author.find(current_user.id) unless current_user.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_author\n @current_author ||= session[:current_user_id] && Author.find(session[:current_user_id])\n end",
"def author; User.get(self.author_id); end",
"def author\n return User.find(self.user_id).user_name\n end",
"def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\n rescue\n ''\n end\n end",
"def author\n user\n end",
"def author\n User.find(self.user_id)\n end",
"def author\n object.user\n end",
"def current_user\n @current_author ||= Author.find_by(id: session[:author_id])\n end",
"def author\n \"#{user.name} (#{user.login})\"\n end",
"def author_name\n user_data.name || login\n end",
"def author\n User.find_by_id(@user_id)\n end",
"def author\n self.user\n end",
"def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend",
"def author\n User.find_by_id(self.author_id)\n end",
"def author\n @author ||= User.find_by_id(author_id)\n end",
"def get_author\n \tUser.find(author_id)\n \tend",
"def author\n @author ||= get_author\n end",
"def get_author()\n return @author\n end",
"def get_author\n\t\t# TODO\n\t\tauthor_id\n\tend",
"def author\n @author ||= User.find_by_id(author_id) unless author_id.nil?\n end",
"def author_name\n object.anonymous? ? '匿名用户' : object.author.name_or_login\n end",
"def author\n User.find_by_id(users_id)\n end",
"def author_name\n if self.author\n self.author.name\n else\n nil\n end\n end",
"def get_author()\n @author\n end",
"def get_author\n\t\treturn Account.find(self.account_id)\n\tend",
"def author\n @title_pages.each { |tp| tp.author and return tp.author }\n nil\n end",
"def author_login\r\n user.login if user\r\n end",
"def author_name\n self.author ? \"#{self.author}\" : 'Anonymous'\n end",
"def author\n @author ||=\n convert_content(item_attributes!.author) ||\n convert_content(item_attributes!.creator) ||\n \"\"\n end",
"def author_id\n get_info[:authorID]\n end",
"def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end",
"def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end",
"def the_author(content=nil)\n if node = content || @content || Content.get(params[:id]) \n author = node.author\n end\n end",
"def\n get_author()\n @author\n end",
"def author_name\n author.full_name if author\n end",
"def author\n authors.first\n end",
"def author\n authors.first\n end",
"def author\n if user_id\n @author ||= Author.new(instance, user_id)\n else\n nil\n end\n end",
"def author_name\n self.author ? self.author.name : nil\n end",
"def author\n @author\n end",
"def author\n\t\t@author\n\tend",
"def author\n @author ||= begin\n name = grit.config['user.name']\n email = grit.config['user.email']\n Grit::Actor.new(name, email)\n end\n end",
"def author\n UserWrapper.new(@target.user, view_context)\n end",
"def author\n props[ AUTHOR_PROP_NAME ] if props\n end",
"def author_name\n if author\n author.full_name\n else\n 'No Author Found'\n end\n end",
"def author \n user.firstname + ' ' + user.lastname\n end",
"def author_name\n self.author.name if author \n end",
"def author\n author = self[:author] || ''\n\n if author.present?\n @author ||= Infopark::Crm::Contact.search(params: { login: author }).first\n @author ||= Infopark::Crm::Contact.search(params: { email: author }).first\n end\n end",
"def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end",
"def author_name\n self.posts.first.author_name\n end",
"def current_user_is_author?\n current_user && current_user.is_author\n end",
"def author_name\n user.blank? ? I18n.t('view.comments.anonymous') : user.name\n end",
"def author_name_and_email\n if author\n \"#{author.name} (#{author.email})\"\n elsif !email.blank?\n \"Unlogged user (#{email})\"\n else\n \"Anonymous user\"\n end\n end",
"def author\n if not user.present? or (user.first_name.blank? and user.last_name.blank?)\n \"Anonymous\"\n else\n [user.try(:first_name), user.try(:last_name)].reject(&:blank?).join(' ')\n end\n end",
"def author_name\n self.author ? self.author.name : nil \n end",
"def author\n commenter.try(:name)\n end",
"def author\n user || OpenStruct.new({\n :nicename => external_author_name,\n :email => \"%s@%s\" % [external_author_id, Doers::Config.app_id]\n })\n end",
"def author\n @info[:Author]\n end",
"def author\n \"#{user.firstname} #{user.lastname}\"\n end",
"def author_full_name\n self.author.full_name\n end",
"def get_author\n @image.user = current_user\n end",
"def reply_author(reply)\n\t\tlogged_in? && current_user.id == reply.user_id\n\tend",
"def extract_author_name\n `git config user.name`.strip\n end",
"def author_username\n anonymous? ? Reply.human_attribute_name(:anonymous) : user.username\n end",
"def author_exuid\n author && author.to_param\n end",
"def state_author\n if self.originator\n return User.find_by_id(self.originator).email || 'Unknown'\n end\n return 'None'\n end",
"def reply_author(reply)\n user_signed_in? && current_user.id == reply.user_id\n end",
"def author; @author; end",
"def author; @author; end",
"def get_author_name(options = {})\n if(self.author_id && (!options || !options[:force_cataloguer]) && (u = User.find(self.author_id)))\n n = u.name\n n += \" (\" + u.email + \")\" if(!options || !options[:omit_email])\n return n\n end\n if (self.user_id)\n u = User.find(self.user_id)\n n = u.name\n n += \" (\" + u.email + \")\" if(!options || !options[:omit_email])\n return n\n end\n \"\"\n end",
"def author_string\n if !self.verbatim_author.nil?\n self.verbatim_author\n elsif !self.source_id.nil?\n self.source.authority_name\n else\n nil\n end\n end",
"def author_name\n if read_attribute('comment_body') =~ COMMENT_BODY_PARSER\n $1\n elsif created_by and created_by.sfcontact\n created_by.sfcontact.name\n end\n end",
"def name\n author_hash[\"name\"]\n end",
"def name\n author_hash[\"name\"]\n end",
"def notification_author_name_for(content)\n return unless content.respond_to? :author\n if !content.author.is_a?(Group) && current_user == content.author.user\n _('You')\n elsif content.anonymous?\n _('Anonymous')\n else\n # link_to(content.author.name, commoner_path(content.author))\n content.author.name\n end\n end",
"def author\n val = authors and val.first\n end",
"def inner_author\n @commit.author\n end",
"def author?(user)\n self.user == user\n end",
"def author\n page.version.author.name\n end",
"def author_email\n commenter.try(:email)\n end",
"def default_author\n if author \n author \n else\n 'joe'\n end \n end",
"def author\n # TODO: Return object instead\n @json['project']['meta']['author']\n end",
"def author_uri\n meta['author']\n end",
"def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end",
"def author\n traverse_element('meta',\n '{http://www.w3.org/1999/xhtml}meta') {|e|\n begin\n next unless e.fetch_attr('name').downcase == 'author'\n author = e.fetch_attribute('content').strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n\n traverse_element('link',\n '{http://www.w3.org/1999/xhtml}link') {|e|\n begin\n next unless e.fetch_attr('rev').downcase == 'made'\n author = e.fetch_attribute('title').strip\n return author if !author.empty?\n rescue IndexError\n end\n } \n\n if channel = find_element('{http://purl.org/rss/1.0/}channel')\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}creator') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n channel.traverse_element('{http://purl.org/dc/elements/1.1/}publisher') {|e|\n begin\n author = e.extract_text.strip\n return author if !author.empty?\n rescue IndexError\n end\n }\n end\n\n nil\n end",
"def author_name\n h Settings.author_name\n end",
"def author\n @author ||= Readability::Document.new(@html).author\n end",
"def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end",
"def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end",
"def resolved_author; end",
"def to_s\n author_name\n end",
"def current_auth_user\n @current_auth_user ||= auth_key.try :owner\n end",
"def author_string\n auth = nil\n if authors.size > 0 # Build based on People \n case authors.size\n when 1\n auth = authors.first.last_name # self.author\n when 2 \n auth = authors.map(&:last_name).join(\" & \")\n when 3...100\n auth = authors[0..-1].map(&:last_name).join(\", \") + \" & \" + authors.last.last_name\n end\n else # Build based on string\n auth = self.author\n end\n auth\n end",
"def author\n @author ||= Person.new(connection, @attributes[:author])\n end",
"def get_author()\n if not self.check_metatags('author')\n return false\n end\n author = @@metadata['author'].gsub(/\\./,'_').gsub(/\\&/,'').gsub(/\\-/,'_').gsub(/\\s/,'_').gsub(/\\,/,'_').gsub(/\\_\\_/,'_')\n I18n.enforce_available_locales = false\n I18n.transliterate(author).downcase # Normalising\n end",
"def author\n url = @json['user']['meta']['author']\n data = client.get url\n client.factory.create(GoodData::Membership, data)\n end",
"def with(current_user)\n author == current_user ? receiver : author\n end",
"def author\n @author ||= Author.new @instance, author_id\n end",
"def author value = nil\n return @author if value.nil?\n @author = value\n end",
"def author_id_for(object)\n id =\n if object&.author\n user_id_for(object.author)\n else\n GithubImport.ghost_user_id\n end\n\n if id\n [id, true]\n else\n [project.creator_id, false]\n end\n end"
] |
[
"0.8496916",
"0.8378038",
"0.8239637",
"0.8208727",
"0.818924",
"0.81181395",
"0.808904",
"0.8052152",
"0.8044936",
"0.79666424",
"0.7950728",
"0.7943942",
"0.79297084",
"0.7906964",
"0.78874916",
"0.78838074",
"0.7875883",
"0.7835582",
"0.78184617",
"0.77619386",
"0.7719598",
"0.77126646",
"0.7708176",
"0.7678336",
"0.7675942",
"0.76611924",
"0.7653259",
"0.76077706",
"0.75587964",
"0.755412",
"0.75522023",
"0.7534953",
"0.7523742",
"0.7522128",
"0.7521201",
"0.7519916",
"0.7519916",
"0.75189567",
"0.75028557",
"0.750054",
"0.7485751",
"0.74708366",
"0.74611896",
"0.7457995",
"0.7447355",
"0.74302495",
"0.7390083",
"0.7380265",
"0.73759836",
"0.7362571",
"0.73557913",
"0.7353215",
"0.73507476",
"0.7328836",
"0.7328688",
"0.73152703",
"0.72969645",
"0.72697634",
"0.72522634",
"0.724786",
"0.72087616",
"0.7188485",
"0.71856785",
"0.715753",
"0.7148839",
"0.70824915",
"0.70799726",
"0.70637",
"0.70637",
"0.6999497",
"0.6992939",
"0.6986317",
"0.6965248",
"0.6965248",
"0.6944864",
"0.69360685",
"0.6933347",
"0.6921634",
"0.6907243",
"0.69029826",
"0.6902215",
"0.6894671",
"0.68906146",
"0.68831336",
"0.6879999",
"0.6876955",
"0.68619275",
"0.6853108",
"0.68371016",
"0.6827925",
"0.6824836",
"0.68164665",
"0.68114644",
"0.6803362",
"0.6792194",
"0.6789104",
"0.6773933",
"0.67654693",
"0.674419",
"0.67433536"
] |
0.8601786
|
0
|
Our PROPFIND handler Here we set a contenttype, if the node didn't already have one.
|
def prop_find(prop_find, _node)
prop_find.handle(
'{DAV:}getcontenttype',
lambda do
file_name = Http::UrlUtil.split_path(prop_find.path)[1]
return content_type(file_name)
end
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def content_type=(content_type); end",
"def node_content_class\n raise ArgumentError, \"invalid content_type\" unless ActsAsNode.classes.include? params[:content_type]\n params[:content_type].constantize\n end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def content_type(type=nil, params={})\n return @_content_type unless type\n super(type, params)\n @_content_type = type\n end",
"def meta_content_type(body); end",
"def content_type=(new_content_type)\n @content_type = new_content_type\n end",
"def content_type=(value)\n @content_type = value\n end",
"def set_content_type\n @content_type = ContentType.find(params[:id])\n end",
"def node_content_class\n raise ArgumentError, \"invalid content_type\" unless ActsAsNode.classes.include? params[:content_type]\n params[:content_type].constantize\n end",
"def the_content_type(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.content_type\n else\n \"<strong>Error:</strong> No content type information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def content_type=(new_content_type)\n write_attribute(:content_type, new_content_type)\n end",
"def content_type(value = nil)\n value ? @content_type = value : @content_type\n end",
"def multiple_type?(node)\n node.name == 'content' && !node.attributes['type'].nil?\n end",
"def fixup_response_content_type( response )\n\n\t\t# Make the error for returning something other than a Response object a little\n\t\t# nicer.\n\t\tunless response.respond_to?( :content_type )\n\t\t\tself.log.error \"expected response (%p, a %p) to respond to #content_type\" %\n\t\t\t\t[ response, response.class ]\n\t\t\tfinish_with( HTTP::SERVER_ERROR, \"malformed response\" )\n\t\tend\n\n\t\trestype = response.content_type\n\n\t\tif !restype\n\t\t\tif (( default = self.class.default_type ))\n\t\t\t\tself.log.debug \"Setting content type of the response to the default: %p\" %\n\t\t\t\t\t[ default ]\n\t\t\t\tresponse.content_type = default\n\t\t\telse\n\t\t\t\tself.log.debug \"No default content type\"\n\t\t\tend\n\t\telse\n\t\t\tself.log.debug \"Content type already set: %p\" % [ restype ]\n\t\tend\n\tend",
"def []=(content_type, klass); end",
"def content_type=(type)\n @content_type = type\n end",
"def setContenttype(contenttype)\r\n\t\t\t\t\t@contenttype = contenttype\r\n\t\t\t\tend",
"def assign_type(content_type)\n self.type = MimeMapping.class_type_from(content_type).name\n end",
"def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end",
"def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end",
"def content_type\n @content_type || object.content_type\n end",
"def set_type\n case content\n when \"empty\" then self.content_type = \"empty\"\n when /ire/ then self.content_type = \"ire\"\n when /hill|tree/ then self.content_type = \"obstacle\"\n when /axe|sword|lance/ then self.content_type = \"enemy\"\n else raise \"Change type\"\n end\n end",
"def content_type\n @content_type || MiddlewareAutocomplete.content_type\n end",
"def set_content_type old_type, old_resource_type, new_type, new_resource_type\n xml=self.ng_xml\n xml.search('/contentMetadata[@type=\\''+old_type+'\\']').each do |node|\n node['type']=new_type\n xml.search('//resource[@type=\\''+old_resource_type+'\\']').each do |resource|\n resource['type']=new_resource_type\n end\n end\n self.content=xml.to_s\n end",
"def content_type\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n retrieve_meta!\n\n return self.meta['content_type'].to_s\n end",
"def type(node, type); end",
"def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
"def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend",
"def check_content_type!\n\n if self.content_type and (not self.content_type.saved?) and loaded_content_type = ContentType.get(self.content_type.id)\n self.content_type = loaded_content_type\n end\n\n end",
"def content_type\n nil\n end",
"def content_type=(content_type); @message_impl.setContentType content_type; end",
"def content_type\n raise NotImplementedError\n end",
"def set_typed_entity(node)\n fmt = REXML::XPath.first(node, \"./ctx:metadata-by-val/ctx:format\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\"})\n\n fmt_val = fmt.get_text.value if fmt && fmt.has_text?\n\n # Special weird workaround for info sent from metalib.\n # \"info:ofi/fmt:xml:xsd\" is not actually a legal format\n # identifier, it should have more on the end.\n # XPath should really end in \"rft:*\" for maximal generality, but\n # REXML doesn't like that.\n if false && fmt_val && fmt_val == \"info:ofi/fmt:xml:xsd\"\n metalib_evidence = REXML::XPath.first(node, \"./ctx:metadata-by-val/ctx:metadata/rft:journal\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\", \"rft\" => \"info:ofi/fmt:xml:xsd:journal\"})\n\n # Okay, even if we don't have that one, do we have a REALLY bad one\n # where Metalib puts an illegal namespace identifier in too?\n metalib_evidence ||= REXML::XPath.first(node, \"./ctx:metadata-by-val/ctx:metadata/rft:journal\", {\"ctx\" => \"info:ofi/fmt:xml:xsd:ctx\", \"rft\" => \"info:ofi/fmt:xml:xsd\"})\n\n # metalib didn't advertise it properly, but it's really\n # journal format.\n fmt_val = \"info:ofi/fmt:xml:xsd:journal\" if metalib_evidence\n end\n\n if fmt_val\n OpenURL::ContextObjectEntityFactory.format(fmt_val)\n else\n OpenURL::ContextObjectEntity.new\n end\n end",
"def enforce_content_type\n @config.instance_variable_set(:@enforce_content_type, true)\n end",
"def add_content_type(extension, type); end",
"def attachment_content_type=(value)\n self.content_type=value\n end",
"def parse\n self.send(\"parse_#{@content_type}\".to_sym)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def create_default_content_type_handler\n raise \"source is nil in textdocument\" unless @source\n require 'canis/core/include/colorparser'\n # cp will take the content+type from self and select actual parser\n cp = Chunks::ColorParser.new @source\n @content_type_handler = cp\n end",
"def type\n @node[\"type\"] || \"text\"\n end",
"def parser(content_type); end",
"def prop_find_late(prop_find, _node)\n # If the request was made using the SOGO connector, we must rewrite\n # the content-type property. By default SabreDAV will send back\n # text/x-vcard; charset=utf-8, but for SOGO we must strip that last\n # part.\n return unless (@server.http_request.header('User-Agent') || '').index('Thunderbird')\n\n content_type = prop_find.get('{DAV:}getcontenttype')\n part = content_type.split(';').first\n if part == 'text/x-vcard' || part == 'text/vcard'\n prop_find.set('{DAV:}getcontenttype', 'text/x-vcard')\n end\n end",
"def enforce_content_type(request, config)\n content_type = request.content_type\n\n return if content_type.nil?\n\n return if accepted_mime_type?(content_type, config)\n\n yield\n end",
"def get_content_type\n self.content_type\n end",
"def content_type(default = nil)\n content_type = self['content-type']\n if content_type && content_type.length > 0\n\tcontent_type.strip.split(/\\s*;\\s*/)[0].downcase\n else\n\tif block_given?\n yield\n else\n default\n end\n end\n end",
"def nodetype=(val) @records.set(GRT_NODETYPE, val); end",
"def content_type=(v) Axlsx::validate_content_type v; @content_type = v end",
"def dor_content_type\n public_xml_doc.xpath('//contentMetadata/@type').text\n end",
"def set_node_type\n @node_type = NodeType.find(params[:id])\n end",
"def node_type; end",
"def node_type; end",
"def set_default_xtype(c)\n c[:xtype] = 'treecolumn' if c[:name].to_s == config[:treecolumn].to_s\n end",
"def assign_type(content_type)\n self.type = self.class.class_type_from(content_type)\n end",
"def content_type\n end",
"def getContenttype\r\n\t\t\t\t\treturn @contenttype\r\n\t\t\t\tend",
"def ContentType=(v) Axlsx::validate_content_type",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def set_ContentType(value)\n set_input(\"ContentType\", value)\n end",
"def image_content_type=(value)\n @children['image-content-type'][:value] = value\n end",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type\n if id = self.content_type_id\n @content_type ||= self.site.content_types.find(id) rescue nil\n else\n nil\n end\n end",
"def content_type\n @record.send( :\"#{@column}_content_type\" ) rescue ''\n end",
"def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end",
"def content_type(name)\n name_li(name).span(:class=>/(mylibrary_item_|searchcontent_result_)mimetype/).text\n end",
"def add_type\n @item.type = bibtex_type\n end",
"def add_content_type\n header[:content_type] = 'text/plain'\n end",
"def content_type_of(path)\n attributes_for(path).content_type\n end",
"def content_type\n return @content_type\n end",
"def update_content_type\n if file.present? && file_changed?\n self.content_type = file.file.content_type\n end\n end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type(type)\n @response.content_type == type\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def content_type\n raise NotImplemented\n end",
"def content_type\n raise NotImplemented\n end",
"def content_type_id\n if self.target_klass_name =~ /^Locomotive::ContentEntry([a-z0-9]+)$/\n $1\n else\n nil\n end\n end",
"def content_type=( type )\n\t\treturn self.headers[ :content_type ] = type\n\tend",
"def parsed_content_type_header; end",
"def content_type\n @mime_type || @heads['content-type']\n end",
"def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def accepts_content_type?(content_type)\n accepted_content_types.include? content_type.to_sym\n end",
"def content_type=(value)\n raise ArgumentError, \"content_type must be set to :data or :header, was: #{value.inspect}\" unless [:data, :header].include?(value)\n @content_type = value\n end",
"def set_content_type(override=false)\n if override || file.content_type.blank? || generic_content_type?\n new_content_type = ::MIME::Types.type_for(current_path).first.to_s\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n rescue ::MIME::InvalidContentType => e\n raise CarrierWave::ProcessingError, I18n.translate(:\"errors.messages.mime_types_processing_error\", :e => e)\n end",
"def content\n try(content_type)\n end",
"def rel_type=(value)\n @children['rel-type'][:value] = value\n end"
] |
[
"0.6146144",
"0.580601",
"0.578352",
"0.578352",
"0.578352",
"0.57451564",
"0.5740801",
"0.573596",
"0.5703806",
"0.5683967",
"0.56773126",
"0.5675816",
"0.5668588",
"0.5667127",
"0.5665622",
"0.5658394",
"0.5619547",
"0.5560904",
"0.5559502",
"0.55587536",
"0.554366",
"0.554366",
"0.5531723",
"0.5527592",
"0.5514202",
"0.55120665",
"0.5478306",
"0.544671",
"0.5394611",
"0.53926384",
"0.53862345",
"0.53861594",
"0.53816676",
"0.537264",
"0.53389186",
"0.53347003",
"0.53322124",
"0.53263444",
"0.5315604",
"0.5307359",
"0.5307359",
"0.5307359",
"0.5307359",
"0.5303278",
"0.5303065",
"0.5301053",
"0.5286476",
"0.5284737",
"0.52697045",
"0.526221",
"0.52577895",
"0.5256518",
"0.5227582",
"0.5209875",
"0.52025574",
"0.52025574",
"0.520126",
"0.5192662",
"0.5191975",
"0.5180161",
"0.51796633",
"0.5175734",
"0.5175734",
"0.51747155",
"0.51697624",
"0.51697624",
"0.5159114",
"0.51435083",
"0.51349026",
"0.51304436",
"0.51173586",
"0.50908256",
"0.50895756",
"0.5088351",
"0.5086293",
"0.50788164",
"0.50788164",
"0.50788164",
"0.50788164",
"0.50788164",
"0.50788164",
"0.50788164",
"0.50788164",
"0.50719607",
"0.50690025",
"0.50690025",
"0.5068847",
"0.5068847",
"0.50617176",
"0.505644",
"0.5046862",
"0.50360036",
"0.5032171",
"0.50321287",
"0.50321287",
"0.5024137",
"0.50224066",
"0.49934614",
"0.49922362",
"0.49894738"
] |
0.51784456
|
61
|
Simple method to return the contenttype
|
def content_type(file_name)
# Just grabbing the extension
extension = ::File.extname(file_name.downcase)[1..-1]
return @extension_map[extension] if @extension_map.key?(extension)
'application/octet-stream'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def content_type\n return @content_type\n end",
"def get_content_type\n self.content_type\n end",
"def content_type\n end",
"def content_type\n instance_read(:content_type)\n end",
"def content_type\n @content_type || object.content_type\n end",
"def content_type\n @resource.content_type\n end",
"def content_type\n reader.format.content_type if valid?\n end",
"def content_type\n environment.content_type_of(pathname)\n end",
"def getContenttype\r\n\t\t\t\t\treturn @contenttype\r\n\t\t\t\tend",
"def content_type\n self[\"Content-Type\"]\n end",
"def content_type\n @content_type ||= request.content_type\n end",
"def to_s\n content_type\n end",
"def content_type\n @content_type || file.content_type\n end",
"def the_content_type(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.content_type\n else\n \"<strong>Error:</strong> No content type information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def content_type\n #; [!95g9o] returns env['CONTENT_TYPE'].\n return @env['CONTENT_TYPE']\n end",
"def content_type\n @io.content_type\n end",
"def content_type(path)\r\n ext = File.extname(path).split(\".\").last\r\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\r\nend",
"def content_type\n @mime_type\n end",
"def content_type\n file.try(:content_type)\n end",
"def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend",
"def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend",
"def content_type\n self.name[/::(.*)$/, 1].underscore.gsub(/_/, '/')\n end",
"def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end",
"def content_type\n\t\treturn self.headers.content_type\n\tend",
"def content_type\n\t\treturn self.headers.content_type\n\tend",
"def content_type\n @content_type ||=\n identified_content_type ||\n declared_content_type ||\n guessed_safe_content_type ||\n Marcel::MimeType::BINARY\n end",
"def content_type\n\t\treturn self.headers[ :content_type ]\n\tend",
"def content_type\n ::MIME::Types.type_for(name).first.try(:content_type) || 'text/html'\n end",
"def content_type\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n retrieve_meta!\n\n return self.meta['content_type'].to_s\n end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type\n content_type_class.constantize if content_type_class\n end",
"def content_type\n @mime_type || @heads['content-type']\n end",
"def content_type\n raise NotImplementedError\n end",
"def content_type\n headers[:content_type]\n end",
"def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end",
"def content_type_of(path)\n attributes_for(path).content_type\n end",
"def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end",
"def content_type\n type, *parameters = content_type_parse\n type || 'application/octet-stream'\n end",
"def content_type\n raise NotImplemented\n end",
"def content_type\n raise NotImplemented\n end",
"def content_type\n headers['content-type'].first\n end",
"def get_content_type(filename)\n ext = File.extname(filename) # get the extension\n type = 'application/octed-stream'\n type = 'text/html' if ext == '.html' || ext == '.htm'\n type = 'text/plain' if ext == '.txt' || ext == '.rb'\n type = 'text/css' if ext == '.css'\n type = 'image/jpeg' if ext == '.jpeg' || ext == '.jpg'\n type = 'image/gif' if ext == '.gif'\n type = 'image/png' if ext == '.png'\n type = 'image/bmp' if ext == '.bmp'\n type = 'text/xml' if ext == '.xml' || ext == '.xsl'\n type # same as: return type\n end",
"def content_type\n @headers['Content-Type']\n end",
"def to_str\n @content_type\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def content_type\n @response_headers[\"Content-Type\"]\n end",
"def content_type\n headers['content-type'].first\n end",
"def content_type\n @headers['content-type'][0] rescue nil\n end",
"def request_content_type\n @request_headers[\"Content-Type\"]\n end",
"def content_type\n self.file_content_type\n end",
"def mime_type\n return content_type\nend",
"def content_mime_type; end",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def content_type_string\n Mime::Type.lookup_by_extension(content_type).to_s\n end",
"def content_type\n headers['content-type']\n end",
"def content_type\n response.content_type\n end",
"def to_str\n content_type\n end",
"def name_of_content_type\n if self.content_type == 'application/vnd.ms-word'\n return \"Word document\"\n elsif self.content_type == 'application/pdf'\n return \"PDF file\"\n end\n end",
"def to_s\n @content_type\n end",
"def content_type\n @j_del.contentType()\n end",
"def dor_content_type\n public_xml_doc.xpath('//contentMetadata/@type').text\n end",
"def content_type(path)\n ext = File.extname(path).split('.').last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\n end",
"def content_type\n return blank_type if @headers.nil?\n \n # if no content type is supplied return and empty string instead of nil\n Page.content_type_sanitize( @headers['content-type'] ) \n end",
"def get_content_type(uri)\n # TODO double check that open, doesn't make a get request, otherwise use a lower level lib like Net::HTTP\n req = open(uri)\n req.content_type\n end",
"def content_type\n nil\n end",
"def content_type(path)\n extension = path.split(\".\").last\n type = CONTENT_TYPE[extension] ||= 'application/octet-stream'\nend",
"def content_type\n ((response.headers.values_at('content-type', 'Content-Type').compact.first || '').split(';').first || '').strip\n end",
"def content_type\n response_headers[\"Content-Type\"]\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end",
"def content_type\n @content_type ||= MediaTypeIdentifier.load(headers['Content-Type']).freeze\n end",
"def content_type\n if headers.key?('Content-Type')\n typename = headers['Content-Type'].value_without_parameters\n else\n typename = 'text/plain'\n end\n\n MIME::Types[typename].first\n end",
"def content_type\n self.class.response_content_type\n end",
"def content_type(value = nil)\n value ? @content_type = value : @content_type\n end",
"def content_type\n @content_type ||= stream.content_type\n end",
"def get_content_type file\n mime_type = MIME::Types.type_for(file.original_filename)\n return mime_type.first ? mime_type.first : nil\n end",
"def content_type(default = nil)\n content_type = self['content-type']\n if content_type && content_type.length > 0\n\tcontent_type.strip.split(/\\s*;\\s*/)[0].downcase\n else\n\tif block_given?\n yield\n else\n default\n end\n end\n end",
"def content_type_header(request)\n request.content_type\n end",
"def content_type\n content_type = String(headers[\"Content-Type\"] || headers[\"type\"]).split(\";\")[0]\n content_type.blank? ? nil : content_type\n end",
"def content_type\n return @content_type unless @content_type.blank?\n if has_attachments?\n return \"multipart/mixed\"\n elsif !body(:plain).blank? && !body(:html).blank?\n return \"multipart/alternative\"\n elsif body(:html)\n return \"text/html\"\n else\n return \"text/plain\"\n end\n end",
"def get_content_type(file)\n t = MIME::Types.of(file)\n t.first.content_type unless t.empty?\n end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def guessed_safe_content_type\n return unless path\n\n type = Marcel::Magic.by_path(original_filename).to_s\n type if type.start_with?('text/') || type.start_with?('application/json')\n end",
"def content\n try(content_type)\n end",
"def content_type\n content_type_header = @collection.detect { |header| header.has_key?(CONTENT_TYPE_HEADER_KEY) }\n return (content_type_header.nil?) ? nil : content_type_header[CONTENT_TYPE_HEADER_KEY]\n end",
"def response_content_type\n @response_headers[\"Content-Type\"]\n end",
"def main_type\n has_content_type? ? header[:content_type].main_type : nil rescue nil\n end",
"def content_type\n @content_type || MiddlewareAutocomplete.content_type\n end",
"def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end",
"def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end",
"def content_type(type)\n @response.content_type == type\n end",
"def content_type=(_arg0); end"
] |
[
"0.88751155",
"0.8828655",
"0.8769342",
"0.8735177",
"0.85232854",
"0.85230976",
"0.8461848",
"0.8458344",
"0.8441408",
"0.8408258",
"0.84015274",
"0.8399596",
"0.8392392",
"0.8359205",
"0.8316669",
"0.8275507",
"0.82740635",
"0.82681924",
"0.8247097",
"0.82447106",
"0.82447106",
"0.8241287",
"0.8240619",
"0.82381546",
"0.82381546",
"0.82221735",
"0.82030123",
"0.8202617",
"0.8190847",
"0.81746954",
"0.81746954",
"0.81746954",
"0.81746954",
"0.81746954",
"0.81746954",
"0.81746954",
"0.81746954",
"0.81603557",
"0.8149874",
"0.8148277",
"0.8128555",
"0.81272405",
"0.8126995",
"0.8101393",
"0.8099754",
"0.8099373",
"0.8099373",
"0.8098793",
"0.8086205",
"0.807509",
"0.8074201",
"0.8062471",
"0.8062471",
"0.80521965",
"0.80448234",
"0.8011697",
"0.80065846",
"0.799562",
"0.7993908",
"0.7986614",
"0.79836416",
"0.79799235",
"0.7978906",
"0.7977295",
"0.79595333",
"0.7955002",
"0.7951014",
"0.7948079",
"0.7933586",
"0.79302055",
"0.7926302",
"0.7919303",
"0.791432",
"0.78963935",
"0.7893824",
"0.78856516",
"0.7868035",
"0.784825",
"0.78412724",
"0.7837253",
"0.7817228",
"0.78012717",
"0.7795707",
"0.77944493",
"0.77846766",
"0.7769798",
"0.7768413",
"0.7754837",
"0.77548",
"0.77540773",
"0.7752255",
"0.77451926",
"0.7740018",
"0.77379596",
"0.77274257",
"0.77088684",
"0.7700389",
"0.7700389",
"0.7699865",
"0.76842695"
] |
0.78074664
|
81
|
Creates the Move method that takes a array, position and value.
|
def move(array,position,value = "X")
array[position.to_i - 1] = value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move( array, index, value=\"X\" )\n array[index] = value\nend",
"def move(array, index, value = \"X\")\n array[index] = value\nend",
"def move(array, position ,value = \"X\")\n position = position.to_i\n position = position - 1\n if array[position] != \"X\" and array[position] != \"O\"\n array[position] = value\n end\n return array\nend",
"def move(array, index, value = \"X\" )\n \n \n \n \n def update_array_at_with(array, index, value = \"X\" ) # was value = \"X\" @ 857\n \n array[index] = value\n end\n \n \n update_array_at_with(array, index, value) \n # before 854 did not have any arguments\n return array # was return board, threw off the 3rd argument optional test..\n \nend",
"def move(array, index, name = \"X\")\n array[index] = name\nend",
"def move(board, converted_input, value = \"X\")\n def update_array_at_with(array, index, value)\n array[index] = value\n end\n update_array_at_with(board, converted_input, value)\n end",
"def move(array, index, current_player)\n array[index] = current_player\nend",
"def move(board,position,value)\n index = input_to_index(position)\n board[index] = value\n\nend",
"def move(board, position, value = \"X\")\n\n board[position.to_i - 1] = value\n\n return board\nend",
"def move(array,position,player_letter)\r\n #input logic here\r\n player_move = position\r\n array[player_move] = player_letter\r\nend",
"def move(board, index, value = \"X\") # Defines move method accepting 3 arguments (1 default)\n board[index] = value\n end",
"def move(arr, location, character = \"X\")\n location = location.to_i - 1\n arr[location] = character\n\nend",
"def move(board, index, value)\n board[index] = value\nend",
"def move(board, index, value)\n board[index] = value\nend",
"def move(board, index, value = 'X')\n board[index] = value\nend",
"def move(board, index, value)\n board[index] = value\n return board\nend",
"def move(board, index, value = \"X\")\n board[index] = value\nend",
"def move (board, index, value=\"X\")\n board [index] = value\n return board\nend",
"def move(board, index, value)\n board[index] = value\n end",
"def move(index, value)\n @board[index] = value\n end",
"def move(index, value)\n @board[index] = value\n end",
"def move(index, value = \"X\")\n @board[index] = value\n end",
"def move(index, value=\"X\")\n @board[index] = value\nend",
"def move(board, pos, character= \"X\")\n update_array_at_with(board, pos, character)\nend",
"def move(board, position, token)\n board[position] = token\nend",
"def move (board, index, value = \"X\")\n #binding.pry\n board[index] = value\nend",
"def move(board, new_index, position = \"X\")\n\nboard[new_index] = position\n\nend",
"def change(move)\n value = self.dup\n value[0] += move[0]\n value[1] += move[1]\n Position.new(value)\n end",
"def move(board, position, token=\"X\")\n board[position.to_i - 1] = token \nend",
"def moves_array\n\t\t@field[1]\n\tend",
"def move(board, position, player=current_player(board))\n position = position.to_i\n board[position-1]=player\nend",
"def move(*_)\n dir = direction_compass.to_direction(direction)\n new_value = direction_compass.direction[dir.to_sym]\n\n place(x + new_value[:x], y + new_value[:y])\n end",
"def make_move(pos, value)\n\t\tif @gameplay_positions[pos] == 0\n\t\t\t@gameplay_positions[pos] = value\n\t\t\tdraw()\n\t\telse\n\t\t\tdraw()\n\t\t\tnot_available()\n\t\tend\n\tend",
"def makeMove(val, position, direct = true)\n x = ((val-1)/3).floor\n y = (val-1)%3\n if direct\n position[x][y]=@turn\n else\n temp = Array.new(3) {Array.new(3, 0)}\n for i in 0..2\n for j in 0..2\n temp[i][j] = position[i][j]\n end\n end\n temp[x][y] = @turn\n return temp\n end\n end",
"def move(board, position , player= \"X\" )\n\tposition = position.to_i\n\tboard[position -1] = player\n\tdisplay_board(board)\nend",
"def move(new_position)\n yield(new_position, self) if block_given?\n self.position = new_position\n self.moved = true\n nil\n end",
"def move arr, pos\n while arr[pos] == -1\n pos += 1\n end\n pos\nend",
"def move_zeros(array)\n\nend",
"def move(board, index, token=\"X\")\n board[index] = token\n return board\nend",
"def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end",
"def move(input, value = \"X\")\n @board[input.to_i - 1] = value\n end",
"def move(board, index, char=\"X\")\n update_array_at_with(board, index, char)\nend",
"def move(board,index,spot = \"X\")\n board[index] = spot\n return board\nend",
"def move(board, index, token = \"X\")\r\n board[index] = token\r\nend",
"def move(position, token='X')\n @board[position] = token\n end",
"def move(position,token=\"X\")\n position=position.to_i - 1\n @board[position]=token\n end",
"def move(board, index, token = \"X\")\n board[index] = token\nend",
"def move(board, index, token = \"X\")\n board[index] = token\nend",
"def move (board, index, token = \"X\")\n board[index] = token\nend",
"def move(board, index, token = \"X\")\n board[index] = token\nend",
"def move_piece(position_array)\n\n old_position = position_array[0]\n piece_to_move = board_obj.board[old_position[0]][old_position[1]]\n\n castling_move(position_array) if piece_to_move.instance_of?(King)\n pawn_move_two(position_array) if piece_to_move.instance_of?(Pawn)\n\n board_obj.board[old_position[0]][old_position[1]] = \" \"\n\n new_position = position_array[1]\n\n piece_to_move.new_position(new_position)\n new_square = board_obj.board[new_position[0]][new_position[1]]\n\n if enpassant_square(new_position)\n rank = new_position[0]\n file = new_position[1]\n\n adjust = piece_to_move.colour == 'WHITE' ? -1 : 1\n if board_obj.board[rank + adjust][file].instance_of?(Pawn)\n remove_piece(board_obj.board[rank+adjust][file])\n board_obj.board[rank + adjust][file] = ' '\n end\n\n end\n\n if new_square != \" \"\n remove_piece(new_square)\n @piece_taken = true\n else\n @piece_taken = false\n end\n\n board_obj.board[new_position[0]][new_position[1]] = piece_to_move\n end",
"def move(board, index, token)\n board[index] = token\nend",
"def move(board, index, token)\n board[index] = token\nend",
"def move(board, index, token)\n board[index] = token\nend",
"def array_method(input, value_input, which_index)\n\tinput[which_index] = value_input\t\n\tputs input\n\treturn input\nend",
"def move(board,position,choice=\"X\")\n iPosition = position.to_i\n board[iPosition-1] = choice\nend",
"def move_to(x, y); end",
"def move(line, column = T.unsafe(nil)); end",
"def move(line, column = T.unsafe(nil)); end",
"def player_move(board, index, current_player_token)\r\n board[index] = current_player_token\r\nend",
"def move(board, position, current_player)\n board[position] = current_player\nend",
"def move(position, player_token)\n @board[position] = player_token\n end",
"def move(n, from_array, to_array)\n return if n <= 0\n to_array << from_array.shift # this mutates both arrays\n move(n - 1, from_array, to_array)\nend",
"def move(board, position, xo = \"X\")\n board[position] = xo\nend",
"def move(index, token = 'X')\n @board[index] = token\nend",
"def move!(x,y)\n self[0]+=x; self[1]+=y\n return self\n end",
"def []=(pos, value)\n @board[pos[0]][pos[1]] = value\n end",
"def move( x, y=nil )\n self.dup.move!(x, y)\n end",
"def my_array_modification_method!(array, num)\n array[2] = array[2] + num\n array[-1] = array[-1] + num\n array\nend",
"def move(board , location , player_character = \"X\")\n location = location.to_i\n board[location-1] = player_character\n return board\nend",
"def move(board , location , player_character = \"X\")\n location = location.to_i\n board[location-1] = player_character\n return board\nend",
"def move_once(offset, pos)\n temp_pos = []\n pos.each_index do |i|\n temp_pos << pos[i] + offset[i]\n end\n temp_pos\n end",
"def move (board, index, token)\n #token = current_player(board)\n board[index] = token\nend",
"def move(direction)\n \n end",
"def record_move(row, col, value)\n tile = @rows[row-1][col-1]\n tile.value = value\n tile\n end",
"def move(board, i, player)\n # if valid_move?(board, i)\n board[i] = player\n # end\n return board\nend",
"def move(position, player=current_player)\n position = position.to_i\n @board[position-1]=player\n end",
"def move(board, position, current_player= \"X\")\n board[position.to_i - 1] = current_player\nend",
"def move(board, index, marker)\n board[index] = marker\nend",
"def[]=(pos, value)\n row = pos.first\n col = pos.last\n @grid[row][col] = value\n end",
"def move(move_position, player=\"X\")\n @board[move_position] = player\n end",
"def move\n move_by a, m\n end",
"def []=(position, value)\n row, col = position\n @board[row][col] = value\n end",
"def move(pos, down, right)\n\t\t[pos[0] + down, pos[1] + right]\n\tend",
"def move(board, position, char)\n board[position] = char\nend",
"def move(board, position, char)\n board[position] = char\nend",
"def move\n\n if @position != []\n if @position[2] == \"EAST\"\n @position[0] += 1\n elsif @position[2] == \"WEST\"\n @position[0] -= 1\n elsif @position[2] == \"NORTH\"\n @position[1] += 1\n elsif @position[2] == \"SOUTH\"\n @position[1] -= 1\n end\n check_position()\n else\n puts \"Invalid Command!!.\\nPlease execute command (place) to place the robot on the table.\"\n end\n @position\nend",
"def move(board, position, current_player = \"X\")\n board[position.to_i-1] = current_player\nend",
"def update_move(board, player, position)\n\tboard[position.to_i - 1] = player\n\tboard\nend",
"def move(location, token=\"X\") # move( 0 , O ) \n @board[location] = token\n #binding.pry\n end",
"def move(location, token)\n @board[location.to_i-1] = token\nend",
"def move(board, index, current_player = \"X\")\n board[index] = current_player(board)\nend",
"def move _obj, _args\n \"_obj move _args;\" \n end",
"def smove(*arguments)\n\t\t\t\t\tcall(\"SMOVE\", *arguments)\n\t\t\t\tend",
"def move(board, input_to_index, x = \"X\")\n board[input_to_index] = x\n return board\nend",
"def move(board,index,symbol=\"X\")\n board[index]=symbol\nend",
"def move (board, position, character = \"X\")\n board[(position.to_i - 1)] = character\n return board\nend",
"def move(board, index, current_player = 'X')\n board[index] = current_player\nend",
"def move(board, pos, mark=\"X\")\n board[pos.to_i-1] = mark\nend",
"def move(board, index, token = \"X\")\n board[index] = token\n display_board(board)\nend"
] |
[
"0.7541419",
"0.7452942",
"0.7298216",
"0.7074355",
"0.6769837",
"0.6632056",
"0.65359604",
"0.64776385",
"0.6392817",
"0.6362932",
"0.63206774",
"0.6312236",
"0.6212682",
"0.6212682",
"0.618601",
"0.6169062",
"0.61350507",
"0.6134265",
"0.61115277",
"0.6077917",
"0.6077917",
"0.599312",
"0.59507924",
"0.5927544",
"0.5883771",
"0.5868159",
"0.5807102",
"0.5792008",
"0.57759166",
"0.57746357",
"0.5761017",
"0.5758479",
"0.57559663",
"0.5726515",
"0.5668446",
"0.5666889",
"0.56620145",
"0.5661888",
"0.56584334",
"0.5653447",
"0.56405985",
"0.5632934",
"0.56017905",
"0.55715823",
"0.55604964",
"0.55470306",
"0.55338436",
"0.55338436",
"0.55321693",
"0.55209637",
"0.55178547",
"0.55169225",
"0.55169225",
"0.55169225",
"0.55010796",
"0.54919237",
"0.5482233",
"0.5472991",
"0.5472991",
"0.54476637",
"0.54431534",
"0.54411596",
"0.5438769",
"0.54331654",
"0.5424973",
"0.54234374",
"0.5381406",
"0.5374322",
"0.5373332",
"0.5354513",
"0.5354513",
"0.53510535",
"0.53435373",
"0.5341583",
"0.5339923",
"0.53350145",
"0.5333989",
"0.53322726",
"0.53236324",
"0.5316469",
"0.5313105",
"0.53054845",
"0.5302169",
"0.52986217",
"0.52908456",
"0.52908456",
"0.5290319",
"0.52900386",
"0.5280178",
"0.527691",
"0.52694404",
"0.5269179",
"0.5268688",
"0.5259398",
"0.52577037",
"0.5252438",
"0.52455586",
"0.523964",
"0.5236441",
"0.52332896"
] |
0.7676141
|
0
|
Checks to see if the position is taken and returns false if it is taken
|
def position_taken?(board, location)
!(board[location].nil? || board[location] == " ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def position_taken?(index)\n if @board[index] == nil or @board[index] == \"\" or @board[index] == \" \"\n return false\n elsif @board[index] == \"X\" or @board[index] == \"O\"\n return true\n end\n end",
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def position_taken?(position)\r\n if @board[position] == \"\" || @board[position] == \" \" || @board[position] == nil\r\n return false\r\n elsif @board[position] == \"X\" || @board[position] == \"O\"\r\n return true\r\n end\r\n end",
"def position_taken?\nend",
"def position_taken?(index)\n if @board[index] == \" \" || @board[index] == \"\" || @board[index] == nil\n return false\n elsif @board[index] == \"X\" || @board[index] == \"O\"\n return true\n end\n end",
"def position_taken?(board, position)\n\tif board[position] == \"X\" || board[position] == \"0\"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"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 position_taken?(board, position)\n return true if board[position - 1] == \"X\" || board[position - 1] == \"O\"\n false\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def position_taken?(index)\n @board[index] == \"X\" || @board[index] == \"O\"\n end",
"def position_taken?(position)\n if @board[position] == \" \" || @board[position] == \"\" || @board[position] == nil\n false\n elsif @board[position] == \"X\" || @board[position] == \"O\"\n true\n end\n end",
"def position_taken?(index)\n ((@board[index] == \"X\") || (@board[index] == \"O\"))\n end",
"def position_taken?(board, position)\n if !(board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n else \n return false\n end\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def position_taken?(position)\n @board[position] != nil && @board[position] != \" \"\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(location)\n @board[location] != \" \" && @board[location] != \"\"\n end",
"def position_taken?(board, index)\n space = board[index]\n if space == 'X' || space == \"O\"\n return true\n else\n return false\n end\nend",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def position_taken?(board,position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, pos)\n if board[pos]==\"X\" || board[pos]==\"O\"\n taken = true\n else\n taken = false\n end\n taken\nend",
"def position_taken? (index)\n @board[index] != \" \" ? true : false\n end",
"def position_taken?(index)\n position = @board[index]\n \n if !(position.nil? || position.eql?(\" \") || position.empty?)\n return (position.eql?(\"X\") || position.eql?(\"O\"))\n else\n return false\n end\n end",
"def position_taken?(board, position)\n return true if (board[position-1] == \" \" || board[position-1] == \"\" || board[position-1] == nil)\n return false if (board[position-1] == \"X\" || board[position-1] == \"O\")\nend",
"def position_taken?(board, position)\n\tx = board[position -1]\n\tcase x \n\twhen \"\", \" \"\n\t\t return false \n\telse\n\t\t return true \n\tend\nend",
"def position_taken?(index)\n @board[index] != \" \" && @board[index] != \"\"\n end",
"def position_taken?(board,position)\n pos = position.to_i\n val = board[pos-1]\n if val == \"X\" || val ==\"O\"\n true\n else\n false\n end\nend",
"def position_taken?(index)\n\t\t!@board[index].include?(\" \")\n\tend",
"def taken?(input)\n\t\tif position(input) == \"X\" || position(input) == \"O\"\n\t\t\ttrue # Position is taken\n\t\telse\n\t\t\tfalse # Position is free\n\t\tend\n\tend",
"def position_taken?(index)\n if @board[index] == \"X\"\n true\n elsif @board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(position)\n !(@board[position].nil? || @board[position] == \" \")\n end",
"def position_taken?(board,pos)\n if board[pos.to_i]==\"X\" || board[pos.to_i] ==\"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n if board[(position.to_i) - 1] == \" \" || board[(position.to_i) - 1] == \"\" || board[(position.to_i) - 1] == nil\n false\n elsif board[(position.to_i) - 1] == \"X\" || board[(position.to_i) - 1] == \"O\"\n \tfalse\n end\nend",
"def position_taken?(board, idx)\n len = board.length\n if len == 0\n return false\n end\n \n out = board[idx]\n \n if out == nil\n return false \n end\n \n out_strip = out.strip\n if out_strip == \"X\" || out_strip == \"O\"\n return true\n else\n return false\n end\nend",
"def taken?(location)\n position(location) != \" \"\n end",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\n false\nend",
"def position_taken?(position)\n if @board[position] == \" \" || @board[position] == \"\" || @board[position] == nil\n false\n else\n true\n end\n end",
"def position_taken?(board, index_to_validate)\n if (board[index_to_validate] == \"X\" || board[index_to_validate] == \"O\")\n return true\n end\n return false # NOTE: if we arrive here, the position is definitely not taken\nend",
"def position_taken? (board,index)\n if ( board[index] == \"X\" || board[index] == \"O\" )\n return true\n else\n return false\n end\nend",
"def position_taken?(board, new_index)\n if board[new_index] == \"X\" || board[new_index] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end",
"def position_taken?(index)\n ! ( @board[index].nil? || @board[index] == \" \" )\n end",
"def position_taken?(board, index) \n if board[index] == nil\n return false\n # return statement included to shield strip method from nil\n elsif board[index].strip == \"\"\n false\n else\n true\n end\n end",
"def position_taken?(move_index)\r\n if @board[move_index] == \" \"\r\n false\r\n else\r\n true\r\n end\r\n end",
"def position_taken?(pos)\r\n #true if space is empty and false if filled\r\n if @board[pos] == \" \"\r\n return false\r\n else\r\n return true\r\n end\r\n end",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, idx)\n\tif board[idx] == nil || board[idx] == \"\" || board[idx] == \" \" \n\t\tfalse\n\telsif board[idx] == \"X\" || board[idx] == \"O\"\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def position_taken?(index)\n if (@board[index] == \" \")\n return false\n else\n return true\n end\n end",
"def position_taken?(board, position)\n p_taken = false\n if (board[position] == \"\" || board[position] == \" \" || board[position] == nil)\n p_taken = false\n else\n p_taken = true\n end\n p_taken\nend",
"def position_taken?(board, position)\n position = position.to_i - 1\n if board[position] == \"X\" || board[position] == \"O\"\n true\n end\nend",
"def position_taken?(board, position)\n if board[position.to_i-1] == \" \" || board[position.to_i-1] == \"\" || board[position.to_i-1] == nil # if the position is empty like so \" \" or like so \"\", or if the position has a value of nil, it has not been taken\n false\n else # otherwise, it is unavailable\n true\n end\nend",
"def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend",
"def position_taken?(board, position)\n if (board[position.to_i - 1] == \"X\" || board[position.to_i - 1] == \"O\")\n return true\n elsif !(board[position.to_i - 1] == \" \" || board[position.to_i - 1] == nil )\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n\ta = board[position.to_i - 1]\n\tif a != \" \"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def position_taken?(board, position)\n if ((board[position] == \"X\") || (board[position] == \"O\" ))\n return true\n elsif board[position] == nil\n false\n else\n false\n end\nend",
"def position_taken?(board, index)\n board[index] == \"X\" || board[index] == \"O\"\n end",
"def position_taken?(index_i)\n ((@board[index_i] == \"X\") || (@board[index_i] == \"O\"))\n end",
"def position_taken?(board, position)\n \n if board[position.to_i-1] == \" \"\n then false\n elsif board[position.to_i-1] == \"\" \n then false\n elsif board[position.to_i-1] == nil\n then false\n elsif board[position.to_i-1] == \"X\"\n then true\n elsif board[position.to_i-1] == \"O\"\n then true\n end\nend",
"def position_taken?(board,position)\n return true if board[position]==\"X\" || board[position]==\"O\"\n return false\nend",
"def position_taken?(board, index)\n board[index] === \"X\" || board[index] ===\"O\" ? true : false\nend",
"def position_taken?(board, index)\n board[index] === \"X\" || board[index] ===\"O\" ? true : false\nend",
"def position_taken? index_position \n board[index_position] != \" \"\n end",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(index)\n @board[index]==\"X\" || @board[index] == \"O\"\nend",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def position_taken?(board,index)\n if board[index] == \"X\" || board[index] == \"O\"\n TRUE\n else\n FALSE\n end\nend",
"def position_taken?(board, position)\n if board[position]==\"\" || board[position]==\" \"\n return false\n elsif board[position] == \"X\" || board[position]==\"O\"\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n true\n else\n false\n end\nend",
"def position_taken?(board, position)\n\tif board[position] == \" \" || board[position] == \"\" || board[position] == nil \n\t\treturn true\n\telse board[position] == \"O\" || \"X\"\n\t\treturn false\n\tend\nend",
"def position_taken?(board, position)\n\tif board[position] == \" \" || board[position] == \"\" || board[position] == nil \n\t\treturn true\n\telse board[position] == \"O\" || \"X\"\n\t\treturn false\n\tend\nend",
"def position_taken?(board, index)\n if (board[index] == \" \" || board[index] == \"\" || board[index] == nil)\n taken = false\n else\n taken = true\n end\ntaken\nend",
"def position_taken?(board, index)\nposition = board[index]\n if position==\" \"\n return false\n elsif position==\"\"\n return false\n elsif position==nil\n return false\n elsif position == \"X\"\n return true\n elsif position==\"O\"\n return true\n end\nend",
"def position_taken?(board, index)\n if (board[index] == \" \") || (board[index] == nil) || (board[index] == \"\")\n return false\n else\n if (board[index] == \"X\") || (board[index] == \"O\")\n return true\n end\n end\nend",
"def position_taken?(board, index)\n spot = board[index]\n if spot == \" \" || spot == \"\" || spot == nil\n false\n elsif spot == \"X\" || spot == \"O\"\n true\n end\nend",
"def position_taken?( index )\n !(@board[index].nil? || @board[index] == \" \")\n end",
"def position_taken?(board, position)\n if board[position] == \"X\" || board[position] == \"O\"\n return true\n end\nend",
"def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end",
"def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end",
"def position_taken?(board, index)\n if board[index] == \" \" || board[index] == \"\"\n return false\n elsif board[index] == \"X\" || board[index] == \"O\"\n return true\nend\nend",
"def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n else\n false\n end\n\nend",
"def position_taken?(board, index_number)\n if board[index_number] == \" \" || board[index_number] == \"\" || board[index_number] == nil\n false\n else board[index_number] == \"X\" || board[index_number] == \"O\"\n end\n end",
"def position_taken?(board, index)\n position = nil\n if (board[index] == \" \" || board[index] == \"\" || board[index] == nil)\n position = true\n else\n position = false\n end\n position\nend",
"def position_taken?(board, position)\n if !board.empty? && board[position] && (board[position].include?(\"X\") || board[position].include?(\"O\"))\n true\n else\n false\n end\nend",
"def position_taken?(board, position)\n if board[position] == nil || board[position] == \" \" || board[position] == \"\"\n return false\n elsif board[position] == \"X\" || board[position] == \"O\"\n return true \n end \nend",
"def position_taken?(board, index)\n if board[index] == nil or board[index] == \"\" or board[index] == \" \"\n return false\n elsif board[index] == \"X\" or board[index] == \"O\"\n return true\n end\nend",
"def position_taken?(board, position)\n spot = board[position]\n if((spot == \" \") || (spot == \"\") || (spot == nil))\n return false\n elsif ((spot == \"X\") || (spot == \"O\"))\n return true\n end\nend",
"def not_in_place?\r\n @position.nil?\r\n end",
"def position_taken?(position)\n !(@board[position.to_i] == \" \") \n end",
"def position_taken?(board, position)\n value = position.to_i - 1\n if board[value] == \"X\" || board[value] == \"0\"\n true\n end\nend",
"def position_taken?(board, position)\n if (board[position] == \"X\" || board[position] == \"O\")\n true\n end\nend",
"def position_taken? (board, index)\n if @board[index] == \"\" || @board[index] == \" \" || @board[index] == nil\n return false\n else\n return true\n end\n end",
"def position_taken?(board, position)\n\n position = board[position.to_i]\n if board[position.to_i] == \" \" || board[position.to_i] == \"\" || board[position.to_i] == nil\n false\n else board[position.to_i] == \"X\" || board[position.to_i] == \"O\"\n true\n end\nend",
"def position_taken?(index)\n !(@board[index].nil? || @board[index] == \" \")\n end",
"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? index_position \n index_position < 9 && !position_taken?(index_position)\n end",
"def position_taken?(board, index)\n if board[index] == \"\" || board[index] == \" \" || board[index] == nil\n return false\n elsif board[index] == \"X\" || board[index] == \"O\"\n return true\n end\nend",
"def position_taken? (board, index)\n if (board[index] == \" \")\n false\n\n elsif (board[index] == \"X\") || (board[index] == \"O\")\n true\n\n else\n false\n\n end\n end"
] |
[
"0.7846578",
"0.7846038",
"0.7845192",
"0.7813574",
"0.77931523",
"0.77890176",
"0.77831715",
"0.7768618",
"0.7768487",
"0.7768484",
"0.77593327",
"0.77428347",
"0.77269983",
"0.7717083",
"0.7715577",
"0.7698482",
"0.7698482",
"0.76864856",
"0.767383",
"0.7662372",
"0.76533186",
"0.76512575",
"0.76425576",
"0.76289994",
"0.762311",
"0.7622865",
"0.76180214",
"0.7617093",
"0.7612963",
"0.7605698",
"0.7603446",
"0.7595134",
"0.75854355",
"0.7576895",
"0.75714433",
"0.75707775",
"0.75557846",
"0.7555423",
"0.7551997",
"0.75512344",
"0.75455856",
"0.75441796",
"0.75373787",
"0.7536018",
"0.7535138",
"0.753415",
"0.7533554",
"0.7533554",
"0.75329924",
"0.7530157",
"0.75299245",
"0.7525494",
"0.75216633",
"0.75201213",
"0.75160444",
"0.7508774",
"0.74954426",
"0.7484591",
"0.7484338",
"0.7472421",
"0.74703085",
"0.746849",
"0.746849",
"0.7466984",
"0.7465852",
"0.7465852",
"0.7465852",
"0.74649173",
"0.7456951",
"0.7455386",
"0.74509704",
"0.74481124",
"0.74464196",
"0.74464196",
"0.7445885",
"0.74456203",
"0.7437252",
"0.74319106",
"0.74315184",
"0.7427304",
"0.74235976",
"0.74235976",
"0.74224323",
"0.7412472",
"0.74064696",
"0.74061006",
"0.7404358",
"0.7401776",
"0.7399002",
"0.73963577",
"0.73961455",
"0.7395874",
"0.7395523",
"0.73932815",
"0.7392343",
"0.73917854",
"0.73907906",
"0.738996",
"0.73889154",
"0.73841906",
"0.7383731"
] |
0.0
|
-1
|
Checks to see if this was a valid move and returns
|
def valid_move?(board, position)
position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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?(destination)\n occupant = @board[destination]\n result = false\n if occupant.nil? || (enemy? occupant)\n result = movement_rule(destination)\n end\n\n result\n end",
"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 get_good_move\n loop do\n\t\t @player_move = self.get_player_move\n break if @current_state[@player_move].nil?\n puts \"That position is taken. Try another.\"\n end\n @player_move\n end",
"def valid_move?\n\t\t# Now let's make sure all of the moves are valid.\n\t\t# I'll do this by seeing if the sorted version of each\n\t\t# column equals the @board version.\n\t\ttemp_board = Marshal.load(Marshal.dump(@board))\n\t\ttemp = temp_board[@move_from].shift\n\t\ttemp_board[@move_to].unshift(temp)\n\n\t\ttemp_board.each do |column|\n\t\t\tif column.sort != column\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t# If they all pass, we're good!\n\t\treturn true\n\tend",
"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?(move)\n move.to_i.between?(1,9) && !taken?(move)\n end",
"def valid?(move)\n @board.valid_move?(move)\n end",
"def validate_move(move) \n move_from_file = @data[\"moves\"][move]\n move_from_file ? valid = true : valid = false\n end",
"def is_valid?(_destination)\n raise NotImplementedError, \"Must be able to detect if a move is valid!\"\n end",
"def valid_move?\n\t\tvalid_1 = (0..2).include? (@take_from)\n\t\tvalid_2 = (0..2).include? (@move_to)\n\t\tif valid_1 == false || valid_2 == false\n\t\t\tputs \"I'm sorry, please input your move in a 'x,y' format, ensuring that you are selecting numbers between 1 and 3!\"\n\t\t\tmove_input\n\t\telsif @pegs[@take_from][0] == nil\n\t\t\tputs \"I'm sorry, I'm not in the mood for a philosophical debate so let's just agree that you cannot move nothing and you can try again.\"\n\t\t\tmove_input\n\t\tend\n\tend",
"def is_move_valid(move)\n @moves.include? move\n end",
"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 could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def valid_move?(new_x, new_y)\n true\n end",
"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_seq?(move_seq)\n test_board = @board.dup_board\n # debugger\n if test_board[@position].perform_moves!(move_seq)\n return true\n else\n raise InvalidMoveError\n end\n end",
"def valid_move_seq? move_sequence\n dup_board = self.board.dup\n \n begin\n dup_board.perform_moves!(move_sequence)\n rescue InvalidMoveError => e\n puts e.message\n else\n return true\n end \n end",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def isValidMove(pos)\n\tif pos < 0 || pos > 8\n\t\tprint \"Invalid move. Try again human. \\n\"\n\t\treturn false\n\telsif @bo[pos] == '-' then\n\t\treturn true\n\telse \n\t\treturn false\n\tend\n end",
"def get_move\n display_position(@current_state)\n return nil if done?(@current_state)\n pending = true\n height = current_position.length\n width = current_position[0].length\n while pending\n puts\n print \"Enter move as row, column: \"\n move = gets.chomp.split(\",\")\n # Check to make sure move is legal\n if move.length != 2\n puts \"You need to enter two coordinates.\"\n else\n row = move[0].to_i\n column = move[1].to_i\n if row < 0 || row > height - 1\n puts \"Row must be between 0 and #{height - 1}\"\n elsif column < 0 || column > width - 1\n puts \"Column must be between 0 and #{width - 1}\"\n elsif current_position[row][column] == 0\n puts \"That cell has already been chomped!\"\n else\n # It's a legal move\n pending = false\n end\n end\n end\n # Make the move\n make_move([row, column])\n end",
"def validate_move(piece, to_pos)\n if piece.regular_moves.include?(to_pos) # if its a regular move\n return \"regular\"\n elsif piece.jump_moves.include?(to_pos) # if its a jump move\n return \"jump\"\n else # if it is not a valid move\n return nil\n end\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def check_valid_move to_move\r\n\t\t\r\n\t\tif to_move == 0\r\n\t\t\tif driver.location.west_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 1\r\n\t\t\tif driver.location.north_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 2\r\n\t\t\tif driver.location.east_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\t\r\n\t\telsif to_move == 3\r\n\t\t\tif driver.location.south_road == nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn true\r\n\t\t\tend\r\n\t\telse\r\n\t\t\traise \"The location does not exist. Error\"\r\n\t\t\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"def valid_move?(destination)\n possible_moves.select do |move|\n on_board?(move) && open?(move)\n end\n\n possible_moves.include?(destination)\n end",
"def move?\n return @moving\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n # binding.pry\n # input.to_i.between?(1, 9) && position(input) == \" \"\n end",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def valid_move?(position)\n if is_number?(position)\n if position.to_i.between?(0, 10)\n if position_taken?(position.to_i-1)\n false\n else\n true\n end\n else \n false\n end\n else\n false\n end\n end",
"def valid_move?(board, ix)\n if position_taken?(board, ix) == false && move_val?(ix) == true\n return true\n else\n false\n end\nend",
"def valid_move?(board, index)\n if board[index].nil? || position_taken?(board, index) || board[index] == \"X\" || board[index] == \"O\"\n false\n else\n true\n end\nend",
"def is_raw_move?(input)\n move = input.downcase.gsub(/[, ]+/, \"\")\n valid = move.length == 4\n if valid\n origin, destination = move[0..1], move[2..3]\n valid = false if !is_raw_position?(origin)\n valid = false if !is_raw_position?(destination)\n end\n valid\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.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=@board.length && !position_taken?(position))\n return true\n end\n return false\n end",
"def move?\n @moving\n end",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def validate_player_move(move)\r\n \r\n #Return a value of false is the square has already been\r\n #selected\r\n return false if move == \"A1\" && $A1 != \" \"\r\n return false if move == \"B1\" && $B1 != \" \"\r\n return false if move == \"C1\" && $C1 != \" \"\r\n return false if move == \"A2\" && $A2 != \" \"\r\n return false if move == \"B2\" && $B2 != \" \"\r\n return false if move == \"C2\" && $C2 != \" \"\r\n return false if move == \"A3\" && $A3 != \" \"\r\n return false if move == \"B3\" && $B3 != \" \"\r\n return false if move == \"C3\" && $C3 != \" \" \r\n \r\n #Return a value of true if the square is available\r\n return true\r\n \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?(input)\n (0..8).include?(input) && !position_taken?(input)\n end",
"def valid_move?(from, to, player)\n if piece = player_piece?(from, player)\n unless player_piece?(to, player)\n return piece.valid_dest?(to, @board)\n end\n end\n false\n end",
"def try_move(move)\n\t\tsetup if !ready?\n\n\t\t# gen all possible moves\n\t\tmoves = generate_moves(self.pieces, self.turn)\n\t\treturn nil if moves.length == 0\n\t\tvalid_move = moves.find { | m | m.from == move.from && m.to == move.to }\n\t\treturn nil if valid_move.nil?\n\n\t\t# filter out moves that would leave us in check\n\t\tmoves = filter_for_self_check(self.pieces, moves, self.turn)\n\t\treturn nil if moves.length == 0\n\t\tvalid_move = moves.find { | m | m.from == move.from && m.to == move.to }\n\t\treturn nil if valid_move.nil?\n\n\t\t# perform the move\n\t\tvalid_move = perform_move(valid_move)\n\t\tif valid_move.promoted.nil?\n\t\t\tvalid_move = update_after_move(valid_move)\n\t\tend\n \n\t\t# create a new board and set it equal to this one, then save it\n\t\tnext_board = Board.new\n\t\tnext_board.game = self.game\n\t\tnext_board.set(self.fen)\n\t\tif !next_board.save!\n\t\t\treturn nil\n\t\tend\n\n\t\t# finally return our move to the game model\n\t\treturn valid_move\n\tend",
"def valid_move?(input)\n #checks that the attempted move is within the bounds of the game board\n input.between?(0, 8) && !position_taken?(input)\n end",
"def valid_move?(move)\n new_position = @current_player.position_after_move(move)\n\n if(@players.available_moves(@current_player).include? move)\n if(@mine.mineable?(new_position) && @current_player.tunneler != move)\n @current_player.damage(5, \"bumping into the wall\")\n return false\n elsif(@rubies.ruby_at_position(new_position))\n puts \"Found a ruby! Take it home!\"\n @current_player.load_up(@rubies.ruby_at_position(new_position))\n elsif(@current_player.home?(new_position))\n @current_player.unload_ruby\n end\n return true\n end\n\n false\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?(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?(x_des, y_des)\n ( no_x_move?(x_des) && standard_move?(x_des, y_des) ) ||\n ( promotion_move?(x_des, y_des) || pawn_capture_move?(x_des, y_des) )\n end",
"def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend",
"def valid_move?(location)\n location.to_i.between?(1,9) && !taken?(location)\n end",
"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, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def valid_move\n display_current_turn\n \tcol = prompt_legal_move\n \treturn col, @turn%2\n end",
"def validates_move move\n\t\t!@moves.include?(move) && move.index.between?(1,10)\n\tend",
"def check_valid(move)\n\n\t\tif @board[move[0]][move[1]] != \"-\"\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\n\tend",
"def valid_move?(board, index)\n if index.between?(0, 8) && board[index] == \" \"\n true\n else position_taken?(board, index) == nil && board[index] == \"X\"\n false\n end\nend",
"def move_valid?\n @board.first_disk = 0\n\n #determine disk piece to be moved\n @board.board.each do |row, arr|\n if arr[@player.from] != 0\n @board.first_disk = arr[@player.from]\n break\n end\n end\n\n #determine the highest disk available in that column\n @board.board.each do |row, arr|\n if arr[@player.to] != 0\n @board.second_disk = arr[@player.to]\n break\n else\n @board.second_disk = arr[@player.to]\n end\n end\n\n #conditional test to see if move is valid\n if @board.first_disk == 0\n puts \"No disks in this column, try again\"\n get_input\n elsif @board.second_disk == 0 || @board.first_disk < @board.second_disk\n move_disk\n else\n puts \"Move is invalid\"\n puts \"Please check the rules and input a new move\"\n get_input\n end\n end",
"def move(move = {})\n begin\n move!(move)\n rescue => e\n errors.add :base, e.message\n return false\n end\n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def valid_move?(board, index)\n if board[index] == \" \" || board[index] == \"\"\n position_taken = false\n elsif board[index] == nil\n position_taken = false\n elsif board[index] == \"X\" || board[index] == \"O\"\n position_taken = true\n else\n position_taken = false\n end\n return index.between?(0,8) && !position_taken\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?(index)\n return index.between?(0, @board.length) && !position_taken?(index)\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 is_valid_space?(state, move, turn)\n board = JSON.parse(state)\n src, dst = move \n \n # Get the piece that is going to be\n # moved \n srcpiece = board[src[0]][src[1]]\n dstpiece = board[dst[0]][dst[1]]\n \n # Make sure the src piece is the\n # same as the turn and the destination\n # is an empty space\n if srcpiece.downcase != turn or dstpiece != ' '\n return false \n end\n\n return true \n end",
"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 validate_move(move)\n @rules_matrix.has_key?(move)\n end",
"def check_if_moveisvalid(move)\n @all_available_moves.each do |avail_move|\n return true if move.is_equal_to?(avail_move)\n end\n return false\n end",
"def valid_move?\n board[selection.first][selection.last].is_a? Fixnum\n end",
"def get_move(player_number, current_move)\n if check_if_valid(current_move) == true\n if player_number == 1\n then\n @player1.move = current_move\n else\n @player2.move = current_move\n end\n else\n return false\n end\n return true\n end",
"def valid_move? move\n@board[move] == PIECE[:blank]\nend",
"def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else position_taken?(board, index) == true\n nil\n end\nend",
"def valid_move?(board, posn_str, team = \"X\")\n posn = posn_str.to_i\n posn -= 1\n if ((posn.between?(0,8)) && !(position_taken?(board,posn)))\n return true\n else\n return false\n end\nend",
"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?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def moving?\n !@start_move\n end",
"def valid_move?(board,position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=board.length && !position_taken?(board,position))\n return true\n end\n return false\nend",
"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?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend",
"def valid_move?(index)\n puts \"Turn #{turn_count}\"\n index.between?(0,8) && !position_taken?(index)\n end",
"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 position_taken?(board, index) == true; false\n #elsif board[index] == \"X\" || board[index] == \"O\"; true\n elsif index > 9 || index < 0; false\n else; true\n end\n end",
"def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end",
"def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n if board[position] == \"X\"\n return false\n\n elsif position == \"O\"\n return false\n\n elsif position == \" \" or position == \"\" or position == nil\n return true\n\n elsif position.between?(0, 8)\n return true\n end\nend",
"def valid_move?\n\t\t@table.stays_on_table?(@robot_direction, @x, @y)\n\tend",
"def get_valid_move\n begin\n puts 'please enter your move: '\n i = gets.chomp.to_i\n if i == 0\n return ki_get_move\n else\n x,y = $keymap[i]\n end\n end until is_valid_move(x,y)\n return x,y\n end",
"def valid_moves\n\n end",
"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 get_move\n while true\n print \"#{@name}, make your move (e.g. e2 e4): \"\n move = gets.chomp.downcase.split\n break if valid_input?(move)\n puts \"Invalid input\"\n end\n return parse_move(move)\n end",
"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,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend",
"def valid_move?(position)\n !taken?(position) && position.ord.between?(48, 57)\n end",
"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_moves\n moves.reject { |end_pos| move_into_check?(end_pos) }\n end",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend",
"def get_move\n # Fill this in. Sample code:\n # puts\n # display_position\n # move = nil\n # until move != nil\n # puts\n # print \"Enter your move: \"\n # move_string = gets.chomp\n # < interpret move_string as move >\n # if !legal_moves(@current_state).index(move)\n # puts \"That's not a legal move!\"\n # move = nil\n # end\n # end\n # make_move(move)\n end",
"def get_move\n print \"#{@name}, please choose r, p, or s: \" \n @move = gets.chomp.downcase\n until is_move_valid(@move) do\n puts \"Sorry, that's not a valid move!\"\n @move = gets.chomp.downcase\n end\n @move\n end"
] |
[
"0.7423581",
"0.74104947",
"0.740964",
"0.7400391",
"0.73149",
"0.7304227",
"0.72920257",
"0.72742397",
"0.7266016",
"0.72623706",
"0.72468233",
"0.7239165",
"0.7232027",
"0.71552336",
"0.71332973",
"0.71287954",
"0.7124243",
"0.71148866",
"0.71080226",
"0.710551",
"0.70874906",
"0.7040496",
"0.7040374",
"0.70372415",
"0.70372415",
"0.7026343",
"0.70258284",
"0.69976056",
"0.69943523",
"0.69894606",
"0.6977469",
"0.6957013",
"0.695572",
"0.69483143",
"0.6944244",
"0.69439954",
"0.6942848",
"0.6939849",
"0.6930087",
"0.69262916",
"0.69192404",
"0.691758",
"0.69172436",
"0.69094425",
"0.6909101",
"0.6907203",
"0.69060594",
"0.69003665",
"0.69003665",
"0.6882462",
"0.6873672",
"0.6872377",
"0.68717515",
"0.6864712",
"0.6855887",
"0.68537545",
"0.68517995",
"0.68430525",
"0.6833024",
"0.6830843",
"0.6830236",
"0.68247426",
"0.68167293",
"0.6816204",
"0.6809755",
"0.68034637",
"0.6796795",
"0.67760473",
"0.6773722",
"0.67715394",
"0.6770986",
"0.6769296",
"0.6760682",
"0.67606217",
"0.67600965",
"0.67594784",
"0.675519",
"0.67550534",
"0.6753959",
"0.67451096",
"0.674322",
"0.6740669",
"0.67403376",
"0.67380756",
"0.6735873",
"0.6735744",
"0.6733773",
"0.6733205",
"0.6732562",
"0.6730272",
"0.672959",
"0.67271435",
"0.6725419",
"0.6719735",
"0.67187387",
"0.6717029",
"0.6715622",
"0.67148125",
"0.6713599",
"0.6710883",
"0.67099696"
] |
0.0
|
-1
|
takes in the user input and validates the user input
|
def turn(board)
puts "Please enter 1-9:"
input = gets.strip
if valid_move?(board,input)
move(board,input,current_player(board))
else
turn(board)
end
display_board(board)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_user_input\n user_input_valid gets.chomp\n end",
"def put_in_user\n #setting variables\n name, cohort, city, hobby = placeholder\n #prompting the user for input and receiving it\n puts \"Hey there, type your name\".center(50)\n name = STDIN.gets.chomp\n\n puts \"Put your cohort\".center(50)\n cohort_input = STDIN.gets.chomp\n cohort = cohort_input.downcase\n\n puts \"Put your city\".center(50)\n city = STDIN.gets.chomp\n\n puts \"Put your hobby\".center(50)\n hobby = STDIN.gets.chomp\n\n validation_of_user_input(name, cohort, city, hobby)\n\nend",
"def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"def user_input\n\t#set variables\nname, cohort, city, hobby = placeholder\n\t#prompt the user for input\n\tputs \"Please enter the name of the student you'd like to add to the database \\n\".center(50).green\n name = gets.chomp\n \n puts \"Please enter the cohort of the student you'd like to add to the database \\n\".center(50).green\n cohort_input = gets.chomp\n cohort = cohort_input.capitalize\n \n puts \"Please enter the home city of the student you'd like to add to the database \\n\".center(50).green\n city = gets.chomp\n \n puts \"Please enter the hobby of the student you'd like to add to the database \\n\".center(50).green\n hobby = gets.chomp\n\n validate_user_input(name, cohort, city, hobby)\nend",
"def valid_input(input)\n valid = false\n parsed_input = downcase_camelcase_input(input)\n while valid == false\n #accepts uppercase or lowercase Y/N\n if parsed_input == \"Y\" || parsed_input ==\"N\"\n valid = true\n else\n puts \"\\nPlease enter Y or N:\\n\"\n print \"⚡️ \"\n input = gets.chomp.strip\n parsed_input = downcase_camelcase_input(input)\n end\n end\n parsed_input\n end",
"def validate_selection(input)\n print \"#{input} is not a valid choice, re-enter the number or ID > \"\n return gets.strip\nend",
"def validate_user_choice\n input = gets.chomp\n if input ==\"exit\"\n exit_screen\n elsif input == \"buy\"\n ticketing_screen\n elsif input.to_i == 1\n concert_screen\n elsif input.to_i == 2\n # if user doesn't want to buy a ticket yet, they can look for other upcoming bands and/or concerts by typing bands.\n bands_screen\n else\n unrecognized_input\n end\n end",
"def input_validation\n\t\tvalidation = false\n\t\twhile validation == false\n\t\t\tputs \"\\n#{@current_player.name} (#{@current_player.color}) please enter your move like this: b1 to c3\"\n\t\t\tinput = gets.chomp.downcase\n\t\t\t@player_play = input.split(\" to \")\n\t\t\t#if the player wants to save his current gameplay.\n\t\t\tif input == \"save\"\n\t\t\t\tsave_game\n\t\t\t#if the player wants to load a previus game.\n\t\t\telsif input == \"load\"\n\t\t\t\tload_game\t\t\n\t\t\t#if the input dosen't follow the 8 character syntax, sends an error message explaining the correct syntax.\n\t\t\telsif input.length != 8\n\t\t\t\tputs \"\\nIncorrect number of characters, please follow this syntax: b1 to c3 (with spaces)\"\n\t\t\t#if the input doesn't include the word 'to' then sends a message explaining the syntax.\n\t\t\telsif !input.include?(\"to\")\n\t\t\t\tputs \"\\nIncorrect syntax, please follow this example: b1 to c3 (with spaces)\"\n\t\t\t#if the player doesn't enter a letter between a-h for columns and a number between 1-8 for rows then print a error message.\n\t\t\telsif (!(\"a\"..\"h\").include?(@player_play[0][0]) || !(\"1\"..\"8\").include?(@player_play[0][1])) || (!(\"a\"..\"h\").include?(@player_play[1][0]) || !(\"1\"..\"8\").include?(@player_play[1][1]))\n\t\t\t\tputs \"\\n¡Error!.The correct syntax for coordinates is Letter (a - h) + Number (1 - 8)\"\n\t\t\t\tputs \"For example b1, g2 or f5, please try again!\"\n\t\t\t#if the player is trying to move an enemy piece or and empty square, then print a error message.\n\t\t\telsif @current_player.color != @board[@player_play[0]].color\n\t\t\t\tputs \"¡Error!.That is not your piece or is an empty square, try again!\"\n\t\t\t#if the input follows the correct syntax and the piece is the same color as the current player, then validate the input.\n\t\t\telsif (@player_play.size == 2 && @current_player.color == @board[@player_play[0]].color) && (@player_play[0].length == 2 && @player_play[1].length == 2)\n\t\t\t\tvalidation = true\n\t\t\tend\n\t\tend\n\t\tplay_flow(@player_play)\n\tend",
"def validation\n\n\t\tputs \"Enter user name\"\n\t\tuser_name = gets.chomp\n\n\t\tputs \"Enter password\"\n\t\tanswer_password = gets.chomp\n\t\tif answer_password == @password\n\t\t\tget_text\n\t\telse\n\t\t\tcounter = 0\n\t\t\twhile counter !=3 || answer_password!=@password do\n\t\t\t puts \"invalid password\"\n\t\t\t $stdin.gets.chomp\n\t\t\t counter += 1\n\t\t\tend\n\t\tend\n\tend",
"def validate\n 2.times { puts }\n puts <<-EOF\nYou have entered the following information\nApocalypse server : #{@address}\nApocalypse server port : #{@port}\nApocalypse username : #{@username}\nApocalypse password : #{'*' *@password.length}\nThis Server' hostname : #{@hostname}\nEOF\n\n print \"Is this correct? [no]: \"\n raise Exception.new(\"Aborted by user.\") unless gets =~ /^y(?:es|)$/\n puts\n end",
"def validation_of_user_input(name, cohort, city, hobby)\n\n if !name.empty? && ( !cohort.empty? && @months.include?(\"#{cohort}\")) && !city.empty? && !hobby.empty?\n single_student = {month: \"#{cohort}\", name: name, city: city, hobby: hobby}\n @students << single_student\n list_or_continue_prompt\n elsif !@months.include?(\"#{cohort}\") && !name.empty? && !cohort.empty? && !city.empty? && !hobby.empty?\n puts \"You did´t enter a valid month, please try again!\\n\\n\"\n put_in_user\n#prompt when u haven´t entered all information, calls put_in_user\n else name.empty? && cohort.empty? && city.empty? && hobby.empty?\n puts \"Please fill in all fields\\n!\"\n list_or_continue_prompt\n end\nend",
"def checkUserInput\r\n #initialize mainmenu selection characters array\r\n @mainMenuCharSelection = [\"c\",\"l\",\"u\",\"d\",\"e\"];\r\n #check user input for input validation\r\n if(@mainMenuCharSelection.include? @userInput.downcase)\r\n case @userInput.downcase\r\n when \"c\"\r\n result = BackEndLogic.create(politicians);\r\n \r\n politicians << result;\r\n when \"l\"\r\n BackEndLogic.list(politicians);\r\n when \"u\"\r\n BackEndLogic.update(politicians);\r\n when \"d\"\r\n result = BackEndLogic.remove(politicians);\r\n when \"e\"\r\n @ismainMenuLoop = false;\r\n else\r\n puts \"entry unkown! Try again! \\n\\n\"\r\n end\r\n else\r\n puts \"Please enter a valid choice from the menu options! You chose (#{@userInput}) \\n\\n\";\r\n end\r\n end",
"def validate_input_last input\r\n\t\t if @console\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end",
"def valid_input(str, type = \"string\")\r\n type.downcase!\r\n\r\n case type\r\n when \"string\"\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n while input.empty?\r\n puts(\"Nothing entered. Please try again.\")\r\n input = gets.chomp\r\n end\r\n return input\r\n when \"string-one-word\"\r\n puts(\"Invalid entry. Please try again\")\r\n input = gets.chomp\r\n while input.empty? || input.include?(\" \") || ((Integer(input) rescue \"invalid\") == input.to_i)\r\n if input.empty?\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n else\r\n puts(\"Entered more than one entry. Try again\")\r\n input = gets.chomp\r\n end\r\n end\r\n return input\r\n when \"integer-no-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer-greater-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i <= 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0 && input != \"0\"\r\n puts(\"Please enter an integer.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n else\r\n false\r\n end\r\n\r\nend",
"def validate_input\n puts \"Enter move >\"\n player_input = gets.chomp\n if player_input == \"q\"\n exit_game\n return\n end\n \n #Check for valid input\n player_input = player_input.gsub(/[^1-3]/, '') #Strip all but digits 1-3\n # puts player_input # testing\n\n player_input = player_input.split(\"\") # Converts input to array.\n\n if player_input.length != 2 # Looking for only two digit answers\n puts \"Please enter in the format '[1,3]'\"\n return false #Signals invalid input\n elsif player_input[0] == player_input[1]\n puts \"You can't move a piece to the same spot.\"\n else\n return player_input\n end\n end",
"def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend",
"def validateGameInput\t\t\n\t\tcontinueLoop = true\n\t\n\t\tputs \"Welcome to the best Hangman Game Ever!\"\n\t\twhile continueLoop\t\t\t\n\t\t\tputs \"**************************************\"\n\t\t\tputs \"1. New Game\"\n\t\t\tputs \"2. Saved Game\"\n\n\t\t\tinput = gets.chomp.to_i\n\n\t\t\tcase input\n\t\t\twhen 1\t\t\t\t\n\t\t\t\tcontinueLoop = false\n\t\t\t\t@board = Hangman::Board.new \n\t\t\t\tplayGame\n\t\t\twhen 2 \n\t\t\t\tcontinueLoop = false\n\t\t\t\tplayExistingGame\n\t\t\telse\n\t\t\t\tputs \"Invalid input! Try again!\"\n\t\t\tend\n\t\tend\n\t\treturn input\n\tend",
"def check_input(valid_inputs)\n input = \"\"\n loop do\n input = gets.chomp.upcase\n break if (valid_inputs).include?(input)\n puts \"Sorry. One more time:\"\n end\n return input\n end",
"def user_input\n\tgets\nend",
"def unrecognized_input\n puts \"Input not recognized or is invalid.\"\n exit_screen\n end",
"def valid_input? (input)\n #if statement verifies valid input to continue\n if input == \"amex\"\n @selected_program = AMEX\n return true\n\n elsif input == \"chase\"\n @selected_program = CHASE\n return true\n\n elsif input == \"citi\"\n @selected_program = CITI\n return true\n end #ends if/else statement\n\n end",
"def validate(answers, input)\n until answers.include?(input)\n puts \"#Invalid input: #{input}\"\n input_answer\n end\n end",
"def query_user(user_prompt = 'Please enter a string: ', input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'char'\n return user_input if valid_char?(user_input)\n print \"Sorry, single standard characters only. Please try again: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n when 'float'\n return user_input.to_f if valid_float?(user_input)\n print 'Sorry, a float is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend",
"def is_valid_input(input)\n if input == \"rock\" || input == \"paper\" || input == \"scissors\" || input == \"lizard\" || input == \"spock\"\n return true\n else \n return false \n end\n end",
"def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend",
"def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end",
"def get_user_input_and_check(acceptable_input)\n input = gets.chomp.downcase\n\n if acceptable_input.include? input\n return input\n\n else\n puts \"This is not an acceptable input ('#{acceptable_input.join(\"', '\")}'), please try again:\"\n get_user_input_and_check(acceptable_input)\n\n end\n\nend",
"def validate(input_selection, num_stops, msg)\n puts \"you selected #{input_selection}\"\n puts \"there are #{num_stops} on this line\"\n\n if input_selection.between?(1, num_stops)\n bool = 1\n puts \" in first if: i.sel = #{input_selection} and numstops = #{num_stops}\"\n else\n bool = 0\n puts \"else returned boo = 0\"\n end\n while bool > 0\n puts \"Error, Invalid Entry\"\n puts \"#{msg}\"\n try_again = gets.chomp.to_i\n if try_again.between?(1, num_stops)\n bool = 0\n puts \"bool = 0 in nested if statement\"\n else\n bool = 1\n end\n end\n\n #return input_selection\nend",
"def user_input\n puts \"* * * *RULES* * * *\"\n puts \"In this game Health Points or HP is the basis for dealing damage. Each\n attack will hit as hard as 33% to 66% of your charachters MAX Health Points.\n Recovery Rate heals each turn based on how high it is. It doesn't allow you\n to play out each turn yet but for now just put in the values and have fun!\"\n print \"Enter Name 1: \"\n n1 = gets.chomp\n print \" Enter Name 2: \"\n n2 = gets.chomp\n puts \" \"\n print \"Enter #{n1}'s Health Points: \"\n hp1 = gets.to_i\n print \" Enter #{n2}'s Health Points: \"\n hp2 = gets.to_i\n puts \" \"\n print \"Enter #{n1}'s Recovery Rate: \"\n rr1 = gets.to_i\n print \" Enter #{n2}'s Recovery Rate: \"\n rr2 = gets.to_i\n puts \" \"\n @name1 = n1\n @name2 = n2\n @health_points = hp1\n @health_points2 = hp2\n @recovery_rate1 = rr1\n @recovery_rate2 = rr2\n\n battle\n end",
"def get_valid_input(input_type, options = {})\n input = nil\n loop do\n input = gets.chomp\n # binding.pry\n if options.has_key?(:result) && input == \"\"\n input = options[:result]\n break\n else\n if input_type == \"num\"\n numeric?(input) || input.upcase == 'Q' ? break : say(\"Numbers only\")\n else\n %w(1 2 3 4 Q).include?(input.upcase) ? break : say(\"1, 2, 3, or 4 only\")\n end\n end\n end\n input\nend",
"def validate_input(data)\n flag=true\n while flag && data==\"\"\n puts \"Invalid Input!!! \"\n puts \"Enter Again : \"\n data=gets.chomp\n end\n return data\nend",
"def validate_user_input\n validate_chess_piece_type\n validate_current_position_boundaries\n @is_valid\n end",
"def validate_input_1option\n begin\n x = gets.chomp.to_i\n raise \"Incorrect Input\" if x != 1\n return x\n rescue\n puts \"Please Enter 1\"\n validate_input_1option\n end\nend",
"def get_input_main\n input = gets.chomp.downcase\n case input\n when 'all'\n flight_list \n when 'year'\n year\n when 'rocket'\n rocket\n when 'success'\n success_failure\n when 'number'\n flight_number\n when 'mission'\n mission_name\n when 'random'\n random\n when 'exit'\n exit\n else \n begin\n raise Error\n rescue Error => error\n Error.invalid_input\n get_input_main\n end\n end\n end",
"def hamster_organizer\n puts \"What is the hamster\\'s name?\"\n hamster_name = gets.chomp\n puts \"How loud is the hamster on a scale from 1 to 10?\"\n volume = gets.to_i #test .chomp if doesn't work\n puts \"What is the color of the fur?\"\n fur_color = gets.chomp\n puts \"Is the hamster a good candidate for adoption?(y,n)\"\n adoption_status = gets.chomp\n puts \"How many years old is the hamster?\"\n estimated_age = gets.to_i\n if estimated_age == \"\"\n puts estimated_age = nil\n end\n puts \"The hamster name is \" + \"#{hamster_name}\"\n puts \"The hamster is a \" + \"#{volume}\" + \" on a scale of 1 to 10\"\n puts \"The hamster is \" + \"#{fur_color}\"\n if adoption_status == \"y\"\n puts \"It is a good candidate for adoption\"\n elsif\n puts \"It is NOT a good candidate for adoption\"\n end\n puts \"We think the hamster is \" +\"#{estimated_age}\" + \" years old\"\nend",
"def collect_and_validate_input(msg, type)\n input = prompt msg\n \n if valid?(input, type)\n return input.upcase\n else\n system(\"clear\")\n puts \"INVALID INPUT: Please try again\"\n input = collect_and_validate_input msg, type\n end\nend",
"def get_valid_user_choice ###\n print \"\\nWhat would you like to do next? \\n(Enter 'list planets', 'planet details', 'add planet', or 'exit'.) \"\n @user_choice = gets.chomp.downcase\n\n until @user_choice == \"list planets\" || @user_choice == \"exit\" || @user_choice == \"planet details\" || @user_choice == \"add planet\"\n puts \"Please enter a valid choice: list planets, planet details, add planet, or exit.\"\n @user_choice = gets.chomp.downcase\n end\n end",
"def valid_user_input?(input)\n input.length > 0\n end",
"def createnewuser_prompt\n header\n puts \"\\n\\nPlease enter a username.\\n\"\n self.createnewuser_input = STDIN.gets.strip\n self.createnewuser_valid?\nend",
"def input_name\n\tname = gets.chomp\nend",
"def invalid_input\n puts \"Invalid input, please try again\"\nend",
"def validate()\n print \"Username: \"\n user = gets.chomp\n\n # Check user value\n user_state = [false]\n @users.keys.each do |u|\n if u == user then\n user_state[0] = true\n user_state << @users[user][\"group\"]\n next\n end\n end\n\n if user_state and (not user_state.nil? or not user_state.empty?) then\n print \"Password: \"\n password = STDIN.noecho(&:gets).gsub(/\\n/,\"\")\n\n # Check password value\n password_state = false\n @sudo[\"passphrases\"].each do |p|\n if (p[0] == user_state[1]) and (p[1] == password) then\n password_state = true\n next\n end\n end\n\n if password_state then\n group = @users[user][\"group\"]\n return group unless group.empty?\n else\n return \"guest\"\n end\n else\n return \"guest\"\n end\n end",
"def readInput\r\n puts 'Please enter a valid Temperature: '\r\n input = gets.to_s\r\n anArray = input.split(' ')\r\n self.myDegrees = anArray[0].to_f\r\n self.myScale = anArray[1].upcase\r\n checkIfValid(self.myDegrees, self.myScale)\r\n end",
"def get_user_input\n\n\tputs \"What is your name\"\n\t@name = gets\n\tputs \"You are about to enter the world of wrestling, if you want to step foot in it then you will be remembered with your ring name, not as #{@name}\"\n\tputs \"So speaking about ring names, What is your Ring name?\"\n\t@ring_name = gets\n\tputs \"A catchphrase is a thing that you like to say?\"\n\tputs \"What is your catchphrase?\"\n\t@catchphrase = gets\n\tputs \"What is your insult?\"\n\t@insult = gets\n\tputs \"What is your theme song\"\n\t@theme_song = gets\n\tputs \"What are the lyrics of your theme song\"\n\t@lyrics_of_theme_song = gets\n\tputs \"The Indie Circuit is where most people start, if you get promoted to the big leagues maybe you need to change your gimmick.\"\n\tputs \"If you decide to be in the Indies, What will the company be called?\"\n\t@company_indies = gets\n\tputs \"The big leagues are the places where very few people start, it is the main place of wrestling\"\n\tputs \"If you decide to be in the big leagues, you can choose either real or fictional companies, what will the fictional one be called?\"\n\t@company_big_leagues = gets\n\tputs \"If you want to be in a team, what will it be called. if you want to be a singles competitor then just put enter and select\n\tthe choice that you don't want to be in a tag team.\"\n\t@team_name = gets\n\tputs \"Who is your partner, just put a random name if you dont want to be in the tag team\n\tand do the same thing as the last question told you.\"\n\t@partner_tag_first = gets\n\tputs \"Getting back to the fictional company, what will your boss be called?\"\n\t@boss_name = gets\n\tputs \"who is the interviewer for the indies?\"\n\t@interviewername = gets\n\tputs \"If you are a heel during your debut in indies or big leagues, who will be your rival?\"\n\t@rival_name = gets\n\tputs \"but If you are a face during your debut in the indies or big leagues, who will be your rival?\"\n\t@rival_name_face = gets\n\tputs \"Ok so lets get to the story\"\n\n\nend",
"def valid_input\n\t\t#adds single word commands\n\t\tvalid = ['help', 'wait', 'inventory']\n\t\tlocation = find_room_in_dungeon(@player.location)\n\t\tlocation.connections.each do |direction, destination|\n\t\t\tvalid << direction.to_s\n\t\tend\n\t\t\n\t\t#adds two word commands\n\t\t@player.inventory.each do |reference|\n\t\t\t['eat', 'throw', 'examine', 'drop'].each do |action|\n\t\t\tvalid << action + \" \" + reference.to_s\n\t\t\tend\n\t\tend\n\t\tif @player.location == @other_player.location || @player.location == :Lair\n\t\t\t@player.inventory.each do |reference|\n\t\t\t\tvalid << 'give' + \" \" + reference.to_s\n\t\t\tend\n\t\tend\n\t\tif @player.inventory.include?(:crystal) && @other_player.inventory.include?(:crystal)\n\t\t\tvalid << 'wob crystal'\n\t\tend\n\t\tcase @player.location\n\t\twhen :Laboratorium then\n\t\t\tvalid << 'look tools'\n\t\t\tvalid << 'take crystal' unless @crystal_taken > 1\n\t\twhen :garden then\n\t\t\tvalid << 'look plants'\n\t\t\tvalid << 'take beans' unless @beans_taken\n\t\twhen :Lounge then\n\t\t\tvalid << 'look chair'\n\t\t\tvalid << 'take pills' unless @pills_taken\n\t\twhen :Library then\n\t\t\tvalid << 'look pedestal'\n\t\t\tvalid << 'take box' unless @box_taken\n\t\twhen :Study then\n\t\t\tvalid << 'look papers'\n\t\t\tvalid << 'take notes' unless @notes_taken\n\t\twhen :Lair then\n\t\t\tvalid << 'wob box' if @player.inventory.include?(:box)\n\t\t\tvalid << 'look creature'\n\t\t\tvalid << 'take creature'\n\t\tend\n\t\tvalid.each do |string|\n\t\t\tputs string\n\t\tend\n\tend",
"def get_cob(name)\n\n puts \"Enter country of birth for #{name}: -> hit return to skip\"\n\n cob = STDIN.gets.chomp\n\n if cob.empty? then return \"N/A\" end\n\n # return whatever the user enters, no validation\n return cob\n\nend",
"def user_input\n input = gets.chomp\n end",
"def validate_band_number_input\n input = gets.chomp\n if input.to_i > Band.count\n unrecognized_input\n elsif input.to_i < 0\n unrecognized_input\n elsif input.to_i > 0\n individual_bands_screen(input)\n elsif input == \"exit\"\n exit_screen\n else\n unrecognized_input\n end\n end",
"def user_input\n gets.chomp\nend",
"def user_input\n gets.chomp\nend",
"def user_menu_input\n menu\n user_menu_selection = gets.strip.to_i\n if valid_menu_selection?(user_menu_selection)\n user_menu_selection\n else\n puts \"\\nInvalid input \\u{1f4a9} !\\n \".colorize(:red).bold\n user_menu_input\n end\n end",
"def get_input\n square = gets.chomp\n\n input_valid?(square) ? square : false\n end",
"def validate_planet_selection(input, names, length)\n until names.include?(input) || (1..length).include?(input.to_i)\n print \"That doesn't look like one of the planets in the system. \\n\\nPlease select a planet (by name or number) from the existing system: \"\n input = gets.chomp.capitalize\n end\n return input\nend",
"def validate_player_input\n loop do \n input = @player.get_input\n return input if input_is_valid?(input)\n puts \"Invalid input - x,y format and hidden cards only!\" if @player\n end\n end",
"def input(input)\n cleaned_input = sanatise_input input\n\n if valid_input? cleaned_input\n process_input cleaned_input\n else\n # Return error message\n return AppConfig.msg_place_args\n end\n end",
"def validate_params\n puts\n puts \"You're about to import data in your '#{Rails.env}' instance.\"\n puts \"You'll use the following source files:\"\n puts \" users: #{options['users'] || '-'} \"\n puts \" projects: #{options['projects'] || '-'}\"\n puts \" issues: #{options['issues'] || '-'}\"\n puts\n puts \"/!\\\\ Make sure to have a backup of your database before continuing.\"\n puts\n print 'Is this ok ? [y/n]: '\n STDOUT.flush\n ok = STDIN.gets.chomp!\n exit 2 if ok != 'y'\n puts\n end",
"def users_planet\n\n puts \"Please enter the name of your planet.\"\n user_planet_name = gets.chomp\n\n puts \"Please enter its volume.\"\n user_planet_volume = gets.chomp\n\n puts \"Is your planet solid?\"\n user_planet_solid = gets.chomp\n\n puts \"Please enter its diameter.\"\n user_planet_diameter = gets.chomp\n\n puts \"Please enter the time it takes to orbit its sun.\"\n user_planet_orbit_time = gets.chomp\n\nend",
"def show_create_option\n clear_screen\n puts \"The program accepts any numbers of floors and apartments per floor but, for a better look please create with a max of 10 apartments per floor.\\nThe alignment will depends of the size of your screen :).\\n\\n\"\nputs \"Please type the name of the building:\"\nprint \":> \"\nname = gets.chomp\nputs \"How many floors the build have ? \"\nprint \":> \"\nfloors = gets.chomp.to_i\nputs \"How many apartments per floor the build have ?\"\nprint \":> \"\napts_per_floor = gets.chomp.to_i\nif name.length > 0 && floors && apts_per_floor\n building = @rental.create_building(nil,name,floors,apts_per_floor)\n show_success_message_return\nelse\n puts \"\\nPlease type valid numbers and/or valid name\\n\"\n return_to_main_Screen\nend\nend",
"def error\n print \"That is not a valid input. \\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 \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 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 get_user_input\n gets.chomp\nend",
"def get_user_input\n gets.chomp\nend",
"def input\n valid = false\n\n # Loop until a valid input is entered\n until valid\n # Prompt for input\n print \"Enter your move > \"\n \n # Accept input from user\n user_input = gets.strip.to_s\n\n #Check to see if user quit... if so return\n if user_input == \"q\"\n @quit = true\n break;\n end\n\n #Otherwise split input string into an array\n input_array = user_input.split(\",\")\n\n # Strip any spaces or newlines from each piece\n input_array.each_index { |i| input_array[i] = input_array[i].strip.to_i }\n\n # Check input to make sure it is valid\n if input_array.size == 2 and input_array.all?{ |element| element.class == Fixnum }\n if input_array.all?{ |tower_no| tower_no > 0 and tower_no < 4 }\n valid = true\n return input_array\n else\n # message if player enters an invalid stack number\n puts \"Please enter only valid stack numbers (1, 2, or 3).\"\n end\n else\n # message if player enters in an incorrect format (resulting in the wrong number or type of arguments)\n puts \"Please enter your move in the format \\\"1,3\\\".\"\n end\n end\n #If loop reaches the end without returning, return nil (results in trying over from the beginning of the turn)\n return nil \n end",
"def validate_concert_number_input\n input = gets.chomp\n # if user makes an accetable concert choice, they are walked through ticket purchase options.\n if input.to_i > 0 && input.to_i < Concert.count\n input.to_i\n elsif input == \"exit\"\n exit_screen\n else\n unrecognized_input\n end\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 new_hand_check\n puts 'Are you ready to play? Enter ' + '(Y)es'.light_green + ' to proceed or ' + '(N)o'.light_red + ' to return to the main menu.'\n @input = STDIN.gets.chomp\n if @input.downcase == 'y' || @input.downcase == 'yes'\n @game_running = true\n elsif @input.downcase == 'n' || @input.downcase == 'no'\n @game_running = false\n else\n puts 'Please enter a valid input.'\n new_hand_check\n end\nend",
"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 capture_owner()\n puts \"Please enter the owner information.\"\n print \"First name: \"\n first_name = gets.downcase\n print \"Last name: \"\n last_name = gets.downcase\n\n puts \"To confirm, the owner's name is #{first_name.chomp.capitalize} #{last_name.chomp.capitalize}, correct? T/F\"\n is_accurate = gets.chomp.downcase\n\n if is_accurate == \"f\"\n puts \"Please enter the owner information.\"\n print \"First name: \"\n first_name = gets.downcase\n print \"Last name: \"\n last_name = gets.downcase\n end\n\nend",
"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 get_valid_user_choice\r\n choice_ok = false\r\n choice = \"\"\r\n until choice_ok\r\n print \"> \"\r\n choice = gets.chomp\r\n choice_ok = verify_choice_ok(choice)\r\n puts \"Invalid choice.\" unless choice_ok\r\n end\r\n return choice\r\nend",
"def user_input\n\t\tputs \"Please pick a letter to guess the word.\"\n\t\t@letter = gets.chomp.downcase\n\t\t@letters_array = [*?a..?z] #creates an array of the alphabet from a to z lowercase\n\t\tuser_input_check\n\tend",
"def user_choice(input = nil)\n loop do\n input ||= gets.chomp.downcase\n break if %w[p i l].include?(input)\n puts \"invalid. (p)lay, (l)oad, or (i)nstructions\"\n input = nil\n end\n input\n end",
"def user_input\n user_input = gets.chomp\nend",
"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 verification_one(input)\n while input != \"1\" && input != \"2\" && input != \"3\"\n if input == \"exit\"\n return false\n else\n puts \"Please enter (1-3) or type exit.\"\n print \"> \"\n input = gets.strip.downcase\n end\n end\n\n case input\n when \"1\"\n input = \"Critically Endangered\"\n when \"2\"\n input = \"Endangered\"\n when \"3\"\n input = \"Vulnerable\"\n end\n input\n end",
"def check_input (input)\n return false if split_input(input) == false\n return true if (split_input(input).all? {|coordinate| /[0-2]/ === coordinate.to_s})\n puts \"Enter the correct input\"\n return false\n end",
"def checkUserInputForCreateMenu(arr)\r\n #initialize mainmenu selection characters array\r\n @mainMenuCharSelection = [\"p\",\"v\"];\r\n #check user input for input validation\r\n if(@mainMenuCharSelection.include? @userInput.downcase)\r\n case @userInput.downcase\r\n when \"p\"\r\n puts \"Name?\";\r\n\r\n checkExistingNames(arr);\r\n\r\n name = @userInput;\r\n\r\n @userInput = \"\";\r\n while(@userInput.downcase != \"d\" && @userInput.downcase != \"r\" )\r\n puts \"Party? (D)emocrat or (R)epublican\"\r\n @userInput = gets.chomp;\r\n end\r\n\r\n party = @userInput == \"d\" ? \"Democrat\" : \"Republican\";\r\n p = Politician.new(name,party,\"Politician\")\r\n \r\n @ismainMenuLoop = false;\r\n return p;\r\n when \"v\"\r\n puts \"Name?\"\r\n \r\n checkExistingNames(arr);\r\n\r\n name = @userInput;\r\n\r\n @userInput = \"\";\r\n compareArr = [\"l\",\"c\",\"t\",\"s\",\"n\"];\r\n while(!compareArr.include? @userInput.downcase)\r\n puts \"Politics?\\n(L)iberal, (C)onservative, (T)ea Party, (S)ocialist, or (N)eutral\"\r\n @userInput = gets.chomp;\r\n end\r\n\r\n politics = \"\";\r\n case @userInput.downcase\r\n when compareArr[0]\r\n politics = \"Liberal\";\r\n when compareArr[1]\r\n politics = \"Conservative\"\r\n when compareArr[2]\r\n politics = \"Tea Party\"\r\n when compareArr[3]\r\n politics = \"Socialist\"\r\n when compareArr[4]\r\n politics = \"Neutral\"\r\n else\r\n puts \"Wrong choice\"\r\n end\r\n p = Politician.new(name,politics,\"Voter\")\r\n \r\n @ismainMenuLoop = false;\r\n return p;\r\n else\r\n puts \"entry unkown! Try again! \\n\\n\"\r\n end\r\n else\r\n puts \"Please enter a valid choice from the menu options! You chose (#{@userInput}) \\n\\n\";\r\n end\r\n end",
"def validate_input(input)\n if(input < 1)\n return false\n end\n return true\n end",
"def validate\n \n \n end",
"def user_assistance(direction_hash)\n print 'Please enter Transit Route: '\n input_route = gets.chomp.gsub(/\"/, \"\")\n print 'Please enter Transit Stop: '\n input_stop = gets.chomp.gsub(/\"/, \"\")\n print 'Please enter your desired direction: '\n input_direction = gets.chomp.gsub(/\"/, \"\")\n if input_route.empty? || input_stop.empty? || input_direction.empty?\n puts 'Empty input detected. Please try again'\n user_assistance(direction_hash)\n end\n nextBus(input_route, input_stop, input_direction, direction_hash)\n puts ''\n print 'Would you like to check another? [Y]es or [N]o?: '\n entry = gets.chomp\n case entry\n when 'Y', 'y'\n user_assistance(direction_hash)\n when 'N', 'n'\n puts 'Thanks! Exiting...'\n exit\n else\n puts 'Invalid entry! Exiting...'\n end\nend",
"def verification_two(input)\n if input == \"exit\"\n return false\n end\n\n while input.to_i <= 0 || input.to_i > (EndangeredAnimals::Animal.all.length)\n puts \"Please enter a number between 1 and #{EndangeredAnimals::Animal.all.length} or type exit.\"\n input = gets.strip\n\n if input == \"exit\"\n return false\n end\n end\n input\n end",
"def get_hobby(name)\n\n puts \"Enter hobby for #{name}: -> hit return to skip\"\n\n hobby = gets.chomp\n\n if hobby.empty? then return \"N/A\" end\n\n # return whatever the user enters, no validation\n return hobby\nend",
"def user_input\n puts \"Do you often play video-games? (yes/no)\"\n print '> '\n frequency = gets.chomp.downcase\n if frequency == \"yes\"\n begin \n puts \"How many hours a week on average do you think you have played video-games in the past month?\"\n @weekly_playtime = Integer(gets.chomp)\n #integer part of kernel module - can be called anywhere on a file, can be called on a particular thing. will try to convert to_int then to_i if that fails. \n if weekly_playtime == 0\n puts \"Please be realistic, you did play video games.\"\n exit \n end \n rescue ArgumentError \n puts \"Error! please type a whole number!\"\n retry \n end \n elsif frequency == \"no\"\n puts \"Are you using a stick to press the keys while you're up on your high horse!?\"\n exit\n else \n puts \"Error! Try again with yes or no!\"\n user_input \n end \n end",
"def input_valid_animal\n \n adopting_animal_name = \"\" \n print(\"Enter animal name: \")\n adopting_animal_name = gets.chomp\n\n while @animals[adopting_animal_name.to_sym].nil?\n puts(\"That animal not found. Please try again.\")\n print(\"Enter animal name: \")\n adopting_animal_name = gets.chomp\n end\n\n return @animals[adopting_animal_name.to_sym]\n end",
"def get_user_input\n print \">> \"\n input = gets.chomp\n begin\n parse_user_input(input)\n rescue StandardError\n invalid_command\n end\n end",
"def initial_input\n # grabs the user's input and store it before passing it to the method\n input = gets.chomp\n index = input_to_index(input)\n\n if !index.between?(0,1)\n puts \"\\nPlease, select a number between 1 and 2\".colorize(:light_red)\n self.initial_input\n elsif index == 1\n goodbye\n exit\n end\n index\n end",
"def sanitize_choice(choice)\nif choice.include? ' '\nputs 'Please choose from the three option above....sans typos'\nexit\nelse\nuser_mashable = Mashable.new(choice)\nuser_mashable.get\nputs user_mashable.parsed_response\nend\nend",
"def get_name\n ask(\"give me a name to submit to local arena\") { |q|\n q.validate = /\\w+/\n }\nend",
"def accept_input(length)\n print \"Enter your 4 sequence color code. Select from R (Red), G (Green), B (Blue), Y (Yellow), O (Orange), P (Purple). \\n\\nYour input should be in the form: RGBY: \"\n input = gets.chomp\n input_check = input.gsub(/[RGBYOP]/, \"\")\n puts \"\\n\"\n\n # Account for Incorrect Inputs ### IMPORTANT ###\n if input.length != length || input_check.length != 0\n puts \"===============================================================================\\n\\n\"\n puts \"ERROR:\\nPlease follow the instructions and enter a 4 sequence color code!\\n\\n\"\n puts \"===============================================================================\\n\\n\"\n input = \"\"\n answer = accept_input(length)\n else\n answer = input.split(\"\") # Storing the input as an array\n end\n return answer\nend",
"def get_user_input\n input = gets.chomp\n #input\nend",
"def check_if_input_is_valid\n if params[:user] && warn_for_special_chars(params[:user][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n elsif params[:impersonate] && warn_for_special_chars(params[:impersonate][:name], 'Username')\n flash[:error] = 'Please enter valid user name'\n redirect_back fallback_location: root_path\n end\n end",
"def prompt_name\n puts \"Please input a name:\"\n # split name on spaces\n name_parts = gets.chomp.split\n\n if name_parts.count != 2\n raise \"Uh-oh, finnicky parsing!\"\n end\n\n name_parts\nend",
"def input_students\n puts \"please put the names of the students, their cohort, their hobby and country of birth, seperated by a comma and space\".center(100)\n puts \"To finish just hit the return twice\".center(100)\n student_info = STDIN.gets.chomp\n # push student info into student adding loop\n student_loop(student_info)\n @students\nend",
"def valid_operation(user_input)\n user_input.downcase!\n \n case user_input\n when \"add\", \"+\"\n puts \"\\n*** ADDING ***\"\n add(*get_numbers)\n when \"subtract\", \"-\"\n puts \"\\n*** SUBTRACTING ***\"\n subtract(*get_numbers)\n when \"multiply\", \"*\"\n puts \"\\n*** MULTIPLYING ***\"\n multiply(*get_numbers)\n when \"divide\", \"/\"\n puts \"\\n*** DIVIDING ***\"\n divide(*get_numbers)\n else\n puts \"\\nERROR, please enter one operator(name or symbol)\"\n print \"=> \"\n valid_operation(gets.chomp)\n end\n \nend",
"def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend",
"def area_prompt\n Rainbow (\"\\nPlease choose an area from the following options for event listings:\\n\\n\").bright.blue\n i = 1\n Neighborhood.all.each do |nbh|\n puts \"#{i}. #{nbh.name}\"\n i += 1\n end\n self.area_input = STDIN.gets.strip\n self.area_valid?\n end",
"def login_or_create_user\n puts \"Do you have an account with us? Type (y/n)\"\n line\n input = get_input\n if input == 'y'\n login_user\n elsif input == 'n'\n create_user\n else \n invalid_input\n login_or_create_user\n end \nend",
"def validate\n (raise ArgumentError, 'Wrong number of arguments, expected 1' if ARGV.length != 1)\n (raise IndexError, 'Input parameter has to be a natural number' unless /\\A\\d+\\z/.match(@price))\n (raise IndexError, 'Minimal price is 8 cents' if @price.to_i < 8)\n end"
] |
[
"0.7627663",
"0.75430083",
"0.7424897",
"0.7317495",
"0.7211651",
"0.7206336",
"0.72022456",
"0.71905965",
"0.71548915",
"0.7104862",
"0.7097084",
"0.69968647",
"0.69934005",
"0.6963793",
"0.6861714",
"0.68343115",
"0.6821985",
"0.6802902",
"0.6800713",
"0.6762449",
"0.67597646",
"0.6759297",
"0.6758944",
"0.6735571",
"0.6731705",
"0.67280227",
"0.6724633",
"0.67214614",
"0.6712967",
"0.6707716",
"0.6707695",
"0.6707115",
"0.67062",
"0.6684706",
"0.6683736",
"0.6676059",
"0.66684455",
"0.66655886",
"0.6660382",
"0.66462076",
"0.6644097",
"0.6619982",
"0.6619631",
"0.6610658",
"0.66019046",
"0.6595612",
"0.6589938",
"0.6588645",
"0.6573537",
"0.6573537",
"0.65622306",
"0.6556427",
"0.6550939",
"0.6540681",
"0.65386826",
"0.6531682",
"0.6530664",
"0.652113",
"0.6520759",
"0.65185845",
"0.65175396",
"0.65175396",
"0.65143967",
"0.6513953",
"0.6513953",
"0.65124494",
"0.651227",
"0.65109926",
"0.6506725",
"0.6503364",
"0.65018165",
"0.6500051",
"0.6497542",
"0.64955866",
"0.6484878",
"0.6471024",
"0.64697444",
"0.6467821",
"0.64660597",
"0.64526135",
"0.64516425",
"0.64513254",
"0.6446928",
"0.64467996",
"0.6438981",
"0.6433125",
"0.642944",
"0.64194846",
"0.64190805",
"0.64007646",
"0.63933766",
"0.6392751",
"0.63871527",
"0.63811105",
"0.6373983",
"0.63713825",
"0.6364659",
"0.63542783",
"0.6352496",
"0.6350465",
"0.6349478"
] |
0.0
|
-1
|
Create the PLAY Method to bring it all together
|
def play(board)
until over?(board)
turn(board)
end
if won?(board)
puts "Congratulations #{winner(board)}!"
else
puts "Cats Game!"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def play\n \n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play; end",
"def play \n end",
"def play\n\tend",
"def play\n #calls to all the methods that produce game!\n end",
"def get_play() \n # \n end",
"def play\n self\n end",
"def startPlayback\n end",
"def play\n puts 'Playing'\n end",
"def play()\n @ole.Play()\n end",
"def play()\n @ole.Play()\n end",
"def play_sports\n end",
"def play\n\t\t\"playing #{title}\"\n\tend",
"def run \n Engine::play(Beginning)\nend",
"def play\n\t\tgame_loop\n\tend",
"def playAction _obj, _args\n \"_obj playAction _args;\" \n end",
"def show_play_complete_player\n # nothing\n end",
"def play\r\n\t\t[FOLD]\r\n\tend",
"def play(cmd)\n play_game(cmd)\n end",
"def play\n\temulate do |emulator|\n\t\temulator.play(self)\n\tend\nend",
"def play\n #tho I am sure there is a better way to define a virtual method... just gonna throw something\n raise 'Method play cannot be called directly. It must be overridden in a child class first.'\n end",
"def show_play_complete_player\n\t\t# nothing\n\tend",
"def play\n @game.start if @game.waiting_to_start?\n if @game.active?\n play_cards if params[:commit] # play submitted cards, if a form submit occurred\n @sets = @game.fill_gamefield_with_sets\n end\n if @game.finished?\n publish_if_finished_and_promoted\n redirect_to :action => 'archive'\n else\n render :action => 'play'\n end\n end",
"def play\n board_setup\n gameplay_setup\n end",
"def play_game\n # WarAPI.play_turn()\n end",
"def play\n greeting\n get_tiles\n move_sequence\n end",
"def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend",
"def play\n @play_mode = true\n session[:cards] = @tarot.cards.map(&:id).shuffle\n @tname = @tarot.name\n @tauthor = @tarot.author\n @draw_path = draw_one_tarot_cards_path(@tarot)\n @shuffle_path = play_tarot_cards_path(@tarot)\n # シャッフルでは画面リドローした方がいいので描画しなおす\n # respond_to do |format|\n # format.html\n # format.js\n # end\n end",
"def play\n \"We're rockiinnggg\"\n end",
"def play(params)\n path = @version + '/Call/Play/'\n method = 'POST'\n return request(path, method, params)\n end",
"def play\n take_turn until @master.game_over?\n @master.show_board\n @robot.speak\n end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end",
"def play\n render layout: 'player'\n end",
"def play\r\n display_welcome_message\r\n human_choose_move\r\n computer_choose_move\r\n display_winner\r\n display_goodbye_message\r\nend",
"def play_action\n @status.playback_state = :playing\n update_status\n end",
"def set_player\n\n end",
"def play\r\n display_welcome_message\r\n init_players\r\n\r\n loop do\r\n play_match\r\n break unless play_again?\r\n end\r\n\r\n display_goodbye_message\r\n end",
"def play socket\n end",
"def call\n if context.dj.player.stopped?\n related = context.dj.add_related\n if related\n context.dj.switch!\n context.message = [ \"Autoplaying.. #{ related }\" ].join(\" \")\n else\n context.errors = \"Failed getting related video.\"\n context.fail!\n end\n else\n current_video = context.dj.current_video\n context.message = \"Skipping!\"\n next_title = context.dj.switch!\n if next_title\n context.message = [ context.message, \"Playing #{ next_title }\" ].join(\" \")\n else\n context.message = \"Nothing to play, add some songs to playlist.\"\n end\n end\n end",
"def play\n each do |playable|\n if playable.respond_to?(:play)\n playable.play\n end\n end\n end",
"def play\n puts \"buzz\"\n end",
"def show\n\n \t\t\trespond_with @play\n\n \t\tend",
"def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end",
"def change_player\n\n end",
"def playActionNow _obj, _args\n \"_obj playActionNow _args;\" \n end",
"def perform\n\tgame_menu\n\tgameplay\nend",
"def play\n @game = Game.find_by_id(@id)\n raise RecordNotFound, 'Not found' if @game.nil?\n\n @game.increment_access\n render 'play', formats: 'json', handlers: 'jbuilder'\n end",
"def play_as_master_second\r\n \r\n end",
"def play_game\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n \r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n \r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n \r\n #Call on the \r\n gameCount = game_count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n \r\n end",
"def play\n init_player()\n init_board()\n puts \"Test game play\"\n end",
"def play(song)\n # artist = Artist.find_by(id: song.artist_id)\n puts \"Playing #{song}\"\n end",
"def play_special player\n\t\t\tif @spec_action\n\t\t\t\t@spec_action.call player, self\n\t\t\tend\n\t\t\t\n\t\t\ttrue\n\t\tend",
"def after_play\n\n end",
"def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n\r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n\r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n\r\n #CAll on the method responsible for ingrementing the game count\r\n game_Count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n\r\n end",
"def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end",
"def show\n youtube\n soundcloud\n end",
"def playingOperation(client)\n\n\t\tclient.sleep(15000)\n\t\tbegin\t\t\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\t$startTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@id='time']\", 0)\n\t\t\tputs \"Starting time : \" + $startTime\n\n\t\t\tclient.sleep(8000)\n\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\t$endTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@id='time']\", 0)\n\t\t\tputs \"Ending time : \" + $endTime\n\n\t\t\tif $endTime == $startTime\n\t\t\t\t$errMsgConti = \"::MSG::「続きを再生が失敗しました」 Playback has not started, check status!!!\"\n\t\t\t\t$obj_rtnrs.returnNG\n\t\t\t\t$obj_rtnrs.printResult\t\n\t\t\telse\n\t\t\t\t@@comment = \"::MSG::「続きを再生が成功しました」 Playback has started successfully...\"\n\t\t\t\t$obj_rtnrs.returnOK\n\t\t\t\t$obj_rtnrs.printResult\t\t\t\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred, could not get playback time..: \" + e.message\n\t\t\t$obj_rtnrs.returnNG\n\t\tend\n\t\tbegin\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='android.view.View']\", 0, 120000)\n\t\t \t# If statement\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='seek_controller']\", 0, 1)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='play_pause_button']\", 0, 1)\n\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@class='android.view.View']\", 0, 30000)\n\t\t \t# If statement\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@id='toolbar']\", 0, 1)\n\t\t\tclient.sleep(500)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\n\tend",
"def run(player)\n puts \"Hello!\"\n end",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend",
"def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end",
"def set_play\n @play = Play.includes(:player, :opponent, :winner, :messages).find(params[:id])\n end",
"def play(&blk)\n start_playing\n blk.call\n ensure\n stop_playing\n end",
"def show(cmd)\n if cmd.params.empty?\n if playing?\n #mostramos la cancion actual\n progress_bar = get_progress_bar_with_labels(playback_position, playback_length, 20, format_secs(playback_position), format_secs(playback_length))\n return success(message: \"#{current_song.to_s}\\n#{c7(progress_bar)}\", song: current_song)\n else\n return failure(\"Nothing to show yet. Try with 'play' first.\")\n end\n\n # with parameters\n else\n list_to_show = cmd.params(:object).reduce([]) do |acc, p|\n acc + case p.value\n when :playlist then current_playlist.to_a\n when :current then playlists[:current].to_a\n when :history then playlists[:history].to_a\n when :queue then playlists[:queue].to_a\n when :focus then playlists[:focus].to_a\n when :search then playlists[:search].to_a\n\n when :song then return success(message: current_song.to_s, song: current_song)\n when :artist then return success(message: current_artist.to_s, artist: current_artist)\n when :album then return success(message: current_album.to_s, album: current_album)\n when :genre then return success(message: current_song.genres.map{|g| g.name}.join(\", \"), genres: current_song.genres)\n\n when :drives then Drive.all\n when :artists then Artist.all\n when :albums then Album.all\n when :genres then Genre.all\n\n when :library then whole_library.to_a\n\n when :recently_added then\n low_time, high_time = get_recently_added_criteria_limit\n Song.where({created_at: low_time..high_time}).to_a\n\n when :recently_played then\n low_time, high_time = get_recently_played_criteria_limit\n Song.where({last_played_at: low_time..high_time}).to_a\n\n when :most_played then Song.where(\"plays >= ?\", get_most_played_criteria_limit).to_a\n when :less_played then Song.where(\"plays <= ?\", get_less_played_criteria_limit).to_a\n when :populars then\n low_time, up_time, low_count = get_popular_criteria_limits\n Song.where(\"last_played_at between ? and ? and plays >= ?\", low_time, up_time, low_count)\n else []\n end\n end\n \n if list_to_show.empty?\n return failure(\"I checked and there is nothing there.\")\n else\n playlists[:focus] <= list_to_show\n return success(list: list_to_show, response_type: :list)\n end\n end\n end",
"def play\n display_welcome_message\n loop do \n human.choose #.choose is an instance method on the Player class, since human is an object of the Player class\n computer.choose\n display_winner\n break unless play_again? #could put play again loop here, but easier to not have double loop here\n end \n display_goodbye_message\n end",
"def play_first_track()\n @ole.PlayFirstTrack()\n end",
"def play_first_track()\n @ole.PlayFirstTrack()\n end",
"def play\n if (RUBY_PLATFORM == \"java\")\n java_play\n else\n ruby_play\n end\n end",
"def playMoveNow _obj, _args\n \"_obj playMoveNow _args;\" \n end",
"def play\n @@plays += 1\n end",
"def playMove _obj, _args\n \"_obj playMove _args;\" \n end",
"def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend",
"def play results = nil\n # This is horribly complicated.\n #\n songs = results || next_up\n songs && self.next_up = nil\n songs || return\n \n stop\n \n @channel = Cod.bidir_pipe\n @current_pid = fork do\n # Some after-forking setup\n #\n $0 = 'playa controller'\n child_pid = nil\n channel.swap!\n @current_pid = nil\n\n Signal.trap 'USR1' do\n message = channel.get\n \n case message\n when :quit\n Process.kill 'KILL', child_pid if child_pid\n exit 0\n when :next\n Process.kill 'KILL', child_pid if child_pid\n when :toggle_repeat\n @repeat_one = !@repeat_one\n end\n end\n \n file = songs.next || return\n channel.put :song => file\n loop do\n options = Players.options_for player\n child_pid = spawn player, '-v', volume.to_s, file, *options\n Process.waitall\n file = songs.next unless repeat_one\n channel.put :song => file\n break unless file\n end\n end\n end",
"def next_player!\n end",
"def show\n\n \t\t\trespond_with @player\n\n \t\tend",
"def play\r\n return if self.finished?\r\n self.update\r\n end",
"def process_ok\n Sound.play_ok\n super\n end",
"def play!\n @playlist.shift\n end",
"def start\n puts \"Welcome to Tic Tac Toe!\"\n puts \"\"\n define_players\n play\n end",
"def playMission _args\n \"playMission _args;\" \n end",
"def play\n synchronize do\n @starved = false\n @source.play\n end\n end",
"def play_all\n\t\t@songs.each do | song |\n\t\t\tputs \"#{@name} are playing: #{song}\"\n\t\t\tputs \" \"\n\t\t\tmembers_play\n\t\t\tputs \" \"\n\t\t\tsleep(1)\n\t\tend\n\tend",
"def set_play\n @play = Play.find(params[:id])\n end",
"def set_play\n @play = Play.find(params[:id])\n end",
"def start\n setPlayers\n question\nend",
"def play(opponent)\n opponent.choose\n end",
"def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\t@screen.flip()\n end\n end",
"def play(*args)\n sleep(duration)\n end",
"def player\n player(\"640\",\"480\")\n end",
"def ios_playingOperation(client)\n\n\t\tclient.sleep(15000)\n\t\tputs \"::MSG:: Playing operation started...\"\n\t\t\t\n\t\tbegin\t\t\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.UNSeekSlider']\", 0, 1)\n\t\t\t$startTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.UNSeekControl']/*[@alpha='0.6000000238418579']\", 0)\n\t\t\tputs \"Starting time : \" + $startTime\n\n\t\t\tclient.sleep(8000)\n\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.UNSeekSlider']\", 0, 1)\n\t\t\t$endTime = client.elementGetText(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.UNSeekControl']/*[@alpha='0.6000000238418579']\", 0)\n\t\t\tputs \"Ending time : \" + $endTime\n\n\t\t\tif $endTime == $startTime\n\t\t\t\t$errMsgConti = \"::MSG::「続きを再生が失敗しました」 Playback has not started, check status!!!\"\n\t\t\t\t$obj_rtnrs.returnNG\n\t\t\t\t$obj_rtnrs.printResult\t\n\t\t\telse\n\t\t\t\t@@comment = \"::MSG::「続きを再生が成功しました」 Playback has started successfully...\"\n\t\t\t\t$obj_rtnrs.returnOK\n\t\t\t\t$obj_rtnrs.printResult\t\t\t\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred, could not get playback time..: \" + e.message\n\t\t\t$obj_rtnrs.returnNG\n\t\tend\n\t\tbegin\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityIdentifier='player_button_pause']\", 0, 1)\n\t\t\tclient.sleep(300)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityIdentifier='navbar_button_back.png']\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgConti = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\t\n\tend"
] |
[
"0.80753106",
"0.80039287",
"0.79763395",
"0.79763395",
"0.79763395",
"0.79763395",
"0.79606795",
"0.7910502",
"0.7835546",
"0.76925325",
"0.76023877",
"0.73977685",
"0.73465925",
"0.7305119",
"0.73027754",
"0.73027754",
"0.7300075",
"0.7211189",
"0.7137941",
"0.6954433",
"0.6867481",
"0.6859155",
"0.6852574",
"0.68515915",
"0.6843999",
"0.6838621",
"0.68286437",
"0.6820256",
"0.6818679",
"0.68046474",
"0.6788247",
"0.67871237",
"0.6746685",
"0.67311394",
"0.67276406",
"0.6689277",
"0.66843945",
"0.66843945",
"0.66843945",
"0.66843945",
"0.66843945",
"0.66843945",
"0.66843945",
"0.66745764",
"0.6667154",
"0.6664567",
"0.6653386",
"0.6633092",
"0.66310996",
"0.66164833",
"0.6610494",
"0.6600549",
"0.658212",
"0.6567707",
"0.6556358",
"0.6544044",
"0.6534168",
"0.6506415",
"0.6495762",
"0.64717007",
"0.64660937",
"0.645747",
"0.64419997",
"0.64405274",
"0.6435312",
"0.6431543",
"0.64279646",
"0.6422622",
"0.64005834",
"0.6366944",
"0.6345052",
"0.63448584",
"0.6344554",
"0.63382494",
"0.6337235",
"0.6337115",
"0.63363206",
"0.63363206",
"0.63343495",
"0.6332641",
"0.6323739",
"0.6317385",
"0.6282258",
"0.627752",
"0.6254392",
"0.625142",
"0.6246982",
"0.62330693",
"0.62146074",
"0.6211592",
"0.62007934",
"0.61979544",
"0.6194985",
"0.6168146",
"0.6168146",
"0.61640537",
"0.61622584",
"0.6162222",
"0.6153044",
"0.61480516",
"0.6136006"
] |
0.0
|
-1
|
This is a contrived transaction that mirrors the transaction documented by the manual signing example written by xeroc:
|
def test_to_bytes
vote = {
type: :vote,
voter: 'xeroc',
author: 'xeroc',
permlink: 'piston',
weight: 10000,
extensions: [],
}
@transaction.operations << vote
refute_nil bytes = @transaction.send(:to_bytes)
hex = hexlify(bytes)
# Here, we're going to take apart our contrived serialization so we can
# verify each substring individually.
chain_id = hex[0..63]
ref_block_num = hex[64..67]
ref_block_prefix = hex[68..75]
exp = hex[76..83]
op_len = hex[84..85]
op_id = hex[86..87]
voter = hex[88..99]
author = hex[100..111]
permlink = hex[112..125]
weight = hex[126..129]
extensions = hex[130..131]
hex_segments = {
chain_id: chain_id, ref_block_num: ref_block_num,
ref_block_prefix: ref_block_prefix, exp: exp, op_len: op_len,
op_id: op_id, voter: voter, author: author, permlink: permlink,
weight: weight, extensions: extensions
}
# This example serialization was documented by xeroc:
# https://steemit.com/steem/@xeroc/steem-transaction-signing-in-a-nutshell
example_hex = 'bd8c5fe26f45f179a8570100057865726f63057865726f6306706973746f6e102'
assert hex.include?(example_hex), 'expect example_hex in our result'
# Later correction by xeroc:
# https://steemit.com/steem/@xeroc/steem-transaction-signing-in-a-nutshell#@xeroc/re-steem-transaction-signing-in-a-nutshell-20160901t151404
example_hex2 = 'bd8c5fe26f45f179a8570100057865726f63057865726f6306706973746f6e102700'
assert hex.include?(example_hex2), 'expect example_hex2 in our result'
# The only thing that should remain if we remove the second example is the
# chain_id.
remaining_hex = hex.gsub example_hex2, ''
assert_equal Radiator::ChainConfig::NETWORKS_HIVE_CHAIN_ID,
remaining_hex, 'expect nothing but the chain_id'
# Here, we're going to take apart our contrived serialization so we can
# verify each substring.
assert_equal Radiator::ChainConfig::NETWORKS_HIVE_CHAIN_ID,
hex_segments[:chain_id], 'expect chain_id'
assert_equal 'bd8c', hex_segments[:ref_block_num], 'expect ref_block_num'
assert_equal '5fe26f45', hex_segments[:ref_block_prefix], 'expect ref_block_prefix'
assert_equal 'f179a857', hex_segments[:exp], 'expect exp'
assert_equal '01', hex_segments[:op_len], 'expect op_len'
assert_equal '00', hex_segments[:op_id], 'expect op_id'
assert_equal '057865726f63', hex_segments[:voter], 'expect voter'
assert_equal '057865726f63', hex_segments[:author], 'expect author'
assert_equal '06706973746f6e', hex_segments[:permlink], 'expect permlink'
assert_equal '1027', hex_segments[:weight], 'expect weight'
assert_equal '00', hex_segments[:extensions], 'expect extensions'
assert_equal hex, hex_segments.values.join
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signature_base\n tx = Stellar::Transaction.from_xdr(\n # TransactionV0 is a transaction with the AccountID discriminant\n # stripped off, we need to put it back to build a valid transaction\n # which we can use to build a TransactionSignaturePayloadTaggedTransaction\n Stellar::PublicKeyType.to_xdr(Stellar::PublicKeyType.public_key_type_ed25519) + to_xdr\n )\n\n tagged_tx = Stellar::TransactionSignaturePayload::TaggedTransaction.new(:envelope_type_tx, tx)\n\n Stellar::TransactionSignaturePayload.new(\n network_id: Stellar.current_network_id,\n tagged_transaction: tagged_tx\n ).to_xdr\n end",
"def sign(wallet)\n tx = Arweave::Transaction.new(data: @commit.message.to_s)\n @commit.to_tags.each do |name, value|\n tx.add_tag(name: name, value: value)\n end\n tx.sign(wallet)\n end",
"def sign_tx(raw_tx, pkey_wif)\n # Seems like this is your quintessential reference: \n # http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html\n\n # I think this is the right way to do it...\n Bitcoin.network = (bitcoin.is_testing?) ? :testnet3 : :bitcoin\n\n # This parses the binary-encoded raw transaction:\n tx = Bitcoin::P::Tx.new [raw_tx].pack('H*')\n\n # This is the input transaction, which we'll need for signining:\n prev_hash = tx.in[0].prev_out.reverse_hth\n\n # let's parse the keys:\n key = Bitcoin::Key.from_base58 pkey_wif\n\n pubkey = [key.pub].pack('H*')\n\n # And parse the input transaction:\n prev_tx = Bitcoin::P::Tx.new [bitcoin.getrawtransaction(prev_hash)].pack('H*')\n\n # And, now we're ready to sign: \n subscript = tx.signature_hash_for_input 0, prev_tx\n sig = Bitcoin.sign_data Bitcoin.open_key(key.priv), subscript\n tx.in[0].script_sig = Bitcoin::Script.to_signature_pubkey_script sig, pubkey \n\n tx.to_payload.unpack('H*')[0]\n end",
"def transaction(&block); end",
"def signrawtransaction(hexstring, transaction = nil, privatekey =nil, sighashtype = \"ALL\")\n @api.request 'signrawtransaction', hexstring, transaction, privatekey, sighashtype\n end",
"def publish!(wallet)\n tx = self.sign(wallet)\n tx.commit\n tx.attributes[:id]\n end",
"def sign_transaction(tx)\n signed_tx = respond_to?(:signrawtransactionwithwallet) ? signrawtransactionwithwallet(tx) : signrawtransaction(tx)\n raise OpenAssets::Error, 'Could not sign the transaction.' unless signed_tx['complete']\n Bitcoin::Protocol::Tx.new(signed_tx['hex'].htb)\n end",
"def sign!(key, sign_nonce = T.unsafe(nil)); end",
"def sign()\n # TODO\n end",
"def signing_input; end",
"def signing_input; end",
"def sign_key; end",
"def sign; adapter_class.new(self).sign; end",
"def sign(message); end",
"def signing_input=(_); end",
"def signing_input=(_); end",
"def sign\n fail NotImplementedError\n end",
"def update_signature!; end",
"def update_signature!; end",
"def create_transaction\n Transaction.new(\n player,\n [director_certificate],\n @game.initial_offering,\n [@par_price * director_certificate.num_shares]\n )\n end",
"def transaction(key, settings = {}, &block)\n t = init_transaction(key, settings)\n block.call\n t.finish\n rescue\n t.rollback\n raise\n ensure\n t.clean_publisher\n end",
"def sign!\n transaction do\n create_organization!\n organization.contributors.create!(organization: organization, user: user, admin: true)\n save!\n end\n end",
"def new_transaction(vote_cipher:, ring_members:, ring_sig_hex:)\n if validator.valid_transaction?(vote_cipher, ring_members, ring_sig_hex)\n transaction = {\n vote: vote_cipher,\n ring_members: ring_members,\n ring_signature: ring_sig_hex\n }\n\n ring_sig = CryptoHelper.ringsig_from(ring_sig_hex)\n validator.add_voter(ring_sig.key_image)\n new_block(transaction: transaction)\n end\n end",
"def create_tx(tx, prev_tx, prev_out_index, outputs, key = @key)\n tx.input {|i| i.prev_out prev_tx; i.prev_out_index prev_out_index; i.signature_key key }\n outputs.each do |value, key|\n tx.output {|o| o.value value; o.script {|s| s.recipient key.addr } }\n end\nend",
"def sign(pvt, id, txn)\n raise 'pvt must be of type Key' unless pvt.is_a?(Key)\n raise 'id must be of type Id' unless id.is_a?(Id)\n raise 'txn must be of type Txn' unless txn.is_a?(Txn)\n pvt.sign(body(id, txn))\n end",
"def sign_transaction(wallet_id: default_wallet_id, params: {})\n call :post, '/wallet/' + wallet_id + '/signtransaction', params\n end",
"def to_signed_tx(private_key)\n sign_tx to_raw_tx, private_key\n end",
"def stored_signature; end",
"def notification_signature(ns_merchant_id, \n ns_acquirer_bin,\n ns_terminal_id, \n ns_num_operacion, \n ns_importe, \n ns_tipo_moneda,\n ns_exponente,\n ns_referencia)\n\n charge = Charge.get(ns_num_operacion.to_i)\n configuration = configuration(charge.nil? ? nil : charge.sales_channel_code)\n\n signature = \"\"\n signature << configuration[:clave_encriptacion]\n signature << ns_merchant_id\n signature << ns_acquirer_bin\n signature << ns_terminal_id\n signature << ns_num_operacion\n signature << ns_importe\n signature << ns_tipo_moneda\n signature << ns_exponente\n signature << ns_referencia\n\n p \"calculating notification signature: #{signature}\"\n\n Digest::SHA256.hexdigest signature\n\n end",
"def straighten_transaction(transaction)\n raise \"Please implement #straighten_transaction in #{self.to_s}\"\n end",
"def sub(amount, invoice, pvt, details = '-', time: Time.now)\n raise 'The amount has to be of type Amount' unless amount.is_a?(Amount)\n raise \"The amount can't be negative: #{amount}\" if amount.negative?\n raise 'The pvt has to be of type Key' unless pvt.is_a?(Key)\n prefix, target = invoice.split('@')\n tid = max + 1\n raise 'Too many transactions already, can\\'t add more' if max > 0xffff\n txn = Txn.new(\n tid,\n time,\n amount * -1,\n prefix,\n Id.new(target),\n details\n )\n txn = txn.signed(pvt, id)\n raise \"Invalid private key for the wallet #{id}\" unless Signature.new(network).valid?(key, id, txn)\n add(txn)\n txn\n end",
"def generate_raw_transaction(priv, value, data, gas_limit, gas_price, to = nil, nonce = nil)\n\n key = ::Eth::Key.new priv: priv\n address = key.address\n\n nonce = nonce.nil? ? eth_get_transaction_count(address, 'latest').to_i(16) : nonce\n\n args = {\n from: address,\n value: 0,\n data: '0x0',\n nonce: nonce,\n gas_limit: gas_limit,\n gas_price: 0\n }\n args[:value] = (value * 10**18).to_i if value\n args[:data] = data if data\n args[:to] = to if to\n tx = ::Eth::Tx.new(args)\n tx.sign key\n tx.hex\n end",
"def submit_transaction(args = {})\n return false if args[:amount] == 0\n t = transactions.new\n t.reference = args[:reference].to_s\n t.amount = args[:amount]\n t.contract_id = contract.id\n t.campaign_id = campaign.id\n t.save\n end",
"def balance_sign_submit(wid, payload)\n tx_balanced = SHELLEY.transactions.balance(wid, payload)\n expect(tx_balanced).to be_correct_and_respond 202\n\n tx_signed = SHELLEY.transactions.sign(wid, PASS, tx_balanced['transaction'])\n expect(tx_signed).to be_correct_and_respond 202\n\n tx_submitted = PROXY.submit_external_transaction(Base64.decode64(tx_signed['transaction']))\n expect(tx_submitted).to be_correct_and_respond 202\n\n [tx_balanced, tx_signed, tx_submitted]\nend",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def signed_or_encrypted; end",
"def nonce=(_arg0); end",
"def signer\n end",
"def build_test_envelope\n Docusign::Envelope.new.tap do |e|\n doc = Docusign::Document.new\n tabs = doc.tabs do |d| \n d.tab :name => 'Make'\n d.tab :name => 'Model'\n d.tab :name => 'VIN'\n end\n \n e.tabs = tabs\n \n e.recipients = [\n Docusign::Recipient.new.tap do |r|\n r.template_required = true\n r.type = Docusign::RecipientTypeCode::Signer\n r.template_locked = true\n r.role_name = 'Insured'\n r.user_name = \"Mike Borozdin\"\n end\n ]\n end\n end",
"def transaction(&blk)\n tap(&blk)\n end",
"def signing_information\n super\n end",
"def add_genesis_block\n\t\tself.add_transaction( to: GENESIS_WALLET, from: GENESIS_WALLET, amount: INITIAL_AMOUNT )\n\t\tsuper\n\tend",
"def signing_key; end",
"def sign!\n params = {\n :if_updated_at => @contract.content_updated_at\n }\n\n response = @client.put self.url, { :body => params.to_json, :headers => { 'Content-Type' => 'application/json' } }\n\n if response.status != 201\n raise Inkdit::Error.new(response)\n end\n\n Inkdit::Signature.new(@client, response.parsed)\n end",
"def setup_multi_sig_sign_hash2(tx_code,keypair)\n #this will search the multi-sign-server for the published transaction with a matching tx_code.\n #if the transaction is found it will get the b64 encoded transaction from the server \n #and sign it with this keypair that is assumed to be a valid signer for this transaction.\n #after it signs the transaction it will send the signed transaction back to the multi-sign-server\n #that will continue to collect more signatures from other signers until the total signer weight threshold is met,\n #at witch point the multi-sign-server will send the fully signed transaction to the stellar network for validation\n # this function only returns the sig_hash to be sent to send_to_multi_sign_server(sig_hash) to publish signing of tx_code\n # this sig_hash can be modified before it is sent \n # example: \n # sig_hash[\"tx_title\"] = \"some cool transaction\"\n # sig_hash[\"signer_weight\"] = 2\n # the other values should already be filled in by the function that for the most part should not be changed.\n\n #this action get_tx when sent to the mss-server will returns the master created transaction with added info, \n #{\"tx_num\"=>1, \"signer\"=>0, \"tx_code\"=>\"7ZZUMOSZ26\", \"tx_title\"=>\"test multi sig tx\", \"signer_address\"=>\"\", \"signer_weight\"=>\"\", \"master_address\"=>\"GDZ4AFAB...\", \"tx_envelope_b64\"=>\"AAAA...\",\"signer_sig\"=>\"URYE...\"}\n get_tx = {\"action\"=>\"get_tx\",\"tx_code\"=>\"7ZZUMOSZ26\"}\n get_tx[\"tx_code\"] = tx_code\n result = Utils.send_to_multi_sign_server(get_tx)\n puts \"mss result: #{result}\"\n puts \"env_b64: #{result[\"tx_envelope_b64\"]}\"\n env = Utils.b64_to_envelope(result[\"tx_envelope_b64\"])\n if env.nil?\n puts \"env was nil\"\n return nil\n end\n tx = env.tx\n signature = Utils.sign_transaction_env(env,keypair)\n #sig_b64 = ??\n envnew = Utils.envelope_addsigners(env, tx, keypair)\n tx_envelope_b64 = Utils.envelope_to_b64(envnew)\n submit_sig = {\"action\"=>\"sign_tx\",\"tx_title\"=>\"test tx\",\"tx_code\"=>\"JIEWFJYE\", \"signer_address\"=>\"GAJYGYI...\", \"signer_weight\"=>\"1\", \"tx_envelope_b64\"=>\"AAAA...\",\"signer_sig\"=>\"JIDYR...\"}\n submit_sig[\"tx_code\"] = tx_code\n submit_sig[\"tx_title\"] = tx_code\n sig_b64 = Stellar::Convert.to_base64 signature\n submit_sig[\"signer_sig\"] = sig_b64\n #sig_bytes = Stellar::Convert.from_base64 sig_b64\n #sig_b64 = Stellar::Convert.to_base64 sig_bytes\n submit_sig[\"tx_envelope_b64\"] = tx_envelope_b64\n submit_sig[\"signer_address\"] = keypair.address\n return submit_sig\nend",
"def verify_tx_signed_by(transaction_envelope:, keypair:)\n Stellar::SEP10.verify_tx_signed_by(\n tx_envelope: transaction_envelope, keypair: keypair\n )\n end",
"def transaction_primitive\n raise NotImplementedError\n end",
"def use_transactions; end",
"def use_transactions; end",
"def new_transaction(sender, recipient, amount, fing, act)\n Redis.new.publish('Blockchain.new_transaction', \"#{sender} #{recipient} #{amount} #{fing} #{act}\")\n @action.incr(\"#{recipient}:#{act}\")\n @finger.incr(\"#{recipient}##{fing.join(':')}\")\n user(sender).coins.decrement(amount)\n user(recipient).coins.increment(amount)\n h = {\n epoch: Time.now.utc.to_f,\n sender: sender,\n recipient: recipient,\n amount: amount,\n fingerprint: fing,\n act: act\n }\n @current_transactions << h\n last_block[:index] + 1\n return h\n end",
"def transaction_primitive\n raise NotImplementedError\n end",
"def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end",
"def transaction(&block)\n yield\n end",
"def transaction(&block)\n yield\n end",
"def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end",
"def sign_request\n # By default OpenSSL generates an all-zero array for the encriptation vector\n # You can read it here: http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-iv-3D\n # If you want to declare it, you can take a look at the next couple of lines\n #bytes = Array.new(8,0)\n #iv = bytes.map(&:chr).join\n # We need to decode the secret key\n key = Base64.strict_decode64(credentials[:secret_key])\n # In thee cipher initialization we need to speficy the encryptation like method-length-mode (http://ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-c-new).\n # Sermepa needs DES3 in CBC mode\n # The direct way the declare it's: des-ede3-cbc\n # You can also declare like 'des3' wich use CBC mode by default\n des3 = OpenSSL::Cipher::Cipher.new('des-ede3-cbc')\n # OpenSSL use by default PKCS padding. But Sermepa (mcrypt_encrypt PHP function) use zero padding.\n # OpenSSL do not allow zero padding. So we need to disable the default padding and make zero padding by hand\n # Padding in cryptography is to fill the data with especial characteres in order to use the data in blocks of N (https://en.wikipedia.org/wiki/Padding_(cryptography))\n # We need to use blocks of 8 bytes\n block_length = 8\n # We tell OpenSSL not to pad\n des3.padding = 0\n # We want to encrypt\n des3.encrypt\n # Key set\n des3.key = key\n #des3.iv = iv\n order_number = @fields[\"Ds_Merchant_Order\"]\n # Here is the 'magic'. Instead use the default OpenSSL padding (PKCS). We fill with \\0 till the data have\n # a multiple of the block size (8, 16, 24...)\n order_number += \"\\0\" until order_number.bytesize % block_length == 0\n # For example: the string \"123456789\" will be transform in \"123456789\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n # data must be in blocks of 8 or the update will break\n key_des3 = des3.update(order_number) + des3.final\n # The next step is to encrypt in SHA256 the resulting des3 key with the base64 json\n result = OpenSSL::HMAC.digest('sha256', key_des3, merchant_parameters_base64_json)\n # The last step is to encode the data in base64\n Base64.strict_encode64(result)\n end",
"def signstuff(revision, data, pkeypath)\n pkey = OpenSSL::PKey::EC.new File.read pkeypath\n\n revm = revision.match(/([0-9]+)-.+/)\n oldrev = revm[1]\n newrev = oldrev.to_i + 1\n\n signature = Base64.encode64(pkey.dsa_sign_asn1(newrev.to_s+data))\nend",
"def signature_key; end",
"def signature_key=(_arg0); end",
"def sign(data, padding: nil, rng: Botan::RNG.new)\n sign = Botan::PK::Sign.new(key: self, padding: padding)\n sign << data\n sign.finish(rng)\n end",
"def transaction(&block)\n block.call\n end",
"def nonce; end",
"def generate_signature\n sha1x16 = Digest::SHA1.hexdigest(signed_string)\n .tap { |s| logger.debug \"sha1x16 #{s}\" }\n enc = case form_fields['signMethod']\n when '01' # 01 means RSA\n merchant_private_key.sign(OpenSSL::Digest::SHA1.new, sha1x16)\n .tap { |s| logger.debug \"enc #{s}\" }\n else # at current time (2015-05-25) no other signing method is mentioned in Unionpay's official docs\n raise \"sign method #{form_fields['signMethod']} is not implemented yet.\"\n end\n Base64.strict_encode64(enc) # has to be strict_encode64, not encode64, as the latter as an extra '\\n'\n .tap { |s| logger.debug \"final: #{s}\" }\n end",
"def begin_transaction(mutable: false, graph_name: nil)\n raise NotImplementedError\n end",
"def transaction_propose(trsc)\n synchro_point\n create_sibling(trsc)\n nil\n end",
"def sign(data)\n @key.sign(@algo.new, data)\n end",
"def sign!(cert)\n openssl_cert = cert.cert # because model -> OpenSSL object\n openssl_cert.serial = self.next_serial\n cert.serial = self.next_serial\n openssl_cert.issuer = ca_cert.subject\n openssl_cert.sign private_key, OpenSSL::Digest::SHA1.new\n self.next_serial = self.next_serial + 1\n self.save\n nil\n end",
"def transaction(message, &block)\n store.transaction(message, &block)\n end",
"def sign!(signing_profile={})\n raise \"Invalid certificate #{self.errors.full_messages}\" unless valid?\n merge_profile_with_extensions(signing_profile)\n\n openssl_cert = OpenSSL::X509::Certificate.new\n openssl_cert.version = 2\n openssl_cert.not_before = self.not_before\n openssl_cert.not_after = self.not_after\n openssl_cert.public_key = self.key_material.public_key\n\n openssl_cert.serial = self.serial_number.number\n\n openssl_cert.subject = self.distinguished_name.to_x509_name\n openssl_cert.issuer = parent.distinguished_name.to_x509_name\n\n factory = OpenSSL::X509::ExtensionFactory.new\n factory.subject_certificate = openssl_cert\n\n #NB: If the parent doesn't have an SSL body we're making this a self-signed cert\n if parent.openssl_body.nil?\n factory.issuer_certificate = openssl_cert\n else\n factory.issuer_certificate = parent.openssl_body\n end\n\n factory.config = build_openssl_config\n\n # Order matters: e.g. for self-signed, subjectKeyIdentifier must come before authorityKeyIdentifier\n self.extensions.keys.sort{|a,b| b<=>a}.each do |k|\n e = extensions[k]\n next if e.to_s.nil? or e.to_s == \"\" ## If the extension returns an empty string we won't include it\n ext = factory.create_ext(e.openssl_identifier, e.to_s, e.critical)\n openssl_cert.add_extension(ext)\n end\n\n if signing_profile[\"digest\"].nil?\n digest = OpenSSL::Digest.new(\"SHA512\")\n else\n digest = OpenSSL::Digest.new(signing_profile[\"digest\"])\n end\n\n self.openssl_body = openssl_cert.sign(parent.key_material.private_key, digest)\n end",
"def within_transaction; end",
"def within_transaction; end",
"def sign(opts = {})\n params = {\n secret: client_secret,\n tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }\n }\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n post(:sign, params)\n end",
"def sign\n # parameters: petition_id, email (of petition signer), postcode\n\n # Save the petition signature\n\n db_query(\"\n\n INSERT INTO petition_signatures (petition_id, email)\n\n VALUES (#{params[:petition_id]}, '#{params[:email]}')\n\n \")\n\n # Tell CRM to store this new member, or update existing record\n\n http_post(\"https://crm.example.org/apiv1/upsert_member?email=#{params[:email]}\",\n postcode: params[:postcode])\n\n petition = Petition.find(params[:petition_id])\n\n render inline: \"<p>Thank you for signing #{petition.name}</p>\"\n end",
"def tran_xml(xml, index, job, batch, transaction_set_count) \n if !payer.blank? && !payer.status.blank? && (!payer.gateway.blank? || !payer.gateway_temp.blank?)\n gateway = payer.status.upcase == 'MAPPED' ? payer.gateway : (payer.gateway_temp || 'HLSC')\n payid = payer.payer_identifier(micr_line_information)\n footnote_indicator = (payer.footnote_indicator ? 1 : 0)\n else raise 'Invalid Payer'\n puts \"Payer record for check number #{check_number} is incomplete or invalid\"\n log.error \"Payer record for check number #{check_number} is incomplete or invalid\"\n end\n\n payee_name ||= batch.facility.name.to_s.strip\n xml.tran(:ID => index + 1) do\n xml.tag!(:batch_attrib, 1)\n xml.tag!(:gateway, gateway)\n xml.tag!(:pay_id, payid)\n xml.tag!(:payee_nm, (payee_name.slice(0, 25) if !payee_name.blank?))\n xml.tag!(:aba_num, (micr_line_information.aba_routing_number if micr_line_information))\n xml.tag!(:chk_act, (micr_line_information.payer_account_number if micr_line_information))\n xml.tag!(:chk_num, check_number)\n xml.tag!(:chk_amt, sprintf('%.02f', check_amount.to_f))\n xml.tag!(:eob_id, (index + 1))\n xml.tag!(:tid, job.transaction_number)\n xml.tag!(:rework, '0')\n xml.tag!(:payer_footnote_based, (footnote_indicator || 0))\n xml.tag!(:worklist_status_cd, '')\n xml.tag!(:transaction_receipt_dt, (batch.date.strftime(\"%Y-%m-%d\") unless batch.date.blank?))\n xml.tag!(:hlsc_file_nm, batch.src_file_name)\n xml.tag!(:show_on_worklist, '0')\n xml.tag!(:transaction_guid, guid)\n end\n transaction_set_count += 1\n end",
"def transaction_for_hash(hash)\n raise \"Not Implemented\"\n end",
"def sign_contract(venture_capitalist, investment, investment_amt)\n new_funding_round = FundingROund.new(self, venture_capitalist, investment, investment_amt )\nend",
"def transaction(order_id, total, store_name = nil, tax = nil, shipping = nil, city = nil, region = nil, country = nil, utmhid = random_id)\n check_account_params\n hey(transaction_params(order_id, total, store_name, tax, shipping, city, region, country, utmhid))\n end",
"def scaffold_transaction(&block)\n transaction(&block)\n end",
"def give(shareholder, transferrable)\n Transaction.new shareholder, Array(transferrable), self, []\n end",
"def sign(t_outputs)\n # binding.pry\n Base64.encode64(private_key.sign(OpenSSL::Digest::SHA256.new, t_outputs.to_json))\n end",
"def test_valid_transaction\n\t\tassert_nothing_raised() {\n\t\t\t@transaction = @order.get_auth_transaction\n\t\t\tassert_equal @transaction.test_transaction, true\n\t\t\t@transaction.submit\n\t\t}\n\tend",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def sign(bare_token)\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(self.shared_secret)).update(bare_token.toutf8).digest).strip\n end",
"def sign!(ha)\n ha[:sig] = compute_checksum(ha)\n end",
"def transaction(&block)\n @fb_txns << Rubyfb::Transaction.new(@fb_cxn)\n super &block\n end",
"def sign_legacy(private_key)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\n result = result.append(27 + recovery_id)\n result.pack('c*')\n end",
"def call_with_transaction(from_, address, sig, args, gas = nil, gasPrice = nil, value = nil)\n gas = gas or DEFAULT_GAS_PER_TX\n gasPrice = gasPrice or DEFAULT_GAS_PRICE\n data = self._encode_function(sig, args)\n data_hex = RLP::Utils.encode_hex(data)\n eth_sendTransaction(from: from_,\n to: address, data: data_hex, gas: gas,\n gasPrice: gasPrice, value: value)\n end",
"def sign!(current_user, _password)\n @current_user = current_user\n unless current_user == signing_user\n raise ESignatureUserError, 'The current user does not match the user that prepared the document for signature'\n end\n\n validate_prepared_doc_digest\n set_signature_timestamp\n salt_document\n sign_document\n\n validate_signature\n @prepared_doc\n end",
"def signature_verification_state\n super\n end",
"def save!(private_key)\n bitcoin.sendrawtransaction to_signed_tx(private_key)\n end",
"def create_transaction_void(transaction_id, options = {})\n handle_transaction_id(transaction_id)\n create_transaction(:void, nil, nil, nil, nil, options)\n end",
"def zero_receipt(transaction)\n @recipients = \"#{transaction.user.fullname} <#{transaction.user.email}>\"\n @from = AppConfig.admin_email\n @subject = \"Thank You for your registration!\"\n @sent_on = Time.now\n @body[:transaction] = transaction\n end",
"def transaction_params\n params.require(:transaction).permit(:amount, :account_id, :note, :sign, :account_to_id)\n end",
"def transaction_disabled=(_arg0); end",
"def calculate_signature(doc, node)\n sha1 = OpenSSL::Digest::SHA1.new\n node = doc.at_css(node)\n canon_signed_info_node = canonicalize_exclusively(node)\n signature = @signing_private_key.sign(sha1, canon_signed_info_node)\n\n encode(signature).gsub(/\\s+/, \"\")\n end",
"def complete_transaction(trans)\n trans = trans.split('>')\n\n return 1 if trans.size != 2\n\n s = trans[0]\n r = trans[1].split('(')[0]\n x = trans[1].split('(')[1].chomp(')')\n\n return 1 unless s.length == r.length && s.length == 6 && x.to_i.to_s == x\n\n sender = @wallets[s.to_i]\n recipient = @wallets[r.to_i]\n x = x.to_i\n\n # update sender wallet\n if @wallets[s.to_i].nil?\n @wallets[s.to_i] = Wallet.new(s, x * -1)\n else\n sender.balance -= x\n @negs.push(sender) if sender.address != 'SYSTEM' && sender.balance.negative?\n end\n\n # update recipients wallet\n if @wallets[r.to_i].nil?\n @wallets[r.to_i] = Wallet.new(r, x)\n else\n recipient.balance += x\n end\n\n @actives.add(s)\n @actives.add(r)\n end",
"def generate_withdrawal_transaction(exported_order)\n tx = build_tx do |t|\n input_amount = generate_inputs(t, exported_order)\n validate_input_amount(input_amount, exported_order)\n generate_withdrawal_output(t, exported_order)\n generate_residual_output(t, input_amount, exported_order)\n end\n Base64.encode64(tx.to_payload)\n end",
"def sign_block(key_private, timestamp)\r\n # RSA Encryption (Formula: C = M^d mod n)\r\n timestamp = timestamp.to_i % key_private[1].to_i\r\n signature = timestamp.to_bn.mod_exp(key_private[0],key_private[1])\r\n return signature\r\nend"
] |
[
"0.64489174",
"0.6299867",
"0.62841564",
"0.628355",
"0.62298733",
"0.6201105",
"0.61977506",
"0.6188881",
"0.61878294",
"0.6126257",
"0.6126257",
"0.5987242",
"0.59748185",
"0.5967082",
"0.5910438",
"0.5910438",
"0.5898333",
"0.58685046",
"0.58685046",
"0.5831936",
"0.58294034",
"0.58057684",
"0.58046246",
"0.57942307",
"0.57742584",
"0.57286924",
"0.5727787",
"0.5682611",
"0.56709546",
"0.56653905",
"0.5631341",
"0.56236255",
"0.56035817",
"0.5591984",
"0.5542732",
"0.5542732",
"0.5542732",
"0.5523491",
"0.55168253",
"0.5505655",
"0.5484017",
"0.54576486",
"0.5436761",
"0.5433769",
"0.5432622",
"0.54265577",
"0.54255146",
"0.5424596",
"0.54196954",
"0.54186124",
"0.54186124",
"0.5410981",
"0.54101825",
"0.53962016",
"0.53925806",
"0.53925806",
"0.5391587",
"0.53902733",
"0.53894335",
"0.5384988",
"0.5378864",
"0.5376808",
"0.536395",
"0.53624666",
"0.5359814",
"0.535972",
"0.5355234",
"0.5341279",
"0.5338691",
"0.53323734",
"0.5320856",
"0.5311829",
"0.5311829",
"0.5295404",
"0.5290868",
"0.5288308",
"0.52799565",
"0.5277693",
"0.5261815",
"0.52561635",
"0.5245673",
"0.5229518",
"0.5228967",
"0.52243185",
"0.5214898",
"0.52035725",
"0.5194196",
"0.5193915",
"0.51938033",
"0.51866657",
"0.51863813",
"0.51820916",
"0.5179386",
"0.51751596",
"0.5167259",
"0.5161863",
"0.51614296",
"0.5158299",
"0.51574934",
"0.5155149"
] |
0.6036052
|
11
|
=begin neo4j data location on mac osx with homebrew: cd /usr/local/Cellar/neo4j/community1.9.2unix/libexec to clear the db: neo4j stop && rm rf data/ && neo4j start BigQuery query: SELECT repository_name, repository_url, actor_attributes_login, type FROM [githubarchive:github.timeline] WHERE type IN ("FollowEvent", "ForkEvent", "ForkApplyEvent", "IssueCommentEvent", "IssuesEvent", "MemberEvent", "PullRequestEvent", "PullRequestReviewCommentEvent", "PushEvent", "WatchEvent") AND created_at > '20130101 00:00:00' AND repository_name IS NOT NULL AND actor_attributes_login IS NOT NULL GROUP EACH BY repository_name, repository_url, actor_attributes_login, type LIMIT 100000 to test the indexes: (make sure irclogs is inside the dataset) START repo = node:nodes_index(type = "repo") WHERE repo.name = "irclogs" RETURN ID(repo), repo.name; find duplicates: START n=node(), m=node() WHERE HAS(n.name) AND HAS(m.name) AND n.name = m.name RETURN n, m; =end detect if rake is running
|
def is_rake
File.basename($0) == 'rake'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_repos(neo)\n\n\t# return repo's that have more than 1 connection\n\t# TODO: try this; n<-r[follows*2..]-m\n\tcypher_query = ' START n = node:nodes_index(type = \"repo\")'\n\tcypher_query << ' MATCH n<-[r:follows]-m'\n\tcypher_query << ' WITH n, count(m) AS follow_count'\n\tcypher_query << ' WHERE follow_count > 2'\n\tcypher_query << ' RETURN ID(n), n.name, follow_count'\n\tcypher_query << ' ORDER BY ID(n)'\n\tneo.execute_query(cypher_query)['data']\n\nend",
"def clean_neo4j\n neo_connection.execute_query(\"START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx\")\nend",
"def neo_graphs\n @neo_graphs ||= {}\n end",
"def get_relationships_for_repo(neo, repo)\n\n\tcypher_query = ' START user = node:nodes_index(type = \"user\"), repo = node:nodes_index(type = \"repo\")'\n\tcypher_query << ' MATCH user-[r:follows]->repo'\n\tcypher_query << ' WHERE ID(repo) = {repo_id}'\n\tcypher_query << ' RETURN ID(user), user.name'\n\n\tneo.execute_query(cypher_query, { :repo_id => repo[0] })['data']\n\nend",
"def find_related_nodes_via_cypher(query_string, options = {})\n query_string = \"\n #{neo_self_match_clause}\n #{query_string}\n \"\n # t1 = Time.now\n result = CypherResult.new(Neo4jDatabase.execute(query_string))\n # t2 = Time.now\n result.to_active_record(options) || []\n # t3 = Time.now\n\n \n # p \"===\", (t2-t1)*1000.0, (t3-t2)*1000.0\n # result.to_active_record || []\n end",
"def collect_node_nei_hashes\n @log.info(\"#{__method__.to_s} started[#{self.class.to_s}]\")\n\n node_nei_hash = @redis_connector.fetch_relations\n end",
"def check_for_neo4j(neo4j_uri)\n begin\n http = Net::HTTP.new(neo4j_uri.host, neo4j_uri.port)\n request = Net::HTTP::Get.new(neo4j_uri.request_uri)\n request.basic_auth(neo4j_uri.user, neo4j_uri.password) if (neo4j_uri.user)\n response = http.request(request)\n\n if (response.code != \"200\")\n abort \"Sad face. Neo4j does not appear to be running. #{neo4j_uri} responded with code: #{response.code}\"\n end\n rescue\n abort \"Sad face. Neo4j does not appear to be running at #{neo4j_uri} (\" + $!.to_s + \")\" \n end\n puts \"Awesome! Neo4j is available at #{neo4j_uri}\"\nend",
"def check_for_neo4j(neo4j_uri)\n begin\n http = Net::HTTP.new(neo4j_uri.host, neo4j_uri.port)\n request = Net::HTTP::Get.new(neo4j_uri.request_uri)\n request.basic_auth(neo4j_uri.user, neo4j_uri.password) if (neo4j_uri.user)\n response = http.request(request)\n\n if response.code != '200'\n abort \"Sad face. Neo4j does not appear to be running. #{neo4j_uri} responded with code: #{response.code}\"\n end\n rescue\n abort \"Sad face. Neo4j does not appear to be running at #{neo4j_uri} (\" + $!.to_s + ')'\n end\n puts \"Awesome! Neo4j is available at #{neo4j_uri}\"\nend",
"def on_neo4j_shutdown\n @indexes.clear\n end",
"def index\n neo = Neography::Rest.new\n r = neo.execute_query(\"START n=node(*) RETURN n;\")\n r[\"data\"].shift # first node is wacky\n @cities = r[\"data\"].map { |node|\n OpenStruct.new(node[0][\"data\"].merge(id: node[0][\"self\"].match(/node\\/(\\d+)$/)[1].to_i))\n }\n end",
"def node_query_mapping_insert\n # binding.pry\n branches.each do |br|\n br.nodes.each do |nd|\n nodeName = nd.name\n\n # columnsArray=nd.columns.map{|c| \"'\"+(c.relalias.nil? ? '' : c.relalias+'.')+c.colname+\"'\"}.join(',')\n columnsArray = nd.columns.map { |c| \"'\" + c.relname + '.' + c.colname + \"'\" }.join(',')\n query = \"INSERT INTO #{@nqTblName} values (#{@test_id} ,'#{br.name}','#{nd.name}', '#{nd.query.gsub(/'/, '\\'\\'')}',#{nd.location}, ARRAY[#{columnsArray}], #{nd.suspicious_score} , '#{@type}' )\"\n # pp query\n DBConn.exec(query)\n end\n end\n end",
"def test_index_all_blobs_from_head\n blob_count = @repository.index_blobs\n Repository.__elasticsearch__.refresh_index!\n\n result = @repository.search('def project_name_regex')\n assert { result[:blobs][:total_count] == 1 }\n end",
"def get_relationships(clear_cache = false)\n\n\tFile.delete(node_cache_file) if clear_cache && File.exist?(node_cache_file)\n\n\tif File.exist?(node_cache_file)\n\n\t\tcontent_type :json unless is_rake\n\t\tsend_file node_cache_file\n\n\telse\n\n\t\tneo = Neography::Rest.new(ENV['NEO4J_URL'] || 'http://localhost:7474')\n\n\t\tout = {\n\t\t\t:nodes => [],\n\t\t\t:links => [],\n\t\t}\n\n\t\tusers = {}\n\t\trepos = []\n\t\trepo_index = 0\n\t\tuser_index = 0\n\n\t\tget_repos(neo).each do |repo|\n\n\t\t\trelationships = get_relationships_for_repo(neo, repo)\n\n\t\t\trepos << {\n\t\t\t\t:name => repo[1],\n\t\t\t\t:type => :repo,\n\t\t\t\t:id => repo[0],\n\t\t\t\t:group => 1,\n\t\t\t}\n\n\t\t\trelationships.each do |n|\n\n\t\t\t\tunless users.has_key?(n[0])\n\n\t\t\t\t\tusers[n[0]] = {\n\t\t\t\t\t\t:name => n[1],\n\t\t\t\t\t\t:type => :user,\n\t\t\t\t\t\t:id => n[0],\n\t\t\t\t\t\t:group => 2,\n\t\t\t\t\t\t:index => user_index,\n\t\t\t\t\t}\n\n\t\t\t\t\tuser_index = user_index + 1\n\n\t\t\t\tend\n\n\t\t\t\tout[:links] << {\n\t\t\t\t\t:source => repo_index,\n\t\t\t\t\t:target => n[0],\n\t\t\t\t\t:value => 1,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\t\trepo_index = repo_index + 1\n\n\t\tend\n\n\t\t# set the target index correctly for the javascript\n\t\tout[:links].each do |l|\n\n\t\t\tl[:target] = users[l[:target]][:index] + repo_index\n\n\t\tend\n\n\t\tout[:nodes] = repos.concat(users.values.to_a).flatten\n\n\t\tFile.open(node_cache_file, 'w'){ |f| f << out.to_json }\n\n\t\tunless is_rake\n\n\t\t\tcontent_type :json\n\t\t\t#JSON.pretty_generate(out) # pretty print\n\t\t\tout.to_json # normal out\n\n\t\tend\n\n\tend\n\nend",
"def get_or_create_node(conn, uri)\n # PARSE URI\n _, namespace, name = uri.split(/^(.*[\\/|#])([^\\/|#]+)$/)\n # LOOK FOR THIS NODE IN THE INDEX\n r = conn.get(\"/db/data/index/node/#{CGI.escape(namespace)}/name/#{CGI.escape(name)}\")\n node = (JSON.parse(r.body).first || {})['self'] if r.status == 200\n #puts r.status, node\n unless node\n # THIS NODE IS NOT FOUND IN THE INDEX, SO CREATE IT\n r = conn.post(\"/db/data/node\", JSON.unparse({\"name\" => name, \"uri\" => uri}), HEADER)\n node = (JSON.parse(r.body) || {})['self'] if [200, 201].include? r.status\n # ADD THE NAME OF THE NEW NODE TO THE INDEX\n node_data = \"{\\\"uri\\\" : \\\"#{node}\\\", \\\"key\\\" : \\\"name\\\", \\\"value\\\" : \\\"#{CGI.escape(name)}\\\"}\"\n conn.post(\"/db/data/index/node/#{CGI.escape(namespace)}\", node_data, HEADER)\n # GET OR CREATE NAMESPACE NODE, AND CREATE RELATIONSHIP\n #namespace_node = get_or_create_namespace_node(conn, namespace)\n #get_or_create_relationship(conn, namespace_node, node, 'namespace_of')\n $load_n += 1\n else\n $skip_n += 1\n end\n # RETURN NEO4J'S NODE OBJECT\n node\nend",
"def neo_id\n getId\n end",
"def index\n neo = Neography::Rest.new\n\n clause = \"MATCH (c:Category)-[:HasChild]->(child:Category) WHERE c.is_root=true RETURN c.name, c.icon, COUNT(child)\"\n puts clause.blue.on_red\n @categories = neo.execute_query(clause)[\"data\"]\n end",
"def config\n Neo4j::Config\n end",
"def config\n Neo4j::Config\n end",
"def neo4j_query(*args)\n ActiveGraph::Base.query(*args)\n end",
"def find_longest_path(neo)\n\n\tcypher_query = ' START user = node:nodes_index(type = \"user\")'\n\tcypher_query << ' MATCH path=user-[:follows*]-repo'\n\tcypher_query << ' WITH path, LENGTH(path) AS cnt'\n\tcypher_query << ' RETURN extract(n in nodes(path): [ID(n), n.name, n.type])'\n\tcypher_query << ' ORDER BY cnt DESC'\n\tcypher_query << ' LIMIT 5'\n\n\tneo.execute_query(cypher_query)['data']\n\nend",
"def neo4j_url\n URI.parse(ENV['NEO4J_URL']) if ENV['NEO4J_URL']\n end",
"def neo4j_query(*args)\n Neo4j::ActiveBase.query(*args)\n end",
"def test_index_blobs_after_first_push\n commit_count = @repository.index_blobs(\n from_rev: \"0000000000000000000000000000000000000000\",\n to_rev: @repository.repository_for_indexing.head.target.oid)\n Repository.__elasticsearch__.refresh_index!\n\n result = @repository.search('def project_name_regex')\n assert { result[:blobs][:total_count] == 1 }\n end",
"def neo_id\n getId\n end",
"def get_users(neo)\n\n\tcypher_query = ' START me = node:nodes_index(type = \"user\")'\n\tcypher_query << ' RETURN ID(me), me.name'\n\tcypher_query << ' ORDER BY ID(me)'\n\tneo.execute_query(cypher_query)['data']\n\nend",
"def skip_sync?\n if R8::Config[:node_agent_git_clone][:mode] == 'skip'\n return true\n end\n skip_sync = nil\n @head_git_commit_id = nil #nil means dont skip\n installed_agent_git_commit_id = @node.get_field?(:agent_git_commit_id)\n begin\n # TODO: ran into obscure problem when github is down; below does not work\n @head_git_commit_id = AgentGritAdapter.get_head_git_commit_id()\n if R8::Config[:node_agent_git_clone][:mode] == 'debug'\n installed_agent_git_commit_id = @node[:agent_git_commit_id] = nil\n end\n rescue => e\n Log.error(\"Error trying to get most recent sync agent code (#{e}); skipping the sync\")\n skip_sync = { error: true }\n end\n skip_sync || ((@head_git_commit_id == installed_agent_git_commit_id) && { error: false })\n end",
"def db\n @db ||= Neo4j::Core::Database.new\n end",
"def snapshots_redact_sql_queries; end",
"def ha_master?\n db.graph && db.graph.isMaster()\n end",
"def findByWord(word)\n Neo4j::Transaction.run do\n puts \"Find all sentence with #{word}\"\n result = Sentence.find(:text => word)\n\n puts \"Found #{result.size} sentences\"\n \n result.each {|x| puts \"#{x}\"}\n end\nend",
"def get_users_for_repo(neo, repo)\n\n\tneo.traverse(repo, 'nodes', {\n\t\t:order => 'breadth first',\n\t\t:uniqueness => 'node global',\n\t\t:relationships => {\n\t\t\t:type => 'follows',\n\t\t\t:direction => 'in'\n\t\t},\n\t})\n\nend",
"def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n # Make sure the key is set\n api_key = _get_task_config(\"binary_edge_api_key\")\n\n if entity_type == \"IpAddress\"\n response = search_binaryedge_by_ip entity_name, api_key\n\n if response[\"events\"]\n response[\"events\"].each do |e|\n e[\"results\"].each do |r|\n\n # create a network service for every result\n # saving the details off as extended details\n port = r[\"target\"][\"port\"]\n proto = r[\"target\"][\"protocol\"]\n be_details = {\"extended_binaryedge\" => e }\n _create_network_service_entity(@entity,port,proto, be_details)\n\n # this should be optional...\n #if port != \"443\"\n # _create_issue({\n # name: \"#{entity_name}:#{port} [Binary Edge]\",\n # type: \"Malicious IP\",\n # severity: 3 ,\n # status: \"confirmed\",\n # description: \"Port: #{e[\"port\"]} || State:#{r[\"result\"][\"data\"][\"state\"]} || Security issue:#{r[\"result\"][\"data\"][\"security\"]}\n # || Reason:#{r[\"result\"][\"data\"][\"reason\"]} || \", #Running Service:#{r[\"result\"][\"data\"][\"service\"]}\"s\n # details: json\n # })\n #end\n\n end\n end\n end\n\n elsif entity_type == \"Domain\"\n # look for related eentities?\n dns_records = search_binaryedge_by_subdomain entity_name, api_key\n\n dns_records.each do |d|\n _create_entity \"DnsRecord\" , \"name\" => d\n end\n\n # also check for data leaks\n response = search_binaryedge_leaks_by_domain entity_name, api_key\n response[\"groups\"].each do |t|\n # create issues if we found any\n _create_linked_issue(\"leaked_data\",{\n proof: \"#{t[\"count\"]} accounts found related to #{entity_name} in #{t[\"leak\"]}\",\n detailed_description: \"#{t[\"count\"]} accounts found related to #{entity_name} in #{t[\"leak\"]}\",\n references:[\"https://binaryedge.com/\",\n \"https://askleo.com/account-involved-breach/\"] ,\n details: t\n })\n end\n\n elsif entity_type == \"EmailAddress\"\n\n # checks for data leaks\n response = search_binaryedge_leaks_by_email_address entity_name, api_key\n\n if response[\"total\"] == 0\n _log \"No results found!\"\n return\n end\n\n # create issues if we found any\n response[\"events\"].each do |u|\n ############################################\n ### Old Issue ###\n ###########################################\n # _create_issue({\n # name: \"Email Found in Data Leak #{u}\",\n # type: \"leaked_account\",\n # severity: 3,\n # status: \"confirmed\",\n # detailed_description: \"This Email has been found in this breach: #{u}, via BinaryEdge\",\n # references:\"https://binaryedge.com/\",\n # details: u\n # })\n ############################################\n ### New Issue ###\n ###########################################\n _create_linked_issue(\"leaked_data\",{\n proof: \"This Email has been found in this breach: #{u}\",\n name: \"Email Found in Data Leak #{u}\",\n type: \"leaked_email\",\n detailed_description: \"This Email has been found in this breach: #{u}, via BinaryEdge\",\n references:\"https://binaryedge.com/\",\n details: u\n })\n end\n\n elsif entity_type == \"NetBlock\"\n #do the right thing\n events = search_binaryedge_netblock(_get_entity_name, api_key, 0)\n events.each do |e|\n begin \n port = e[\"target\"][\"port\"]\n target = e[\"target\"][\"ip\"]\n protocol = e[\"target\"][\"protocol\"]\n _create_entity \"NetworkService\", {\"name\" => \"#{target}:#{port}/#{protocol}\"}\n \n rescue NoMethodError, KeyError\n # pass it on\n next\n end\n end\n \n else\n _log_error \"Unsupported entity type\"\n end\n\n end",
"def run\n super\n\n # get options\n opt_elastic = _get_option(\"elastic\")\n opt_mongodb = _get_option(\"mongodb\")\n opt_couchdb = _get_option(\"couchdb\")\n opt_rsync = _get_option(\"rsync\")\n opt_sonarqube = _get_option(\"sonarqube\")\n opt_jenkins = _get_option(\"jenkins\")\n opt_gitlab = _get_option(\"gitlab\")\n opt_kibana = _get_option(\"kibana\")\n #opt_listing = _get_option(\"listing\")\n opt_cassandra = _get_option(\"cassandra\")\n opt_rethink = _get_option(\"rethink\")\n\n # Set the range of research\n first_page = _get_option(\"first_page\") || 1\n last_page = _get_option(\"last_page\") || 20\n\n range = first_page..last_page\n\n elastic_query = \"type:%22elasticsearch%22\"\n mongodb_query = \"type:%22mongodb%22\"\n couchdb_query = \"product:%22couchdb%22\"\n rsync_query = \"rsync port:%22873%22\"\n sonarqube_query = \"%22Title: SonarQube%22\"\n jenkins_query = \"%22Dashboard [Jenkins]%22\"\n gitlab_query = \"%22Sign in GitLab%22\"\n kibana_query = \"product:%22kibana%22\"\n listing_query = '%22Index of /%22'\n cassandra_query = \"type:%22cassandra%22\"\n rethink_query = \"type:%22rethinkdb%22\"\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n db_source = nil\n\n # Make sure the key is set\n api_key = _get_task_config(\"binary_edge_api_key\")\n \n # Set the headers\n headers = { \"X-Key\" => \"#{api_key}\" }\n\n if opt_elastic == true\n query = elastic_query\n\t range.each do |page_num|\n \t result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_elastic_results(result)\n end\n end\n\n if opt_kibana == true\n query = kibana_query\n\t range.each do |page_num|\n \t result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_kibana_results(result)\n end\n end\n\n if opt_rsync == true\n query = rsync_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_rsync_results(result)\n end\n end\n\n if opt_jenkins == true\n query = jenkins_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_jenkins_results(result)\n end\n end\n\n if opt_gitlab == true\n query = gitlab_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_gitlab_results(result)\n end\n end\n\n if opt_sonarqube == true\n query = sonarqube_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_sonarqube_results(result)\n end\n end\n\n if opt_mongodb == true\n query = mongodb_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_mongodb(result)\n end\n end\n\n if opt_cassandra == true\n query = cassandra_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_cassandra_results(result)\n end\n end\n\n if opt_couchdb == true\n query = couchdb_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_couchdb_results(result)\n end\n end\n\n if opt_rethink == true\n query = rethink_query\n range.each do |page_num|\n result = search_binaryedge_string_query(query,headers,entity_name,page_num)\n check_rethinkdb_results(result)\n end\n end\n\n end",
"def manage_cluster\n @nodes = Node.find(:all)\n end",
"def repo_connections_weighted_graph\n read_all_git_repos('repos')\n graph_links_between_git_objects\n end",
"def main\n Dotenv.load\n # get arg\n time = ARGV.length < 2 ? '15m' : \"%s%s\" % [ARGV[0], ARGV[1]]\n # check environment variables\n # exit if not set those\n if ENV['ND_DB_HOST'] == nil || ENV['ND_DB_USER'] == nil || ENV['ND_DB_PASS'] == nil || ENV['ND_DB_NAME'] == nil\n puts 'environment value has not set'\n puts 'you have to set ND_DB_{NAME,USER,PASS,HOST}'\n exit(1)\n end\n Process.daemon\n scheduler = Rufus::Scheduler.new\n register_pid\n scheduler.every time do\n ND::NDCrawl.new(ENV['ND_DB_HOST'], ENV['ND_DB_USER'], ENV['ND_DB_PASS'], ENV['ND_DB_NAME']).main\n end\n scheduler.join\nend",
"def build_sketch_graph\n\t@temp_hop_record = Hash.new\n\t@processed_list = Hash.new\n\t$node_list.each do |n|\n\t\t#Nodes in sketched graph: queries, user_inputs\n\t\t#if n.getInstr.getFromUserInput or (n.isQuery? and n.isWriteQuery?) or (n.getInstr.instance_of?AttrAssign_instr and n.getInstr.getFuncname.index('!') == nil)\n\t\tif n.isQuery? #or n.getInstr.getFromUserInputor isTableAttrAssign(n) \n\t\t\tn.Tnode = TreeNode.new(n)\n\t\t\t$sketch_node_list.push(n.Tnode)\t\n\t\t\t@temp_hop_record[n] = Array.new\n\t\t\t@processed_list[n] = Array.new\n\t\t\t@temp_hop_record[n].push(n)\n\t\tend \n\tend\n\tfor i in 0...$node_list.length\n\t\tadded_edge = false\n\t\tno_changes = true\n\t\t$node_list.each do |n|\n\t\t\tif n.Tnode != nil\n\t\t\t\t@temp_hop_record[n].push(nil)\n\t\t\t\ttemp_node = @temp_hop_record[n].shift\n\t\t\t\tstep = 0\n\t\t\t\twhile temp_node != nil and step < 10000 do\n\t\t\t\t\tstep += 1\n\t\t\t\t\tno_changes = false\n\t\t\t\t\ttemp_node.getDataflowEdges.each do |e|\n\t\t\t\t\t\tif e.getToNode.Tnode != nil and e.getToNode != n\n\t\t\t\t\t\t\tif n.Tnode.hasChildren(e.getToNode.Tnode) == false and (n.getIndex < e.getToNode.getIndex)\n\t\t\t\t\t\t\t\tn.Tnode.addChildren(e.getToNode.Tnode, i)\n\t\t\t\t\t\t\t\t#puts \"\\tAdd edge: #{n.getIndex}:#{n.getInstr.toString} -> #{e.getToNode.getIndex}:#{e.getToNode.getInstr.toString}\"\n\t\t\t\t\t\t\t\tadded_edge = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif e.getToNode != n \n\t\t\t\t\t\t\t\tif @processed_list[n].include?e\n\t\t\t\t\t\t\t\telsif e.getToNode.getIndex < e.getFromNode.getIndex #returnv\n\t\t\t\t\t\t\t\t\te.getToNode.getDataflowEdges.each do |e1|\n\t\t\t\t\t\t\t\t\t\tif e1.getToNode.getIndex > temp_node.getIndex\n\t\t\t\t\t\t\t\t\t\t\t@temp_hop_record[n].push(e1.getToNode)\n\t\t\t\t\t\t\t\t\t\t\t@processed_list[n].push(e1)\n\t\t\t\t\t\t\t\t\t\tend \n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@temp_hop_record[n].push(e.getToNode)\n\t\t\t\t\t\t\t\t\t@processed_list[n].push(e)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttemp_node = @temp_hop_record[n].shift\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif added_edge\n\t\t\t#puts \"iteration #{i} ||\"\n\t\tend\n\t\tif no_changes\n\t\t\tbreak\n\t\tend\n\tend\n=begin\n\tgraph_write($graph_file, \"digraph sketch {\\n\")\n\t$node_list.each do |n|\n\t\tif n.Tnode != nil\n\t\t\tif n.isQuery?\n\t\t\t\tcolor = \"blue\"\n\t\t\telsif n.getInstr.instance_of?AttrAssign_instr\n\t\t\t\tcolor = \"darkorange\"\n\t\t\telse\n\t\t\t\tcolor = \"crimson\"\n\t\t\tend\n\t\t\tgraph_write($graph_file, \"\\tn#{n.getIndex} [label=<<i>#{n.getIndex}__#{n.getInstr.toString2}</i>> color=#{color}]; \\n\")\n\t\t\tn.Tnode.children.each do |c|\n\t\t\t\tgraph_write($graph_file, \"\\tn#{n.getIndex} -> n#{c.node.node.getIndex} [label=\\\"#{c.dist}\\\"]\\n\")\n\t\t\tend\n\t\tend\n\tend\n\tgraph_write($graph_file, \"}\")\n=end\nend",
"def checkNode()\n source_set = []\n neighbor_set = []\n $networks.each do |s, nb|\n source_set << s\n nb[\"neighbors\"].each do |s_, dist|\n neighbor_set << s_\n end\n end\n source_set.sort!\n source_set.uniq!\n neighbor_set.sort!\n neighbor_set.uniq!\n return source_set == neighbor_set\nend",
"def fresh(login)\n @pgsql.exec(\n [\n 'SELECT task.id FROM task',\n 'LEFT JOIN teleping ON teleping.task = task.id',\n 'JOIN plan ON task.plan = plan.id',\n 'JOIN part ON plan.part = part.id',\n 'JOIN project ON project.id = part.project',\n 'WHERE project.login = $1',\n 'AND teleping.id IS NULL',\n 'GROUP BY task.id'\n ],\n [login]\n ).map { |r| r['id'].to_i }\n end",
"def findByLang(lang)\n Neo4j::Transaction.run do\n puts \"Find all sentence with lang #{lang}\"\n result = Sentence.find(:lang => lang)\n\n puts \"Found #{result.size} sentences\"\n \n result.each {|x| puts \"#{x}\"}\n end\nend",
"def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end",
"def singleton_nodes\n all_node_ids = Node_Query.new(analysis_window: aw).run.first[:objects].collect{|n| n.id}.uniq\n all_nodes_in_ways = Way_Query.new(analysis_window: aw).run.first[:objects].collect{|w| w.nodes}.flatten.uniq\n # all_nodes_in_rels = Relation_Query.new(analysis_window: aw).run.first[:objects].collect{|r| r.nodes}.flatten.uniq\n nodes_not_in_ways_or_rels = (all_node_ids - all_nodes_in_ways).length\n puts \"Total Nodes: #{all_node_ids.length}, Nodes not in ways or relations: #{nodes_not_in_ways_or_rels}\"\n puts \"Percentage: #{nodes_not_in_ways_or_rels.to_f / all_node_ids.length.to_f}\"\n end",
"def replica_set?; true; end",
"def run\n pgp = Lodqa::Graphicator.produce_pseudo_graph_pattern @query\n pseudo_graph_pattern = PseudoGraphPattern.create pgp:, query: @query\n search = create_search pseudo_graph_pattern\n SearchJob.perform_later search.search_id\n search.search_id\n end",
"def replica_set?; false; end",
"def perform\n @analysis = Analysis.find(@analysis_id)\n\n # get the analysis and report that it is running\n @analysis_job = AnalysisLibrary::Core.initialize_analysis_job(@analysis, @analysis_job_id, @options)\n\n # reload the object (which is required) because the subdocuments (jobs) may have changed\n @analysis.reload\n\n # Make the analysis directory if it doesn't already exist\n FileUtils.mkdir_p analysis_dir(@analysis.id) unless Dir.exist? analysis_dir(@analysis.id)\n\n # create an instance for R\n @r = AnalysisLibrary::Core.initialize_rserve(APP_CONFIG['rserve_hostname'],\n APP_CONFIG['rserve_port'])\n logger.info 'Setting up R for GA Run'\n # Initialize some variables that are in the rescue/ensure blocks\n cluster = nil\n begin\n @r.converse(\"setwd('#{APP_CONFIG['sim_root_path']}')\")\n\n # make this a core method\n if !@analysis.problem['algorithm']['seed'].nil? && (@analysis.problem['algorithm']['seed'].is_a? Numeric)\n logger.info \"Setting R base random seed to #{@analysis.problem['algorithm']['seed']}\"\n @r.converse(\"set.seed(#{@analysis.problem['algorithm']['seed']})\")\n end\n # R libraries needed for this algorithm\n @r.converse 'library(rjson)'\n @r.converse 'library(R.utils)'\n @r.converse 'library(parallel)'\n @r.converse 'library(doParallel)'\n @r.converse 'library(NRELGA)'\n\n # At this point we should really setup the JSON that can be sent to the worker nodes with everything it needs\n # This would allow us to easily replace the queuing system with rabbit or any other json based versions.\n\n master_ip = 'localhost'\n\n logger.info(\"Master ip: #{master_ip}\")\n logger.info('Starting GA Run')\n\n # Quick preflight check that R, MongoDB, and Rails are working as expected. Checks to make sure\n # that the run flag is true.\n\n # TODO: preflight check -- need to catch this in the analysis module\n if @analysis.problem['algorithm']['maxiter'].nil? || (@analysis.problem['algorithm']['maxiter']).zero?\n raise 'Number of max iterations was not set or equal to zero (must be 1 or greater)'\n end\n\n if @analysis.problem['algorithm']['popSize'].nil? || (@analysis.problem['algorithm']['popSize']).zero?\n raise 'Must have number of samples to discretize the parameter space'\n end\n\n if @analysis.problem['algorithm']['elitism'] < 0 || @analysis.problem['algorithm']['elitism'] > 1\n raise 'elitism must be 0 <= elitism <= 1'\n end\n\n if @analysis.problem['algorithm']['pcrossover'] < 0 || @analysis.problem['algorithm']['pcrossover'] > 1\n raise 'pcrossover must be 0 <= pcrossover <= 1'\n end\n\n if @analysis.problem['algorithm']['pmutation'] < 0 || @analysis.problem['algorithm']['pmutation'] > 1\n raise 'pmutation must be 0 <= pmutation <= 1'\n end\n\n # TODO: add test for not \"minkowski\", \"maximum\", \"euclidean\", \"binary\", \"manhattan\"\n # if @analysis.problem['algorithm']['norm_type'] != \"minkowski\", \"maximum\", \"euclidean\", \"binary\", \"manhattan\"\n # raise \"P Norm must be non-negative\"\n # end\n\n if @analysis.problem['algorithm']['p_power'] <= 0\n raise 'P Norm must be non-negative'\n end\n\n # exit on guideline 14 is no longer true/false. its 0,1,2,3\n # @analysis.exit_on_guideline_14 = @analysis.problem['algorithm']['exit_on_guideline_14'] == 1 ? true : false\n if [0, 1, 2, 3].include? @analysis.problem['algorithm']['exit_on_guideline_14']\n @analysis.exit_on_guideline_14 = @analysis.problem['algorithm']['exit_on_guideline_14'].to_i\n logger.info \"exit_on_guideline_14 is #{@analysis.exit_on_guideline_14}\"\n else\n @analysis.exit_on_guideline_14 = 0\n logger.info \"exit_on_guideline_14 is forced to #{@analysis.exit_on_guideline_14}\"\n end\n @analysis.save!\n logger.info(\"exit_on_guideline_14: #{@analysis.exit_on_guideline_14}\")\n\n @analysis.problem['algorithm']['objective_functions'] = [] unless @analysis.problem['algorithm']['objective_functions']\n @analysis.save!\n logger.info(\"exit_on_guideline_14: #{@analysis.exit_on_guideline_14}\")\n\n # check to make sure there are objective functions\n if @analysis.output_variables.count { |v| v['objective_function'] == true }.zero?\n raise 'No objective functions defined'\n end\n\n # find the total number of objective functions\n if @analysis.output_variables.count { |v| v['objective_function'] == true } != @analysis.problem['algorithm']['objective_functions'].size\n raise 'Number of objective functions must equal between the output_variables and the problem definition'\n end\n\n pivot_array = Variable.pivot_array(@analysis.id, @r)\n logger.info \"pivot_array: #{pivot_array}\"\n selected_variables = Variable.variables(@analysis.id)\n logger.info \"Found #{selected_variables.count} variables to perturb\"\n\n # discretize the variables using the LHS sampling method\n @r.converse(\"print('starting lhs to discretize the variables')\")\n logger.info 'starting lhs to discretize the variables'\n\n lhs = AnalysisLibrary::R::Lhs.new(@r)\n samples, var_types, mins_maxes, var_names = lhs.sample_all_variables(selected_variables, 3)\n\n # Result of the parameter space will be column vectors of each variable\n logger.info \"Samples are #{samples}\"\n logger.info \"mins_maxes: #{mins_maxes}\"\n logger.info \"var_names: #{var_names}\"\n logger.info(\"variable types are #{var_types}\")\n\n if samples.empty? || samples.size <= 1\n logger.info 'No variables were passed into the options, therefore exit'\n raise \"Must have more than one variable to run algorithm. Found #{samples.size} variables\"\n end\n\n if var_names.empty? || var_names.empty?\n logger.info 'No variables were passed into the options, therefore exit'\n raise \"Must have at least one variable to run algorithm. Found #{var_names.size} variables\"\n end\n\n unless var_types.all? { |t| t.casecmp('continuous').zero? }\n logger.info 'Must have all continous variables to run algorithm, therefore exit'\n raise \"Must have all continous variables to run algorithm. Found #{var_types}\"\n end\n\n # Start up the cluster and perform the analysis\n # cluster = AnalysisLibrary::R::Cluster.new(@r, @analysis.id)\n # unless cluster.configure\n # raise 'could not configure R cluster'\n # end\n\n @r.converse(\"cat('max_queued_jobs: #{APP_CONFIG['max_queued_jobs']}')\")\n worker_ips = {}\n if @analysis.problem['algorithm']['max_queued_jobs']\n if @analysis.problem['algorithm']['max_queued_jobs'] == 0\n logger.info 'MAX_QUEUED_JOBS is 0'\n raise 'MAX_QUEUED_JOBS is 0'\n elsif @analysis.problem['algorithm']['max_queued_jobs'] > 0\n worker_ips[:worker_ips] = ['localhost'] * @analysis.problem['algorithm']['max_queued_jobs']\n logger.info \"Starting R queue to hold #{@analysis.problem['algorithm']['max_queued_jobs']} jobs\"\n end\n elsif !APP_CONFIG['max_queued_jobs'].nil?\n worker_ips[:worker_ips] = ['localhost'] * APP_CONFIG['max_queued_jobs'].to_i\n logger.info \"Starting R queue to hold #{APP_CONFIG['max_queued_jobs']} jobs\"\n else\n raise 'could not start the cluster (cluster size not set correctly)'\n end\n\n # logger.info \"Cluster Started flag is #{cluster.started}\"\n # maxiter is the max number of iterations to calculate\n # varNo is the number of variables (ncol(vars))\n # popSize is the number of sample points in the variable (nrow(vars))\n # epsilongradient is epsilon in numerical gradient calc\n\n # convert to float because the value is normally an integer and rserve/rserve-simpler only handles maxint\n @analysis.problem['algorithm']['failed_f_value'] = @analysis.problem['algorithm']['failed_f_value'].to_f\n @r.command(master_ips: master_ip,\n ips: worker_ips[:worker_ips],\n vartypes: var_types,\n varnames: var_names,\n varseps: mins_maxes[:eps],\n mins: mins_maxes[:min],\n maxes: mins_maxes[:max],\n normtype: @analysis.problem['algorithm']['norm_type'],\n ppower: @analysis.problem['algorithm']['p_power'],\n objfun: @analysis.problem['algorithm']['objective_functions'],\n popSize: @analysis.problem['algorithm']['popSize'],\n run: @analysis.problem['algorithm']['run'],\n maxFitness: @analysis.problem['algorithm']['maxFitness'],\n maxiter: @analysis.problem['algorithm']['maxiter'],\n pcrossover: @analysis.problem['algorithm']['pcrossover'],\n pmutation: @analysis.problem['algorithm']['pmutation'],\n elitism: @analysis.problem['algorithm']['elitism'],\n epsilongradient: @analysis.problem['algorithm']['epsilon_gradient'],\n debug_messages: @analysis.problem['algorithm']['debug_messages'],\n failed_f: @analysis.problem['algorithm']['failed_f_value']) do\n %{\n rails_analysis_id = \"#{@analysis.id}\"\n rails_sim_root_path = \"#{APP_CONFIG['sim_root_path']}\"\n rails_ruby_bin_dir = \"#{APP_CONFIG['ruby_bin_dir']}\"\n rails_mongodb_name = \"#{AnalysisLibrary::Core.database_name}\"\n rails_mongodb_ip = \"#{master_ip}\"\n rails_run_filename = \"#{@options[:run_data_point_filename]}\"\n rails_create_dp_filename = \"#{@options[:create_data_point_filename]}\"\n rails_root_path = \"#{Rails.root}\"\n rails_host = \"#{APP_CONFIG['os_server_host_url']}\"\n r_scripts_path = \"#{APP_CONFIG['r_scripts_path']}\"\n rails_exit_guideline_14 = \"#{@analysis.exit_on_guideline_14}\"\n\n init <- function(x){\n ruby_command <- \"cd #{APP_CONFIG['sim_root_path']} && #{APP_CONFIG['ruby_bin_dir']}/bundle exec ruby\"\n y <- paste(ruby_command,\" #{APP_CONFIG['sim_root_path']}/worker_init_final.rb -h #{APP_CONFIG['os_server_host_url']} -a #{@analysis_id} -s 'initialize'\",sep=\"\")\n print(paste(\"Run command\",y))\n z <- system(y,intern=TRUE)\n z\n }\n init\n source(paste(r_scripts_path,'/functions.R',sep=''))\n source(paste(r_scripts_path,'/ga.R',sep=''))\n }\n end\n logger.info 'Returned from rserve ga block'\n # TODO: find any results of the algorithm and save to the analysis\n rescue StandardError, ScriptError, NoMemoryError => e\n log_message = \"#{__FILE__} failed with #{e.message}, #{e.backtrace.join(\"\\n\")}\"\n logger.error log_message\n @analysis.status_message = log_message\n @analysis.save!\n @analysis_job.status = 'completed'\n @analysis_job.save!\n @analysis.reload\n @analysis.save!\n ensure\n # ensure that the cluster is stopped\n logger.info 'Executing ga.rb ensure block'\n begin\n # cluster.stop if cluster\n rescue StandardError, ScriptError, NoMemoryError => e\n # logger.error \"Error executing cluster.stop, #{e.message}, #{e.backtrace}\"\n end\n # logger.info 'Successfully executed cluster.stop'\n\n # Post process the results and jam into the database\n best_result_json = \"#{APP_CONFIG['sim_root_path']}/analysis_#{@analysis.id}/best_result.json\"\n if File.exist? best_result_json\n begin\n logger.info('read best result json')\n temp2 = File.read(best_result_json)\n temp = JSON.parse(temp2, symbolize_names: true)\n logger.info(\"temp: #{temp}\")\n @analysis.results[@options[:analysis_type]]['best_result'] = temp\n @analysis.save!\n logger.info(\"analysis: #{@analysis.results}\")\n rescue StandardError => e\n logger.error 'Could not save post processed results for bestresult.json into the database'\n end\n end\n\n # Post process the results and jam into the database\n converge_flag_json = \"#{APP_CONFIG['sim_root_path']}/analysis_#{@analysis.id}/convergence_flag.json\"\n if File.exist? converge_flag_json\n begin\n logger.info('read converge_flag.json')\n temp2 = File.read(converge_flag_json)\n temp = JSON.parse(temp2, symbolize_names: true)\n logger.info(\"temp: #{temp}\")\n @analysis.results[@options[:analysis_type]]['convergence_flag'] = temp\n @analysis.save!\n logger.info(\"analysis: #{@analysis.results}\")\n rescue StandardError => e\n logger.error 'Could not save post processed results for converge_flag.json into the database'\n end\n end\n\n # Only set this data if the analysis was NOT called from another analysis\n unless @options[:skip_init]\n @analysis_job.end_time = Time.now\n @analysis_job.status = 'completed'\n @analysis_job.save!\n @analysis.reload\n end\n @analysis.save!\n\n logger.info \"Finished running analysis '#{self.class.name}'\"\n end\n end",
"def get_repo (repoName='ComputerScience_test')\n puts \"get_repo\"\n set_repository repoName\n puts \"set_repository #{@repository}\"\n result = @repository.query.perform \"select ?s ?p ?o {?s ?p ?o} order by ?s\"\n #puts \"@repository.query.perform #{result}\"\n \n graph = RDF::Graph.new(\"http://ninjalearning.info:8080/repositories/ComputerScience_test\") # TODO: repo name, host, port, ...\n \n result['values'].each do |triple|\n graph << RDF::Statement.new(\n RDF::URI.new(triple[0]),\n RDF::URI.new(triple[1]),\n RDF::URI.new(triple[2]),\n )\n end\n graph\n end",
"def lsepoch_identify_ids(params, record)\n# right now, record[:host_id] contains the hostname - immediately after parsing\n _host = Host.find_by_hostname(record[:host_id])\n# \"discovery\" in case the Host was not found, create it with scavenger data that is available!\n if _host.nil?\n _host = lsepoch_create_host_record(params, record, _host)\n end\n# now \"exchange\" the hostname with the \"true\" id \n record[:host_id] = _host[:id]\n \n _row = Vob.find_by_tag_and_replica_name(record[:tag], record[:row_replica])\n# \"discovery\" in case the Vob (replica) was not found, create it with scavenger data that is available!\n if _row.nil?\n lsepoch_create_replica_record(params, record)\n else\n record[:row_replica] = _row[:id]\n end\n\n# fill the replica_uuid for the empty references in Vob table\n _col = lsepoch_fill_stray_replica_uuid(record)\n\n record[:column_replica] = (_col.nil?) ? 0 : _col[:id]\n# local, true oplogs are tagged with Resident/Imported\n# they represent true results of Export and Import operations\n if _host[:site_id] == record[:site_id]\n if record[:row_replica] == record[:column_replica]\n record[:process] = \"Resident\"\n else\n record[:process] = \"Imported\"\n end\n else\n# apply \"Info\" tag to \"best guesses\" - Info are mostly useless pieces of information\n# apply \"Export\" tag to rows that represent exported packets\n record[:process] = \"Info\" # \"default\"\n# find the column_replica's site ID to check if \"Exported\" (identified) was performed\n if record[:column_replica] != 0\n _vob = Vob.find(record[:column_replica])\n if !_vob.nil?\n _host = Host.find(_vob[:host_id])\n record[:process] = \"Exported\" if !_host.nil? && (_host[:site_id] == record[:site_id])\n end\n end\n end\n end",
"def get_node_id\n # @@neo = Neography::Rest.new\n begin\n qur = \"MATCH (n {object_id: \"+self.id.to_s+\", object_type: \\'\"+self.class.to_s+\"\\' }) RETURN n LIMIT 1\"\n response = @@neo.execute_query(qur)\n node_id = response[\"data\"].flatten.first[\"metadata\"][\"id\"]\n return node_id\n rescue Exception\n return nil\n end\n end",
"def run\n super\n\n # Allow the user to set the port ranges\n #ports = _get_option \"ports\"\n\n # Get range, or host\n to_scan = _get_entity_attribute \"name\"\n\n # Create a tempfile to store results\n temp_file = \"#{Dir::tmpdir}/nmap_scan_#{rand(100000000)}.xml\"\n\n # Check to see if nmap is in the path, and raise an error if not\n return \"Unable to find nmap\" unless _unsafe_system(\"sudo nmap\") =~ /http:\\/\\/nmap.org/\n\n\n # Check for IPv6\n # XXX - SECURITY!\n nmap_options = \"\"\n nmap_options << \"-6 \" if to_scan =~ /:/\n #nmap_options << \"-p #{ports}\" if ports\n\n # shell out to nmap and run the scan\n @task_log.log \"Scanning #{to_scan} and storing in #{temp_file}\"\n @task_log.log \"NMap options: #{nmap_options}\"\n nmap_string = \"nmap #{to_scan} #{nmap_options} -P0 --top-ports 100 --min-parallelism 10 -oX #{temp_file}\"\n @task_log.log \"Running... #{nmap_string}\"\n _unsafe_system(nmap_string)\n\n # Gather the XML and parse\n #@task_log.log \"Raw Result:\\n #{File.open(temp_file).read}\"\n @task_log.log \"Parsing #{temp_file}\"\n\n parser = ::Nmap::Parser.parsefile(temp_file)\n\n # Create entities for each discovered service\n parser.hosts(\"up\") do |host|\n\n @task_log.log \"Handling nmap data for #{host.addr}\"\n\n # Handle the case of a netblock or domain - where we will need to create host entity(s)\n if @entity[\"type\"] == \"NetBlock\" or @entity[\"type\"] == \"DnsRecord\"\n host_entity = _create_entity(\"IpAddress\", { :name => host.addr } )\n else\n host_entity = @entity # We already have a host\n end\n\n [:tcp, :udp].each do |proto_type|\n\n host.getports(proto_type, \"open\") do |port|\n\n # Create a NetSvc for each open port\n entity = _create_entity(\"NetSvc\", {\n :name => \"#{host.addr}:#{port.num}/#{port.proto}\",\n :ip_address => \"#{host.addr}\",\n :port_num => port.num,\n :proto => port.proto,\n :fingerprint => \"#{port.service.name}\"})\n\n # Go ahead and create webapps if this is a known webapp port\n if entity.attributes[:proto] == \"tcp\" &&\n [80,443,8080,8081,8443].include?(entity.attributes[:port_num])\n\n # determine if this is an SSL application\n ssl = true if [443,8443].include?(entity.attributes[:port_num])\n protocol = ssl ? \"https://\" : \"http://\" # construct uri\n uri = \"#{protocol}#{host.addr}:#{entity.attributes[:port_num]}\"\n _create_entity(\"Uri\", :name => uri, :uri => uri ) # create an entity\n\n # and create the entities if we have dns\n host.hostnames.each do |hostname|\n uri = \"#{protocol}#{hostname}:#{entity.attributes[:port_num]}\"\n _create_entity(\"Uri\", :name => uri )\n end\n\n end # end if\n\n end # end host.getports\n end # end tcp/udp\n end # end parser\n\n # Clean up!\n begin\n File.delete(temp_file)\n rescue Errno::EPERM\n @task_log.error \"Unable to delete file\"\n end\n\n end",
"def star_cluster; end",
"def make_outer_connections\n per_batch = 1000\n\n outer_neigh = Answer.where(:question_id.ne => self.question_id, :team_id => self.team_id).shuffle[0..99]\n\nouter_neigh.each do |a|\n #0.step(outer_neigh.count, per_batch) do |offset|\n # outer_neigh.limit(per_batch).skip(offset).each do |a|\n if self.id != a.id\n SimilarityMachine::create_connection(self,a)\n end\n # end\n #end\nend\n\n true\n end",
"def nodetool_status()\n out = `/opt/cassandra/bin/nodetool status`\n raise 'nodetool status failed' if $? != 0\n rows = out.split(\"\\n\")\n hash = {}\n dc_exp = /Datacenter: (.*)/\n #vnode\n #-- Address Load Tokens Owns Host ID Rack\n #non-vnode\n #-- Address Load Owns Host ID Token Rack\n #node_ex = /^(?<status>[UD\\?][NLJM]) +(?<address>(?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +(?<load>(\\d+\\.?\\d* (TB|GB|MB|KB|bytes))|\\?) +(?<tokens>\\d+) +(?<owns>(\\d+\\.?\\d*%|\\?)) +(?<hostid>[a-z0-9\\-]+) +(?<rack>.*)$/\n node_ex = /^([UD\\?][NLJM]) +((?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +((?:\\d+\\.?\\d* (?:TB|GB|MB|KB|bytes))|\\?) +(\\d+) +(\\d+\\.?\\d*%|\\?) +([a-z0-9\\-]+) +(.*)$/\n datacenter = nil\n rows.each do |row|\n m = dc_exp.match(row)\n if m\n datacenter = m[1]\n next\n end\n m = node_ex.match(row)\n next if m == nil\n node = {'datacenter' => datacenter}\n hash[m[2]] = node\n i = 0\n %w(status address load tokens owns hostid rack).each do |name|\n node[name] = m[i += 1]\n end\n # m.names.each do |name|\n # node[name] = m[name]\n # end\n end\n return hash\n end",
"def reindex_everything(repo, query = '')\n i = 0\n repo.search(query) do |object|\n next if object.pid.start_with?('fedora-system:')\n i += 1\n next if i < start_at\n puts \"I: #{i}\"\n begin\n @solr_conn.add index_digital_object(object)\n rescue Rubydora::FedoraInvalidRequest => e\n puts \"ERROR #{e}\"\n end\n @solr_conn.commit(softCommit: true) if i % 100 == 0\n end\n @solr_conn.commit\nend",
"def log_nodes_count\n @max_nodes += 1\n end",
"def create_database\n options = { database: Orientdb::ORM.connection_uri.database, user: Orientdb::ORM.connection_uri.user, password: Orientdb::ORM.connection_uri.password, type: :graph, storage: :memory }\n Orientdb::ORM.with { |conn| conn.client.create_database( options ) }\nend",
"def initialize_db_schema\n @db.exec(\n 'create table if not exists nodes\n (\n id SERIAL PRIMARY KEY,\n host VARCHAR(256) UNIQUE,\n last_seen TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n current_report INTEGER\n );\n\n create table if not exists collections\n (\n id SERIAL PRIMARY KEY,\n collection VARCHAR(256) NOT NULL,\n archived BOOL DEFAULT FALSE\n );\n\n create table if not exists reports\n (\n id SERIAL PRIMARY KEY,\n node_id INTEGER NOT NULL,\n file_handle INTEGER,\n status INTEGER NOT NULL,\n collection INTEGER NOT NULL,\n time TIMESTAMP NOT NULL,\n resources_changed INTEGER NOT NULL,\n resources_failed INTEGER NOT NULL,\n resources_total INTEGER NOT NULL,\n runtime REAL NOT NULL,\n new_report BOOL DEFAULT FALSE,\n FOREIGN KEY (node_id) REFERENCES nodes (id),\n FOREIGN KEY (collection) REFERENCES collections(id)\n );\n\n create table if not exists schemaversion\n (\n id SERIAL PRIMARY KEY,\n complete BOOL DEFAULT FALSE,\n comment VARCHAR(256) NOT NULL\n );\n create table if not exists reportdata\n (\n id SERIAL PRIMARY KEY,\n report bytea\n );\n '\n )\n end",
"def get_node_launch_command(node_info, mode, offset, nw_name)\n pwd = `pwd`.gsub(/\\n+/,\"\")\n ds = node_info.dir_structure\n if :docker.eql? mode\n docker_rpc_port = 6666\n docker_api_port = 7777\n \"docker run \\\n --name #{node_info.id} \\\n --hostname #{node_info.id} \\\n -e NODE_ID=#{node_info.id} \\\n -e ELECTION_TIMEOUT_MILLIS=3000 \\\n --mount type=bind,source=#{pwd}/#{ds.log},target=/node/cluster-data/log \\\n --mount type=bind,source=#{pwd}/#{ds.state},target=/node/cluster-data/state \\\n --mount type=bind,source=#{pwd}/#{ds.snapshot},target=/node/cluster-data/snapshot \\\n --mount type=bind,source=#{pwd}/#{ds.cluster},target=/node/cluster-data/cluster,readonly \\\n -p #{docker_api_port + offset}:#{docker_api_port} \\\n --network=#{nw_name} \\\n raft:local \\\n \".gsub(/\\s+/, \" \")\n else\n \"./raft \n --id=#{node_info.id} \\\n --api-port=#{node_info.api_port} \\\n --rpc-port=#{node_info.rpc_port} \\\n --log-entry-path=#{ds.log} \\\n --log-metadata-path=#{ds.log}/metadata.json \\\n --raft-state-path=#{ds.state}/state.json \\\n --election-timeout=3000 \\\n --rpc-timeout=2000 \\\n --api-timeout=2000 \\\n --api-fwd-timeout=1500 \\\n --max-conn-retry-attempts=5 \\\n --snapshot-path=#{ds.snapshot} \\\n --cluster-config-path=#{ds.cluster}/config.json \\\n \".gsub(/\\s+/, \" \")\n end\nend",
"def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend",
"def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend",
"def full_analysis\n Repository::Config.setup_repo @repo, @log, @process, @type\n Rails.logger.debug \"01 - Done setting up initial path - LOG\"\n init_repo\n Rails.logger.debug \"02 - Done initializing codeclimat config - LOG\"\n exclude_files\n Rails.logger.debug \"03 - Done excluding files - LOG\"\n report_json = analyze_repo\n Rails.logger.debug \"04 - Done analyzing repository - LOG\"\n store_data report_json\n Rails.logger.debug \"05 - Done storing data - LOG\"\n calculate_results\n Rails.logger.debug \"06 - Done calculating result - LOG\"\n rescue => e\n Rails.logger.debug e.backtrace.to_s + \" ----- \" + e.to_s\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.update(clone_path: nil)\n repo_name = @repo.repo_name.gsub(/[.]+/, '-') || @repo.repo_name\n FileUtils.rm_rf(Rails.root.join('storage', 'repos', @repo.username, @repo.supplier_project_id.to_s, repo_name, @repo.current_branch))\n end\n end",
"def common_nodes(remote, opts={:heads => nil, :force => nil, :base => nil})\n # variable prep!\n node_map = changelog.node_map\n search = []\n unknown = []\n fetch = {}\n seen = {}\n seen_branch = {}\n opts[:base] ||= {}\n opts[:heads] ||= remote.heads\n \n # if we've got nothing...\n if changelog.tip == NULL_ID\n opts[:base][NULL_ID] = true # 1 is stored in the Python\n \n return [NULL_ID], [NULL_ID], opts[:heads].dup unless opts[:heads] == [NULL_ID]\n return [NULL_ID], [], [] # if we didn't trip ^, we're returning this\n end\n \n # assume we're closer to the tip than the root\n # and start by examining heads\n UI::status 'searching for changes'\n \n opts[:heads].each do |head|\n if !node_map.include?(head)\n unknown << head\n else\n opts[:base][head] = true # 1 is stored in the Python\n end\n end\n \n opts[:heads] = unknown # the ol' switcheroo\n return opts[:base].keys, [], [] if unknown.empty? # BAIL\n \n # make a hash with keys of unknown\n requests = Hash.with_keys unknown\n count = 0\n \n # Search through the remote branches\n # a branch here is a linear part of history, with 4 (four)\n # parts:\n #\n # head, root, first parent, second parent\n # (a branch always has two parents (or none) by definition)\n #\n # Here's where we start using the Hashes instead of Arrays\n # trick. Keep an eye out for opts[:base] and opts[:heads]!\n unknown = remote.branches(*unknown)\n until unknown.empty?\n r = []\n \n while node = unknown.shift\n next if seen.include?(node[0])\n UI::debug \"examining #{short node[0]}:#{short node[1]}\"\n \n if node[0] == NULL_ID\n # Do nothing...\n elsif seen_branch.include? node\n UI::debug 'branch already found'\n next\n elsif node_map.include? node[1]\n UI::debug \"found incomplete branch #{short node[0]}:#{short node[1]}\"\n search << node[0..1]\n seen_branch[node] = true # 1 in the python\n else\n unless seen.include?(node[1]) || fetch.include?(node[1])\n if node_map.include?(node[2]) and node_map.include?(node[3])\n UI::debug \"found new changset #{short node[1]}\"\n fetch[node[1]] = true # 1 in the python\n end # end if\n \n node[2..3].each do |p|\n opts[:base][p] = true if node_map.include? p\n end\n end # end unless\n \n node[2..3].each do |p|\n unless requests.include?(p) || node_map.include?(p)\n r << p\n requests[p] = true # 1 in the python\n end # end unless\n end # end each\n end # end if\n \n seen[node[0]] = true # 1 in the python\n end # end while\n \n unless r.empty?\n count += 1\n \n UI::debug \"request #{count}: #{r.map{|i| short i }}\"\n \n (0 .. (r.size-1)).step(10) do |p|\n remote.branches(r[p..(p+9)]).each do |b|\n UI::debug \"received #{short b[0]}:#{short b[1]}\"\n unknown << b\n end\n end\n end # end unless\n end # end until\n \n # sorry for the ambiguous variable names\n # the python doesn't name them either, which\n # means I have no clue what these are\n find_proc = proc do |item1, item2|\n fetch[item1] = true\n opts[:base][item2] = true\n end\n \n # do a binary search on the branches we found\n search, new_count = *binary_search(:find => search,\n :repo => remote,\n :node_map => node_map,\n :on_find => find_proc)\n count += new_count # keep keeping track of the total\n \n # sanity check, because this method is sooooo fucking long\n fetch.keys.each do |f|\n if node_map.include? f\n raise RepoError.new(\"already have changeset #{short f[0..3]}\")\n end\n end\n \n if opts[:base].keys == [NULL_ID]\n if opts[:force]\n UI::warn 'repository is unrelated'\n else\n raise RepoError.new('repository is unrelated')\n end\n end\n \n UI::debug \"found new changesets starting at #{fetch.keys.map{|f| short f }.join ' '}\"\n UI::debug \"#{count} total queries\"\n \n # on with the show!\n [opts[:base].keys, fetch.keys, opts[:heads]]\n end",
"def run\n sleep INTERVAL\n loop do\n start = Time.now\n @db.purge\n first_id = @db_id_seen+1\n @db_id_seen, records = @db.nodes_down(first_id)\n sleep INFLIGHT_WAIT\n records = records.all\n @graphite.add @db.id_range(first_id, @db_id_seen).all if @graphite\n @buffer.push records.map { |record| record.peer }\n @buffer.exceed_median? ? @alarm.set(@buffer) : @alarm.clear(@buffer)\n delay = INTERVAL-(Time.now-start)\n # in case delay happens to be too big\n if delay > INTERVAL\n delay = INTERVAL\n Log.warn \"delay became larger than #{INTERVAL}, capping it. (did ntp just sync?)\"\n end\n if delay > 0\n sleep delay\n else\n Log.error \"Analyzer loop took longer than #{INTERVAL}, wanted to sleep for #{delay}s\"\n end\n end\n end",
"def build_issue_graph\n load_issues()\n\n # Then get the epics and their included tickets.\n load_epics()\n\n # Then the dependencies\n load_dependencies()\n\n # Pick a color for the issue, based on repository.\n color_issues_by_repo()\n end",
"def fillDatabaseWithCSV(fileName)\n\n nbrSentences = 0\n tempSentence = nil\n \n File.open(fileName).each_line do |line| \n \n if line.nil? \n return\n end\n # don't handle line starting with #\n if line[0].chr == \"#\"\n next\n end\n columns = line.split(';\"')\n \n if !columns.empty?\n transaction = nil\n # We start the transaction every 1000 sentences\n # otherwise it either to slow if we done one transaction\n # per sentence, or it run out of memory if we try to load\n # all the 300 000 sentences in one transaction\n #\n # TODO find a better way to do this\n \n if (nbrSentences.modulo 10000).equal? 0\n Neo4j::Transaction.new\n end\n tempSentence = Sentence.new\n tempSentence.text = columns.last[0..-4]\n tempSentence.lang = columns[1][0..-2];\n tempSentence.sentenceId = columns.first[1..-2]\n \n \n if (nbrSentences.modulo 10000).equal? 9999\n Neo4j::Transaction.finish\n end\n nbrSentences += 1\n end\n end\nend",
"def _load_node(neo_id)\n return nil if neo_id.nil?\n @graph_db.get_node_by_id(neo_id.to_i)\n rescue Java::OrgNeo4jGraphdb.NotFoundException\n nil\n end",
"def nodes\n @conn.nodes\n end",
"def fetch_cumulative_graph\n Graphs::CumulativeWorker.perform_async(@board.id, encrypted_github_token)\n end",
"def collect_and_compare_queries!(tcpdump_time=30, *compare_nodes)\n # Sample traffic and convert to slowlog for master\n master_dump_filename = master.tcpdump!(tcpdump_time)\n local = Host.local # node where we're running Jetpants from\n local.ssh_cmd \"mkdir -p #{Jetpants.export_location}\"\n master.fast_copy_chain(Jetpants.export_location, local, files: master_dump_filename, overwrite: true)\n master.ssh_cmd \"rm #{Jetpants.export_location}/#{master_dump_filename}\"\n master_slowlog_path = local.dumpfile_to_slowlog(\"#{Jetpants.export_location}/#{master_dump_filename}\")\n \n # If we also have an active slave running, grab sampled slowlog from there too\n active_slowlog_path = nil\n if active_slaves.size > 0\n active_slave = active_slaves.first\n active_dump_filename = active_slave.tcpdump!(tcpdump_time)\n active_slave.fast_copy_chain(Jetpants.export_location, local, files: active_dump_filename, overwrite: true)\n active_slave.ssh_cmd \"rm #{Jetpants.export_location}/#{active_dump_filename}\"\n active_slowlog_path = local.dumpfile_to_slowlog(\"#{Jetpants.export_location}/#{active_dump_filename}\")\n end\n \n # Gather our comparison nodes\n if compare_nodes.size == 0\n higher_ver_standby = standby_slaves.select {|s| s.version_cmp(master) > 0}.first\n same_ver_standby = standby_slaves.select {|s| s.version_cmp(master) == 0}.first\n if higher_ver_standby && same_ver_standby\n compare_nodes = [same_ver_standby, higher_ver_standby]\n else\n compare_nodes = standby_slaves[0, 2]\n end\n end\n \n # Disable monitoring on our comparison nodes, and then stop replication\n # at the same position. We only proceed with this if we're comparing\n # exactly two nodes; this may be improved in a future release.\n if compare_nodes.size == 2\n compare_nodes.each {|n| n.disable_monitoring}\n compare_nodes.first.pause_replication_with(compare_nodes.last)\n end\n \n # Run pt-upgrade using the master dumpfile\n puts\n output \"COMPARISON VIA QUERY LOG FROM MASTER\"\n compare_queries(master_slowlog_path, true, *compare_nodes)\n \n if active_slowlog_path\n puts\n output \"COMPARISON VIA QUERY LOG FROM ACTIVE SLAVE\"\n compare_queries(active_slowlog_path, true, *compare_nodes)\n end\n \n # If we previously paused replication and disabled monitoring, un-do this\n if compare_nodes.size == 2\n compare_nodes.concurrent_each do |n| \n n.resume_replication\n n.catch_up_to_master\n n.enable_monitoring\n end\n end\n end",
"def get_true_node_objects get_all_nodes=false\r\n nodes, all_nodes, names, iter_arr, file_cache_nodes, h = [],[],[],[],[],{}\r\n\r\n @config['chef_nodes'] = @config['ridley'].node.all\r\n\r\n @config['helper'].completion_rate? 0, __method__\r\n\r\n file_cache_nodes = @config['filesystem'].check_nodes_file_cache if @config['filesystem'].compare_file_node_cache_against_chef_nodes('equal')\r\n\r\n @config['chef_nodes'].each do |n|\r\n true_obj = if !file_cache_nodes.empty? && @config['parser'].array_of_nodes_contains_node_name?(file_cache_nodes, n.name)\r\n file_cache_nodes[@config['parser'].index_of_node_name_in_array_of_nodes(file_cache_nodes, n.name)]\r\n else\r\n @config['filesystem'].cleanup_file_caches('current-nodes')\r\n\r\n @config['ridley'].node.find(n.name)\r\n end\r\n\r\n iter_arr << n.name\r\n\r\n progress_value = (( iter_arr.length.to_f/@config['chef_nodes'].length.to_f )*100 ).floor\r\n\r\n @config['helper'].completion_rate? progress_value, __method__\r\n\r\n all_nodes << true_obj\r\n\r\n next if !get_all_nodes && true_obj.chef_environment != @options['env'] && true_obj.chef_environment != '_default'\r\n\r\n if get_all_nodes\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['role'] == 'all'\r\n next if true_obj.chef_environment == '_default'\r\n\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['node_name'] && true_obj.name == @options['node_name']\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n if @options['address'] && true_obj.public_ipaddress == @options['address']\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next\r\n end\r\n\r\n unless ( @options['address'] || @options['node_name'] )\r\n if true_obj.run_list.include?(\"role[#{ @options['role'] }]\")\r\n h[n.name] = true_obj\r\n names << n.name\r\n\r\n next #not needed here but good to keep in mind\r\n end\r\n end\r\n end\r\n\r\n names.sort.each { |name| nodes << h[name] }\r\n\r\n @config['filesystem'].write_nodes_file_cache(all_nodes) unless @config['filesystem'].compare_file_node_cache_against_chef_nodes('equal')\r\n\r\n puts(\"\") unless @options['quiet']\r\n \r\n nodes\r\n end",
"def populatemongonetwork\n \n db = Mongo::Connection.new(\"localhost\", 27017).db(\"networks\")\n \n #coll = db.collection(\"masterNetwork\")\n \n Network.where(\"degree=1\").find_each(:batch_size => 5000) do |network| \n coll = db.collection(network['facebook_id'])\n #doc = {\"_id\"=> User.find_by_facebook_id(network['friend_id']).id, \"d\"=>network['degree']}\n doc = {\"_id\"=> network['friend_id'], \"d\"=>network['degree']}\n coll.insert(doc) \n end\n \nend",
"def _test_replicate(sql)\n sql = [ sql ] unless sql.is_a? Enumerable\n connection do |c|\n c.query \"select setval('t_seq', 1, false)\"\n sql.each do |q|\n c.query q\n end\n end\n\n config['backend']['nodes'].map do |node|\n PGconn.open(:port => node['port'], :dbname => @dbname) do |c|\n break c.query(\"select nextval('t_seq')\")[0]\n end\n end\n end",
"def create_index_with(type, index_name)\n db = Neo4j.started_db\n index_config = lucene_config(type)\n if config.entity_type == :node\n db.lucene.for_nodes(index_name, index_config)\n else\n db.lucene.for_relationships(index_name, index_config)\n end\n end",
"def status()\n\tneighbors = []\n $neighbors.each do |node, distance|\n neighbors << node\n end\n neighbors.sort\n msg = \"Name: \" + $hostname + \"\\n\"\n msg += \"Port: \" + $port + \"\\n\"\n msg += \"Neighbors: \" \n neighbors.each do |node|\n msg += node + \",\"\n end\n if msg[-1] == \",\"\n msg = msg.chop\n end\n STDOUT.puts msg\nend",
"def make_inner_connections\n per_batch = 1000\n\n inner_neigh = Answer.where(:question_id => self.question_id, :team_id => self.team_id).shuffle[0..99]\n\ninner_neigh.each do |a|\n #0.step(inner_neigh.count, per_batch) do |offset|\n # inner_neigh.limit(per_batch).skip(offset).each do |a|\n if self.id != a.id\n SimilarityMachine::create_connection(self,a)\n end\n #end\n # end\nend\n\n true\n end",
"def skip_schema_queries; end",
"def analysis(fin, fout, fhint, furls, fdefmaps, fskip, franges)\n sort_col = 'authors'\n forks = ENV.has_key? 'INCLUDE_FORKS'\n unless forks\n require 'json'\n require 'octokit'\n require './ghapi'\n gcs = octokit_init()\n hint = rate_limit(gcs)[0]\n fork_data = {}\n $g_forks_file = ENV['FORKS_FILE'] if ENV.key? 'FORKS_FILE'\n begin\n data = JSON.parse File.read $g_forks_file\n data.each do |row|\n repo = row[0]\n is_fork = row[1]\n fork_data[repo] = is_fork\n end\n rescue => err\n STDERR.puts [err.class, err]\n end\n Signal.trap('INT') do\n puts \"Caught signal, saving forks cache\"\n pretty = JSON.pretty_generate fork_data\n File.write $g_forks_file, pretty\n puts \"Saved\"\n exit 1\n end\n end\n # Repos, Orgs and Projects to skip\n skip_repos = {}\n skip_orgs = {}\n skip_projs = {}\n CSV.foreach(fskip, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n org = (h['org'] || '').strip\n repo = (h['repo'] || '').strip\n proj = (h['project'] || '').strip\n if org.length > 0\n orgs = org.split(',')\n orgs.each do |o|\n if skip_orgs.key?(o)\n puts \"Duplicate skip org entry: #{o}\"\n return\n end\n skip_orgs[o] = true\n end\n end\n if repo.length > 0\n reps = repo.split(',')\n reps.each do |r|\n if skip_repos.key?(r)\n puts \"Duplicate skip repo entry: #{r}\"\n return\n end\n skip_repos[r] = true\n end\n end\n if proj.length > 0\n projs = proj.split(',')\n projs.each do |p|\n if skip_projs.key?(p)\n puts \"Duplicate skip project entry: #{p}\"\n return\n end\n skip_projs[p] = true\n end\n end\n end\n\n # Min/Max ranges for integer columns (with exceptions)\n ranges = {}\n CSV.foreach(franges, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n key = h['key'].strip\n min = h['min'].strip\n max = h['max'].strip\n exc = (h['exceptions'] || '').strip\n rps = {}\n ors = {}\n excs = exc.split(',')\n excs.each do |ex|\n next if ex == ''\n if ex.include?('/')\n if rps.key?(ex)\n puts \"Duplicate exception repo entry: #{ex}\"\n return\n end\n rps[ex] = true\n else\n if ors.key?(ex)\n puts \"Duplicate exception org entry: #{ex}\"\n return\n end\n ors[ex] = true\n end\n end\n if ranges.key?(key)\n puts \"Duplicate ranges key: #{key}\"\n return\n end\n ranges[key] = [min.to_i, max.to_i, ors, rps]\n end\n\n # Repo --> Project mapping\n hints_comments = []\n File.readlines(fhint).each do |line|\n hints_comments << line if line[0] == '#'\n end\n\n projects = {}\n CSV.foreach(fhint, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n proj = (h['project'] || '').strip\n repo = (h['repo'] || '').strip\n if proj == '' || repo == ''\n puts \"Invalid hint: project='#{proj}' repo='#{repo}'\"\n return\n end\n if projects.key?(repo)\n if projects[repo] != proj\n puts \"Non unique entry: projects: projects['#{repo}'] = '#{projects[repo]}', new value: #{proj}\"\n else\n puts \"Duplicate entry: projects: projects['#{repo}'] = '#{projects[repo]}'\"\n end\n return\n end\n projects[repo] = proj\n end\n\n # Sort hints files on the fly (program user manually updates that file while working so it should be sorted all the time)\n hdr = ['repo', 'project']\n CSV.open(fhint, \"w\", headers: hdr) do |csv|\n csv << hdr\n projects.keys.sort.each do |repo|\n csv << [repo, projects[repo]]\n end\n end\n\n File.open(fhint, 'a') do |file|\n hints_comments.sort.each { |comment| file.write(comment) }\n end\n\n # Project --> URL mapping (it uses final project name after all mappings, including defmaps.csv)\n urls_comments = []\n File.readlines(furls).each do |line|\n urls_comments << line if line[0] == '#'\n end\n\n urls = {}\n CSV.foreach(furls, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n proj = (h['project'] || '').strip\n url = (h['url'] || '').strip\n if proj == '' || url == ''\n puts \"Invalid URL: project='#{proj}' url='#{url}'\"\n return\n end\n if urls.key?(proj)\n if urls[proj] != url\n puts \"Non unique entry: urls: urls['#{proj}'] = '#{urls[proj]}', new value: #{url}\"\n else\n puts \"Duplicate entry: urls: urls['#{proj}'] = '#{urls[proj]}'\"\n end\n return\n end\n urls[proj] = url\n end\n\n # Sort URLs files on the fly (program user manually updates that file while working so it should be sorted all the time)\n hdr = ['project', 'url']\n CSV.open(furls, \"w\", headers: hdr) do |csv|\n csv << hdr\n urls.keys.sort.each do |project|\n csv << [project, urls[project]]\n end\n end\n\n File.open(furls, 'a') do |file|\n urls_comments.sort.each { |comment| file.write(comment) }\n end\n\n # Final name --> new name mapping (defmaps)\n # Used to create better names for projects auto generated just from org or repo name\n # And/Or to group multiple orgs, repos, projects or combinations of all into single project\n # For example we can create \"XYZ\" project for sum of \"Kubernetes\" and \"dotnet\" via:\n # name,project\n # Kubernetes,XYZ\n # dotnet,XYZ\n defmaps_comments = []\n File.readlines(fdefmaps).each do |line|\n defmaps_comments << line if line[0] == '#'\n end\n\n defmaps = {}\n skip_group = {}\n CSV.foreach(fdefmaps, headers: true) do |row|\n next if is_comment row\n h = row.to_h\n name = (h['name'] || '').strip\n project = (h['project'] || '').strip\n if project == '' || name == ''\n puts \"Invalid defmap: project='#{project}' name='#{name}'\"\n return\n end\n\n # Handle skip groupping this org\n if project.downcase == '=skip'\n project = project[1..-1]\n if skip_group.key?(name)\n puts \"Duplicate entry: defmaps: skip_group['#{name}']\"\n return\n end\n skip_group[name] = true\n next\n end\n\n if defmaps.key?(name)\n if defmaps[name] != project\n puts \"Non unique entry: defmaps: defmaps['#{name}'] = '#{defmaps[name]}', new value: #{project}\"\n else\n puts \"Duplicate entry: defmaps: defmaps['#{name}'] = '#{defmaps[name]}'\"\n end\n return\n end\n defmaps[name] = project\n end\n\n # Sort defmaps files on the fly (program user manually updates that file while working so it should be sorted all the time)\n hdr = ['name', 'project']\n CSV.open(fdefmaps, \"w\", headers: hdr) do |csv|\n csv << hdr\n skip_group.keys.sort.each do |name|\n csv << [name, '=SKIP']\n end\n defmaps.keys.sort.each do |name|\n csv << [name, defmaps[name]]\n end\n end\n\n File.open(fdefmaps, 'a') do |file|\n defmaps_comments.sort.each { |comment| file.write(comment) }\n end\n\n # Missing URLs: will abort program: if somebody care to define some project (via hints, defmaps or whatever) then let's force him/her to define project URL as well\n # This won't complain about autogenerated projects (like sum of org repos etc)\n urls_found = true\n projects.values.uniq.each do |project|\n unless urls.key? project\n puts \"Project '#{project}' have no URL defined, aborting\"\n urls_found = false\n end\n end\n defmaps.values.uniq.each do |project|\n unless urls.key? project\n puts \"Defmap Project '#{project}' have no URL defined, aborting\"\n urls_found = false\n end\n end\n return unless urls_found\n\n # Analysis:\n # Get repo name from CSV row\n # If repo found in projects set mode to \"project\" and groupping\n # If project not found and \"org\" is present set mode to \"org\" and groupping\n # If mode not determined yet set it to repo\n # Now check if final project key (project, org or repo) is in additional mapping\n # Additional mapping is used to:\n # create better name for data groupped by org (when default is enough) like org = \"aspnet\" --> ASP.net\n # group multiple orgs and orgs with repos into single project\n orgs = {}\n project_counts = {}\n all_repos = {}\n n_rows = CSV.foreach(fin, headers: true).count\n CSV.foreach(fin, headers: true).with_index do |row, i|\n next if is_comment row\n h = row.to_h\n\n # skip repos & orgs\n repo = h['repo']\n unless forks\n hint, is_fork = is_fork?(gcs, hint, fork_data, repo, i, n_rows)\n next if is_fork\n end\n all_repos[repo] = true\n next if skip_repos.key? repo\n org = h['org']\n next if skip_orgs.key? org\n\n a = h['authors']\n if a[0] == '=' && a[1..-1].to_i > 0\n n = a[1..-1].to_i\n h['authors'] = (1..n).to_a.join(',')\n end\n a = h['authors_alt1']\n if a[0] == '=' && a[1..-1].to_i > 0\n n = a[1..-1].to_i\n h['authors_alt1'] = (1..n).to_a.join(',')\n end\n\n # skip by values ranges\n skip = false\n ranges.each do |key, value|\n min_v, max_v, ors, rps = *value\n next if ors.key? org\n next if rps.key? repo\n\n unless key == 'authors'\n v = h[key].to_i\n else\n v = h[key].split(',').uniq.count\n end\n if min_v > 0 && v < min_v\n skip = true\n break\n end\n if max_v > 0 && v > max_v\n skip = true\n break\n end\n end\n next if skip\n\n k = h['project'] = projects[repo]\n mode = nil\n if k\n project_counts[k] = [0, []] unless project_counts.key?(k)\n project_counts[k][0] += 1\n project_counts[k][1] << repo\n mode = 'project'\n end\n\n # Is this org defined to skip groupping?\n org = nil if skip_group.key? org\n\n k = org unless k\n mode = 'org' if k && !mode\n k = h['repo'] unless k\n next unless k\n mode = 'repo' unless mode\n if defmaps.key? k\n k = defmaps[k]\n mode = 'defmap'\n end\n h['project'] = k\n h['mode'] = mode\n next if skip_projs.key?(k)\n\n orgs[k] = { items: [] } unless orgs.key? k\n h.each do |p, v|\n vi = v.to_i\n vis = vi.to_s\n h[p] = vi if vis == v\n end\n orgs[k][:items] << h\n end\n\n unless forks\n pretty = JSON.pretty_generate fork_data\n File.write $g_forks_file, pretty\n end\n\n orgs.each do |name, org|\n org[:sum] = {}\n org[:items].each do |repo|\n repo.each do |k, v|\n if ['authors', 'authors_alt1'].include? k\n if org[:sum].key? k\n org[:sum][k] += ',' + v.to_s\n else\n org[:sum][k] = v.to_s\n end\n next\n end\n if v.is_a?(String)\n if repo['org'] && k == 'repo' && v.include?('/')\n v = v.split('/')[1]\n end\n if org[:sum].key? k\n v = '' if v.nil?\n org[:sum][k] = '' if org[:sum][k].nil?\n org[:sum][k] += '+' + v\n else\n org[:sum][k] = v \n end\n elsif v.is_a?(Integer)\n org[:sum][k] = 0 unless org[:sum].key? k\n binding.pry if org[:sum][k].nil?\n org[:sum][k] += v\n else\n org[:sum][k] = nil\n end\n end\n end\n new_org = org[:sum]['org'].to_s\n org[:sum]['org'] = new_org.split('+').uniq.join('+') if new_org\n new_prj = org[:sum]['project'].to_s\n org[:sum]['project'] = new_prj.split('+').uniq.join('+') if new_prj\n new_mode = org[:sum]['mode']\n org[:sum]['mode'] = new_mode.split('+').uniq.join('+') if new_mode\n org[:sum]['authors'] = org[:sum]['authors'].split(',').uniq.count\n if org[:sum]['authors'] < 1\n puts \"WARNING: data from BigQuery truncated, no authors on current org: #{org[:sum]['project']}\"\n alt1 = org[:sum]['authors_alt1'].split(',').uniq.count\n if alt1 > 1\n puts \"Alternate value used: #{alt1}\"\n org[:sum]['authors'] = alt1\n else\n puts \"Very Alternate value used: #{org[:sum]['authors_alt2']}\"\n org[:sum]['authors'] = org[:sum]['authors_alt2']\n end\n binding.pry\n end\n end\n\n # Sort by sort_col desc to get list of top projects\n orgs_arr = []\n orgs.each do |name, org|\n orgs_arr << [name, org[:sum][sort_col], org]\n end\n\n res = orgs_arr.sort_by { |item| -item[1] }\n\n # now create list of projects missing URL (`miss` variable to be seen in debugger)\n # but only display and stop in debugger if any missing URL in top 50\n # so if no URL is missing in Top 50 projects, it won't stop at this point, but missing URLs\n # for projects >50th will still be in `miss` variable\n no_url = false\n miss = []\n unmapped = {}\n ract = {}\n rcomm = {}\n rauth = {}\n rauth1 = {}\n rauth2 = {}\n rprs = {}\n riss = {}\n rpush = {}\n res.each_with_index do |item, index|\n sum = item[2][:sum]\n project = sum['project']\n ract[project] = item[2][:items].map { |i| [i['activity'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rcomm[project] = item[2][:items].map { |i| [i['commits'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rauth[project] = item[2][:items].map { |i| [i['authors'].split(',').uniq.count, i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rprs[project] = item[2][:items].map { |i| [i['prs'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n riss[project] = item[2][:items].map { |i| [i['issues'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rpush[project] = item[2][:items].map { |i| [i['pushes'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rauth1[project] = item[2][:items].map { |i| [i['authors_alt1'].split(',').uniq.count, i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n rauth2[project] = item[2][:items].map { |i| [i['authors_alt2'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| \"#{i[1]},#{i[0]}\" }\n if !urls.key?(project)\n s = \"Project ##{index} (#{sum['mode']}, #{sum[sort_col]}) #{project} (#{sum['org']}) (#{sum['repo']}) have no URL defined\"\n if index <= 50\n unmapped[project] = item[2][:items].map { |i| [i['activity'], i['repo']] }.sort_by { |i| -i[0] }.map { |i| (\"%-8d\" % i[0]) + \" #{i[1]}\" }\n puts s\n no_url = true\n end\n miss << s\n sum['url'] = ''\n else\n sum['url'] = urls[project]\n end\n end\n puts \"Use `unmapped` to see what needs to be defined\" if no_url\n binding.pry if no_url\n\n puts 'res[0..30].map { |it| it[0] }'\n puts \"Defined projects: \"\n prjs = []\n project_counts.keys.sort.each do |k|\n prjs << \"#{k}: #{project_counts[k][0]}\"\n end\n prjs = prjs.join(', ')\n puts prjs\n\n # This is pretty print of what was found, it is displayed and program stops in debugger\n # To see all projects use `all variable` if ok type \"quit\" to exit debugger and save results\n puts \"Top:\"\n tops = res[0..40].map.with_index { |it, idx| \"#{idx}) #{it[0]} (#{it[2][:sum]['mode']} #{it[2][:sum]['url']}): #{it[1]} (#{it[2][:sum]['org']}) (#{it[2][:sum]['repo']})\" }\n all = res.map.with_index { |it, idx| \"#{idx}) #{it[0]} (#{it[2][:sum]['mode']} #{it[2][:sum]['url']}): #{it[1]} (#{it[2][:sum]['org']}) (#{it[2][:sum]['repo']})\" }\n puts tops\n puts \"`all` to see all data, `miss` to see missing project's urls, `ract['key'] to see `key`'s repos sorted by activity desc (also rcomm, rauth, rprs, riss, rpush for commits, authors, PRs, issues, pushes)\"\n puts \"Use `rauth[res[N][0]]` to examine what creates N-th top project, actually to have a good Top N data, You should define all data correctly for 0-N\"\n puts \"Or by project name `rauth[res[res.map { |i| i[0] }.index('project_name')][0]]`\"\n puts \"Project's index is: `res.map { |i| i[0] }.index('project_name')`, top N: `res.map { |i| i[0] }[0..N]`\"\n puts \"List of 'Google' repos that have > 10 authors: `rauth[res[res.map { |i| i[0] }.index('Google')][0]].select { |i| i.split(',')[1].to_i > 10 }.map { |i| i.split(',')[0] }.join(',')`\"\n puts \"See indices of projects contain something in name: `res.map.with_index { |e, i| [e, i] }.select { |e| e[0][0].include?('OpenStack') }.map { |e| \\\"\\#{e[1]} \\#{e[0][0]}\\\" }`\"\n puts \"Nice view Top 50: `res.map.with_index { |e,i| \\\"\\#{i+1} \\#{e[0]}\\\" }[0..49]`\"\n puts \"Dan loves it: `res[res.map { |i| i[0] }.index('Google Cloud')][2][:items].map { |i| [i['repo'], i['commits'], i['issues'], i['prs'], i['authors'].split(',').count] }.sort_by { |i| -i[1] }.map { |i| \\\"\\#{i[0]}, commits: \\#{i[1]}, issues: \\#{i[2]}, PRs: \\#{i[3]}, authors: \\#{i[4]}\\\" }`\"\n puts \"See Project's specific repo: `res[res.map { |i| i[0] }.index('openSUSE')][2][:items].select { |i| i['repo'] == 'openSUSE/kernel' }`\"\n puts \"Project's Repo's real authors count: `res[res.map { |i| i[0] }.index('openSUSE')][2][:items].select { |i| i['repo'] == 'openSUSE/kernel' }.first['authors'].split(',').count`\"\n puts 'Projects matching regexp: `res.map.with_index { |e, i| [e, i] }.select { |e| e[0][0].match(\"/cloud/i\".to_regexp) }.map { |e| \"#{e[1]} #{e[0][0]}\" }`'\n puts 'Projects and authors: `res.each_with_index.map { |r, i| [i+1, r[0], r[1]] }`'\n puts 'OpenStack analysis: `res.select { |r| r[0][0..8] == \\'OpenStack\\' }.map { |r| [r[0], r[1]] }`'\n\n binding.pry\n\n ks = res[0][2][:sum].keys - %w(mode authors_alt1 authors_alt2)\n CSV.open(fout, \"w\", headers: ks) do |csv|\n csv << ks\n res.each do |row|\n csv_row = []\n ks.each do |key|\n csv_row << row[2][:sum][key]\n end\n csv << csv_row\n end\n end\n\n CSV.open('reports/all_repos.csv', \"w\", headers: ['repo']) do |csv|\n csv << ['repo']\n all_repos.keys.sort.each do |repo|\n csv << [repo]\n end\n end\n\n # All projects summed\n return if res.count < 1\n numeric_keys = []\n res[0][2][:sum].keys.each do |key|\n obj = res[0][2][:sum]\n numeric_keys << key if obj[key].to_i.to_s == obj[key].to_s\n end\n numeric_keys -= %w(authors_alt1 authors_alt2)\n\n sum_proj = {}\n res.each do |proj|\n numeric_keys.each do |key|\n sum_proj[key] = 0 unless sum_proj.key?(key)\n sum_proj[key] += proj[2][:sum][key].to_i\n end\n end\n numeric_keys.each do |key1|\n numeric_keys.each do |key2|\n next if key1 == key2\n key = \"#{key1}/#{key2}\"\n sum_proj[key] = sum_proj[key2] == 0 ? Float::NAN : (sum_proj[key1].to_f / sum_proj[key2].to_f).round(4)\n end\n end\n\n # Save all projects summed numeric values and their ratios\n hdr = %w(key value)\n CSV.open('reports/sumall.csv', \"w\", headers: hdr) do |csv|\n csv << hdr\n sum_proj.each do |key, value|\n csv << [key, value]\n end\n end\nend",
"def node_cluster_id() ; info[:node_cluster] ; end",
"def inspector_started_query(query, inspector)\n puts(\"\")\n puts(\"Looking for related GitHub issues on #{inspector.repo_owner}/#{inspector.repo_name}...\")\n puts(\"Search query: #{query}\") if FastlaneCore::Globals.verbose?\n puts(\"\")\n end",
"def auto_discover_nodes!\n @servers = execute(:all_nodes)\n end",
"def enhance_data(arr)\n puts \"Enhancing data\"\n valscount = {}\n\n####\n if (use_store())\n require 'lib/four_store/store'\n store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/'\n\n\n arr.each do |pid|\n\n q = \"SELECT ?vals WHERE\n{{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/masterbrand> ?vals .} UNION\n{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/category> ?vals . } UNION \n{<http://www.bbc.co.uk/programmes/#{pid}#programme> \n<http://purl.org/ontology/po/genre> ?vals . } UNION \n{?vals <http://purl.org/ontology/po/episode>\n<http://www.bbc.co.uk/programmes/#{pid}#programme> . }}\"\n\n puts \"Making query for #{pid}\\n#{q}\"\n response = store.select(q)\n\n response.each do |r|\n url = r[\"vals\"]\n if(valscount[url]==nil)\n valscount[url]=1\n else\n count = valscount[url]\n count = count+1\n valscount[url]=count\n end\n end\n sleep 2\n end\n else\n#not store\n arr.each do |pid|\n\n url = \"http://www.bbc.co.uk/programmes/#{pid}.rdf\"\n puts \"pid url is #{url}\"\n #occassionally we get a duff pid\n\n m = ModelFactory.createDefaultModel()\n\n begin \n m.read(url)\n \n q = \"SELECT ?vals WHERE\n{{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/masterbrand> ?vals .} UNION\n{<http://www.bbc.co.uk/programmes/#{pid}#programme>\n<http://purl.org/ontology/po/category> ?vals . } UNION \n{<http://www.bbc.co.uk/programmes/#{pid}#programme> \n<http://purl.org/ontology/po/genre> ?vals . } UNION \n{?vals <http://purl.org/ontology/po/episode>\n<http://www.bbc.co.uk/programmes/#{pid}#programme> . }}\"\n puts \"Making query for #{pid}\\n#{q}\"\n\n qexec = QueryExecutionFactory.create(q, m) ;\n response = qexec.execSelect()\n# ResultSetFormatter.out(java.lang.System.out, response)\n response.each do |r|\n url = r.get(\"vals\").to_s\n puts \"got result #{url}\"\n if(valscount[url]==nil)\n valscount[url]=1\n else\n count = valscount[url]\n count = count+1\n valscount[url]=count\n end\n end\n rescue\n puts \"duff url, continuing\"\n end\n sleep 2\n end\n\n end\n pp valscount\n####\n return valscount\n end",
"def test_connected_false \n \ttest_neighbor = Node.new(4, \"d\")\n\n \tassert_nil @n.connected?\n end",
"def import_nodes(nodes)\n result = self.import(nodes)\n # node_ids = [] # could accumulate the ids and return the array, but this might cause problems when importing thousands of records. For now, not doing it.\n nodes.each do |n|\n node_id = n.latest_version_id\n # Must query the database to get the id of the imported node so that can be passed to the NodeIndexer job\n # AND so the resulting document in elasticsearch will have the _bindery_node_id value populated.\n # This adds the cost of a database query but allows us to run the elasticsearch import asynchronously...\n Bindery::Persistence::ElasticSearch::Node::NodeIndexer.perform_async(node_id)\n end\n result\n end",
"def nodes # :nodoc:\n return @nodes if defined?(@nodes) \n node_ids = (1..Configuration.numbers['total_nodes'])\n @nodes = node_ids.map do |id| \n {\n id: id,\n host: \"node_#{id}_#{Worker::VERSION}\"\n }.to_struct\n end\n end",
"def initialize(dataset)\n opts = dataset.opts\n eager_graph = opts[:eager_graph]\n @master = eager_graph[:master]\n requirements = eager_graph[:requirements]\n reflection_map = @reflection_map = eager_graph[:reflections]\n reciprocal_map = @reciprocal_map = eager_graph[:reciprocals]\n limit_map = @limit_map = eager_graph[:limits]\n @unique = eager_graph[:cartesian_product_number] > 1\n \n alias_map = @alias_map = {}\n type_map = @type_map = {}\n after_load_map = @after_load_map = {}\n reflection_map.each do |k, v|\n alias_map[k] = v[:name]\n after_load_map[k] = v[:after_load] unless v[:after_load].empty?\n type_map[k] = if v.returns_array?\n true\n elsif (limit_and_offset = limit_map[k]) && !limit_and_offset.last.nil?\n :offset\n end\n end\n\n # Make dependency map hash out of requirements array for each association.\n # This builds a tree of dependencies that will be used for recursion\n # to ensure that all parts of the object graph are loaded into the\n # appropriate subordinate association.\n @dependency_map = {}\n # Sort the associations by requirements length, so that\n # requirements are added to the dependency hash before their\n # dependencies.\n requirements.sort_by{|a| a[1].length}.each do |ta, deps|\n if deps.empty?\n dependency_map[ta] = {}\n else\n deps = deps.dup\n hash = dependency_map[deps.shift]\n deps.each do |dep|\n hash = hash[dep]\n end\n hash[ta] = {}\n end\n end\n \n # This mapping is used to make sure that duplicate entries in the\n # result set are mapped to a single record. For example, using a\n # single one_to_many association with 10 associated records,\n # the main object column values appear in the object graph 10 times.\n # We map by primary key, if available, or by the object's entire values,\n # if not. The mapping must be per table, so create sub maps for each table\n # alias.\n records_map = {@master=>{}}\n alias_map.keys.each{|ta| records_map[ta] = {}}\n @records_map = records_map\n\n datasets = opts[:graph][:table_aliases].to_a.reject{|ta,ds| ds.nil?}\n column_aliases = opts[:graph_aliases] || opts[:graph][:column_aliases] # SEQUEL5: Remove :graph_aliases support\n primary_keys = {}\n column_maps = {}\n models = {}\n row_procs = {}\n datasets.each do |ta, ds|\n models[ta] = ds.model\n primary_keys[ta] = []\n column_maps[ta] = {}\n row_procs[ta] = ds.row_proc\n end\n column_aliases.each do |col_alias, tc|\n ta, column = tc\n column_maps[ta][col_alias] = column\n end\n column_maps.each do |ta, h|\n pk = models[ta].primary_key\n if pk.is_a?(Array)\n primary_keys[ta] = []\n h.select{|ca, c| primary_keys[ta] << ca if pk.include?(c)}\n else\n h.select{|ca, c| primary_keys[ta] = ca if pk == c}\n end\n end\n @column_maps = column_maps\n @primary_keys = primary_keys\n @row_procs = row_procs\n\n # For performance, create two special maps for the master table,\n # so you can skip a hash lookup.\n @master_column_map = column_maps[master]\n @master_primary_keys = primary_keys[master]\n\n # Add a special hash mapping table alias symbols to 5 element arrays that just\n # contain the data in other data structures for that table alias. This is\n # used for performance, to get all values in one hash lookup instead of\n # separate hash lookups for each data structure.\n ta_map = {}\n alias_map.keys.each do |ta|\n ta_map[ta] = [records_map[ta], row_procs[ta], alias_map[ta], type_map[ta], reciprocal_map[ta]]\n end\n @ta_map = ta_map\n end",
"def getStatus(topo, domain)\r\n\r\n puts \"-----------------------------------------------\"\r\n if topo.include?(\":\")\r\n filename = topo.delete(\"[]\")\r\n t = Topology[\"#{filename}\"]\r\n else\r\n begin\r\n t = Topology.create(\"mytopo\", eval(topo))\r\n rescue Exception => e\r\n filename = topo.delete(\"[]\")\r\n t = Topology[\"#{filename}\"]\r\n end\r\n end\r\n d = (domain == \"default\") ? OConfig.domain : domain\r\n puts \" Testbed : #{d}\"\r\n url = \"#{OConfig[:tb_config][:default][:cmc_url]}/allStatus?domain=#{d}\"\r\n response = NodeHandler.service_call(url, \"Can't get node status from CMC\")\r\n doc = REXML::Document.new(response.body)\r\n doc.root.elements.each('//detail/*') { |e|\r\n attr = e.attributes\r\n x = attr['x'].to_i\r\n y = attr['y'].to_i\r\n state = attr['state']\r\n if t.nodesArr[x][y] == [x,y]\r\n puts \" Node n_#{x}_#{y} - State: #{state}\" \r\n end\r\n }\r\n puts \"-----------------------------------------------\"\r\nend",
"def nodes\n\t\t# Query the database\n\t\tnodeQuery = Node.select(:node_id)\n\t\t# Place the query in an array\n\t\tnodeArray = Array.new\n\t\tnodeQuery.each do |node|\n\t\t\tnodeArray.push [node.node_id]\n\t\tend\n\t\treturn nodeArray\n\tend",
"def get_or_create_node(conn, index, data)\n\n\tvalue = data.object.to_s.unpack('U*').pack('C*').force_encoding(\"UTF-8\")\n\turi = data.subject.to_s\n\n\t# look for node in the index\n\t#r = conn.get(\"/db/data/index/node/#{index}/name/#{URI.escape(value).gsub(\"?\",\"%3F\")}\")\n\tr = conn.get(\"/db/data/index/node/#{index}/uri/#{CGI.escape(uri)}\")\n\tnode = (JSON.parse(r.body).first || {})['self'] if r.status == 200\n\t\n\tunless node\n\t\t# no indexed node found, so create a new one\n\t\tr = conn.post(\"/db/data/node\", JSON.unparse({\"name\" => value, \"uri\" => uri}), HEADER)\n\n\t\tnode = (JSON.parse(r.body) || {})['self'] if [200, 201].include? r.status\n\t\t# add new node to an index\n\t\tnode_data = \"{\\\"uri\\\" : \\\"#{node}\\\", \\\"key\\\" : \\\"name\\\", \\\"value\\\" : \\\"#{value}\\\"}\"\n\t\tconn.post(\"/db/data/index/node/#{index}_names\", node_data, HEADER)\n\n\t\tnode_data = \"{\\\"uri\\\" : \\\"#{node}\\\", \\\"key\\\" : \\\"uri\\\", \\\"value\\\" : \\\"#{uri}\\\"}\"\n\t\tconn.post(\"/db/data/index/node/#{index}\", node_data, HEADER)\t\n\n\t\tnode_data = \"{\\\"uri\\\" : \\\"#{node}\\\", \\\"key\\\" : \\\"name\\\", \\\"value\\\" : \\\"#{value}\\\"}\"\t\t\n\t\tconn.post(\"/db/data/index/node/fulltext\",node_data,HEADER)\n\t\tconn.post(\"/db/data/index/node/#{index}_fulltext\",node_data,HEADER)\n\tend\n\tnode\nend",
"def build_dag(dataset)\n \n Scarcity::Dagger.new do\n \n # use the job statement to create nodes\n # job :head, 'null.submit'\n \n # jobs can take a block to specify dag configurations relevant to the node\n job :autorecon1, \"condorsurfer.submit\" do\n pre 'prejob.sh'\n post 'postjob.sh'\n vars :args => \"#{dataset.uniq} 1 -nuintensitycor-3T\",\n # vars :args => \"#{dataset.uniq} 1\",\n :exec => \"condorsurfer.sh\",\n :inputfiles => \"#{dataset.uniq}.tar.gz\"\n priority 5\n retries 3\n end\n\n job :autorecon2, \"condorsurfer.submit\" do\n pre 'prejob.sh'\n post 'postjob.sh'\n vars :args => \"#{dataset.uniq} 2\",\n :exec => \"condorsurfer.sh\",\n :inputfiles => \"freesurfer_results.tar.gz\"\n priority 5\n retries 3\n end\n \n job :autorecon3, \"condorsurfer.submit\" do\n pre 'prejob.sh'\n post 'postjob.sh'\n vars :args => \"#{dataset.uniq} 3\",\n :exec => \"condorsurfer.sh\",\n :inputfiles => \"freesurfer_results.tar.gz\"\n priority 5\n retries 3\n end\n \n breed :autorecon1, :children => :autorecon2\n breed :autorecon2, :children => :autorecon3\n \n # job :tail, 'null.submit'\n \n # breed parent nodes to define child nodes\n # breed :head, :children => :main\n # breed :main, :children => :tail\n\n end\n \nend",
"def dbsize\n on_each_node :dbsize\n end",
"def nodes\n TestLab::Node.all\n end",
"def dataset\n database.from(:robots)\n end",
"def install\n ENV[\"ENABLE_MONGODB\"] = \"0\"\n #ENV[\"LDFLAGS\"] = \"-all_load\"\n\n\n #ENV[\"ENABLE_MYSQL\"] = \"1\"\n #ENV[\"CC\"] = \"#{Formula[\"gcc\"].bin}/gcc-9\"\n #ENV[\"CXX\"] = \"#{Formula[\"gcc\"].bin}/g++-9\"\n #ENV[\"CFLAGS\"] = \"-I/usr/local/include\"\n #ENV[\"CXXFLAGS\"] = \"-I/usr/local/include\"\n #ENV[\"LDFLAGS\"] = \"-L/usr/local/lib\"\n\n cmake_args = %w[]\n cmake_args << \"-DUSE_STATIC_LIBRARIES=1\" if MacOS.version >= :sierra\n cmake_args << \"-DENABLE_MYSQL=0\"\n cmake_args << \"-DENABLE_IPO=0\" # WE have -- IPO/LTO not enabled.\n # cmake_args << \"-DLLVM_ENABLE_LTO=Thin\" # ????\n\n mkdir \"build\"\n # boost somehow is not populated with standard git commands, do manual forced fetch!\n system \"git\", \"submodule\", \"update\", \"--init\", \"--recursive\", \"--force\", \"contrib/boost\"\n cd \"build\" do\n system \"cmake\", \"..\", *cmake_args\n system \"ninja\"\n if MacOS.version >= :sierra\n #lib.install Dir[\"#{buildpath}/build/dbms/*.dylib\"]\n #lib.install Dir[\"#{buildpath}/build/contrib/libzlib-ng/*.dylib\"]\n end\n bin.install \"#{buildpath}/build/dbms/programs/clickhouse\"\n bin.install_symlink \"clickhouse\" => \"clickhouse-server\"\n bin.install_symlink \"clickhouse\" => \"clickhouse-client\"\n end\n\n mkdir \"#{var}/clickhouse\"\n\n inreplace \"#{buildpath}/dbms/programs/server/config.xml\" do |s|\n s.gsub! \"/var/lib/clickhouse/\", \"#{var}/clickhouse/\"\n s.gsub! \"/var/log/clickhouse-server/\", \"#{var}/log/clickhouse/\"\n s.gsub! \"<!-- <max_open_files>262144</max_open_files> -->\", \"<max_open_files>262144</max_open_files>\"\n end\n\n # Copy configuration files\n mkdir \"#{etc}/clickhouse-client/\"\n mkdir \"#{etc}/clickhouse-server/\"\n mkdir \"#{etc}/clickhouse-server/config.d/\"\n mkdir \"#{etc}/clickhouse-server/users.d/\"\n\n #there is no client config as of Sept 2017\n #(etc/\"clickhouse-client\").install \"#{buildpath}/dbms/src/Client/config.xml\"\n (etc/\"clickhouse-server\").install \"#{buildpath}/dbms/programs/server/config.xml\"\n (etc/\"clickhouse-server\").install \"#{buildpath}/dbms/programs/server/users.xml\"\n end",
"def search_artists\n\n puts \"MetaGeneration.search_artists\"\n\n return if @settings.wikipedia_host.empty? || @@running_meta_generation\n\n Task.do_task('Searching music metadata...') do |task|\n begin\n @@running_meta_generation = true\n\n puts \"Metadata search started\"\n\n # Update pending artists\n Artist.all.where(wikilink: nil).each do |artist|\n update_artist(artist)\n end\n ensure\n @@running_meta_generation = false\n end\n end\n\n end",
"def startup # {{{\n require 'logger'\n require 'date'\n\n path = File.join(ENV[\"LOGDIR\"] || \"./\" ,\"v.log\")\n file = File.open(path, File::WRONLY|File::TRUNC|File::CREAT) \n $log = Logger.new(path)\n $log.level = Logger::DEBUG\n today = Time.now.to_s\n $log.info \"MOV #{$0} started on #{today}\"\n FFI::NCurses.init_pair(10, FFI::NCurses::BLACK, FFI::NCurses::GREEN) # statusline\n dbname = \"movie.sqlite\"\n @imdbfile = '/Volumes/Pacino/dziga_backup/rahul/Downloads/MOV/imdbdata/imdb.sqlite'\n @db = SQLite3::Database.new(dbname)\n @tablename = \"movie\"\n #@query =\"SELECT rowid, year, title, directed_by, starring , language\"\n @total = @db.get_first_value(\"select count(*) from #{@tablename}\")\nend",
"def test_show_a_simple_parse\n @rank = 0\n\n self.xml_file= File.new('test/contents.xml')\n\n # Open a database\n db = SQLite3::Database.new \"life_planner.db\"\n\n db.execute <<-SQL\n DROP TABLE IF EXISTS tasks;\n SQL\n\n # Create a table\n rows = db.execute <<-SQL\n create table tasks (\n id INTEGER PRIMARY KEY NOT NULL,\n name TEXT NOT NULL,\n note TEXT,\n rank INTEGER,\n parent INTEGER,\n splitable BOOLEAN,\n remaining_time INTEGER,\n FOREIGN KEY(parent) REFERENCES tasks(id)\n );\n SQL\n\n @count = 0\n root_node = self.get_root_node\n disp_node root_node, 0\n\n insert_node_in_db db, root_node, 0\n\n puts @count\n # FIXME mon dossier TODO list et tout ce qui est dedans n'apparait nulle part!\n\n # FIXME il manque des noeuds! Car on ne parse pas à l'intérieur des dossiers?\n end",
"def run()\n\t\t\t# Get first page of albums\n\t\t\tfb_albums = @graph.get_connections(\"mojeSarajevo\",\"albums\")\n\n\t\t\t# IDs\n\t\t\tnum_of_albums = 0\n\t\t\tnum_of_photos = 0\n\t\t\tnum_of_comments = 0\n\t\t\tnum_of_users = 0\n\n\t\t\twhile fb_albums.size > 0\n\t\t\t\tputs \"\\tRetrieving #{fb_albums.size} albums...\"\n\t\t\t\t\n\t\t\t\t# Get albums\n\t\t\t\tfb_albums.each do |fb_album|\n\t\t\t\t\tnum_of_albums += 1\n\t\t\t\t\t\n\t\t\t\t\t# Get album photos\n\t\t\t\t\tfb_photos = @graph.get_connections(fb_album['id'],\"photos\")\n\n\t\t\t\t\twhile fb_photos.size > 0\n\t\t\t\t\t\tputs \"\\t\\tRetrieving #{fb_photos.size} photos...\"\n\t\t\t\t\t\tfb_photos.each do |fb_photo|\n\t\t\t\t\t\t\tnum_of_photos += 1\n\t\t\t\t\t\t\t# 0. create new user if one doesn't exist yet \n\t\t\t\t\t\t\t# 1. create issue for each photo\n\t\t\t\t\t\t\t# 2. create attachment with photo URL\n\t\t\t\t\t\t\t# 3. create issue updates from comments\n\n\t\t\t\t\t\t\t# 0. User\n\t\t\t\t\t\t\tfb_user_id = fb_photo['from']['id']\n\t\t\t\t\t\t\tuser = User.find_by_fb_id(fb_user_id)\n\t\t\t\t\t\t\tif (user.nil?)\n\t\t\t\t\t\t\t\tuser = create_user(fb_user_id)\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tfb_photo_id = fb_photo['id']\n\t\t\t\t\t\t\tfb_item = FbItem.find_by_fb_id(fb_photo_id)\n\n\t\t\t\t\t\t\t# first time\n\t\t\t\t\t\t\tif (fb_item.nil?)\n\t\t\t\t\t\t\t\tfb_item = FbItem.new\n\t\t\t\t\t\t\t\tissue = Issue.new\n\t\t\t\t\t\t\t\tattachment = Attachment.new\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tissue = Issue.find(fb_item.ssg_id)\n\t\t\t\t\t\t\t\tattachment = issue.attachments.first\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Was this photo updated after the import?\n\t\t\t\t\t\t\tif (fb_item.fb_updated_at.nil? || fb_item.fb_updated_at < fb_photo['updated_time'])\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t# 1. Issue\n\t\t\t\t\t\t\t\tissue.name = \"Moj grad, moja sigurnost, moja odgovornost - Issue \\##{num_of_photos}\"\n\t\t\t\t\t\t\t\tissue.description = \"This issue is created from \\\"Moj grad, moja sigurnost, moja odgovornost\\\" - Facebook ID=#{fb_photo['id']}\"\n\t\t\t\t\t\t\t\tif (!fb_photo['place'].nil?)\n\t\t\t\t\t\t\t\t\tissue.latitude = fb_photo['place']['location']['latitude']\n\t\t\t\t\t\t\t\t\tissue.longitude = fb_photo['place']['location']['longitude']\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tuser.issues << issue\n\n\t\t\t\t\t\t\t\t# 2. Attachment\n\t\t\t\t\t\t\t\tattachment.file_type = Attachment::JPG\n\t\t\t\t\t\t\t\tattachment.name = !fb_photo['name'].nil? ? fb_photo['name'] : \"Attachment\"\n\t\t\t\t\t\t\t\tattachment.URL = fb_photo['source']\n\t\t\t\t\t\t\t\tattachment.width = fb_photo['width']\n\t\t\t\t\t\t\t\tattachment.height = fb_photo['height']\n\t\t\t\t\t\t\t\tattachment.user = user\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tissue.attachments << attachment\n\n\t\t\t\t\t\t\t\t# 1.1 FBItem for photo\n\t\t\t\t\t\t\t\tfb_item.fb_object_type = FbItem::PHOTO\n\t\t\t\t\t\t\t\tfb_item.name = fb_photo['name']\n\t\t\t\t\t\t\t\tfb_item.fb_id = fb_photo_id\n\t\t\t\t\t\t\t\tfb_item.ssg_id = issue.id\n\t\t\t\t\t\t\t\tfb_item.fb_created_at = fb_photo['created_time']\n\t\t\t\t\t\t\t\tfb_item.fb_updated_at = fb_photo['updated_time']\n\n\t\t\t\t\t\t\t\t# save to DB\n\t\t\t\t\t\t\t\tuser.save\n\t\t\t\t\t\t\t\tissue.save\n\t\t\t\t\t\t\t\tattachment.save\n\t\t\t\t\t\t\t\tfb_item.save\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tputs \"\\t\\tPhoto: ID=#{fb_photo_id}\"\t\n\t\t\t\t\t\t\tend\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t# retrieve photo comments\n\t\t\t\t\t\t\tfb_comments = @graph.get_connections(fb_photo_id,\"comments\")\n\n\t\t\t\t\t\t\twhile fb_comments.size > 0\n\t\t\t\t\t\t\t\tputs \"\\t\\t\\tRetriving #{fb_comments.size} comments..\"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfb_comments.each do |fb_comment|\n\t\t\t\t\t\t\t\t\tfb_user_id = fb_comment['from']['id']\n\t\t\t\t\t\t\t\t\tfb_comment_id = fb_comment['id']\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t# Get or create user\n\t\t\t\t\t\t\t\t\tuser = User.find_by_fb_id(fb_user_id)\n\t\t\t\t\t\t\t\t\tif (user.nil?)\n\t\t\t\t\t\t\t\t\t\tuser = create_user(fb_user_id)\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t\t# Update existing\n\t\t\t\t\t\t\t\t\tfb_item = FbItem.find_by_fb_id(fb_comment_id)\n\n\t\t\t\t\t\t\t\t\t# Comments cannot be updated so we're skipping already imported\n\t\t\t\t\t\t\t\t\tif (fb_item.nil?)\n\t\t\t\t\t\t\t\t\t\tfb_item = FbItem.new\n\t\t\t\t\t\t\t\t\t\tissue_update = IssueUpdate.new\n\n\t\t\t\t\t\t\t\t\t\t# Create issue update from comment\n\t\t\t\t\t\t\t\t\t\tissue_update.description = fb_comment['message']\n\t\t\t\t\t\t\t\t\t\tissue_update.user = user\n\t\t\t\t\t\t\t\t\t\tissue_update.save\n\n\t\t\t\t\t\t\t\t\t\tissue.issue_updates << issue_update\n\t\t\t\t\t\t\t\t\t\tissue.save\n\n\t\t\t\t\t\t\t\t\t\t# 1.1 FBItem for comment\n\t\t\t\t\t\t\t\t\t\tfb_item.fb_object_type = FbItem::COMMENT\n\t\t\t\t\t\t\t\t\t\tfb_item.name = fb_comment['name']\n\t\t\t\t\t\t\t\t\t\tfb_item.fb_id = fb_comment_id\n\t\t\t\t\t\t\t\t\t\tfb_item.ssg_id = issue_update.id\n\t\t\t\t\t\t\t\t\t\tfb_item.fb_created_at = fb_comment['created_time']\n\t\t\t\t\t\t\t\t\t\tfb_item.save\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t# Get next comments\n\t\t\t\t\t\t\t\tfb_comments = fb_comments.next_page\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\tend\t\t\t\t\t\t\n\t\t\t\t\t\t# Get next set of photos\n\t\t\t\t\t\tfb_photos = fb_photos.next_page\n\t\t\t\t\tend\n\n\t\t\t\t\t# Save album to fb_items\n\t\t\t\t\tfb_album_id = fb_album['id']\n\t\t\t\t\tfb_item = FbItem.find_by_fb_id(fb_album_id)\n\n\t\t\t\t\tif (fb_item.nil?)\n\t\t\t\t\t\tfb_item = FbItem.new\n\t\t\t\t\tend\n\n\t\t\t\t\tif (fb_item.fb_updated_at.nil? || fb_item.fb_updated_at < fb_album['updated_time'])\n\t\t\t\t\t\tfb_item.fb_id = fb_album_id\n\t\t\t\t\t\tfb_item.ssg_id = -1\n\t\t\t\t\t\tfb_item.fb_object_type = FbItem::ALBUM\n\t\t\t\t\t\tfb_item.name = fb_album['name']\n\t\t\t\t\t\tfb_item.fb_created_at = fb_album['created_time']\n\t\t\t\t\t\tfb_item.fb_updated_at = fb_album['updated_time']\n\t\t\t\t\t\tfb_item.save\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Get next set of albums\n\t\t\t\tfb_albums = fb_albums.next_page\n\t\t\tend\n\n\t\t\tputs \"Exported: Albums=#{num_of_albums}, Photos=#{num_of_photos}, Comments=#{num_of_comments}, Users=#{num_of_users}\"\n\t\tend",
"def calc_full_nodes_avail\n @full_nodes_available = 0\n #if @cluster_title.eql?(\"Ruby\")\n # # See line 62\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"np = 20\") && node.include?(\"gpu_state=Unallocated\")}.size\n #else\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"gpu_state=Unallocated\") }.size\n #end\n end",
"def optimize\n @database.execute 'VACUUM'\n end",
"def nodetype() @records.get_data(GRT_NODETYPE); end",
"def reexecute_connections?\n return true\n end"
] |
[
"0.5616407",
"0.5507869",
"0.54831976",
"0.5285926",
"0.51739055",
"0.51308024",
"0.5121129",
"0.50801903",
"0.5068621",
"0.4980295",
"0.49163735",
"0.48961207",
"0.48404622",
"0.47866452",
"0.47632173",
"0.47542253",
"0.47284454",
"0.47284454",
"0.47101265",
"0.46870038",
"0.46518016",
"0.4624413",
"0.4596655",
"0.45962918",
"0.45886427",
"0.4538342",
"0.45106405",
"0.45016032",
"0.44942164",
"0.4484432",
"0.44786808",
"0.4476756",
"0.44677886",
"0.44510254",
"0.4448104",
"0.44441",
"0.4435576",
"0.4425945",
"0.43992835",
"0.43884578",
"0.43745017",
"0.43704572",
"0.43589053",
"0.4345451",
"0.4324108",
"0.43227187",
"0.43144062",
"0.4304395",
"0.4302983",
"0.43025723",
"0.42938823",
"0.42861375",
"0.4284505",
"0.4284388",
"0.4282369",
"0.42819002",
"0.42695472",
"0.42605156",
"0.4250559",
"0.4250559",
"0.4249514",
"0.4243127",
"0.42315277",
"0.42275393",
"0.42186934",
"0.421863",
"0.4198528",
"0.41961092",
"0.41912007",
"0.41801146",
"0.4178944",
"0.41718343",
"0.41700172",
"0.4164905",
"0.41619194",
"0.4153157",
"0.41528168",
"0.414681",
"0.41437483",
"0.41397992",
"0.4135445",
"0.4130296",
"0.41291502",
"0.41272956",
"0.41162995",
"0.41099107",
"0.4108481",
"0.41074932",
"0.41067237",
"0.41032404",
"0.41026527",
"0.40989065",
"0.4086697",
"0.40855408",
"0.40853295",
"0.40850887",
"0.4084201",
"0.40829533",
"0.40799773",
"0.40765315",
"0.40745324"
] |
0.0
|
-1
|
get all users in the graph
|
def get_users(neo)
cypher_query = ' START me = node:nodes_index(type = "user")'
cypher_query << ' RETURN ID(me), me.name'
cypher_query << ' ORDER BY ID(me)'
neo.execute_query(cypher_query)['data']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_users()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/users\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end",
"def users\n User.where(network_id: context[:current_network]&.id)\n end",
"def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end",
"def get_all\n @user_repository.get_all_users\n end",
"def all_users()\n User.all\n end",
"def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end",
"def list\n get('users')['users']\n end",
"def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end",
"def get_all_users\n @users = []\n results = User.all\n results.each do |user|\n @users << user.to_hash\n end\n end",
"def all_users\n result = []\n api.search(accounts_dn, ::LDAP::LDAP_SCOPE_SUBTREE, accounts_filter) do |user|\n result << user.to_hash\n end\n result\n end",
"def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def users\n @users_by_href.values\n end",
"def get_all_users\n @users = []\n User.all.each do |user|\n @users << user.to_hash\n end\n end",
"def get_all_users\n @users = []\n\n User.all.each do|user|\n @users << user.to_hash\n end\n end",
"def getUsers() #:name, :default_currency, :locale\r\n returnArray = []\r\n retrieveData(\"/v1/users\")[\"data\"].each do |item|\r\n returnArray << User.new(item[\"name\"], item[\"default_currency\"], item[\"locale\"])\r\n end\r\n return returnArray\r\n end",
"def getAllUsers()\n puts \"\\nUSERS:\"\n puts \"-------------------------------------------------\"\n @users.each {|user| puts \"ID: \" + user.id.to_s + \" Name: \" + user.name}\n puts \"-------------------------------------------------\"\n end",
"def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end",
"def users\n get('get_users')\n end",
"def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend",
"def list_all_users\n\n end",
"def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end",
"def all\n xml_doc.xpath('/MediaContainer/User').map {|n| [n['email'],n['username']] }\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def get_all_users(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"user\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end",
"def users\n @users = User.find(:all)\n end",
"def all_users\n return [] if @json_data['users'].nil?\n @json_data['users'].collect { |user| [user['first'], user['last']].join(' ') }\n end",
"def users\n res = []\n url = data['links']['roleUsers']\n tmp = GoodData.get url\n tmp['associatedUsers']['users'].each do |user_url|\n user = GoodData.get user_url\n res << GoodData::Profile.new(user)\n end\n res\n end",
"def list\n @all_users = User.find(:all)\n end",
"def users\n []\n end",
"def user_graph\n set = self.personal_account? ? {} : self.company.cached_users\n set.merge! self.recognition_graph \n return set\n end",
"def users\n channel = Channel.find(params[:id])\n users = ChannelJoined.where(channel_id: params[:id])\n return json_response({\n users: users.map{|j| j.user}\n })\n end",
"def users\n gateway_check\n @users\n end",
"def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end",
"def users_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('users/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tusers=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['users'].each_element('//user') { |user|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=user.elements['name'].text\n\t\t\t\tentry['admin']=user.elements['admin'].text\n\t\t\t\tentry['lastlogin']=user.elements['lastlogin'].text\n\t\t\t\tusers.push(entry)\n\t\t\t}\n\t\t\treturn users\n\t\tend",
"def list_users\n self.class.get('/users')\n end",
"def all\n @users = User.all\n end",
"def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end",
"def get_users(request); end",
"def all_users\n Skype.find_users_of_type \"ALL_USERS\"\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users(query)\n get_endpoint('users', nil, {'q' => query})[\"users\"].map{|u| \n Bibliovore::User.new(u, self)\n }\n end",
"def view_all_users\n # !! get all user so can interact after viewing them? all_users\n # User.select(:username).each_with_index {|user, index| puts \"#{index+1}. #{user.username}\"}\n #??????\n User.select(:username).each {|user| puts user.username}\n end",
"def users\n @attributes[:users]\n end",
"def users\n result_hash['usr']\n end",
"def index\n\t\t# current_user.cdg_id\n\t\t@@users = SoapConnection::ChoferUsers.users( (1 rescue 1) ).compact rescue []\n\t\t@users = @@users\n\tend",
"def get_all_user_data\n load_user_data(nil)\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def list_users\n @users = User.find(:all)\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 query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def users\n\t\tusers = []\n\t\trooms.each do |room|\n\t\t\troom.users.each do |user|\n\t\t\t\tusers << user\n\t\t\tend\n\t\tend\n\t\tusers\n\tend",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end",
"def users\n @users\n end",
"def getUsers\n return @Users \n end",
"def users\n return @users\n end",
"def returning_users\n []\n end",
"def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend",
"def index\n @users = UserService.all_users\n end",
"def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end",
"def users\n set_attributes_for(User)\n User.find(:all)\n end",
"def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end",
"def users\n @users = User.all\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end",
"def users\n res = []\n\n tmp = GoodData.get @json['project']['links']['users']\n tmp['users'].map do |user|\n res << GoodData::Membership.new(user)\n end\n\n res\n end",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def list_users\n BrickFTP::API::User.all\n end",
"def list_users\n BrickFTP::API::User.all\n end",
"def get_all\n\t\tif !params.has_key?(\"count\") or params[:count].empty?\n\t\t\tparams[:count]= 50\n\t\tend\n\t\tif !params.has_key?(\"start\") or params[:start].empty? \n\t\t\tparams[:start] = 0 \n\t\tend\n\t\tusers = []\n\t\tUser.all.limit(params[:count]).offset(params[:start]).each do |u|\n\t\t\thash = u.attributes \n\t\t\thash[:client] = u.client ? u.client.name : nil\n\t\t\tusers.push(hash)\n\t\tend\n\t\trespond({ status: 0, users: users, start: params[:start] })\n\tend",
"def query\n ::User.all\n end",
"def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def fremont_users\n\ttmp = Array.new\n\tres = Array.new\n\ti = 0\n\twhile (tmp = TOKEN.get('/v2/campus/7/users', params: { page: i, per_page: 100 }).parsed).length > 0\n\t\tputs 'user request page is ' + i.to_s\n\t\ttmp.each do |page|\n\t\t\tres.push(page)\n\t\tend\n\t\ti += 1\n\tend\n\treturn res\nend",
"def users\n return @users_array\n \tend",
"def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end",
"def all_users\n `dscl . list /Users`.split(\"\\n\").delete_if { |e| e =~ /^_/ }\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def users\n users_array = []\n if serialization_options[:include_users] == true\n # NOTE: object here refers to the ActiveRecord model object. self refers to the serializer object itself.\n object.users.each do |user|\n # NOTE: You can pass serialization_options to serializable_hash.\n users_array << UserSerializer.new(user, {}).serializable_hash({})\n end\n end\n return users_array\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def find_all_gym_users\n self.gym_user_instances.map{|user| user.name } \n end",
"def request_course_users\n all_users = []\n params = \"include[]=enrollments&per_page=30\"\n while params do\n response = request_uncached(\n \"courses/#{@course_id}/users?#{params}\",\n \"_course_users\"\n )\n break unless (response && response.status == 200 && users_list = safe_json(response.body))\n all_users.concat(users_list)\n params = next_page_params(response)\n end\n all_users\n end",
"def index\n @users = current_user.users\n end",
"def users\n company_ids = [self.id]\n company_ids += advisor_company_ids if advised?\n\n user_ids = UserAffiliation.where(:company_id.in => company_ids).with_access.only(:user_id).map(&:user_id)\n User.where(:id.in => user_ids).order_by(created_at: :asc)\n end",
"def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end",
"def list_users(api_object)\r\n puts \"Current Users:\"\r\n doc = Nokogiri::XML.parse api_object.read\r\n names = doc.xpath('users').collect {|e| e.text }\r\n puts names.join(\", \")\r\n puts \"\"\r\nend",
"def users\n records do |instance|\n instance['users'] = user.where('organization_id': instance['_id'])\n end\n end",
"def index\n \t@all_users = User.all\n end",
"def users\n watches_unique_by_user.map(&:user)\n end",
"def all\n @users = User.only(:id, :name, :about_me, :avatar_file_name, :avatar_updated_at).not_in(:id => current_user.follow_ids).not_in(:id => [current_user])\n\n respond_to do |format|\n format.html\n format.json { render :json => { :users => @users.as_json(:json => 'wall') }}\n end\n end",
"def get_users(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"users\", params)\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 show_users\n @users = User.all\n end",
"def users\n users = Set.new\n\n @channels.each do |channel|\n users.merge(channel.users)\n end\n\n users\n end"
] |
[
"0.7535191",
"0.7437218",
"0.74323624",
"0.73720616",
"0.73589134",
"0.7345213",
"0.73325175",
"0.7277267",
"0.72661966",
"0.72155476",
"0.7213228",
"0.72066355",
"0.7196767",
"0.7187327",
"0.71700126",
"0.71645075",
"0.7152486",
"0.7141491",
"0.7122641",
"0.712086",
"0.7116725",
"0.7034071",
"0.69868535",
"0.6979127",
"0.69754046",
"0.6972923",
"0.69719625",
"0.6963816",
"0.6961231",
"0.69546187",
"0.694695",
"0.6939256",
"0.69052196",
"0.689898",
"0.6896537",
"0.6883976",
"0.6871413",
"0.6870322",
"0.68696487",
"0.6867992",
"0.6867992",
"0.6867284",
"0.68635786",
"0.68613243",
"0.6835092",
"0.6830935",
"0.68261117",
"0.68246496",
"0.6810935",
"0.68090343",
"0.680859",
"0.68038625",
"0.6803593",
"0.6802692",
"0.67833024",
"0.67796314",
"0.6778432",
"0.6777863",
"0.6771585",
"0.6764989",
"0.67617565",
"0.6761358",
"0.6758521",
"0.6755557",
"0.6754241",
"0.6754241",
"0.6749549",
"0.6724241",
"0.6724095",
"0.67126775",
"0.67087036",
"0.66967195",
"0.66957676",
"0.6691349",
"0.6677648",
"0.6677648",
"0.6677231",
"0.6672879",
"0.66674995",
"0.66650957",
"0.66567624",
"0.66560113",
"0.66470784",
"0.6645317",
"0.6638461",
"0.66304004",
"0.6621291",
"0.66132355",
"0.6611895",
"0.6607825",
"0.66016114",
"0.65865034",
"0.6579537",
"0.6573784",
"0.65700746",
"0.65682995",
"0.6557115",
"0.6543809",
"0.6543549",
"0.6528255"
] |
0.75305843
|
1
|
get all repo's with a follow_count > 2
|
def get_repos(neo)
# return repo's that have more than 1 connection
# TODO: try this; n<-r[follows*2..]-m
cypher_query = ' START n = node:nodes_index(type = "repo")'
cypher_query << ' MATCH n<-[r:follows]-m'
cypher_query << ' WITH n, count(m) AS follow_count'
cypher_query << ' WHERE follow_count > 2'
cypher_query << ' RETURN ID(n), n.name, follow_count'
cypher_query << ' ORDER BY ID(n)'
neo.execute_query(cypher_query)['data']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def repositories\n Repository.where(user_id: group_ids).or(membered_repositories).order(\"updated_at desc\")\n end",
"def activity_watching_following()\n\t Activity.where('$or' => [{ :project_id => { \"$in\" => self[:watching] } }, { :project_id => { \"$in\" => repo_ids } }, {:author_id => { \"$in\" => self[:following] }}] ).all\n end",
"def repositories_with_pull_requests(reponames = [])\n repositories = []\n page = 1\n loop do\n repositories_in_page = load_repos_in_page(page)\n break if repositories_in_page.empty?\n repositories.concat(repositories_in_page)\n page += 1\n end\n repositories.select! { |repo| reponames.include?(repo.name) } unless reponames.empty?\n repositories.select!(&:any_pull_requests?)\n repositories\n end",
"def find_users_with_shared_repos\n\n (friends - [self]).sort_by do |f|\n f.repos.select { |r| repos.collect { |s| s.id }.include?(r.id) }.size\n end.reverse\n\n end",
"def get_my_repos\n repos = []\n\n (1..get_total_repo_pages_count.to_i).each do |index|\n get_json( \"#{ GITHUB_USER_REPOS_URL }?per_page=100&page=#{ index }\" ).each do |item|\n repos << item[ 'full_name' ]\n end\n end\n\n return repos\nend",
"def active_followed_users\n @user.following.limit(FRESH_FETCH_SIZE)\n end",
"def find_not_following(handle, limit = 10)\n not_followed = []\n followed = User.where(handle: handle).first.following\n followed << handle\n User.not_in(handle: followed).limit(limit).each {|u| not_followed << u.handle}\n return not_followed\n end",
"def find_pulls\n # return self.github_client.pull_requests(\"#{user}/#{repository}\", request_params).count\n initial_pulls = self.github_client.pull_requests(\"#{user}/#{repository}\", request_params).count\n return find_last_page(initial_pulls)\n end",
"def filterRepositories\n\tEnumerator.new { |repos|\n\t\twhile (gets)\n\t\t\trepo = Repo.new\n\t\t\t$_.sub!(/\\(via.*?\\)/, '') # Remove 'via' annotation in line.\n\t\t\trepo.name, repo.type, repo.url = $_.split(/\\s+/)\n\t\t\t\n\t\t\trepo.score = 0\n\t\t\t\n\t\t\trepos << repo\n\t\tend\n\t}.group_by{|repo| repo.name}.values.each{|repoList|\n\t\tprintBest repoList\n\t}\nend",
"def get_repo_list(token, user)\n query = %{\n query ($user: String!, $cursor: String) {\n user(login: $user) {\n repositories(first: 100, after: $cursor) {\n edges {\n node {\n name\n owner {\n login\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n }\n\n vars = { user: user, cursor: nil }\n\n repos = []\n\n loop do\n result = Github.query(token, query, vars)\n repos += result.dig(\"data\", \"user\", \"repositories\", \"edges\") || []\n break unless result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"hasNextPage\")\n vars[:cursor] = result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"endCursor\")\n end\n\n repos.map { |e| { owner: e.dig(\"node\", \"owner\", \"login\"), name: e.dig(\"node\", \"name\") } }\nend",
"def sorted_top_users\n add_github_user('redline6561')\n followers = github.get_followers('redline6561',1,100)\n followers.map { |x| x['login'] }.sample(20).each do |username|\n add_github_user(username)\n end\n\n Cheepcreep::GithubUser.order(:followers => :desc).each do |u|\n puts \"User: #{u.login}, Name: #{u.name}, Followers: #{u.followers}\"\n end\nend",
"def get_users_for_repo(neo, repo)\n\n\tneo.traverse(repo, 'nodes', {\n\t\t:order => 'breadth first',\n\t\t:uniqueness => 'node global',\n\t\t:relationships => {\n\t\t\t:type => 'follows',\n\t\t\t:direction => 'in'\n\t\t},\n\t})\n\nend",
"def count_public_repos\n @top_ten.each do |user|\n public_repos = self.class.get(\"/users/#{user[0]}/repos?q=visibility:public+created:\\>\\=2015-01-01T00:00:00-07:00\").parsed_response\n user << public_repos.length\n end\n end",
"def overlapping_repos_from_users_with_shared_repos\n users = find_users_with_shared_repos[0..1]\n\n if users.size > 1\n ((users[0].repos & users[1].repos) - repos).sort.reverse\n else\n []\n end\n end",
"def followers \r\n\tlovers = []\r\n\tself.likes.each do |l|\r\n\t\tlovers << l.user\r\n\tend\r\n\tself.feature_groups.each do |fg|\r\n\t\tfg.features.each do |f|\r\n\t\t\tf.likes.each do |l|\r\n\t\t\t\tlovers << l.user\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn lovers.unique\r\n end",
"def all\n repos = self.class.load_json(repos_url)\n repos.map! { |repo| self.class.filter_repo_info(repo) }\n self.class.slice_in(repos, 3)\n end",
"def private_repo_count\n repositories.reject { |repo| not repo.private? }.length\n end",
"def followers(options={})\n # Not avaiable since 30.04.2015\n return []\n\n limit = options[:limit] || 5000\n fetch_all = options[:fetch_all] || false\n iteration = 0\n\n _followers = collection = user.subscribers(:limit => limit)\n max_iteration = _followers.total_count / limit + 1\n\n if fetch_all\n while iteration < max_iteration\n iteration += 1\n collection = collection.next\n _followers += collection\n end\n end\n\n _followers\n end",
"def list_repos\n repos = []\n end_cursor = nil\n\n data = get_repos(end_cursor)\n repos = repos + data.fetch(\"nodes\")\n next_page = data.dig(\"pageInfo\", \"hasNextPage\")\n end_cursor = data.dig(\"pageInfo\", \"endCursor\")\n\n while next_page do\n data = get_repos(end_cursor)\n repos = repos + data.fetch(\"nodes\")\n next_page = data.dig(\"pageInfo\", \"hasNextPage\")\n end_cursor = data.dig(\"pageInfo\", \"endCursor\")\n end\n\n repos.reject { |r| r.dig(\"isArchived\") || r.dig(\"isDisabled\") }\n end",
"def get_total_repo_pages_count\n get_url( \"#{ GITHUB_USER_REPOS_URL }?per_page=100\" ) do |response|\n link = response.meta[ 'link' ]\n no_quotes = link.gsub( /\\\"/, '' )\n captures = no_quotes.match( /page=(\\d+)\\>\\; rel=last/ ).captures\n\n return captures[0]\n end\nend",
"def followers(pr_id)\n q = <<-QUERY\n select count(f.follower_id) as num_followers\n from pull_requests pr, followers f, pull_request_history prh\n where pr.user_id = f.user_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and f.created_at < prh.created_at\n and pr.id = ?\n QUERY\n if_empty(db.fetch(q, pr_id).all, :num_followers)\n end",
"def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Status.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Song.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"def following(options = {})\n params = {}\n\n limit = options[:limit]\n if limit && (limit < 100)\n params[:limit] = limit\n else\n params[:limit] = 100\n limit = 0\n end\n\n return connection.accumulate(\n :path => \"users/#{@name}/follows/channels\",\n :params => params,\n :json => 'follows',\n :sub_json => 'channel',\n :class => Channel,\n :limit => limit\n )\n end",
"def shared_with_following_tips\n follower_ids = user.user_followers.pluck(:id)\n\n @filtered_tips.where(share_following: true, user_id: (follower_ids).uniq).pluck(:id)\n end",
"def fetch_watched_repos\n toggle! :fetching_repos\n\n sidekiq_logger.info { \"[#{username}] Fetching watched repos...\" }\n\n github_watched.each do |wr|\n attrs = wr.slice(:name, :language, :description, :fork, :private, :size,\n :forks, :open_issues, :pushed_at, :created_at, :updated_at)\n\n if repo = Repo.find_by_id(wr.id)\n repo.attributes = attrs.merge({:watchers_count => wr.watchers})\n else\n repo = Repo.new(attrs.merge({:watchers_count => wr.watchers}))\n repo.id = wr.id\n end\n\n repo.owner = User.find_or_create_by_username(wr.owner.login)\n repo.save\n\n unless watchings.exists?(repo.id)\n watchings << repo\n sidekiq_logger.info { \"[#{username}] now watching #{wr.name}\" }\n end\n end\n\n sidekiq_logger.info { \"[#{username}] Completed fetching watched repos\" }\n\n prune_unwatched_repos\n\n toggle! :fetching_repos\n end",
"def get_qualifying_repos\n if !authenticated?\n authenticate!\n end\n\n # Get Github data.\n\n repos = client.repositories\n username = client.user.login\n\n # Compile a list of repositories for projecs that we've already used.\n user = User.find_by(github_id: client.user.id)\n used_repos = Array.new\n my_books = Book.where(\"user_id = ?\", user.id)\n [*my_books].each do |book|\n used_repos << book[:repo_id]\n end\n\n # Identify the names claimed for github user/organization pages. There may\n # be a better way to remove them than string detection, but I'll use it for\n # now, since it looks like that's what github uses and I don't know beter.\n name_match_1 = username + '.github.io' #=> octocat.github.io\n name_match_2 = username + '.github.com' #=> octocat.github.com\n\n # Iterate through our array of github repos and delete ones from the list\n # that don't qualify for a new book-site.\n repos.delete_if do |repo|\n # Remove this repo if it matches the name for a user/org page project.\n if repo.name == name_match_1 || repo.name == name_match_2\n true\n # Remove this repo if it has already been used for a book.\n elsif used_repos.include? repo.id\n true\n # Remove this repo if it doesn't belong to this user. This is designed to\n # remove repos you are a \"collaborator\" on.\n elsif username != repo.full_name.split('/')[0]\n true\n else\n # This repo is good... return false to prevent deleting it.\n false\n end\n end\n\n return repos\nend",
"def smart_bfs(len, to_get_users = [], to_get_neighbors = [], visited = Set.new)\n sample = []\n i = 0\n while i < len do\n while i < len do\n if to_get_users.empty? then\n break\n end\n # ask Twitter for a chunk of user objects from ids list\n uids = to_get_users.slice!(0..$max_users-1)\n users = get_users(uids)\n p \"got #{users.length} users\"\n sample.concat(users)\n\n # add ids to neighbors todo\n to_get_neighbors.concat( users.map { |u| u.attrs[:id] } )\n i+=users.length\n end\n\n while to_get_users.empty? do\n if to_get_neighbors.empty? then \n return sample\n end\n uid = to_get_neighbors.slice!(0)\n\n next_cursor = -1\n last_index = 0\n next_user_id = 0\n while next_cursor != 0 do\n # get the next page of follower ids\n cur = get_followers_cursor(uid, next_cursor)\n\n # add never-before-seen users to worklist\n newusers = cur[:ids].sselect { |fid| not visited.member?(fid) }\n newusers.each { |u| visited.add(u) }\n to_get_users.concat( newusers ) \n\n # next page index \n next_cursor = cur[:next_cursor]\n end\n end\n end\n \n return sample\nend",
"def set_top_10_related_sub_reddits\n @top_10_related_sub_reddits = RelatedSubReddit\n .order(weight: :desc)\n .limit(20)\n .all\n .to_a\n .each_slice(2).map(&:last)\n end",
"def all_following( options={} )\n\t\t\t\tall_follows( options ).collect{ |f| f.followed }\n\t\t\tend",
"def mutual_follows\n self.followees.to_a.select { |followee| followee.is_following?(self) }\n end",
"def followers(pr)\n q = <<-QUERY\n select count(f.follower_id) as num_followers\n from pull_requests pr, followers f, pull_request_history prh\n where prh.actor_id = f.user_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and f.created_at < prh.created_at\n and pr.id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:num_followers]\n end",
"def followings\n b=BeFollow.scoped_by_follower_id(self.id)\n user_ids=b.map do |a|\n a.user.id\n end\n User.find_all_by_id(user_ids)\n end",
"def followed_by_profiles\n profile_ids = Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq\n return Profile.where(:id => profile_ids)\n end",
"def fetch_followers\n cache(:expire_in => 2.hours).following\n end",
"def show_repo_list\n # Synchronize user's id_github with Git Hub (4 days between refreshs)\n @owner.sync_github!(4.days).save!\n \n # Synchronize list of user's projects (4 hours between refreshs)\n if @owner.sync_projects_delay?(4.hours)\n github_projects = @owner.get_github_projects\n \n if github_projects\n @owner.upd_projectlist_at = Time.now\n repos = CacheRepo.where(path: github_projects)\n \n # Drop any projects than no more exist in the user space\n if repos.length > 0\n CacheRepo.where.not(id: repos.map(&:id)).where(owner: @owner).delete_all\n end\n \n # Add any new project to this user\n (github_projects - repos.map(&:path)).each do |github_project_new|\n new_project = CacheRepo.new(path: github_project_new, owner: @owner)\n # Alway be aware of we have multiple workers and possibility concurrent insert\n if !new_project.save\n new_project = CacheRepo.where(path: github_project_new).first\n new_project.owner = @owner\n new_project.save!\n end\n end\n end\n @owner.save!\n end\n \n # Repository information will be refreshed only if the user request it\n # So, this action is more light than #show_repo_details\n @projects = CacheRepo.where(owner: @owner)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_list, status: :ok, location: @owner }\n end\n end",
"def RecentActivity\n @followings = Follwing.where(:kite_id => kites.select(\"id\"), :Type => \"like\").order(\"created_at DESC\").take(5)\n @comments = Comment.where(:kite_id => kites.select(\"id\")).order(\"created_at DESC\").take(5)\n return (@followings + @comments).sort_by(&:created_at)\n end",
"def public_repo_count\n repositories.reject { |repo| repo.private? }.length\n end",
"def follows\n @follows ||= refresh_follows\n end",
"def follow_list(options)\n session.options = adapt_to_dev_env(options)\n session.get('/follows')\n end",
"def get_more_users(l=1,n = nil)\n\t #u is a User in the database\n\t\t#n is the number we want to had \n\t\t#l is the level of recursivity\n\t\tif l != 0\n #call the API\n\t\t\t#fws = self.get_followers\n\t\t\tfi = self.get_following\n\t\t\t#from the API objects create databases objects \n\t users = User.set_users_from_twitter_users(fi,n)\n\t\t\tself.save!\n self.add_followings(users)\n\t users.each{|f|\n\t\t\t f.get_more_users(l-1, n)\n\t\t\t}\n\t\tend\n\t\treturn users\n end",
"def followed_users\n cached_followed_users\n end",
"def repositories_to_fetch\n # Find all .git Repositories - Ignore *.wiki.git\n repos = Dir.glob(\"#{@config['git']['repos']}/*/*{[!.wiki]}.git\")\n\n # Build up array of NOT ignored repositories\n delete_path = []\n @config['ignore'].each do |ignored|\n path = File.join(@config['git']['repos'], ignored)\n delete_path += repos.grep /^#{path}/\n repos.delete(delete_path)\n end\n\n return repos - delete_path\n\n end",
"def dormant_repos(days)\n Repository.where(\"updated_at < ?\", (Time.now - days.day))\n end",
"def find_following_hals\n Hal.where(\"user_id in (?)\", self.following.collect(&:id)).public.order(\"created_at desc\")\n end",
"def followed_by_profiles_count\n return Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq.count\n end",
"def get_relationships_for_repo(neo, repo)\n\n\tcypher_query = ' START user = node:nodes_index(type = \"user\"), repo = node:nodes_index(type = \"repo\")'\n\tcypher_query << ' MATCH user-[r:follows]->repo'\n\tcypher_query << ' WHERE ID(repo) = {repo_id}'\n\tcypher_query << ' RETURN ID(user), user.name'\n\n\tneo.execute_query(cypher_query, { :repo_id => repo[0] })['data']\n\nend",
"def total_repo_count\n repositories.length\n end",
"def followers_even_indirectly_count\n Rails.redis.sunion(redis_name__followed_by, user.redis_name__followed_by).count\n end",
"def followers\n project.source.followers\n end",
"def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end",
"def index\n @repositories = Repository.limit(20)\n @recent_objects = Repository.order(updated_at: :desc).limit(10)\n end",
"def process_top_contributors\n @top_contributors = (top_contributors || []).map { |contrib_data| contrib_data[:author][:login] }\n @top_contributors.last(10).reverse.each do |login|\n (meta[:top_10_contributors] ||= []) << \"https://github.com/#{login}\"\n end\n nil\n end",
"def latest_repos(print_bool = true, num = 10)\n\n # grab repository list\n repositories = @github.repos.list user: @username\n\n # sort repositories by creation date then reverse\n most_recent_repos = repositories.sort_by { |repo| repo.created_at }.reverse\n\n # if print is true, print the necessary number of repos\n # should be separate method\n if print_bool\n\n puts num.to_s + \" most recent repositores for #{@username}:\"\n\n # prints most recent repositories\n 0..(num - 1).times do |index|\n puts \"\\t\" + (index + 1).to_s + \". \" + most_recent_repos[index]['name'].to_s\n end\n\n end\n\n most_recent_repos[0..(num - 1)]\n\n end",
"def show_repo_details\n # Synchronize repo with Git Hub (1 day between refreshs)\n @repo.sync_github!(1.day).save!\n \n # Synchronize contributors (1 hour between refreshs)\n if @repo.sync_contribs_delay?(1.hour)\n github_contributors_login = @repo.get_github_contributors\n \n if github_contributors_login\n users = CacheUser.where(login: github_contributors_login)\n\n # Drop any relation with old contributors - I think i've wasted my time\n if users.length > 0\n CacheContrib.where(cache_repo_id: @repo).where.not(cache_user_id: users.map(&:id)).delete_all\n end\n\n # Add new contributors with empty personal data\n new_users = github_contributors_login - users.map(&:login)\n new_users.each do |github_login_new|\n CacheUser.create(login: github_login_new)\n end\n \n # Make link for each contributor\n current_contribs = CacheUser.joins(:cache_contribs).where(cache_contribs: {cache_repo_id: @repo.id})\n CacheUser.where(login: github_contributors_login).where.not(id: current_contribs).each do |user|\n user.cache_contribs.build(cache_repo: @repo)\n user.save\n end\n end\n \n @repo.upd_userlist_at = Time.now\n @repo.save!\n end\n \n # Load contributors from cache, contributors without personal data or too old are first\n # Nota : I use this method because a simple select order by synced_on show nil in first\n # but I read than oracle put them at the end depending server configuration. This suck !\n @users = CacheUser.never_synced.only_repo(@repo).order(:updated_at)\n @users.merge CacheUser.synced_from(4.days).only_repo(@repo).order(:synced_on, :updated_at)\n \n # Update contributors personal data if too old or never updated\n if @users.length > 0\n maxlist = @users.length <= 148 ? @users.length : 148 # Not exceed 148 personal data requests\n \n # Synchronize personal data of contributors : Old method\n # -> not enought efficient with large contributors list\n # @users[0...maxlist].each {|contributor| contributor.reload.sync_github!(4.days).save!}\n\n # Synchronize personal data of contributors : Use threads for concurrent requests\n work_queue = Queue.new \n # Add to the working queue all logins to proceed by threads\n @users[0...maxlist].map(&:login).each {|github_login| work_queue.push github_login}\n \n # Launch up to 10 threads\n # Warning : Each worker use a connection from ActiveRecord's pool. See database.yml for\n # set the pool size (count also the connection for this main thread).\n workers = (0...10).map do\n Thread.new do\n until work_queue.empty? do\n github_login = work_queue.pop(true) rescue nil\n if github_login\n user = CacheUser.where(login: github_login).first\n if user\n user.sync_github!(4.days).save!\n end\n end\n end\n end\n end\n workers.map(&:join) # Wait all threads finished before proceeding further \n end\n # Reload fresh data.\n @users = CacheUser.only_repo(@repo)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_details, status: :ok, location: @repo }\n end\n end",
"def get_ranked_issues\n issues = ranked_issues.joins(:issue_rank_caches).includes(:tracker).where(\"issue_rank_caches.rank > ?\", 2).order(\"issue_rank_caches.rank DESC\").limit(10)\n end",
"def followers(num)\n last_followers = @client.followers\n\n end",
"def get_followings(user1)\n $redis2.fetch(\"followings/#{user1.cache_key}\") do\n ids = Follow.where(user: user1).pluck(:following_id)\n User.where(id: ids)\n end\n end",
"def number_of_followees\n return_list_of_followed_users.size\n end",
"def get_user_posts_by_following\n self.following.collect do |followed|\n followed.get_user_posts\n end\n end",
"def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end",
"def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend",
"def fetch_followed\n cache(:expire_in => 2.hours).followed\n end",
"def most_followed(n)\n QuestionFollower.most_followed_questions(n)\n end",
"def guesses_from_similar_repos(compare)\n\n # get guesses excluding this user's repos\n guesses = guesses_from_similar_repos_with_similarity((compare.to_set - repos))[0..49]\n\n # return only the similar non-user repos\n guesses.collect { |c| c[1] }.uniq\n\n end",
"def follows channel=false\n followees.find_all { |user| (user.channel? == channel) }\n end",
"def second_degree_followings\n combined_followings = []\n # combined_followings << followings\n combined_followings << followings.map(&:followings)\n combined_followings.flatten.uniq - [self]\n end",
"def following_boards(fields: nil, cursor: nil, limit: nil)\n get_boards_collection(\"/me/following/boards/\", nil, fields, cursor, limit)\n end",
"def followings\n @followings = @other_user.followings.paginate(:page => params[:page], :per_page => 20)\n end",
"def get_saved_news(user_id,start,count)\n numitems = $r.zcard(\"user.saved:#{user_id}\").to_i\n news_ids = $r.zrevrange(\"user.saved:#{user_id}\",start,start+(count-1))\n return get_news_by_id(news_ids),numitems\nend",
"def repos(show_commits = false)\n response = @github.repos.list(user: 'siakaramalegos', sort: 'updated', direction: 'desc', page: 1, per_page: 10)\n repos = response.body\n\n repos.each_with_index do |repo, index|\n puts '-' * 80\n date_string = repo.updated_at\n date = DateTime.parse(date_string).to_date\n puts \"(#{index + 1}) #{repo.name}: #{repo.description} (updated: #{date.stamp('12/30/99')})\"\n\n if show_commits\n repo_commits = @github.repos.commits.list('siakaramalegos', repo.name, page: 1, per_page: 10).body\n\n repo_commits.each do |c|\n date_string = c.commit.author.date\n date = DateTime.parse(date_string).to_date\n puts \" #{c.commit.message} (#{date.stamp('12/30/99')})\"\n end\n end\n end\n puts '-' * 80\n repos\n end",
"def all_following(options={})\n all_follows(options).collect{ |f| f.followable }\n end",
"def following_profiles_count\n stream_ids = favorites.streams.pluck(:favable_id).uniq\n return Stream.where(:id => stream_ids).pluck(:profile_id).uniq.count\n end",
"def chunked_repo_sets \n all_repositories = Dir.entries(OBSERVATIONS_DIR).select{|x| x != '.' && x != '..' && x != '.DS_Store'}.map{|x| \"#{OBSERVATIONS_DIR}/\" + x}\n stride = 500\n start_i = 0\n end_i = stride - 1\n repo_count = all_repositories.size\n repo_sets = Array.new\n while start_i < repo_count do\n end_i = repo_count - 1 if end_i >= repo_count\n next_set = all_repositories[start_i..end_i]\n repo_sets << next_set\n start_i = end_i + 1\n end_i += stride\n end\n repo_sets\nend",
"def followers\n Follow.where(\"following_id = ?\", self.id)\n end",
"def rec_users_to_follow(num_scrolls)\n num_results = 3\n Rails.cache.delete(\"fof_sorted_scores_#{self.id}\") if num_scrolls == 0\n \n cached_sorted_rec_users = Rails.cache.fetch(\"fof_sorted_scores_#{self.id}\", expires_in: 5.hours) do\n followed_users = self.users_followed.includes(:users_followed)\n fof_scores = Hash.new(){0}\n followed_users.each do |followed_user|\n followed_user.users_followed.each do |fof_user|\n fof_scores[fof_user] += 3 if (!followed_users.include?(fof_user)) \n end\n end \n sorted_rec_users = fof_scores.sort_by{|key, value| value}.map(&:first).reverse\n end\n\n return cached_sorted_rec_users[num_scrolls*num_results, num_results]\n end",
"def excess_repositories_for(multi_repo = nil)\n repository_full_names = repositories_for(multi_repo).map(&:full_name)\n local_repositories_for(multi_repo).reject { |repo|\n repository_full_names.include? repo.full_name\n }\n end",
"def fetch_profile_pages(urls)\n urls = urls.map { |l| \"#{l}?tab=repositories\" }\n responses = fetch(urls)\n hubbers = responses.map do |response|\n parse_profile_page(response)\n end\n hubbers\n end",
"def get_more\n @options = {\n :includeFirst => false, :limit => 10, :fetch_mode => 'normal', :fetch_focus_id => 0,\n :handle => \".endless_scroll_inner_wrap\" \n }\n\n if params.has_key? :includeFirst then\n @options[:includeFirst] = params[:includeFirst] == 'true' ? true : false \n end\n\n if params.has_key? :fetch_mode then\n if params[:fetch_mode] == 'following' then\n @options[:fetch_mode] = 'following'\n elsif params[:fetch_mode] == 'followers' then\n @options[:fetch_mode] = 'followers'\n end\n end\n\n if params.has_key? :fetch_focus_id then\n @options[:fetch_focus_id] = params[:fetch_focus_id].to_i\n end\n\n if params.has_key? :handle then\n @options[:handle] = params[:handle]\n end\n\n upper = @options[:includeFirst] ? 0..params[:last_id].to_i : 0..(params[:last_id].to_i - 1)\n\n if @options[:fetch_mode] == 'normal' then\n @next_personas = Persona.where( :id => upper).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'following' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(\n :id => persona.followers.where(:tracked_object_type => 'persona', \n :tracked_object_id => upper ).pluck(:tracked_object_id) \n ).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'followers' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(:id => Follower.where(\n :tracked_object_id => persona.id, :tracked_object_type => 'persona').pluck(:persona_id)\n ).order('id desc').group(:id).having(:id => upper)\n end\n end",
"def static_list_repositories\n %w[https://github.com/iwc-workflows/sars-cov-2-variation-reporting.git\n https://github.com/iwc-workflows/sars-cov-2-pe-illumina-artic-variant-calling.git\n https://github.com/iwc-workflows/sars-cov-2-ont-artic-variant-calling.git\n https://github.com/iwc-workflows/sars-cov-2-se-illumina-wgs-variant-calling.git\n https://github.com/iwc-workflows/sars-cov-2-pe-illumina-wgs-variant-calling.git\n https://github.com/iwc-workflows/parallel-accession-download.git\n https://github.com/iwc-workflows/sars-cov-2-consensus-from-variation.git\n https://github.com/iwc-workflows/sars-cov-2-pe-illumina-artic-ivar-analysis.git\n https://github.com/iwc-workflows/fragment-based-docking-scoring.git\n https://github.com/iwc-workflows/protein-ligand-complex-parameterization.git\n https://github.com/iwc-workflows/gromacs-mmgbsa.git\n https://github.com/iwc-workflows/gromacs-dctmd.git].map { |r| { 'clone_url' => r }}\n end",
"def pull_requests repo\n name = full_name repo\n \n %w[open closed].reduce([]) do |memo, state|\n memo | octokit.pulls(name, state, :per_page=>100)\n end\n end",
"def follow(num_users=N)\n num_users.times do |n|\n user = User.find_by_username(\"testuser#{n}\")\n NUM_FOLLOWEES.times do\n f = User.find_by_username(\"testuser#{rand(num_users)}\")\n user.follow(f)\n end\n end\nend",
"def find_commits(repos=@repo_array)\n repos.each do |repo|\n commit_list = @github.repos.commits.list user: @user_name, repo: repo\n @repos_and_commits[repo] = commit_list.body.to_s.scan(/message=\"([^\"]*)\"/)\n sleep @delay\n end\n end",
"def owned_repositories_with_user(user)\n repos = owned_repositories.publics\n repos = repos.or(user.membered_repositories.where(user_id: id)) if user\n repos\n end",
"def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend",
"def get_watched_repos\n @repos.each do |r|\n if r.name.downcase == 'txtout'\n @watched.store('txtout', r.id)\n end\n if r.name.downcase == 'resumemonster'\n @watched.store('resumemonster', r.id)\n end\n end\n end",
"def get_social_reach(person)\n person\n\n .loop do |p|\n p.in_e(:FOLLOWS).out_v(type: 'person').uniq\n end\n\n .while do |p, depth|\n if depth == 0\n :loop\n else depth <= 6\n :loop_and_emit\n else\n false\n end\n end",
"def find_repos(user)\n user.repos\n end",
"def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :person_id\"\n \n Post.where(\"person_id IN (#{following_ids}) OR person_id = :person_id\", person_id: id)\n end",
"def repo_connections_weighted_graph\n read_all_git_repos('repos')\n graph_links_between_git_objects\n end",
"def following_profiles\n stream_ids = favorites.streams.pluck(:favable_id).uniq\n profile_ids = Stream.where(id: stream_ids).pluck(:profile_id).uniq\n return Profile.where(id: profile_ids)\n end",
"def contributors_top\n\t\t\t@db.js('musicthoughts.top_contributors($1)', [20])\n\t\tend",
"def find_all(repo, options = {})\n refs = []\n already = {}\n Dir.chdir(repo.path) do\n files = Dir.glob(prefix + '/**/*')\n files.each do |ref|\n next if !File.file?(ref)\n id = File.read(ref).chomp\n name = ref.sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => id)\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n\n if File.file?('packed-refs')\n File.readlines('packed-refs').each do |line|\n if m = /^(\\w{40}) (.*?)$/.match(line)\n next if !Regexp.new('^' + prefix).match(m[2])\n name = m[2].sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => m[1])\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n end\n end\n end\n\n refs\n end",
"def find_recently_created_interesting(user, options = {})\n per = count = options[:count] || 20\n includes = options[:includes]\n excluded_ids = options[:excluded_ids]\n # to_a forces the query so that we don't get extraneous count queries on the relation later\n suggestions = user.recently_created_listings_from_followed_collections(includes: includes, per: per,\n excluded_ids: excluded_ids).to_a\n if suggestions.size < count\n per = count - suggestions.size\n excluded_ids = suggestions.map(&:id)\n suggestions += find_recently_created(includes: includes, per: per, excluded_ids: excluded_ids).to_a\n end\n suggestions\n end",
"def find_repositories\n @repos = GithubApi.call :repos\n end",
"def get_follower_ids( id, login=@login, password=@password, type='json' )\n http = Net::HTTP.new('twitter.com', 80)\n \n begin\n json_data = http.start do |http_inst|\n if id.class == Fixnum\n path = \"/followers/ids/ids.#{type}?user_id=#{id}\"\n else \n path = \"/followers/ids/#{id}.#{type}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n # puts data\n hash_data = JSON.parse( json_data )\n if hash_data.class == Hash && hash_data[\"error\"]\n return []\n end\n results = hash_data\n rescue\n puts \"Switching to paging.\"\n results = []\n page=1\n loop do\n json_data = http.start do |http_inst|\n if id.class == Fixnum\n path = \"/followers/ids/ids.#{type}?user_id=#{id}&page=#{page}\"\n else \n path = \"/followers/ids/#{id}.#{type}?page=#{page}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n # puts data\n hash_data = JSON.parse( json_data )\n if hash_data.class == Hash && hash_data[\"error\"]\n return []\n end\n puts \"page #{page} (5000 per page)\"\n results += hash_data\n break if hash_data.length == 0\n page += 1\n end\n \n end\n results \n end",
"def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend",
"def search_top_references(expr, count = 10)\n papers = search_api(expr, 1000)\n\n sorted_referenced_papers = papers[\"entities\"].inject([]) { |result, arr|\n if arr[\"RId\"].instance_of?(Array)\n result + arr[\"RId\"]\n else\n result\n end\n }.group_by(&:itself)\n .map { |key, value| [key, value.count] }\n .sort { |(k1, v1), (k2, v2)| v2 <=> v1 }\n\n request = \"Or(#{sorted_referenced_papers[0, count].map { |key, value|\n \"Id=#{key}\"\n }.join(\",\")})\"\n\n return search_api(request, count)\n end",
"def number_of_followers\n return_list_of_followers.size\n end",
"def repos\n client.repos({}, query: { sort: \"asc\" })\n end"
] |
[
"0.5932431",
"0.5884256",
"0.58509874",
"0.5850755",
"0.5832055",
"0.569113",
"0.56283444",
"0.5611019",
"0.54878515",
"0.5467303",
"0.54627734",
"0.5409336",
"0.53812915",
"0.5371475",
"0.5336227",
"0.5296693",
"0.5284301",
"0.5277139",
"0.52546793",
"0.5250612",
"0.52483416",
"0.5246688",
"0.5219369",
"0.5216519",
"0.5202943",
"0.51855",
"0.51705587",
"0.51601744",
"0.5144297",
"0.51387995",
"0.5136337",
"0.51220834",
"0.5113552",
"0.5106701",
"0.5103782",
"0.509521",
"0.5090704",
"0.508626",
"0.5075396",
"0.5069377",
"0.50675166",
"0.50599784",
"0.50595707",
"0.5053951",
"0.5052644",
"0.50484294",
"0.50456834",
"0.5041913",
"0.5029535",
"0.5022321",
"0.5009037",
"0.5005826",
"0.49981838",
"0.4995962",
"0.49941373",
"0.49849993",
"0.4977557",
"0.4975928",
"0.4972902",
"0.49726245",
"0.49525377",
"0.4941344",
"0.49332237",
"0.49305254",
"0.4928692",
"0.4924257",
"0.4922336",
"0.49209598",
"0.4919048",
"0.49111217",
"0.49078658",
"0.49032226",
"0.48996618",
"0.4898069",
"0.48852077",
"0.48831594",
"0.4881441",
"0.48798418",
"0.4873908",
"0.48706287",
"0.48692095",
"0.48689482",
"0.48684302",
"0.48638466",
"0.48628107",
"0.48563364",
"0.48532653",
"0.48487082",
"0.48425123",
"0.48377302",
"0.4837707",
"0.48364466",
"0.4835644",
"0.48302934",
"0.48301628",
"0.48269245",
"0.48266453",
"0.48228598",
"0.4819434",
"0.48191777"
] |
0.66640586
|
0
|
get the users for a repo
|
def get_users_for_repo(neo, repo)
neo.traverse(repo, 'nodes', {
:order => 'breadth first',
:uniqueness => 'node global',
:relationships => {
:type => 'follows',
:direction => 'in'
},
})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_repo_users\n repo_users = Array.new\n github = Github.new :oauth_token => github_token\n\n github.repos.list.body.each do |repo|\n repo_users << repo[\"owner\"][\"login\"]\n end\n\n repo_users\n end",
"def get_all_user_repos\n user = User.find_by(uuid: params[:uuid])\n\n client = Octokit::Client.new(:access_token => user.password)\n repo_list = []\n client.repositories(:user => user.gh_username).each { |repo|\n repo_list.push(repo.name)\n }\n render :json => {:repos => repo_list}\n end",
"def user_repos\n @user_repos ||= (\n talk 'user repos'\n client.repos\n )\n end",
"def users\n @users ||= begin\n users = client.team_members ENV[\"GITHUB_TEAM_ID\"], :per_page => 100\n while client.last_response.rels[:next] && client.rate_limit.remaining > 0\n users.concat client.get client.last_response.rels[:next].href\n end\n users.map { |u| User.new u[:login] }\n end\n end",
"def find_repos(user)\n user.repos\n end",
"def list\n # ask the repo for a list of all the users\n users = @repo.all\n # pass that list to the view to display\n @view.list_users(users)\n end",
"def user_repos\n @repos = @github.repos.list user: params[:username]\n render json: @repos\n end",
"def repository_issues_users(username, repository)\n issues = github_client.issues(:username => username, :repo => repository).select { |issue| issue.pull_request.html_url.nil? }.uniq_by(&:user)\n issues.map {|issue| {:issue => issue.to_hash, :user => Commiter.import_from_github(issue.user.login)} }\n end",
"def get_repo_names github_username , git_token\n\n Rails.cache.fetch(\"#{self.id}/repo_names\", expires_in: 6.hours) do\n repo_names = Array.new\n github = Github.new :oauth_token => git_token\n\n github.repos.list.body.each do |repo|\n if github_username == repo[\"owner\"][\"login\"]\n repo_names << { :user=>github_username ,:repo=>repo[\"name\"]}\n end\n end\n\n orgs_names = Array.new\n github.orgs.list.each do |org|\n orgs_names << org[\"login\"]\n end\n\n orgs_names.each do |oname|\n url = \"orgs/\"+oname+\"/repos\"\n \n github.get_request(url,Github::ParamsHash.new({})).each do |orepo|\n if oname == orepo[\"owner\"][\"login\"]\n repo_names << { :user=>oname ,:repo=>orepo[\"name\"]}\n end\n end\n end\n repo_names\n end\n end",
"def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_members(org).each do |user|\n if users.has_key?(user.login)\n users[user.login][:orgs] << org\n else\n users[user.login] = user.to_h\n users[user.login][:mfa_enabled] = true\n users[user.login][:orgs] = [org]\n end\n end\n end\n orgs.each do |org|\n octokit.organization_members(org, filter: '2fa_disabled').each do |user|\n users[user.login][:mfa_enabled] = false\n end\n end\n\n synchronize { @org_users = users }\n end",
"def get_user_repos(username) # :yields: JSON\n uri=URI.parse(@@uri_builder.user_repos_url(username,@@app_token))\n http=HttpHandler.initiate_http(uri)\n begin\n response=HttpHandler.get_response(http,uri)\n rescue ArgumentError\n puts \"Request failed with code: #{response.code}\"\n else\n @@responseStatus=true\n return response\n end\n end",
"def get_all\n @user_repository.get_all_users\n end",
"def get_my_repos\n repos = []\n\n (1..get_total_repo_pages_count.to_i).each do |index|\n get_json( \"#{ GITHUB_USER_REPOS_URL }?per_page=100&page=#{ index }\" ).each do |item|\n repos << item[ 'full_name' ]\n end\n end\n\n return repos\nend",
"def get_repo_list(token, user)\n query = %{\n query ($user: String!, $cursor: String) {\n user(login: $user) {\n repositories(first: 100, after: $cursor) {\n edges {\n node {\n name\n owner {\n login\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n }\n\n vars = { user: user, cursor: nil }\n\n repos = []\n\n loop do\n result = Github.query(token, query, vars)\n repos += result.dig(\"data\", \"user\", \"repositories\", \"edges\") || []\n break unless result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"hasNextPage\")\n vars[:cursor] = result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"endCursor\")\n end\n\n repos.map { |e| { owner: e.dig(\"node\", \"owner\", \"login\"), name: e.dig(\"node\", \"name\") } }\nend",
"def getUsers(projectId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/users/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap)\t\t\r\n\t\t\t\treturn $userParser.getUsers(response)\r\n\t\t\tend",
"def get_project_users(project_oid)\n project_users_url = make_project_users_url(project_oid)\n args = {:method => :get}\n params = {:fetch => \"UserName\", :order=> \"UserName ASC\"}\n results_json = @rally_json_connection.get_all_json_results(project_users_url, args, params, limit = 99999)\n\n these_project_users = []\n results = results_json[\"QueryResult\"][\"Results\"]\n results.each do | this_user_hash |\n username = this_user_hash[\"UserName\"]\n user = find_user(username)\n these_project_users.push(user)\n end\n return these_project_users\n end",
"def get_repos\n\t\tif current_user.nil?\n\t\t\t@repos = Repo.where(:user_id => nil)\n\t\telse\n\t\t\t@repos = current_user.repos\n\t\tend\n\tend",
"def get_project_users(project_id_or_key)\n get(\"projects/#{project_id_or_key}/users\")\n end",
"def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end",
"def repos\n @repos ||= (user_repos + org_repos).flatten\n end",
"def get_user\n response = HTTParty.get(\n GIT_BASE_URL + 'users/' + self.git_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (get user): #{response}\"\n return response\n end",
"def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end",
"def repositories\n client.repositories(user_repo, @options)\n end",
"def get_contributors_of_a_repository(username,repo_name) # :yields: JSON\n uri=URI.parse(@@uri_builder.get_repo_content(Api_options::REPO::CONTRIBUTORS,username,repo_name))\n http= HttpHandler.initiate_http(uri)\n begin\n response=HttpHandler.get_response(http,uri)\n rescue ArgumentError\n puts \"Request failed with code: #{response.code}\"\n else\n @@responseStatus=true\n return response\n end\n end",
"def repo_info\n # Extract user and project name from GitHub URL.\n url = git_config['remote.origin.url']\n if url.nil?\n puts \"Error: Not a git repository.\"\n return [nil, nil]\n end\n user, project = github_user_and_project(url)\n # If there are no results yet, look for 'insteadof' substitutions in URL and try again.\n unless user && project\n short, base = github_insteadof_matching(config_hash, url)\n if short and base\n url = url.sub(short, base)\n user, project = github_user_and_project(url)\n end\n end\n [user, project]\n end",
"def get_public_repos(user_name)\n get(\"/users/#{user_name}/repos\")\n end",
"def github_user_and_project(github_url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(github_url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end",
"def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end",
"def users\n result_hash['usr']\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def find_users\n if @dir.exist?\n return @dir.entries.each_with_object([]) do |entry, users|\n user_name = entry.basename\n user = User.new(user_name, self)\n if user.exist?\n users << user\n end\n end\n else\n return []\n end\n end",
"def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend",
"def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end",
"def user_repos1\n addons = Addon.joins(:user).where(\"lower(users.login) = ?\", params[:login].downcase)\n render json: to_v1_repo_hashes(addons)\n end",
"def contributor_usernames\n @contributor_usernames ||= contributors.map(&:username)\n end",
"def project_users(project_id, params = {})\n make_get_request(\"/projects/#{project_id}/users\", params)\n end",
"def get_users\n res = search(@config[:userdn])\n \n if (res[:message] != \"Success\")\n # tbd handle error\n return nil\n end\n \n if (res[:values] == [])\n return nil\n end\n \n users = []\n \n res[:values].each do |user|\n begin\n uid = user.uidnumber.first\n gid = user.gidnumber.first\n rescue\n uid = 0\n gid = 0\n end\n \n users << {\n :username => user.uid.first,\n :uid => uid,\n :gid => gid,\n :first => user.givenname.first,\n :last => user.sn.first\n }\n end\n \n return users\n end",
"def get_repos_by_orga(orga) \n\t\treturn self.fetch(\"repos?owner_name=#{orga}\")\n\tend",
"def repos\n @repos ||= get(\"/repos/show/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end",
"def users\n @users_by_href.values\n end",
"def find_user_repo(user, repo)\n UserRepo.find_by(\"user_id = ? AND repo_id = ?\", user.id, repo.id)\n end",
"def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end",
"def project_users\n request :user\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def index\n @github_users = GithubUser.all\n end",
"def github_logins\n pull_request_commits.select(&:author).map(&:author).map(&:login).uniq\n end",
"def repo_user\n # TODO: Clarify what repo_user actually is.\n # github is currently using the repo's 'owner', gitlab is using the user who pushed.\n case @vcs\n when 'github'\n @data['repository']['owner']['login']\n when 'gitlab'\n @data['user_username']\n end\n # TODO: Bitbucket, Stash/Bitbucket Server, TFS\n end",
"def read_owners(config, org_guid)\n user_setup_obj = UsersSetup.new(config)\n\n users_list = []\n users = @client.organization(org_guid).managers\n\n users.each do |user|\n user_guid = user.guid\n username = user_setup_obj.get_username_from_guid(user_guid)\n users_list << Users::User.new(username, 'owner', false, user_guid)\n end\n\n users_list\n end",
"def user_list\n execute('dscacheutil -q user') do |result|\n users = []\n result.stdout.each_line do |line|\n users << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n users\n end\n end",
"def users()\n\t\t\t\tusers = UserList.new()\n\n if dscl?\n # The dscl version is still limited\n idlist = `#{DSCLBIN} . -list /Users UniqueID`\n grouplist = `#{DSCLBIN} . -list /Users PrimaryGroupID`\n idlist.each do | line |\n user = UserInfo.new()\n name,id = line.split\n user.username = name\n user.uid = id.to_i\n users[name] = user\n end\n else\n # get the list of users using niutil\n textlist = `niutil -list . /users`\n textlist.each() { |line|\n line.strip!()\n user = UserInfo.new()\n user.username = line[/^[0-9]+\\s+(\\S+)$/, 1]\n userlist = `niutil -read . /users/#{user.username}`\n userlist.each() { |subline|\n subline.strip!()\n case(subline)\n when(/^home:/)\n user.homedir = subline[/:\\s*(.*)$/, 1]\n when(/^uid:/)\n user.uid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^gid:/)\n user.gid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^realname:/)\n user.fullname = subline[/:\\s*(.*)$/, 1]\n end\n }\n users[user.username] = user\n }\n end\n\t\t\t\treturn(users)\n\t\t\tend",
"def contributors(exact = false)\n acl.get_users_with_role(AlbumACL::CONTRIBUTOR_ROLE, exact)\n end",
"def get_user_github_organizations(github_orgs_url)\n uri = URI.parse(github_orgs_url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n user_organizations = JSON.parse(response.body)\n user_organizations.map { |o| o['login'] }\n end",
"def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end",
"def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end",
"def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def users\n return [member_1, member_2];\n end",
"def owned_repositories_with_user(user)\n repos = owned_repositories.publics\n repos = repos.or(user.membered_repositories.where(user_id: id)) if user\n repos\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 users\n res = []\n\n tmp = GoodData.get @json['project']['links']['users']\n tmp['users'].map do |user|\n res << GoodData::Membership.new(user)\n end\n\n res\n end",
"def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def list\n get('users')['users']\n end",
"def index\n @repos = @user.repos.includes(:user)\n render json: to_json(@repos)\n end",
"def public_users\n raw_users = GitHub::API.json(\"/organizations/#{self.login}/public_members\")['users']\n users = []\n\n raw_users.each do |user|\n users << GitHub::User.new(user)\n end\n\n return users\n end",
"def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end",
"def users\n runner_users + corporation_users\n end",
"def repos(options = {})\n Tinybucket::Resource::User::Repos.new(username, options)\n end",
"def owned_repositories_with_user(user)\n repos = self.owned_repositories.publics\n repos = repos.or(user.membered_repositories.where(user_id: self.id)) if user\n repos\n end",
"def find_repositories\n @repos = GithubApi.call :repos\n end",
"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 add_repositories_for_member name\n # For a single repo, we'd call\n # GET /users/:username/repos (see https://developer.github.com/v3/repos/#list-user-repositories)\n GithubApi.get(\"/users/#{name}/repos\").each do |r|\n @repositories << r[\"full_name\"]\n end\n end",
"def list\n @connection.get('/user/repos').map do |repo_data|\n Rails.logger.info \"listing repos\"\n GitHubApi::Repo.new(self, repo_data)\n end\n end",
"def getAllApprovedUsers()\n users = [] \n docs = @usersColl.find({ \"approval_status.code\" => 1 }, { :username => 1 })\n index = 0\n docs.each do |doc|\n users[index] = doc[:username]\n index += 1\n end # End of docs iteration\n return users\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def repos\n api.repos.map(&:to_hash)\n end",
"def list_of_users\n\tusers=[]\n\tfor username in Dir.entries(\"/Users\")\n\t\tif !username.start_with?(\".\")\n\t\t\tusers.push(username)\n\t\tend\n\tend\n\treturn users\nend",
"def team_repositories\n team_profiles.map(&:repositories).flatten\n end",
"def find_repos\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get user input from API\n user_input_string = request.params[:_json]\n input_arr = user_input_string.gsub(/\\s+/, \"\").split(\",\")\n\n # search repos using user input\n repoids = input_arr.map do |input|\n repo = @client.repository(input)\n \"#{repo.to_hash[:id]}\"\n end\n\n # Save user search input and repos to UserPreference\n @current_user.UserPreference.search_input = user_input_string\n @current_user.UserPreference.repos = repoids.join(\",\")\n @current_user.UserPreference.save\n\n respond_to do |format|\n format.json {\n render json: repoids.to_json, status: 200\n }\n end\n end",
"def get_users_for_role(name)\n model.model['g']['g'].rm.get_users(name)\n end",
"def login_users\n self.journal_entries.collect { |entry| entry.login_user }.compact\n end",
"def users()\n\t\t\t\tuserlist = UserList.new()\n\n\t\t\t\tFile.open('/etc/passwd', File::RDONLY) { |fp|\n\t\t\t\t\tregex = /^([a-zA-Z0-9-]+):[^:]+:([0-9]+):([0-9]+):([^:]*):([^:]*):([^:]*)$/\n\t\t\t\t\tfp.each_line() { |line|\n\t\t\t\t\t\tmatch = regex.match(line)\n\t\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\t\tuser = UserInfo.new()\n\t\t\t\t\t\t\tuser.username = match[1]\n\t\t\t\t\t\t\tuser.uid = match[2].to_i()\n\t\t\t\t\t\t\tuser.gid = match[3].to_i()\n\t\t\t\t\t\t\tuser.fullname = match[4]\n\t\t\t\t\t\t\tuser.homedir = match[5]\n\t\t\t\t\t\t\tuser.shell = match[6]\n\t\t\t\t\t\t\tuserlist[user.username] = user\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn(userlist)\n\t\t\tend",
"def find_users_with_shared_repos\n\n (friends - [self]).sort_by do |f|\n f.repos.select { |r| repos.collect { |s| s.id }.include?(r.id) }.size\n end.reverse\n\n end",
"def list\n @repos\n end",
"def github_projects\n Rails.cache.fetch(\"/users/#{self.id}/github_projects\", :expires_in => 1.day) {\n gh = Github.new(authentications.where(:provider => 'github').first.provider_token)\n gh.repos\n }\n end",
"def users_for_new_issue_watchers(issue)\n users = issue.watcher_users.select{|u| u.status == User::STATUS_ACTIVE}\n project = issue.project\n scope_users = project.users\n scope_groups = project.principals.merge(Group.givable)\n if scope_users.count + scope_groups.count <= 20\n users = (users + scope_users.sort + scope_groups.sort).uniq\n end\n users\n end",
"def get_users(request); end",
"def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end",
"def get_users\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n render json: @project.project_users, status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:id]}\" }, status: 404\n end\n end",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end",
"def list_collaborators(user, repo_name)\n @connection.get(\"/repos/#{user}/#{repo_name}/collaborators\").map do |user_data|\n GitHubApi::User.new(@connection.users, user_data)\n end\n end",
"def get_all_users(spec)\n user = spec.or_contributors_to_spec\n if @users.include? user\n @numbers[user] = @numbers[user] + 1\n else\n @users.add user\n @numbers[user] = 1\n end\nend",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def org_repos\n @org_repos ||= (\n talk 'org repos'\n logins = orgs.map { |org| org[:login] }\n\n logins.map do |login|\n talk \"repos for #{login}\"\n client.organization_repositories login.to_s\n end.flatten\n )\n end",
"def get_repos\n\t\t@repos = Repo.all\n\tend",
"def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end",
"def returning_users\n []\n end",
"def list(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n normalize! params\n\n response = if params['ref']\n ref = params.delete('ref')\n _validate_reference ref\n get_request(\"/repos/#{user}/#{repo}/git/refs/#{ref}\", params)\n else\n get_request(\"/repos/#{user}/#{repo}/git/refs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end",
"def all_redmine_users()\n return @@redmine_cxn.all_users\n end",
"def users\n if design.only_unblinded\n project.unblinded_members_for_site(subject.site)\n else\n project.members_for_site(subject.site)\n end\n end",
"def users\n recipe_cards.map do |r|\n r.user\n end\n end"
] |
[
"0.8831717",
"0.7594455",
"0.733468",
"0.7199064",
"0.7116713",
"0.7096837",
"0.7087345",
"0.7025816",
"0.7003137",
"0.6926963",
"0.6855608",
"0.6847159",
"0.6806955",
"0.6793283",
"0.67886394",
"0.6774231",
"0.6760473",
"0.67336935",
"0.6683094",
"0.66607404",
"0.6646639",
"0.6631369",
"0.6630932",
"0.6609309",
"0.65574175",
"0.65394545",
"0.6536161",
"0.6521675",
"0.6520895",
"0.6511074",
"0.64922917",
"0.6491148",
"0.6483852",
"0.6483496",
"0.64762986",
"0.6438481",
"0.64357245",
"0.6434251",
"0.6414727",
"0.6407024",
"0.6377401",
"0.6350238",
"0.6345427",
"0.63385427",
"0.63248056",
"0.63119376",
"0.6305679",
"0.6293192",
"0.62617326",
"0.62535435",
"0.62442994",
"0.62397647",
"0.62337315",
"0.62337315",
"0.6233065",
"0.6230734",
"0.6211169",
"0.62044907",
"0.62036514",
"0.6188032",
"0.6179797",
"0.6178437",
"0.6174512",
"0.6173737",
"0.616723",
"0.61568433",
"0.6154818",
"0.61542624",
"0.6154244",
"0.61509293",
"0.6150748",
"0.6149025",
"0.6140417",
"0.6135529",
"0.61346245",
"0.6128509",
"0.6121764",
"0.6117289",
"0.6115072",
"0.6093148",
"0.6091708",
"0.60850406",
"0.60844725",
"0.6076314",
"0.60741186",
"0.6072168",
"0.6070739",
"0.6070523",
"0.6069034",
"0.60653055",
"0.6060278",
"0.6054468",
"0.6054295",
"0.60535806",
"0.6052253",
"0.60519123",
"0.60403365",
"0.6038833",
"0.60385907",
"0.60382754"
] |
0.7610166
|
1
|
get the relationships for a repo, with user id and user name
|
def get_relationships_for_repo(neo, repo)
cypher_query = ' START user = node:nodes_index(type = "user"), repo = node:nodes_index(type = "repo")'
cypher_query << ' MATCH user-[r:follows]->repo'
cypher_query << ' WHERE ID(repo) = {repo_id}'
cypher_query << ' RETURN ID(user), user.name'
neo.execute_query(cypher_query, { :repo_id => repo[0] })['data']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def relationships\n model.relationships(repository.name)\n end",
"def find_repos(user)\n user.repos\n end",
"def get_users_for_repo(neo, repo)\n\n\tneo.traverse(repo, 'nodes', {\n\t\t:order => 'breadth first',\n\t\t:uniqueness => 'node global',\n\t\t:relationships => {\n\t\t\t:type => 'follows',\n\t\t\t:direction => 'in'\n\t\t},\n\t})\n\nend",
"def repositories\n client.repositories(user_repo, @options)\n end",
"def owned_repositories_with_user(user)\n repos = owned_repositories.publics\n repos = repos.or(user.membered_repositories.where(user_id: id)) if user\n repos\n end",
"def owned_repositories_with_user(user)\n repos = self.owned_repositories.publics\n repos = repos.or(user.membered_repositories.where(user_id: self.id)) if user\n repos\n end",
"def get_relationship user_id\n url = API + \"users/#{user_id}/relationship?access_token=\" + @access_token\n get(url)\n end",
"def get_all_user_repos\n user = User.find_by(uuid: params[:uuid])\n\n client = Octokit::Client.new(:access_token => user.password)\n repo_list = []\n client.repositories(:user => user.gh_username).each { |repo|\n repo_list.push(repo.name)\n }\n render :json => {:repos => repo_list}\n end",
"def get_repo_list(token, user)\n query = %{\n query ($user: String!, $cursor: String) {\n user(login: $user) {\n repositories(first: 100, after: $cursor) {\n edges {\n node {\n name\n owner {\n login\n }\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n }\n\n vars = { user: user, cursor: nil }\n\n repos = []\n\n loop do\n result = Github.query(token, query, vars)\n repos += result.dig(\"data\", \"user\", \"repositories\", \"edges\") || []\n break unless result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"hasNextPage\")\n vars[:cursor] = result.dig(\"data\", \"user\", \"repositories\", \"pageInfo\", \"endCursor\")\n end\n\n repos.map { |e| { owner: e.dig(\"node\", \"owner\", \"login\"), name: e.dig(\"node\", \"name\") } }\nend",
"def find_user_repo(user, repo)\n UserRepo.find_by(\"user_id = ? AND repo_id = ?\", user.id, repo.id)\n end",
"def get_repos\n\t\tif current_user.nil?\n\t\t\t@repos = Repo.where(:user_id => nil)\n\t\telse\n\t\t\t@repos = current_user.repos\n\t\tend\n\tend",
"def get_repo_users\n repo_users = Array.new\n github = Github.new :oauth_token => github_token\n\n github.repos.list.body.each do |repo|\n repo_users << repo[\"owner\"][\"login\"]\n end\n\n repo_users\n end",
"def user_repos\n @user_repos ||= (\n talk 'user repos'\n client.repos\n )\n end",
"def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end",
"def get_repos(neo)\n\n\t# return repo's that have more than 1 connection\n\t# TODO: try this; n<-r[follows*2..]-m\n\tcypher_query = ' START n = node:nodes_index(type = \"repo\")'\n\tcypher_query << ' MATCH n<-[r:follows]-m'\n\tcypher_query << ' WITH n, count(m) AS follow_count'\n\tcypher_query << ' WHERE follow_count > 2'\n\tcypher_query << ' RETURN ID(n), n.name, follow_count'\n\tcypher_query << ' ORDER BY ID(n)'\n\tneo.execute_query(cypher_query)['data']\n\nend",
"def get_relations_of_workspace_and_user(wid)\n get \"/workspaces/#{wid}/workspace_users\"\n end",
"def repositories\n Repository.where(user_id: group_ids).or(membered_repositories).order(\"updated_at desc\")\n end",
"def team_repositories\n team_profiles.map(&:repositories).flatten\n end",
"def repos\n @repos ||= (user_repos + org_repos).flatten\n end",
"def relationships(*ids)\n perform_request_with_collection(:get, '/api/v1/accounts/relationships',\n array_param(:id, ids),\n Mastodon::Relationship)\n end",
"def get_relation(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/relations/#{args[:relation]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def list(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n normalize! params\n\n response = if params['ref']\n ref = params.delete('ref')\n _validate_reference ref\n get_request(\"/repos/#{user}/#{repo}/git/refs/#{ref}\", params)\n else\n get_request(\"/repos/#{user}/#{repo}/git/refs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end",
"def user_repos\n @repos = @github.repos.list user: params[:username]\n render json: @repos\n end",
"def list_relationships\n end",
"def get_repos_by_orga(orga) \n\t\treturn self.fetch(\"repos?owner_name=#{orga}\")\n\tend",
"def repos\n @repos ||= get(\"/repos/show/#{login}\")['repositories'].map { |r| Repo.new(connection, r) }\n end",
"def repositories(repo, options = {})\n paginate repo.public_user_repos_path, options if valid_user?(repo)\n end",
"def find_users_with_shared_repos\n\n (friends - [self]).sort_by do |f|\n f.repos.select { |r| repos.collect { |s| s.id }.include?(r.id) }.size\n end.reverse\n\n end",
"def repos\n client.repos({}, query: { sort: \"asc\" })\n end",
"def relation(user)\n traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| (path.end_node[:fbid] == user[:fbid]) ? :include_and_continue : :exclude_and_continue }\n # self.both(:bobfather).depth(:all).filter{|path| path.end_node.rel?(:recommend, :incoming)}.\n # each{|node| puts node[:name]}\n \n #traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| puts path.end_node ; puts path.end_node.id ; :include_and_continue }\n # traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| :include_and_continue }\n # traversal = u1.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| :include_and_continue }\n return traversal\n end",
"def relationships_for_remote\n {\n inviter: UserHandler.relationship_data(@entity.inviter),\n native: UserHandler.relationship_data(User.find_by(id: @entity.native_id))\n }\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def get_repo_names github_username , git_token\n\n Rails.cache.fetch(\"#{self.id}/repo_names\", expires_in: 6.hours) do\n repo_names = Array.new\n github = Github.new :oauth_token => git_token\n\n github.repos.list.body.each do |repo|\n if github_username == repo[\"owner\"][\"login\"]\n repo_names << { :user=>github_username ,:repo=>repo[\"name\"]}\n end\n end\n\n orgs_names = Array.new\n github.orgs.list.each do |org|\n orgs_names << org[\"login\"]\n end\n\n orgs_names.each do |oname|\n url = \"orgs/\"+oname+\"/repos\"\n \n github.get_request(url,Github::ParamsHash.new({})).each do |orepo|\n if oname == orepo[\"owner\"][\"login\"]\n repo_names << { :user=>oname ,:repo=>orepo[\"name\"]}\n end\n end\n end\n repo_names\n end\n end",
"def my_relationships(name)\n self.class.find_relationship(name).find_by_participant(self)\n end",
"def get_relationships(clear_cache = false)\n\n\tFile.delete(node_cache_file) if clear_cache && File.exist?(node_cache_file)\n\n\tif File.exist?(node_cache_file)\n\n\t\tcontent_type :json unless is_rake\n\t\tsend_file node_cache_file\n\n\telse\n\n\t\tneo = Neography::Rest.new(ENV['NEO4J_URL'] || 'http://localhost:7474')\n\n\t\tout = {\n\t\t\t:nodes => [],\n\t\t\t:links => [],\n\t\t}\n\n\t\tusers = {}\n\t\trepos = []\n\t\trepo_index = 0\n\t\tuser_index = 0\n\n\t\tget_repos(neo).each do |repo|\n\n\t\t\trelationships = get_relationships_for_repo(neo, repo)\n\n\t\t\trepos << {\n\t\t\t\t:name => repo[1],\n\t\t\t\t:type => :repo,\n\t\t\t\t:id => repo[0],\n\t\t\t\t:group => 1,\n\t\t\t}\n\n\t\t\trelationships.each do |n|\n\n\t\t\t\tunless users.has_key?(n[0])\n\n\t\t\t\t\tusers[n[0]] = {\n\t\t\t\t\t\t:name => n[1],\n\t\t\t\t\t\t:type => :user,\n\t\t\t\t\t\t:id => n[0],\n\t\t\t\t\t\t:group => 2,\n\t\t\t\t\t\t:index => user_index,\n\t\t\t\t\t}\n\n\t\t\t\t\tuser_index = user_index + 1\n\n\t\t\t\tend\n\n\t\t\t\tout[:links] << {\n\t\t\t\t\t:source => repo_index,\n\t\t\t\t\t:target => n[0],\n\t\t\t\t\t:value => 1,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\t\trepo_index = repo_index + 1\n\n\t\tend\n\n\t\t# set the target index correctly for the javascript\n\t\tout[:links].each do |l|\n\n\t\t\tl[:target] = users[l[:target]][:index] + repo_index\n\n\t\tend\n\n\t\tout[:nodes] = repos.concat(users.values.to_a).flatten\n\n\t\tFile.open(node_cache_file, 'w'){ |f| f << out.to_json }\n\n\t\tunless is_rake\n\n\t\t\tcontent_type :json\n\t\t\t#JSON.pretty_generate(out) # pretty print\n\t\t\tout.to_json # normal out\n\n\t\tend\n\n\tend\n\nend",
"def repos\n api.repos.map(&:to_hash)\n end",
"def user_repos1\n addons = Addon.joins(:user).where(\"lower(users.login) = ?\", params[:login].downcase)\n render json: to_v1_repo_hashes(addons)\n end",
"def get_relationship(other_user)\n\tif other_user.present?\n\t\tRelationship.where(\"follower_id = :follower_id and followed_id = :followed_id or follower_id = :followed_id and followed_id = :follower_id\", {follower_id: other_user.id, followed_id: self.id})[0]\n\tend\n end",
"def add_repositories_for_member name\n # For a single repo, we'd call\n # GET /users/:username/repos (see https://developer.github.com/v3/repos/#list-user-repositories)\n GithubApi.get(\"/users/#{name}/repos\").each do |r|\n @repositories << r[\"full_name\"]\n end\n end",
"def rels(node)\n @batch_inserter.getRelationships(node)\n end",
"def get_relations\n # Descobrir as relacoes:\n # Orientados\n # Projetos de Pesquisa\n # Producoes Bibliograficas\n # Consultar o RP de cada uma\n # Somar os RPs e retornar\n orientados = self.get_relations_of_orientados\n projetos = self.get_relations_of_projetos_pesquisa\n producoes = self.get_relations_of_producoes_bibliograficas\n\n relations = (orientados | projetos | producoes).delete self.id\n return relations.to_a\n end",
"def fetch_refs(repo_user,repo_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/refs\")\n body = response_body(uri)\n \n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n [] \n end\n end",
"def get(user, repo_name)\n org_data = @connection.get(\"/repos/#{user}/#{repo_name}\")\n GitHubApi::Repo.new_with_all_data(self, org_data)\n rescue RestClient::ResourceNotFound\n raise NotFound, \"The repository #{user}/#{repo_name} does not exist or is not visible to the user.\"\n end",
"def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end",
"def index\n @repos = @user.repos.includes(:user)\n render json: to_json(@repos)\n end",
"def get_user_relationships_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"relationships\"] = user.get_relationship_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def owners\n get_user_with_role(:owner)\n end",
"def get_repos\n # using oauth token to increase limit of request to github api to 5000\n client = Octokit::Client.new :access_token => self.github_token\n (client.repositories self.github_name, {:type => 'all'}).map do |repo|\n repo.full_name\n end\n end",
"def user_relationship\n if request.xhr?\n organization_id = params[\"organization_id\"]\n per_page = params[:iDisplayLength] || Settings.per_page\n page = params[:iDisplayStart] ? ((params[:iDisplayStart].to_i/per_page.to_i) + 1) : 1\n params[:iSortCol_0] = 1 if params[:iSortCol_0].blank?\n sort_field = SORT_MAP_RELATIONSHIP[params[:iSortCol_0].to_i]\n # @users = User.get_all_users_except_id(current_user.id, page, per_page, params[:sSearch], sort_field + \" \" + params[:sSortDir_0],organization_id)\n @users = User.get_user_to_relationship(page, per_page, params[:sSearch], sort_field + \" \" + params[:sSortDir_0])\n render :json => @users\n return\n end\n end",
"def user_repo1\n addon = Addon.joins(:user)\n .where(\"lower(users.login) = ?\", params[:login].downcase)\n .where(\"lower(repos.name) = ?\", params[:repo_name].downcase)\n .first\n render json: to_v1_repo_hash(addon)\n end",
"def repo_connections_weighted_graph\n read_all_git_repos('repos')\n graph_links_between_git_objects\n end",
"def repos\n pry(Git::Multi.repositories)\nend",
"def get_relations_from_api(api=Rosemary::API.new)\n api.get_relations_referring_to_object(type, self.id.to_i)\n end",
"def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end",
"def get_qualifying_repos\n if !authenticated?\n authenticate!\n end\n\n # Get Github data.\n\n repos = client.repositories\n username = client.user.login\n\n # Compile a list of repositories for projecs that we've already used.\n user = User.find_by(github_id: client.user.id)\n used_repos = Array.new\n my_books = Book.where(\"user_id = ?\", user.id)\n [*my_books].each do |book|\n used_repos << book[:repo_id]\n end\n\n # Identify the names claimed for github user/organization pages. There may\n # be a better way to remove them than string detection, but I'll use it for\n # now, since it looks like that's what github uses and I don't know beter.\n name_match_1 = username + '.github.io' #=> octocat.github.io\n name_match_2 = username + '.github.com' #=> octocat.github.com\n\n # Iterate through our array of github repos and delete ones from the list\n # that don't qualify for a new book-site.\n repos.delete_if do |repo|\n # Remove this repo if it matches the name for a user/org page project.\n if repo.name == name_match_1 || repo.name == name_match_2\n true\n # Remove this repo if it has already been used for a book.\n elsif used_repos.include? repo.id\n true\n # Remove this repo if it doesn't belong to this user. This is designed to\n # remove repos you are a \"collaborator\" on.\n elsif username != repo.full_name.split('/')[0]\n true\n else\n # This repo is good... return false to prevent deleting it.\n false\n end\n end\n\n return repos\nend",
"def get_my_repos\n repos = []\n\n (1..get_total_repo_pages_count.to_i).each do |index|\n get_json( \"#{ GITHUB_USER_REPOS_URL }?per_page=100&page=#{ index }\" ).each do |item|\n repos << item[ 'full_name' ]\n end\n end\n\n return repos\nend",
"def get_relations(service)\n\t\treturn @transport.get_path(\"relations\",service)\n\tend",
"def relations\n @relations ||= process_rels\n end",
"def related_to(*args)\n@relations = args.map(&:to_s)\nend",
"def get_relations(type, options)\n configure_twitter\n result = case type\n when :follows\n Twitter.friend_ids(options)\n when :followers\n Twitter.follower_ids(options)\n end\n # next_cursor = result.next_cursor\n ids = result.ids\n options[:page] = 0 if options[:page].nil?\n offset = options[:page].to_i * USERS_PER_PAGE\n users = Twitter.users(result.collection[offset, USERS_PER_PAGE+1]).index_by(&:id)\n data = []\n ids.each {|id|\n data << users[id] unless users[id].nil?\n }\n data\n end",
"def find_repos\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get user input from API\n user_input_string = request.params[:_json]\n input_arr = user_input_string.gsub(/\\s+/, \"\").split(\",\")\n\n # search repos using user input\n repoids = input_arr.map do |input|\n repo = @client.repository(input)\n \"#{repo.to_hash[:id]}\"\n end\n\n # Save user search input and repos to UserPreference\n @current_user.UserPreference.search_input = user_input_string\n @current_user.UserPreference.repos = repoids.join(\",\")\n @current_user.UserPreference.save\n\n respond_to do |format|\n format.json {\n render json: repoids.to_json, status: 200\n }\n end\n end",
"def repos(opts={ push: false, details: false, orgs: true })\n repos = @client.repositories.map {|repo| parse_repo repo}\n @client.organizations.each do |org|\n repos += @client.organization_repositories(org.login).map {|repo| parse_repo repo}\n end\n repos.reject! {|repo| !repo[:push]} if opts[:push]\n repos.map { |repo| repo[:full_name] } unless opts[:details]\n end",
"def relationships\n @relationships ||= {}\n end",
"def relators\n\t\t@relators = @tags = Relator.order('left_name').all.decorate\n\tend",
"def relationships\n return [] if empty?\n\n map { |table| Relationship.new(table, TABLE_R, \"../#{table.pn}\") }\n end",
"def get_repo_details\n user = User.find_by(uuid: params[:uuid])\n client = Octokit::Client.new(:access_token => user.password)\n repo_map = {}\n client.repository(:user => user.gh_username, :repo => params[:repo_name]).each { |detail|\n repo_map[detail[0]] = detail[1]\n }\n repo_map['languages'] = client.languages(:user => user.gh_username, :repo => params[:repo_name]).map{ |langArray|\n langArray[0]\n }\n render :json => repo_map\n end",
"def org_repos\n @org_repos ||= (\n talk 'org repos'\n logins = orgs.map { |org| org[:login] }\n\n logins.map do |login|\n talk \"repos for #{login}\"\n client.organization_repositories login.to_s\n end.flatten\n )\n end",
"def mutual_relationships\n Relationship.find_by_sql([\"SELECT * from relationships t1 INNER JOIN relationships t2 ON (t1.follower_id = t2.followable_id) WHERE t1.follower_id = ? AND t1.id < t2.id AND t1.followable_type = 'User'\", self.id])\n end",
"def get_relation(id)\n get_object('relation', id)\n end",
"def owners\n self.authors.collect(&:user)\n end",
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def relations\n _relations\n end",
"def relations\n _relations\n end",
"def investors\n relationships = self.investment_relationships\n users = []\n\n relationships.each do |relationship|\n users << relationship.investor_user\n end\n return users\n end",
"def get_repos\n @api.list_repositories\n end",
"def all_organization_relationships(**args)\n params = parameters(args) do\n required_params :org_id\n optional_params :org_id\n end\n request(:get, 'organizationRelationships', params)\n end",
"def get_repos\n\t\t@repos = Repo.all\n\tend",
"def users\n recipes.map {|recipe| recipe.user}\n end",
"def get_public_repos(user_name)\n get(\"/users/#{user_name}/repos\")\n end",
"def relationships\n @relationships ||= Relationship.from_associations(self, associations)\n end",
"def get_repositories\n get(\"#{url_base}/repositories?#{dc}\")[\"data\"]\n end",
"def get(user_name, repo_name, ref, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n _validate_presence_of ref\n _validate_reference ref\n normalize! params\n\n get_request(\"/repos/#{user}/#{repo}/git/refs/#{ref}\", params)\n end",
"def followers\n rels = Relationship.where(followed_id: self.id)\n followers = []\n rels.each do |rel|\n followers << User.find(rel.follower_id)\n end\n followers\n end",
"def repo\n @repo\n end",
"def relationships(label = \"all\", status = true, created_by = \"any\")\n edges = self.edges.select do |edge|\n creation_condiction = true\n\n if created_by == \"self\"\n creation_condiction = edge.origin == self\n elsif created_by == \"other\"\n creation_condiction = edge.destiny == self\n end\n \n (edge.label == label or label == \"all\") and edge.active == status and creation_condiction\n end\n\n users = Set.new\n\n edges.each do |edge|\n users << (edge.origin != self ? edge.origin : edge.destiny)\n end\n\n return users\n end",
"def relationships_with_name(input, name)\n input.relations(name)\n end",
"def link_commits(repo_path, username, repo_name)\n\n # create a partial repo URL for GitHub repository\n partial_URL = \"https://github.com/#{username}/#{repo_name}/commit/\"\n \n # access the repository at the given repo_path\n repo = Grit::Repo.new(repo_path)\n \n all_commits = get_all_commits(repo)\n \n #all_commits.each{ |commit|\n # puts \"[#{commit.sha}](#{partial_URL + commit.sha})\\n\\n\"\n #}\n\n return all_commits.map do |commit|\n \"[#{commit.sha}](#{partial_URL + commit.sha})\\n\\n\"\n end\nend",
"def find_repositories\n @repos = GithubApi.call :repos\n end",
"def get_repo (repoName='ComputerScience_test')\n puts \"get_repo\"\n set_repository repoName\n puts \"set_repository #{@repository}\"\n result = @repository.query.perform \"select ?s ?p ?o {?s ?p ?o} order by ?s\"\n #puts \"@repository.query.perform #{result}\"\n \n graph = RDF::Graph.new(\"http://ninjalearning.info:8080/repositories/ComputerScience_test\") # TODO: repo name, host, port, ...\n \n result['values'].each do |triple|\n graph << RDF::Statement.new(\n RDF::URI.new(triple[0]),\n RDF::URI.new(triple[1]),\n RDF::URI.new(triple[2]),\n )\n end\n graph\n end",
"def projects\n Tracker.includes(:tracker_relations => [:linked_account]).where('trackers.id in (:ids)', ids: tracker_relations.pluck(:tracker_id))\n end",
"def relationships\n return [] unless has_comments?\n\n comments.relationships\n end",
"def acquire_repo_list\n set_auth\n set_github_repo_name\n repo_list = []\n (@github.repos.list org: GITHUB_ORG).each do |l|\n repo_list << l[:name]\n end\n repo_list\nend",
"def get_contributors_of_a_repository(username,repo_name) # :yields: JSON\n uri=URI.parse(@@uri_builder.get_repo_content(Api_options::REPO::CONTRIBUTORS,username,repo_name))\n http= HttpHandler.initiate_http(uri)\n begin\n response=HttpHandler.get_response(http,uri)\n rescue ArgumentError\n puts \"Request failed with code: #{response.code}\"\n else\n @@responseStatus=true\n return response\n end\n end",
"def list\n # ask the repo for a list of all the users\n users = @repo.all\n # pass that list to the view to display\n @view.list_users(users)\n end",
"def get_user_repo_hash(user, data)\n return {\n 'user_id' => user['_id'],\n 'open_issues' => data['open_issues'],\n 'watchers' => data['watchers'],\n 'pushed_at' => data['pushed_at'],\n 'homepage' => data['homepage'],\n 'git_url' => data['git_url'],\n 'updated_at' => data['updated_at'],\n 'fork' => data['fork'],\n 'forks' => data['forks'],\n 'language' => data['language'],\n 'private' => data['private'],\n 'size' => data['size'],\n 'clone_url' => data['clone_url'],\n 'created_at' => data['created_at'],\n 'name' => data['name'], # a unique name for a user repo\n 'html_url' => data['html_url'],\n 'description' => data['description']\n }\n end",
"def refs(repo)\n repo.refs_hash[id]\n end",
"def related_accounts\n self.class.related_accounts(self.id.to_s)\n end",
"def related_accounts\n self.class.related_accounts(self.id.to_s)\n end",
"def get_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}\")\n\tend",
"def repos\n @repos ||= OY.repos\n end"
] |
[
"0.721598",
"0.68205875",
"0.652867",
"0.6370234",
"0.63568276",
"0.6260161",
"0.62548524",
"0.60606635",
"0.6008354",
"0.6002312",
"0.59954065",
"0.5979937",
"0.59636974",
"0.59211624",
"0.58956385",
"0.5737095",
"0.57164115",
"0.57111883",
"0.5703567",
"0.5692235",
"0.5686561",
"0.56856483",
"0.568009",
"0.5636653",
"0.5573616",
"0.55490947",
"0.55316937",
"0.55301636",
"0.5526227",
"0.5509294",
"0.5506482",
"0.5493253",
"0.5481663",
"0.54767853",
"0.54677546",
"0.5452555",
"0.5426827",
"0.5408146",
"0.54042387",
"0.5386369",
"0.5381867",
"0.5380841",
"0.5379968",
"0.5378866",
"0.53698635",
"0.53636086",
"0.5358741",
"0.5342526",
"0.5331211",
"0.5328171",
"0.5320831",
"0.5311279",
"0.53026795",
"0.53016937",
"0.52902865",
"0.52892506",
"0.5282332",
"0.5280553",
"0.5276407",
"0.5261686",
"0.5252029",
"0.5252024",
"0.52474463",
"0.5237631",
"0.52267885",
"0.52258795",
"0.522508",
"0.5224531",
"0.52128714",
"0.5207714",
"0.52053607",
"0.520194",
"0.520194",
"0.51867884",
"0.5185704",
"0.51850927",
"0.5184345",
"0.5181559",
"0.5180077",
"0.5179284",
"0.5177815",
"0.5167606",
"0.51627237",
"0.51580405",
"0.515229",
"0.51481724",
"0.5145546",
"0.5136682",
"0.51351535",
"0.51333773",
"0.51326185",
"0.5123634",
"0.5118154",
"0.51044875",
"0.51038986",
"0.5103469",
"0.51021826",
"0.51021826",
"0.51004845",
"0.5087306"
] |
0.7237486
|
0
|
find the longest paths
|
def find_longest_path(neo)
cypher_query = ' START user = node:nodes_index(type = "user")'
cypher_query << ' MATCH path=user-[:follows*]-repo'
cypher_query << ' WITH path, LENGTH(path) AS cnt'
cypher_query << ' RETURN extract(n in nodes(path): [ID(n), n.name, n.type])'
cypher_query << ' ORDER BY cnt DESC'
cypher_query << ' LIMIT 5'
neo.execute_query(cypher_query)['data']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def longest_path_1(edges)\nend",
"def find_max_path_length_recursively\n if self.outgoing_edges.exists?\n available_path_lengths = self.next_vertices.map do |vertex|\n [vertex.id, 1 + vertex.find_max_path_length_recursively]\n end\n longest = available_path_lengths.max{|a,b| a[1] <=> b[1]}[1]\n return longest\n else\n return 0;\n end\n end",
"def find_longest_path_length_to_leaf(source)\n longest = 0\n\n find_leaves.each do |a_leaf|\n begin\n temp_result = find_longest_path_length(source,a_leaf)\n rescue\n temp_result = 0\n end\n\n longest = [longest, temp_result].max if temp_result\n end\n\n longest\n end",
"def longest_common_subpath(paths)\n return if paths.empty?\n\n lcsp = Pathname.new(paths[0])\n\n paths[1..-1].each do |path|\n until ascendant_of?(lcsp, path)\n if lcsp.root?\n # If we get here a root directory is not an ascendant of path.\n # This may happen if there are paths in different drives on\n # Windows.\n return\n else\n lcsp = lcsp.parent\n end\n end\n end\n\n lcsp\n end",
"def longest_bridges(input)\n components = Set.new(parse(input))\n starters = components.select { |c| c[0].zero? }\n longest = []\n max = 0\n starters.each do |starter|\n bridge_each(components, starter) do |bridge|\n longest = [] if bridge.length > max\n longest << bridge if bridge.length >= max\n max = bridge.length if bridge.length > max\n end\n end\n longest\nend",
"def longest_path_from_segment(segment, visited_segments = [])\n visited_segments << segment\n unvisited_segments = unvisited_connected_segments(segment, visited_segments)\n return visited_segments if unvisited_segments.empty?\n further_visited_segments = unvisited_segments.map do |next_segment|\n longest_path_from_segment(next_segment, visited_segments.dup)\n end\n further_visited_segments.max_by(&:length)\n end",
"def longest\n @strings.max { |a,b| a.length <=> b.length}\n end",
"def longest_distance()\n max = 0\n s = \"\"\n @edges.each do |city, dests|\n dests.each do |dest|\n if max < dest.distance\n max = dest.distance\n s = \"#{city} to #{dest.name}\"\n end\n end\n end\n \"Longest distance is #{max} from #{s}\"\n end",
"def longest_string array\n array.max_by(&:length)\nend",
"def longestSub(str)\n\n\nend",
"def longest_string array\n\tarray.max_by(&:length)\nend",
"def longest(s1, s2)\n (s1 + s2).split(//).sort.uniq.join\nend",
"def longest (arr)\n arr.max_by {|str| str.length}\nend",
"def longest_string ar\n return ar.max_by(&:length)\nend",
"def lesstrips(start, finish, max_distance)\n total_paths, distance = 0, 0\n path, paths = [], []\n visited = [start]\n cycles = all_cycles # all cycles in graph\n puts \"MAX DISTANCE = #{max_distance}\\n\"\n total_paths += lesstrips_dfs(start, finish, max_distance, distance, visited, path, paths, cycles)\n puts \"\\n==> Total paths from #{start} to #{finish}, with distance < #{max_distance}: #{total_paths}\\n\"\n total_paths\n end",
"def longest str\n\tstr.max_by(&:length)\nend",
"def longest(s)\n\tall_results = []\n\n\tlist_of_chars = s.chars\n\n\tlist_of_chars.each_with_index do |char, index|\n\n\t\tresult = ''\n\t\tnext_index = index + 1 \n\t\tcurrent_index = index\n\t\tresult << char\n\n\t\tif current_index == list_of_chars.length - 1\n\t\t\tall_results = all_results.max { |a,b| a.length <=> b.length }\n\t\telse\n\t\t loop do\n\t\t \tif list_of_chars[next_index] == nil\n\t\t \t\tall_results << result\n\t\t \t\tbreak\n\t\t\t\telsif list_of_chars[next_index] >= list_of_chars[current_index]\n\t\t\t\t\tresult << list_of_chars[next_index]\n\t\t\t\t\tcurrent_index += 1\n\t\t\t\t\tnext_index += 1\n\t\t\t\telse\n\t\t\t\t\tall_results << result\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tall_results\nend",
"def longest_string ar\n\tar.max_by(&:length)\nend",
"def longest_string\nend",
"def find_longest(arr)\n arr.max_by { |x| x.to_s.length }\nend",
"def longest(stringArray)\n return stringArray.max_by(&:length)\nend",
"def find_longest(arr)\n arr.map(&:to_s).sort_by(&:length).find { |num| num.length == arr.map(&:to_s).sort_by(&:length).last.length }.to_i\nend",
"def longest_string \nend",
"def search(node)\n longest_path = 0\n if (@paths[node])\n @paths[node].each_index do |next_idx|\n next_node = @paths[node][next_idx]\n @paths[node].delete_at(next_idx)\n tmp = 1 + search(next_node)\n @paths[node].insert(next_idx,next_node)\n if (longest_path < tmp)\n longest_path = tmp\n end\n end\n end\n return longest_path\n end",
"def search(node)\n longest_path = 0\n if (@paths[node])\n @paths[node].each_index do |next_idx|\n next_node = @paths[node][next_idx]\n @paths[node].delete_at(next_idx)\n tmp = 1 + search(next_node)\n @paths[node].insert(next_idx,next_node)\n if (longest_path < tmp)\n longest_path = tmp\n end\n end\n end\n return longest_path\n end",
"def get_longest_path(clear_cache = false)\n\n\tFile.delete(longest_cache_file) if clear_cache && File.exist?(longest_cache_file)\n\n\tif File.exist?(longest_cache_file)\n\n\t\tcontent_type :json unless is_rake\n\t\tsend_file longest_cache_file\n\n\telse\n\n\t\tneo = Neography::Rest.new(ENV['NEO4J_URL'] || 'http://localhost:7474')\n\n\t\tout = {\n\t\t\t:nodes => [],\n\t\t\t:links => [],\n\t\t}\n\n\t\ti = 0\n\t\tfind_longest_path(neo).each do |path|\n\n\t\t\tpath[0].each_with_index do |n, index|\n\n\t\t\t\tout[:nodes] << {\n\t\t\t\t\t:name => n[1],\n\t\t\t\t\t:type => n[2],\n\t\t\t\t\t:id => n[0],\n\t\t\t\t\t:group => n[2] == 'user' ? 2 : 1,\n\t\t\t\t}\n\n\t\t\t\tif index < path[0].length - 1\n\n\t\t\t\t\tout[:links] << {\n\t\t\t\t\t\t:source => i,\n\t\t\t\t\t\t:target => i + 1,\n\t\t\t\t\t\t:value => 1,\n\t\t\t\t\t}\n\n\t\t\t\tend\n\n\t\t\t\ti = i + 1\n\n\t\t\tend\n\n\t\tend\n\n\t\tFile.open(longest_cache_file, 'w'){ |f| f << out.to_json }\n\n\t\tunless is_rake\n\n\t\t\tcontent_type :json\n\t\t\t#JSON.pretty_generate(out) # pretty print\n\t\t\tout.to_json # normal out\n\n\t\tend\n\n\tend\n\nend",
"def longest_dominos(string)\n i = 0\n j = 0\n result = 0\n\n return 0 if string.length < 2\n\n\tfor k in (0..(string.length) - 2) do\n\t\tleft = string[k][2]\n\t\trigth = string[k + 1][0]\n\n if (left == rigth)\n j += 1\n else\n i = j\n end\n\n\t\tresult = [result, j - i].max\n\tend\n\n\tresult\nend",
"def longest(array)\n return array.max\nend",
"def length_of_longest_substring(s)\n # find each substring and compare lengths\n # as i move through the string, have a store that keeps building until it finds a repeated character\nend",
"def longest2(collection)\n collection.max { |a, b| a.length <=> b.length }\nend",
"def longest(string)\n sliced = string.chars.slice_when {|a,b| a > b}.to_a\n longest = sliced.max_by {|sub_arr| sub_arr.length}.join\nend",
"def longest_string_length\n longest_string.size\n end",
"def ROOK_long_path(position, target)\n now = getposition(position)\n moves = ['move_down', 'move_up', 'move_right', 'move_left']\n\n steps = 0\n long_position = ''\n for i in moves do\n path = inpath(position, i)\n # print path\n long_tile = path_len_tile(path, target)\n # print long_tile\n if long_tile.any? && long_tile[1] > steps\n steps = long_tile[1]\n long_position = long_tile[0]\n end\n end\n return [long_position, steps + 1]\n # print ROOK_long_path('h5')\n end",
"def linear_longest_fish(fishes)\n biggest = fishes.first\n fishes.each do |fish|\n biggest = fish if fish.length > biggest.length\n end\n biggest\nend",
"def longest_sym_sequence()\n count = 0\n max = 0\n for hop in @hops\n if hop.type != :sym and hop.type != \"sym\"\n count = 0 \n else\n count += 1\n max = (count > max) ? count : max\n end\n end\n\n max\n end",
"def longest_string(array)\n\tarray.max_by(&:length)\nend",
"def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\nend",
"def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend",
"def longest_single_flight\n\n max_distance = -1\n flight = \"\"\n @query.get_graph.each_key do |city|\n route_dict = get_outgoing_routes(city)\n route_dict.each do |dest, dist|\n if dist > max_distance\n max_distance = dist\n flight = \"#{get_city_info(city,\"name\")}-#{dest}\"\n end\n end\n end\n\n return flight\n\n end",
"def linear_fish(arr)\n longest = nil\n arr.each_with_index do |fish, idx|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend",
"def path_length(path)\n return 0 if path.size <= 1\n (0..path.size - 2).map {|i| dist(path[i], path[i + 1])}.inject(&:+)\n end",
"def longest_possible_chain(words)\n # 1\n chain_count = 1\n max = 1\n hash = Hash.new()\n\n # 2\n count = words[0]\n words = words[1..-1]\n\n words.each do |word|\n length = word.length\n hash[length] ||= []\n hash[length] << word\n end\n\n # 3\n hash = Hash[hash.sort_by{|k,v| -k}]\n\n hash.each_with_index do |(k, v), i|\n if hash.values[i+1] && (remove_one_elements(v) & hash.values[i+1]).any?\n chain_count += 1\n else\n max = chain_count\n chain_count = 0\n end\n end\n\n puts max\nend",
"def longest_segment(input, delimeter)\n s = input.split(delimeter)\n #s.sort_by{|x| x.size}.last\n s.max{|x,y| x.length <=> y.length}\nend",
"def get_max_path(num_pyramid)\n num_pyramid.each_index do |i|\n next if i == 0\n num_pyramid[i].each_index do |j|\n num_pyramid[i][j] += [num_pyramid[i - 1][j], num_pyramid[i - 1][j + 1]].max\n end\n end\n\n num_pyramid[-1].first\nend",
"def lsworc s\n i = 0\n max_len = 0\n cc = {}\n s.chars.each_with_index do |c, j|\n if !!cc[c]\n # contract window\n while s[i] != c\n cc[s[i]] = false\n i += 1\n end\n i += 1\n end\n # expand window\n cc[c] = true\n # select longest\n max_len = [max_len, j + 1 - i].max\n end\n return max_len\nend",
"def shortest_path_lengths(source)\n seen = {}\n level = 0\n nextlevel = { source => 1 }\n until nextlevel.empty?\n thislevel = nextlevel\n nextlevel = {}\n thislevel.each do |v, _|\n if seen[v].nil?\n seen[v] = level\n nextlevel.update(neighbors_of(v).map { |w| [w, nil] }.to_h)\n end\n end\n level += 1\n end\n seen\n end",
"def longest_chain()\r\n\tmax_num = 1000000\r\n\tcache = Array.new(max_num, -1)\r\n\tcache.unshift(1)\r\n\r\n\tlength = (1..max_num).map{ |num| [collatz_length(num, cache), num] }.sort\r\n\treturn length.last.join(', ')\r\nend",
"def longest_mountain(arr)\n return 0 if arr.length < 3\n max = 0\n idx = 0\n\n until arr[idx + 2].nil?\n max_from_idx = identify_mountain(arr, idx)\n if max_from_idx > max\n max = max_from_idx\n idx = idx + max_from_idx - 1\n else\n idx += 1\n end\n end\n max\nend",
"def longest_sequence_in(string)\n arr = string.split(' ').map{|num| num.to_i}\n if arr.length < 3\n return arr.length\n end\n chain_tracker = [2]\n increment = arr[1] - arr[0]\n chain = 2\n arr.each_with_index do |num, idx|\n if idx != 0 and idx != arr.length - 1\n if arr[idx + 1] - arr[idx] == increment \n chain += 1\n chain_tracker << chain\n else \n chain = 2\n increment = arr[idx + 1] - arr[idx]\n end\n end\n end\n chain_tracker.max\nend",
"def clever_octopus(arr)\n longest = nil\n\n arr.each do |fish|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend",
"def longest_prefix(strings)\n strings.each do |string|\n if string.length == 0\n return \"\"\n end \n end \n prefix = strings[0]\n (1...strings.length).each do |n|\n (0...prefix.length).each do |i|\n if strings[n][i] != prefix[i]\n if i == 0\n prefix = \"\"\n break\n else \n prefix = prefix[0...i]\n break\n end \n end \n end \n end \n return prefix\nend",
"def longest_string list\n # longest = ''\n # list.each do |str|\n # if str.length > longest.length\n # longest = str\n # end\n # end\n # longest\n list.max_by{|i| i.length}\n # list.max_by(&:length)\nend",
"def solve(words)\n return 0 if words.length == 0\n\n longest_sublist = 1\n current_sublist = 1\n\n i = 0\n while i < words.length - 1\n if words[i][0] == words[i+1][0]\n current_sublist += 1\n if current_sublist > longest_sublist\n longest_sublist = current_sublist\n end\n else\n current_sublist = 1\n end\n i += 1\n end\n\n return longest_sublist\nend",
"def longest_string(string_array)\n string_array.max_by(&:length)\nend",
"def longest_chain\n\t\ttime do\n\t\t\t(1..@num_limit).each do |num|\n\t\t\t\tif self.collatz_length(num) > @max_length\n\t\t\t\t\t@max_num = num\n\t\t\t\t\t@max_length = @chain_lengths[num]\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"The maximum collatz chain length starting below #{@num_limit} is #{@max_length} starting with #{@max_num}.\"\n\t\tend\n\tend",
"def longest_prefix(strings)\n min = strings.min \n max = strings.max\n string_pre = min.size.times do |i| \n break i if min[i] != max[i]\n end\n min[0...string_pre]\nend",
"def longest(str)\n return str if str.length == 1\n current = str[0]\n longest = ''\n\n 1.upto(str.size-1) do |idx|\n if current[-1] <= str[idx]\n current += str[idx]\n else\n if current.length > longest.length\n longest = current\n end\n current = str[idx]\n end\n end\n\n if current.length > longest.length\n longest = current\n end\n\n longest\nend",
"def longest_palindrome(str)\n return 0 if str.empty?\n\n arr = str.chars\n substrings = []\n length = 1\n loop do\n arr.each_cons(length) { |set| substrings << set }\n length += 1\n break if length > arr.length\n end\n substrings.select { |set| set == set.reverse }.max_by(&:length).length\n p substrings\nend",
"def longest_palindrome(s)\n max = \"\"\n 0.upto(s.size - 1).each { |i|\n odd = palindrome(s, i, i)\n even = palindrome(s, i, i + 1)\n \n return s if odd.size == s.size || even.size == s.size\n max = odd if odd.size > max.size\n max = even if even.size > max.size\n }\n\n max \nend",
"def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend",
"def longest_entry(words)\n return words.max_by(&:length)\n end",
"def longest_consec(strarr, k)\n return '' if strarr.empty? || k > strarr.size || k <= 0\n\n strarr.each_cons(k).map(&:join).max_by(&:size)\nend",
"def longest_palindrome(str)\n result = [0, \"\"]\n for i in (0..str.length - 1)\n p1 = expand(str, i, i) \n result = result[0] > p1.length ? result : [p1.length, p1]\n p2 = expand(str, i, i + 1) \n result = result[0] > p2.length ? result : [p2.length, p2]\n end\n result[1]\nend",
"def longest_prefix(strings)\n if strings.length == 1\n return strings\n end\n\n prefix = \"\"\n str_index = 0\n\n\n until (strings[0][str_index] != strings[1][str_index]) || (strings[0][str_index] == nil && strings[1][str_index] == nil)\n prefix += strings[0][str_index]\n str_index += 1\n end\n\n strings.each do |string|\n return \"\" if prefix[0] != string[0]\n\n prefix.length.times do |i|\n if prefix[i] != string[i]\n prefix = prefix[0...i]\n break\n end\n end\n end\n return prefix\nend",
"def find_longest(arr)\n x = arr.map(&:to_s).sort_by { |x| x.length }.last.chars.length\n arr.map(&:to_s).find { |num| num.length == x }.to_i\nend",
"def longest_prefix(strings)\n if strings.length < 2\n raise ArgumentError\n else\n prefix = \"\"\n l = 0\n (strings.min.length).times do\n s = 0\n track = 0\n (strings.length - 1).times do\n if strings[s][l] == strings [(s+1)][l]\n track += 1\n else\n break\n end\n s += 1\n end\n if track == (strings.length - 1)\n prefix << strings.min[l]\n else\n break\n end\n l += 1\n end\n return prefix\n end\nend",
"def height\n longest_tree_path(@root)\n end",
"def longest(str)\n \n alphabet_substr = find_substr(str).select do |substr|\n substr.chars == substr.chars.sort\n end\n alphabet_substr.sort_by! { |str| str.length }\n\n longest = alphabet_substr.select { |str| str.length == alphabet_substr.last.length }\n longest.shift\nend",
"def longest_prefix(strings)\n return \"\" if strings.empty? \n index = 0\n min = strings.min_by{|s| s.length} # find the shortest string\n longest_prefix = \"\"\n while index < min.length # keep running based on the length of the sortest the string \n strings.each do |string|\n if min[index] != string[index] # if the it's not equal, return the \"\"\n return longest_prefix\n end\n end\n longest_prefix += min[index]\n index +=1\n end \n return longest_prefix\nend",
"def longest_shared_substring s1, s2\n sufs1 = all_suffixes(s1)\n root = SuffixTreeNode.new\n sufs1.each{|s| root.add(s)}\n sufs2 = all_suffixes(s2)\n best = []\n sufs2.each do |s|\n nxt = root.overlay(s)\n best = nxt if nxt.length > best.length\n end\n best\nend",
"def find_longest(sorted_data, key)\n keys = sorted_data.map { |h| h[key].to_s }\n return keys.max_by(&:length).length\n end",
"def longest_string(arr)\n arr.max_by { |word| word.length }\nend",
"def maximal_non_branching_paths(graph)\n <<-DOC\n A node v in a directed graph Graph is called a 1-in-1-out node if its indegree and outdegree are both equal to 1, \n i.e., in(v) = out(v) = 1. We can rephrase the definition of a \"maximal non-branching path\" from the main text \n as a path whose internal nodes are 1-in-1-out nodes and whose initial and final nodes are not 1-in-1-out nodes. \n Also, note that the definition from the main text does not handle the special case when Graph has a connected \n component that is an isolated cycle, in which all nodes are 1-in-1-out nodes.\n\n The MaximalNonBranchingPaths pseudocode below generates all non-branching paths in a graph. \n It iterates through all nodes of the graph that are not 1-in-1-out nodes and generates all non-branching \n paths starting at each such node. In a final step, MaximalNonBranchingPaths finds all isolated cycles in the graph.\n\n MaximalNonBranchingPaths(Graph)\n Paths ← empty list\n for each node v in Graph\n if v is not a 1-in-1-out node\n if out(v) > 0\n for each outgoing edge (v, w) from v\n NonBranchingPath ← the path consisting of the single edge (v, w)\n while w is a 1-in-1-out node\n extend NonBranchingPath by the outgoing edge (w, u) from w \n w ← u\n add NonBranchingPath to the set Paths\n for each isolated cycle Cycle in Graph\n add Cycle to Paths\n return Paths \n DOC\n\n paths = []\n\n in_degrees = {}\n out_degrees = {}\n # Calculating the indegree and outdegree for each node\n graph.values.flatten.each do |val|\n in_degrees[val] = 0 unless in_degrees.has_key?(val)\n in_degrees[val] += 1\n end\n graph.keys.each do |val|\n out_degrees[val] = graph[val].length\n end\n\n non_branch_path = \"\"\n\n one_in_one_out_nodes = []\n in_degrees.each do |k,v|\n if v == 1\n one_in_one_out_nodes << k if (out_degrees[k] == 1)\n end\n end\n\n # puts one_in_one_out_nodes\n nodes = []\n nodes = graph.keys\n graph.values.flatten.each {|v| nodes << v}\n nodes.uniq!\n\n v_index = 0\n loop do\n break if v_index == nodes.length\n v = nodes[v_index]\n\n if (one_in_one_out_nodes.include?(v))\n v_index += 1\n next\n else\n if (out_degrees[v] && (out_degrees[v] > 0))\n loop do\n break unless graph[v]\n break if graph[v].empty?\n w = graph[v][0]\n non_branch_path = v\n non_branch_path += w[-1]\n graph[v].delete_at(graph[v].index(w))\n graph.delete(v) if graph[v].length == 0\n while (w && graph[w] && in_degrees[w] && out_degrees[w] && in_degrees[w] == 1 && out_degrees[w] == 1) do\n u = graph[w][0]\n non_branch_path += u[-1]\n graph.delete(w)\n w = u\n end\n paths << non_branch_path\n # puts \"path:\" + non_branch_path\n non_branch_path = \"\"\n end\n else\n v_index += 1\n next\n end\n end\n v_index += 1\n end\n # puts paths\n paths.sort\n end",
"def find_fish_lengths_1\n longest = false\n (0...Fish.length - 1).each do |i|\n (0..Fish.length - 1).each do |i2|\n Fish[i] = first_fish\n Fish[i2] = next_fish\n longest = Fish[i] if Fish[i].length > fish[i2].length\n end\n end\n longest\nend",
"def longest_palindrome s\n return 0 if s.empty?\n (s.length).downto(1).each do | i |\n s.split(\"\").each_cons(i).map do |c|\n return c.count if c == c.reverse\n end\n end\nend",
"def clever_octopus(arr)\n longest = \"\"\n arr.each {|el| longest = el if el.length >= longest.length}\n longest\nend",
"def length_of_longest_substring(str) ## Does not pass LeetCode Test\n max_longest = ''\n current_longest = ''\n str.each_char do |letter|\n current_longest = \"\" if current_longest.index(letter)\n current_longest << letter \n max_longest = current_longest if current_longest.length > max_longest.length \n end\n max_longest.length \nend",
"def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend",
"def longest_startstop\n startstop(0).first\n end",
"def find_longest(n)\n\tbinary = n.to_s(2)\n\n p binary\n a , b = 0\n\t# (0...binary.size).map do |i|\n\t\tbinary_copy = binary.dup\n\n\t\t# binary_copy[i] = \"1\"\n\n\t\t# puts binary_copy\n\n\t a = binary_copy.scan(/0+/).max.size \n\t b = binary_copy.scan(/1+/).max.size \n\t# end \n\ta > b ? a : b \nend",
"def linear()\n longest = FISH[0]\n\n (1...FISH.length).each do |i|\n fish = FISH[i]\n longest = fish if longest.length < fish.length \n end\n\n return longest\n end",
"def clever_octopus(arr)\n longest = \"\"\n arr.each do |el|\n longest = el if el.length > longest.length\n end\n longest\nend",
"def longest_length(my_strings)\n\n if my_strings.length == 0\n return nil\n else\n # initialize longest\n longest_string = \"\"\n array = []\n\n #iterate through my_strings\n my_strings.each do |string|\n if string.length >= longest_string.length\n longest_string = string\n array << string\n end\n end\n\n end\n return longest_string\n\nend",
"def longest_streak str \n str.split('L').max.length\nend",
"def shortest_length(start, finish)\n infinity = (2**(0.size * 8 - 2) - 1) # max Fixnum integer value\n distances = {} # smallest distance from starting vertex to this one\n previous = {}\n cyclic = start == finish # true if starting vertex = ending vertex\n loops = 0 # useful for cyclic path\n vertex_pq = PriorityQueue.new\n\n adj_lists.each do |vertex|\n vname = vertex.name\n if vname == start\n distances[vname] = 0\n vertex_pq.enq(vname, 0)\n else\n distances[vname] = infinity\n vertex_pq.enq(vname, infinity)\n end\n previous[vname] = nil\n end\n\n while vertex_pq\n loops += 1\n # if cyclic, pretend starting vertex is unvisited. put it back in queue.\n if cyclic && loops == 2\n vertex_pq.enq(start, infinity)\n distances[start] = infinity\n end\n # vertex currently being checked. picks closest one first.\n current = vertex_pq.deq\n vname = current.keys.first\n\n # if we've arrived at final vertex, return shortest distance\n # if cyclic, skip this code during first loop\n if vname == finish && loops > 1\n shortest_path = []\n vname2 = vname\n while previous[vname2]\n shortest_path << vname2\n vname2 = previous[vname2]\n previous[start] = nil if cyclic # pretend starting vertex is unvisited\n end\n shortest_path = [start] + shortest_path.reverse\n print \"Shortest path: #{shortest_path}, Length = #{path_length(shortest_path)}\\n\"\n return distances[finish]\n end\n\n # leave if we never get to final vertex\n break if vname == nil || distances[vname] == infinity\n\n adj_vertices(vname, adj_lists).each do |vertex|\n alt_distance = distances[vname] + dist(vname, vertex)\n # if total distance to neighbor < last minimum total distance\n # to neighbor, replace it with this new distance\n if alt_distance < distances[vertex]\n distances[vertex] = alt_distance\n previous[vertex] = vname\n vertex_pq.enq(vertex, alt_distance)\n end\n end\n end\n\n end",
"def sluggish_octopus(arr)\n longest = \"\"\n arr.each do |el1|\n arr.each do |el2|\n longest = el1 if el1.length > el2.length\n end\n end\n longest\nend",
"def total_paths(initial_s)\n reachable_stops(initial_s).count\n end",
"def longest_parlindrom_substring string\n return string if string.length < 2\n\n length = string.length\n memo = {}\n\n 1.upto(length) do |sub_length|\n 0.upto(length - sub_length) do |start_i|\n\n last_i = start_i + sub_length - 1\n indice = [start_i, last_i]\n\n next unless string[start_i] == string[last_i]\n\n memo[indice] = 1 if start_i == last_i\n memo[indice] = 2 if start_i + 1 == last_i\n\n indice_of_sub_substring = [start_i+1, last_i-1]\n \n if memo.has_key?(indice_of_sub_substring)\n memo[indice] = 2 + memo[indice_of_sub_substring]\n end\n end\n end\n indice = memo.key(memo.values.max)\n string[indice[0]..indice[1]]\nend",
"def longest_prefix(strings)\n temp = strings[0].chars\n \n strings.each_with_index do |value, i|\n value.length.times do |i|\n if value[i] != temp[i]\n temp[i] = nil\n end\n end\n end\n \n nil_location = temp.index(nil) || temp.length\n return temp.take(nil_location).join\nend",
"def length_of_longest_substring(target_string)\n return 0 if target_string.length < 1\n max_so_far = 0\n index_hash = {}\n left_pointer = 0\n right_pointer = 0\n target_string.each_char.with_index do |ch, index|\n last_index_seen = index_hash[ch]\n if last_index_seen && last_index_seen.between?(left_pointer, right_pointer)\n sub_length = right_pointer - left_pointer + 1\n max_so_far = [max_so_far, sub_length].max\n left_pointer = last_index_seen + 1\n end\n right_pointer = index\n index_hash[ch] = right_pointer\n end\n last_fragment = target_string[left_pointer..right_pointer]\n has_repeats?(last_fragment) ? max_so_far : [last_fragment.length, max_so_far].max\nend",
"def longest_mountain(arr)\n # Return if the input array's length is less than the minimum mountain length\n return 0 if arr.length < 3\n mountain_cache = Array.new(arr.length, 0)\n idx = 0\n\n # Break if the remaining array is less than 3 in length.\n until arr[idx + 2].nil?\n #\n mountain_cache[idx] = identify_mountain(arr, idx)\n mountain_cache[idx] == 0 ? idx += 1 : idx = idx + mountain_cache[idx] - 1\n end\n # Lastly, we return the maximum mountain length\n mountain_cache.max\nend",
"def longest_string(list_of_words)\n\treturn list_of_words.max {|x,y| x.length <=> y.length}\nend",
"def longest(a1, a2)\na1arr = a1.split(\"\").uniq\na2arr = a2.split(\"\").uniq\na3 = (a1arr + a2arr).sort.uniq.join\na3\n\nend",
"def longest_consec(strarr, k)\n return \"\" unless k.between?(1, strarr.length)\n strarr.each_cons(k).map(&:join).max_by(&:length) || \"\"\nend",
"def find_longest(arr)\n arr.detect { |i| i.to_s.length == arr.max.to_s.length }\nend",
"def longest_fishie_nested_loop(fishies)\n longest_fish = \"\"\n (0...fishies.length).each do |i|\n (i+1...fishies.length).each do |j|\n next if i == fishies.length - 1\n fish_compare = fishies[i].length <=> fishies[j].length\n # debugger\n if fish_compare > 0\n longest_fish = fishies[i] if fishies[i].length > longest_fish.length\n elsif fish_compare < 0\n longest_fish = fishies[j] if fishies[j].length > longest_fish.length\n end\n end\n end\n longest_fish\nend",
"def longest_prefix(strings)\n prefix = ->s1, s2 { s1.each_char.zip(s2.each_char)\n .take_while { |c1, c2| c1 == c2 }\n .map(&:first).join }\n \n strings.reduce(&prefix)\nend",
"def longest_string(list_of_words)\n list_of_words.max { |a, b| a.length <=> b.length }\n end",
"def longest_prefix(strings)\n length = strings.min_by { |string| string.length }.length\n strings = strings.sort!\n substring = \"\"\n \n i = 0\n while i <= length\n if strings[0][0..i] == strings[-1][0..i]\n substring = strings[0][0..i]\n end\n i += 1\n end\n \n return substring\nend",
"def length_of_longest_substring_2(s)\r\n return 0 if s == \"\"\r\n result = 0\r\n chars = s.chars\r\n hash = Hash.new\r\n left, right = 0, 0\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n\r\n while right < chars.size\r\n result = [right - left + 1, result].max\r\n\r\n if hash.has_key?(chars[right + 1]) && left != right\r\n # Process the window\r\n hash.delete(chars[left])\r\n left += 1\r\n elsif !hash.has_key?(chars[right + 1])\r\n # Expand the window\r\n right += 1\r\n else\r\n # Move the window\r\n right += 1\r\n left += 1\r\n end\r\n\r\n # Update hash\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n end\r\n\r\n result\r\nend"
] |
[
"0.80841786",
"0.78725123",
"0.7828093",
"0.7268104",
"0.6891458",
"0.6769048",
"0.6687513",
"0.6597584",
"0.650628",
"0.650417",
"0.6497579",
"0.6488037",
"0.6461223",
"0.6448632",
"0.64292836",
"0.6405151",
"0.64033705",
"0.6378165",
"0.63506556",
"0.6334335",
"0.6332442",
"0.6330243",
"0.6308911",
"0.6298409",
"0.6298409",
"0.62819123",
"0.6251605",
"0.6233418",
"0.62136024",
"0.62131184",
"0.6191624",
"0.6188323",
"0.6184286",
"0.6180794",
"0.6173026",
"0.61729604",
"0.6171775",
"0.6171318",
"0.6167932",
"0.6166173",
"0.6152924",
"0.6147149",
"0.61369777",
"0.61354136",
"0.61313885",
"0.61308414",
"0.6129482",
"0.61245006",
"0.611919",
"0.61172223",
"0.6116847",
"0.61128503",
"0.6110219",
"0.6105052",
"0.6087977",
"0.60878605",
"0.60847765",
"0.6082814",
"0.6073418",
"0.60660326",
"0.6057713",
"0.60537314",
"0.6036484",
"0.6029563",
"0.6023988",
"0.60138834",
"0.6011168",
"0.60047084",
"0.60015386",
"0.59880346",
"0.5981911",
"0.5978766",
"0.5976023",
"0.59622705",
"0.5950956",
"0.59490746",
"0.59483796",
"0.5938011",
"0.5919032",
"0.5914331",
"0.59137505",
"0.5908327",
"0.5906666",
"0.58940965",
"0.5893958",
"0.58927906",
"0.58909786",
"0.58893895",
"0.5886901",
"0.58849066",
"0.58832616",
"0.588304",
"0.58823276",
"0.5880318",
"0.58739245",
"0.5872863",
"0.58720475",
"0.5871591",
"0.58621687",
"0.5853318"
] |
0.60309684
|
63
|
build json for longest paths
|
def get_longest_path(clear_cache = false)
File.delete(longest_cache_file) if clear_cache && File.exist?(longest_cache_file)
if File.exist?(longest_cache_file)
content_type :json unless is_rake
send_file longest_cache_file
else
neo = Neography::Rest.new(ENV['NEO4J_URL'] || 'http://localhost:7474')
out = {
:nodes => [],
:links => [],
}
i = 0
find_longest_path(neo).each do |path|
path[0].each_with_index do |n, index|
out[:nodes] << {
:name => n[1],
:type => n[2],
:id => n[0],
:group => n[2] == 'user' ? 2 : 1,
}
if index < path[0].length - 1
out[:links] << {
:source => i,
:target => i + 1,
:value => 1,
}
end
i = i + 1
end
end
File.open(longest_cache_file, 'w'){ |f| f << out.to_json }
unless is_rake
content_type :json
#JSON.pretty_generate(out) # pretty print
out.to_json # normal out
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def paths_to_json\n JSON.unparse(paths_to_array) \n end",
"def longest_path_1(edges)\nend",
"def generate_json\n if @path\n output = formatted_output\n File.open(@path, 'w') { |f| f.write(output.to_json) }\n end\n end",
"def generate_json\n if @path\n output = formatted_output\n File.open(@path, 'w') { |f| f.write(output.to_json) }\n end\n end",
"def to_json\r\n {\r\n files: @files,\r\n dirs: @dirs\r\n }\r\n end",
"def buildJsonFile(ndv, p4l, jsonkeys, new_datavalues, path, outputFolder)\r\n (0..ndv).each do |j|\r\n p4l[j] = jsonkeys.zip(new_datavalues[j])\r\n end\r\n File.open(path+\"\\\\#{outputFolder}\\\\users.json\",\"w\") do |json|\r\n json.write(p4l.to_json)\r\n end\r\n new_datavalues = []\r\n end",
"def build\n evaluate(@src_path)\n result = @structure.deep_stringify_keys\n JSON.pretty_generate(result) unless result.empty?\n end",
"def gen_path(options = {})\n path = Array.new(options[:length])\nend",
"def build_jason\n if @content.is_a?(Array)\n @content[0] = build_header_and_text_hashs @content[0] unless @content[0].empty?\n @content[2] = build_header_and_text_hashs @content[2] unless @content[2].empty?\n content_hash = {}\n content_hash = content_hash.merge(@content[0]) unless @content[0] || @content[0].empty?\n content_hash = content_hash.merge(@content[1])\n content_hash = content_hash.merge(@content[2]) unless @content[2] || @content[2].empty?\n @content = content_hash\n else\n @content = build_header_and_text_hashs @content\n end\n back_hash = build_back_portion @content\n document_hash = build_front_portion.merge( @content ).merge( back_hash ); back_hash = {}\n @content = {\n \"id\" => sha,\n \"nodes\" => document_hash\n }\n end",
"def gen_json(site, output_path)\n site_data_hierarchy = load_data_hierarchy\n site_data_hierarchy.delete_if { |key| key != 'sites' }\n site_data_hierarchy['sites'].delete_if { |key| key != site }\n site_data_hierarchy['sites'][site].delete_if { |key| key != 'clusters' }\n site_data_hierarchy['sites'][site].fetch('clusters', {}).to_h.each do |_cluster_uid, cluster_hash|\n cluster_hash.delete_if { |key| key != 'nodes' }\n cluster_hash['nodes'].to_h.each do |_node_uid, node_hash|\n node_hash.delete_if { |key| key != 'software' }\n node_hash['software'].delete_if { |key| key != 'standard-environment' }\n end\n\n cluster_hash['nodes'] = cluster_hash['nodes'].sort_by{|node_uid, _node_hash| node_uid[/(\\d+)/].to_i }.to_h\n end\n site_data_hierarchy['sites'][site]['clusters'] = site_data_hierarchy['sites'][site].fetch('clusters', {}).sort_by{ |cluster_uid, _cluster_hash| cluster_uid }.to_h\n\n output_file = File.new(output_path, 'w')\n output_file.write(JSON.pretty_generate(site_data_hierarchy))\nend",
"def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end",
"def make_paths\n visited = {}\n path = []\n return path if @nmap.empty? || @nnmap.empty?\n\n # 0 is false\n @nmap.each do |k, _|\n visited[k] = 0\n end\n\n # for each node that is not an end node to an end node\n @nnmap.each do |s, _|\n # if s is an end node\n @paths << [s] if @ends.include? s\n\n # for each end node as desintation\n @ends.each do |d|\n get_allpaths(s, d, visited, path)\n end\n end\n @paths.sort_by(&:length).reverse\n end",
"def build_path\n path = %w(api where)\n path.concat api_method\n path = path.join('/')\n @path = \"/#{path}.json\"\n end",
"def build_json_from_params \n #Construct array for holding categories\n arr = [] \n get_categories.each do |cat| #Meow\n #For each category create a map {}\n new_cat = {}\n new_cat[\"name\"] = cat[0]\n new_cat[\"steps\"] = []\n get_steps(cat).each do |step|\n #For each step create a map {}\n new_cat_step = {}\n new_cat_step[\"name\"] = step[2]\n #get options returns a list of maps of options\n new_cat_step[\"options\"] = get_options(step) \n new_cat[\"steps\"] << new_cat_step\n end \n arr << new_cat\n end\n json = {\"categories\" => arr, \"prompt\" => params[:prompt]}\n return json\n end",
"def getJSON(tab)\n\n # All nodes get a name. Native support for to_json in Ruby is awesome, btw\n json = \"#{tab}{\\t\\\"name\\\" : #{name.to_json},\\n\"\n \n if (missione_id.to_json != \"null\") \n json += \"#{tab}\\t\\\"id_missione\\\" : #{missione_id.to_json},\\n\"\n end\n\n if (categoria_code.to_json != \"null\") \n json += \"#{tab}\\t\\\"code_categoria\\\" : #{categoria_code.to_json},\\n\"\n end\n\n\n \n # I think we fixed this, but sometimes we were getting null values for size, so we're checking before we add the value line\n # The D3 examples I based this off used both size and value for the amount in the tree, that's why they aren't consistent. I'll fix that later.\n if (size.to_json != \"null\") \n json += \"#{tab}\\t\\\"value\\\" : #{size.to_json},\\n\"\n end\n\n # If we have kids, add them to the json\n if (children.count > 0)\n\n #json = json.chom \n json += \"#{tab}\\t\\\"children\\\" : [\\n\"\n \n # Our recursive call with a couple of extra tabs. Two seemed better than one.\n children.each do |kid|\n json += kid.getJSON(\"\\t\\t\" + tab) \n end \n \n # Chomp off the trailing comma. There's probably a Ruby method for cutting off the comma without removing the newline. Need to google that\n json = json.chomp(\",\\n\") + \"\\n\"\n\n # Close the json array\n json += \"\\n#{tab}\\t]\\n\"\n\n else\n # No kids, so close up shop\n json = json.chomp(\",\\n\")\n json += \"\\n\"\n end\n\n # Doing this recursively, I'm not sure how to pass it back and not have a comma at the very end. Currently chomping it when I call it at the end of the script.\n # I could always check for how many tabs I have, but that seems sort of wrong.\n json += \"#{tab}},\\n\"\n \n return json\n end",
"def build_hash_tree(filenames)\n files_tree = filenames.inject({}) { |h, i| t = h; i.split(\"/\").each { |n| t[n] ||= {}; t = t[n] }; h }\nend",
"def optimal_path(str)\n return [] if str.empty?\n @str = str\n\n @cache = {}\n return optimal_path_from(0)\nend",
"def build_chain(path, ending)\n key = path.select{ |key,value| value.include?(ending) }.keys.first\n chain = [key, ending]\n until key.nil?\n key = path.select{ |k,v| v.include?(key) }.keys.first\n chain.unshift(key)\n end\n chain.compact\n end",
"def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end",
"def to_nifty_json\n self.recursive_delete_if_nil.jsonify.to_json\n end",
"def to_json(*args)\n MultiJson.dump(\n Smash.new(\n :url => url,\n :ref => ref,\n :type => self.class.name,\n :subdirectory => subdirectory,\n ), *args\n )\n end",
"def build_path(prop)\n path = []\n while prop\n path << prop if !path.last || (path.last.name != prop.name)\n prop = prop.__parent\n end\n [path.last.__resource.name] + path.map(&:name).reverse\n end",
"def build_parents(data)\n data.inject({}) do |h, d|\n (1...d.length).each { |i| h[d[i]] = d[0] }; h\n end\nend",
"def fill_path_weights\r\n\r\n #for each vertex, each level, find the shortest path to every node from that node and then add that data to path_weights\r\n hashkeys = @vertices.keys\r\n hashkeys.each do |n|\r\n @current_world.rooms.each {\r\n |key, value|\r\n vertex = Vertex.new(key,value)\r\n @vertices[key] = vertex\r\n }\r\n\r\n vertex = @vertices[n]\r\n return_shortest_path(vertex)\r\n vertices2 = @vertices.clone\r\n @path_weights[vertex.title]=vertices2\r\n end\r\n end",
"def to_heb_json\n arr = []\n @direct_dep.keys.each do |key|\n arr << {name: key, size: 1, imports: dependencies_for(key)}\n end\n arr.to_json\n end",
"def test_shortest_path\n\n test_map = ' { \"metros\" : [ {\n \"code\" : \"LON\" ,\n \"name\" : \"London\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"PAR\" ,\n \"name\" : \"Paris\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"LIM\" ,\n \"name\" : \"Lima\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"MOW\" ,\n \"name\" : \"Moscow\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } ] ,\n \"routes\" : [ {\n \"ports\" : [\"LON\" , \"PAR\"] ,\n \"distance\" : 200\n } , {\n \"ports\" : [\"PAR\" , \"LIM\"] ,\n \"distance\" : 400\n } , {\n \"ports\" : [\"LIM\" , \"MOW\"] ,\n \"distance\" : 600\n } , {\n \"ports\" : [\"PAR\" , \"MOW\"] ,\n \"distance\" : 600\n }] } ' \n graph = Graph.new()\n graph.parse_json_string(test_map)\n\n # There is a less direct path (more stop overs) with shortest distance\n assert_equal( graph.get_dijkstra_path(\"LON\",\"MOW\"), \"LON-PAR-MOW\" )\n \n test_map = ' { \"metros\" : [ {\n \"code\" : \"LON\" ,\n \"name\" : \"London\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"PAR\" ,\n \"name\" : \"Paris\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"LIM\" ,\n \"name\" : \"Lima\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"MOW\" ,\n \"name\" : \"Moscow\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } ] ,\n \"routes\" : [ {\n \"ports\" : [\"LON\" , \"PAR\"] ,\n \"distance\" : 200\n } , {\n \"ports\" : [\"PAR\" , \"LIM\"] ,\n \"distance\" : 200\n } , {\n \"ports\" : [\"LIM\" , \"MOW\"] ,\n \"distance\" : 200\n } , {\n \"ports\" : [\"PAR\" , \"MOW\"] ,\n \"distance\" : 500\n }] } ' \n graph = Graph.new()\n graph.parse_json_string(test_map)\n \n # The flight with more stop overs is shorter\n assert_equal( graph.get_dijkstra_path(\"LON\",\"MOW\"), \"LON-PAR-LIM-MOW\" )\n \n end",
"def js_hash(options = {})\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :string => '',\n :key_is_id => true,\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:key_is_id]\n @n = self.id\n else\n @n = self.display_name.gsub(/[^a-zA-Z]/, \"_\") # these all have to be javascript variables, and then can't be used to round trip search, for things like \"-\"\n end\n\n if @opt[:depth] < @opt[:max_depth]\n children = self.child_ontology_relationships(@opt)\n\n if children.size == 0\n @opt[:string] << \"#{@n},\" # fake size this for the protovis stuff like \"#{@n}:10,\"\n return @opt[:string]\n else\n if @opt[:depth] + 1 < @opt[:max_depth]\n @opt[:string] << \"#{@n}:{\"\n else\n @opt[:string] << \"#{@n}:10,\"\n end\n end\n\n children.each do |n|\n n.ontology_class1.js_hash(@opt)\n end\n\n if @opt[:depth] + 1 < @opt[:max_depth]\n if children.size > 0\n @opt[:string] << \"},\"\n else\n @opt[:string] << \"}\"\n end\n end\n end\n\n # hack, to deal with the extra \",\" in the \"join\"\n return \"{#{@opt[:string]}}\".gsub(/\\,\\}/, \"}\")\n end",
"def compressed_as_path()\n # .uniq assumes no AS loops\n # TODO: do I need the find_all?\n as_path().find_all { |asn| !asn.nil? }.uniq \n end",
"def to_a = @paths.dup",
"def json_cmd_one(cmd, key, path)\n unless path\n [\"JSON.#{cmd.upcase}\", key]\n else\n [\"JSON.#{cmd.upcase}\", key, path]\n end\n end",
"def json_dir_names\n DIR.entries\n .map(&:basename)\n .map(&:to_s)\n .select { |dirname| dirname =~ /^[0-9]+\\.[0-9]/ }.sort\n end",
"def build_json_data(h)\n # building each item of the json data\n json_items = h.keys().map { |k| \"\\\"#{k}\\\": \\\"#{h[k]}\\\"\" }\n\n # actually returning the json data\n return \"{#{json_items.join(', ')}}\"\n end",
"def main(json)\n files = JSON.parse(json).fetch('files')\n dupes = get_name_conflicts(files)\n dupes.each do |list|\n # resolve_conflict(list)\n list.each {|file| puts file['path']}\n puts\n end\nend",
"def json_directional(name, logger)\n\t# return '{\"nodes\":[], \"links\":[], \"constraints\":[]}'\n\t\n\t\n\t\n\t\n\t# input sanitization???\n\t# I mean, the name is coming from a URL piece, so it could be anything...\n\t\n\t\n\t# logger.info @rake.methods.grep(/task/).inspect\n\t# logger.info @rake.tasks.inspect\n\t\n\tshort_path = 'public/CS_BS_all.yaml'\n\t\n\tregenerate_graph = false\n\t@rake[short_path].invoke ->(){\n\t\t# --- this callback runs when YAML file in 'short_path' is regenerated\n\t\tlogger.info \"graph generation callback\"\n\t\t\n\t\tregenerate_graph = true\n\t}\n\t\n\t# Generate graphs if\n\t# 1) no graph yet in memory\n\t# 2) source YAML file was modified\n\tif regenerate_graph or @graphs[short_path].nil?\n\t\t@graphs[short_path] = SummerResearch::DependencyGraph.new.tap do |graph|\n\t\t\traw_data = Models::Utilities.load_yaml_file(short_path)\n\t\t\t# raw_data = \n\t\t\t\t# if name.include? 'split'\n\t\t\t\t# \tModels::Utilities.load_yaml_file \"public/#{name}.yaml\"\n\t\t\t\t# else\n\t\t\t\t\t# Models::Utilities.load_yaml_file(short_path)\n\t\t\t\t# end\n\t\t\t\n\t\t\t# NOTE: just get the node and vert information first. The data will be converted to the proper output format later.\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- add basic node and edge information to the graph\n\t\t\tnodes = raw_data.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t\n\t\t\tlinks =\n\t\t\t\traw_data.collect do |course, deps|\n\t\t\t\t\tdeps.collect do |dependency|\n\t\t\t\t\t\t[course, dependency]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tlinks = links.flatten(1) # remove extra level of nesting\n\t\t\tlinks.delete_if do |course, dependency|\n\t\t\t\tcourse == dependency # remove self-links resulting from messy data\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tlogger.info nodes.inspect\n\t\t\tlogger.info links.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tnodes.each do |vertex|\n\t\t\t\tgraph.add_vertex(vertex)\n\t\t\tend\n\t\t\t\n\t\t\tlinks.each do |course, dependency|\n\t\t\t\tgraph.add_edge(dependency, course)\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- debug printing to make sure that worked\n\t\t\t\n\t\t\t# NOTE: the first item in either of these lists, is the requested node.\n\t\t\t# ie) ancestors of CS 367 includes CS 367 itself, even if all self-loops were removed\n\t\t\t# NOTE: was able to fix this by returning a slightly different Enumerator from the DependencyGraph class.\n\t\t\tlogger.info \"Ancestors\"\n\t\t\tlogger.info graph.ancestors(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Parents\"\n\t\t\tlogger.info graph.parents(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Children\"\n\t\t\tlogger.info graph.children(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Descendants\"\n\t\t\tlogger.info graph.descendants(\"CS 367\").to_a.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tlogger.info graph.each_vertex.to_a\n\t\t\tlogger.info graph.each_edge.to_a\n\t\tend\n\tend\n\t\n\t# pull graph from the cache\n\tgraph = @graphs[short_path]\n\t\n\traise \"Could not find DependencyGraph data. Should have been generated after #{short_path} was made, but it seems like that as not the case.\" if graph.nil?\n\t\n\t\n\t# if short_path == 'data/CS_BS_all.yaml'\n\t\t[\n\t\t\t'CS 310',\n\t\t\t'CS 330',\n\t\t\t'CS 367',\n\t\t\t# 'ENGH 302',\n\t\t\t# # 'CS 262',\n\t\t\t# # 'CS 351',\n\t\t\t# # 'MATH 351',\n\t\t\t# # 'MATH 203',\n\t\t\t# 'STAT 344',\n\t\t\t# # 'MATH 125',\n\t\t\t# 'ECE 445',\n\t\t\t# # 'CS 222',\n\t\t\t# # 'CS 112',\n\t\t\t# # 'STAT 346',\n\t\t\t# 'SYST 210',\n\t\t].each do |course|\n\t\t\t# graph.cut course\n\t\tend\n\t# end\n\t\n\t# graph.remove_vertex('MATH 112') # Discrete Math for IT\n\t# graph.remove_vertex('CS 222') # \"Computer Programming for Engineers\", basically like CS 262\n\t\n\t\n\t\n\t\n\trequirement_by_type_file = 'data/CS_BS_requirements_by_type.yaml'\n\t@rake[requirement_by_type_file].invoke\n\t\n\trequirement_by_type = Models::Utilities.load_yaml_file(requirement_by_type_file)\n\t\n\t\n\t\n\trequired_courses = requirement_by_type[:required].to_set\n\telective_courses = requirement_by_type[:elective].to_set\n\t\n\t\n\t\n\t\n\t\n\t\n\trequirements_file = 'data/CS_BS_requirements.yaml'\n\t@rake[requirements_file].invoke\n\t\n\tdegree_requirements = Models::Utilities.load_yaml_file(requirements_file)\n\tdegree_requirements\n\t\n\telective_category = \n\t\tdegree_requirements.select{ |name, sector| sector[:data].is_a? Hash }\n\t\t .collect { |name, sector|\n\t\t \t sector[:data].collect{ |category, course_id|\n\t\t \t \t[course_id, name]\n\t\t \t }\n\t\t }\n\t\t .flatten(1) # array of [course_id, name] pairs\n\t\n\t# convert [course_id, name] relation into { course_id => i }, where i is an integer corresponding to 'name' in a list of all values for 'name'\n\telective_category = elective_category.to_h\n\t\n\tname_list = elective_category.values.uniq\n\tname_to_number = name_list.each_with_index.to_h\n\t\n\tlogger.info name_list.inspect\n\t\n\telective_category = \n\t\telective_category.collect{ |course_id, name|\n\t\t\t[course_id].flatten.collect { |id|\n\t\t\t\t[ id, name_to_number[name] ]\n\t\t\t}\n\t\t}\n\t\t.flatten(1)\n\t\t.to_h\n\t\n\tlogger.info elective_category.inspect\n\t\n\t\n\treturn graph.to_json_d3v3_cola(required_courses, elective_courses, elective_category)\n\t\n\t\n\t\n\t# below is a bunch of old code, to generate the graph the old way\n\t# still keeping it around, because some of these constraints have not been implemented\n\t# in the new system.\n\t# Also, this alternative way of specifying colors is interesting.\n\t# -------------------------------------------------------------------\n\t\n\t\n\t\n\t\n\t# === Create Constraints\n\t# basic constraint: prereqs go above later courses.\n\t\t# (overall visual flow: top to bottom as skill increases)\n\t\t# defined as local property.\n\t\t# graph ends up showing global properties.\n\tc1 =\n\t\traw_data2.collect do |course, deps|\n\t\t\tdeps.collect do |d|\n\t\t\t\ti_left =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == course}\n\t\t\t\t\n\t\t\t\ti_right =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == d}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => 25\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tc1.flatten!\n\t\n\tconstraints = c1\n\t\n\t# TODO: implement constraint such that all 100-level courses are above the 200-level ones, etc etc.\n\t# (want to stratify course levels)\n\t# logger.info \"HEY\"\n\tgap = 500\n\tc2 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\"left\" => 28, \"right\" => i_left, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c2\n\tconstraints.flatten!\n\t\n\t\n\t\n\t# all nodes want to have horizontal spacing\n\tgap = 25\n\tc3 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t\ttrue\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"x\", \n\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c3\n\tconstraints.flatten!\n\t\n\t\n\t\n\t\n\t# TODO: implement constraint that causes all courses from a single department to clump\n\t\n\t\n\t\n\t\n\t\n\t# === additional processing on the graph\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t# === rough packaging for output\n\tout = {\n\t\t# 'name' => name,\n\t\t'nodes' => nodes,\n\t\t'links' => links,\n\t\t'constraints' => constraints\n\t}\n\t\n\t\n\t# === style the nodes\n\t\n\tcolor_key ||= {\n\t\t:gated_elective_clump => \"#10D588\", # light green\n\t\t:split_link => \"#3399FF\", # blue\n\t\t\n\t\t:required => \"#CC2300\", # red / orange\n\t\t:elective => \"#242424\", # black\n\t\t:not_required => \"#AAA\" # grey\n\t}\n\t\n\trequired =\n\t\t@data[:required].collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\telective = \n\t\t@data[:elective].values\n\t\t.collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\t\n\tout['nodes'].each do |node|\n\t\t# --- color assigment\n\t\ttype = node_type(node['name'], required, elective)\n\t\t# node['color'] = color_key[type]\n\t\tnode['class'] = type.to_s.tr('_', '-')\n\t\t\n\t\t\n\t\t# --- do other things with type\n\t\t# leaves << node['id'] if type == :not_required\n\tend\n\t\n\t\nend",
"def build_nested_object(prop, current_path)\n object_lines = []\n prop.properties.each do |nested_prop|\n next_path = \"#{current_path}/#{nested_prop.out_name}\"\n object_lines << lines([\"* `#{next_path}`\"].join(' '))\n\n object_lines << lines(wrap_field([\n ('Required.' if nested_prop.required),\n ('Output only.' if nested_prop.output),\n nested_prop.description\n ].compact.join(' '), 0), 1)\n\n if nested_prop.is_a? Api::Type::NestedObject\n object_lines.concat(build_nested_object(nested_prop, next_path))\n elsif nested_prop.is_a?(Api::Type::Array) &&\n nested_prop.item_type.is_a?(Api::Type::NestedObject)\n object_lines.concat(build_nested_object(nested_prop.item_type,\n \"#{next_path}[]\"))\n end\n end\n object_lines\n end",
"def local_node_json_pathname\n return Pathname.new(\"nodes\") + \"#{self.name}.json\"\n end",
"def cache_ancestry\n self.names_depth_cache = path.map(&:name).join('/')\n end",
"def build_filename\n \"%s/%s_%06d.json\" % [dir, prefix, index]\n end",
"def build_path\n end",
"def update_paths!\n paths = Hash[*roots.map { |r| \n r.self_and_descendants.map { |n| [n.id, { 'path' => n.send(:build_path) }] } }.flatten]\n update paths.keys, paths.values\n end",
"def to_json\n {\n :parts => @parts,\n :resources => @resources,\n :internals => @internals,\n :props => @props,\n :ignored_cfgs => @ignored_cfgs\n }.to_json\n end",
"def json_pathname(version)\n DIR.join(version, 'vulnerability-rating-taxonomy.json')\n end",
"def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end",
"def longest_common_subpath(paths)\n return if paths.empty?\n\n lcsp = Pathname.new(paths[0])\n\n paths[1..-1].each do |path|\n until ascendant_of?(lcsp, path)\n if lcsp.root?\n # If we get here a root directory is not an ascendant of path.\n # This may happen if there are paths in different drives on\n # Windows.\n return\n else\n lcsp = lcsp.parent\n end\n end\n end\n\n lcsp\n end",
"def as_json\n group_by(&:path).transform_values do |operations|\n append_cors_operation!(operations)\n operations.index_by(&:method).transform_values(&:as_json)\n end\n end",
"def write(json_hash:)\n JSON.pretty_generate(json_hash).tap do |json_string|\n @pathname.write(json_string)\n end\n end",
"def directory_hash(path, name=nil)\n data = {:folder => (name || path.split(\"/\").last)}\n data[:children] = children = []\n Dir.foreach(path) do |entry|\n next if (entry == '..' || entry == '.' || entry == 'yamproject.json' || entry == '.DS_Store')\n full_path = File.join(path, entry)\n if File.directory?(full_path)\n children << directory_hash(full_path, entry)\n else\n children << entry\n end\n end\n return data\nend",
"def generate_ndjson(resource_type, resource_list, output_directory)\n p \"===============================================================\"\n p \"Generating ndjson file of type #{resource_type}...\"\n outfile = File.join(output_directory, \"#{resource_type}.ndjson\")\n ndout = {\n type: resource_type,\n url: \"#{FHIR_SERVER}/resources/#{output_directory.split(\"/\").last}/#{resource_type}.ndjson\",\n }\n NDOUTS << ndout\n\n begin\n o = File.open(outfile, \"w\")\n p \"Writing #{resource_list.size} #{resource_type} resource instances to #{outfile}...\"\n resource_list.each { |instance| o.puts(JSON.generate(instance)) }\n rescue StandardError => e\n puts \"An error occured when generating file #{outfile}: #{e.message}\"\n ensure\n o.close\n end\nend",
"def generate_ndjson(file_paths)\n @unique_id = SecureRandom.uuid\n\n # Local directory where we will keep the generated ndjson files\n ndjson_path = File.expand_path('../../../../resources/quality_reporting/NDJson', __dir__)\n FileUtils.mkdir_p(ndjson_path) unless File.directory?(ndjson_path)\n\n # Absolute path of the .ndjson file\n @output_file_path = \"#{ndjson_path}/#{@unique_id}.ndjson\"\n\n generator = NDJSON::Generator.new(@output_file_path)\n file_paths.each do |f|\n # Ensure Bundle exists\n file_path = File.expand_path(f, __dir__)\n raise \"Bundle #{file_path} not found\" unless File.file?(file_path)\n\n begin\n # Ensure Bundle is valid json and write it to the ndjson file\n json = JSON.parse(File.read(file_path))\n generator.write(json)\n rescue JSON::ParserError\n Inferno.logger.error \"Bundle #{file_path} is not valid JSON\"\n end\n end\n end",
"def paths_to_array\n [{:paths => paths.collect {|p| p.to_array}}]\n end",
"def find_max_path_length_recursively\n if self.outgoing_edges.exists?\n available_path_lengths = self.next_vertices.map do |vertex|\n [vertex.id, 1 + vertex.find_max_path_length_recursively]\n end\n longest = available_path_lengths.max{|a,b| a[1] <=> b[1]}[1]\n return longest\n else\n return 0;\n end\n end",
"def json\n h = Hash.new\n\n h[\"description\"] = overview # add \"...\" if over certain size\n h[\"sources\"] = [full_name]\n h[\"subtitle\"] = \"(#{year}) #{genre}\"\n h[\"thumb\"] = poster\n h[\"art\"] = art\n\n t = name[0..32]\n t = t + \"..\" if t.size > 32\n h[\"title\"] = t\n\n h[\"rating\"] = rating\n h[\"runtime\"] = runtime\n\n h\n end",
"def analysis(prefix, calls, jsons)\n STDERR.puts \"analysis #{prefix} #{calls}\"\n return if jsons.count == 0\n if jsons[0].match?(Regexp.new('^dirre:'))\n ary = jsons[0].split ':'\n dir = ary[1]\n re = Regexp.new(ary[2])\n files = []\n Dir.entries(dir).each do |f|\n files << dir + '/' + f if re.match?(f)\n end\n jsons = files\n end\n n = 0\n occ = {}\n ml = {}\n strs = {}\n calls = calls.split(',').map(&:strip)\n all = jsons.count\n jsons.each_with_index do |json, idx|\n STDERR.puts \"#{(idx.to_f/all.to_f)*100.0} %\" if (idx % 20000 == 0) & (idx > 0)\n h = JSON.parse(File.read(json)).to_h\n oh = h\n calls.each do |call|\n next unless h\n\n if call.include?(':')\n ary = call.split ':'\n h = h[ary[1].to_i] if ary[0] == 'i'\n else\n h = h.send(:[], call)\n end\n end\n next unless h\n\n s = object_structure('', h, true, true, 1)\n strs[s] = oh\n\n # Analysis\n keys = h.keys\n classes = h.values.map(&:class).map(&:name)\n h.each do |k, v|\n vl = v.to_s.length\n ml[k] = vl if !ml.key?(k) || ml[k] < vl\n end\n keys.zip(classes).each do |k, c|\n kc = k + ':' + c\n occ[kc] = 0 unless occ.key?(kc)\n occ[kc] += 1\n end\n n += 1\n end\n\n strs.keys.each_with_index do |key, index|\n h = strs[key]\n h['a_structure'] = key\n File.write(\"analysis/#{prefix}_#{index}.json\", JSON.pretty_generate(h))\n end\n strs.keys.sort.each { |k| p k }\n puts ''\n p occ\n puts ''\n p ml\n puts ''\n p n\n puts ''\n # binding.pry if strs.keys.length > 1\nend",
"def json_formatter\n # Create hash formatted to robot's API for final output with empty \"command_values\" array\n # json_output = { \"robot_commands\" => @command_array.length, \"command_values\" => [] }\n json_output = { }\n # Loop through the @command_array instance variable created above\n command_body = @command_array.each do | command |\n # Add a hash to the \"command_values\" array in the json_output hash for each robot instruction\n # json_output[ \"command_values\" ] << { \"line\" => \"#{ @command_array.index( command ) }\", \"value\" => \"#{ command }\" } \n json_output[ \"cmd#{ @command_array.index( command ) + 1 }\" ] = \"#{ command }\" \n # Set the array element to empty string so that the proper index is set above when it comes back around\n # in the event of duplicate instructions\n @command_array[ @command_array.index( command ) ] = \"\"\n end \n # Convert json_output hash to JSON object, and assign to @output new instance variable\n @output = json_output.to_json\n end",
"def path_with_keys()\n path = []\n\n for part in @path\n if part.is_a? String\n path << part\n elsif part.is_a? Symbol\n path << (yield part)\n else\n raise \"Invalid path part: #{part}\"\n end\n end\n '/' + path.join('/')\n end",
"def json_files\n return if @skip_run\n\n @json_dumper.dump_dir = @config[:json_files_dir]\n # Generate all the jsons, even if 1 hostname is given, as it might be useful for the rest of the graph.\n @json_dumper.dump_json_for(@nodes_handler.known_nodes)\n end",
"def paths_s\n \"['#{paths.join(\"','\")}']\"\n end",
"def find_longest_path_length_to_leaf(source)\n longest = 0\n\n find_leaves.each do |a_leaf|\n begin\n temp_result = find_longest_path_length(source,a_leaf)\n rescue\n temp_result = 0\n end\n\n longest = [longest, temp_result].max if temp_result\n end\n\n longest\n end",
"def create_json(gunclocks)\n# gunclocks = [gunclocks] unless gunclocks.class == Array #for 1 gunclock\n\n# gunclocks = gunclocks.inject([]){ |arr, gunclock|\n# arr << {\n# :id => gunclock.id,\n# :size => gunclock.size,\n# :color => gunclock.color,\n# :created_at => gunclock.created_at\n# }; arr\n# }\n# { :gunclocks => gunclocks }.to_json\n\n# p gunclocks\n gs = []\n gunclocks.each do |gunclock|\n p gunclock\n gs << {\n :id => gunclock.id,\n :size => gunclock.size,\n :color => gunclock.color,\n :created_at => gunclock.created_at\n }\n end\n { :gunclocks => gs }.to_json\n\n end",
"def gen_first_path(path_length)\n # we will now generate an array with path_length number of elements\n # the elements will be randomly selected numbers from (1.. path_length ^ 2)\n # to avoid duplicate numbers we will kepp track of which ones have already been used\n # in another local array\n\n used = []\n\n path = {}\n\n path_length.times do |k, v|\n random = gen_uniq_rand(path_length ** 2, used)\n used << random\n path[random] = 0\n end\n\n path\nend",
"def serialize_sub_folder_to_json(node)\n json = {\n 'nodeinfo' => node,\n 'name' => node.get_name,\n 'type' => node.type,\n 'key' => params[:reactParams2][:key],\n 'private' => node.get_private,\n 'creation_date' => node.get_creation_date,\n 'updated_date' => node.get_modified_date\n }\n if (node.type == 'CourseNode') || (node.type == 'AssignmentNode')\n json['directory'] = node.get_directory\n json['instructor_id'] = node.get_instructor_id\n json['instructor'] = node.get_instructor_id ? User.find(node.get_instructor_id).name(session[:ip]) : nil\n json['is_available'] = course_is_available?(node)\n serialize_assignment_to_json(node, json) if node.type == 'AssignmentNode'\n end\n\n json\n end",
"def hojas_arbol_nodo\n children_array = []\n\n nivel_categoria = @especie.categoria_taxonomica.nivel1\n ancestry = @especie.is_root? ? @especie.id : \"#{@especie.ancestry_ascendente_directo}/%#{@especie.id}%\"\n\n taxones = Especie.select_basico(['ancestry_ascendente_directo', 'conteo', 'categorias_taxonomicas.nivel1']).datos_basicos.\n categoria_conteo_join.where(\"categoria='7_00' OR categoria IS NULL\").where(\"ancestry_ascendente_directo LIKE '#{ancestry}'\").\n where(\"nombre_categoria_taxonomica IN ('#{CategoriaTaxonomica::CATEGORIAS_OBLIGATORIAS.join(\"','\")}')\").\n where(\"nivel1=#{nivel_categoria + 1} AND nivel3=0 AND nivel4=0\"). # Con estas condiciones de niveles aseguro que es una categoria principal\n where(estatus: 2)\n\n taxones.each do |t|\n children_hash = hash_arbol_nodo(t)\n\n # Acumula el resultado del json anterior una posicion antes de la actual\n children_array << children_hash\n end\n\n render :json => children_array.to_json\n end",
"def generateJSON\n \n tableau_url = get_townhall_urls\n #/ pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n File.open(\"../db/emails.json\",\"w\") do |f|\n for townhall_url in tableau_url do\n f.write(JSON.pretty_generate(get_townhall_email(townhall_url)))\n end\n end\n\n end",
"def filename\n files = Hash.new\n filenames = Dir.glob('/home/vagrant/register-stub/data/*.json')\n filenames.foreach(\".\") do |file|\n puts file\n files[file].add file\n end\n return files.to_json\nend",
"def to_json *args\n arr = self.match_data + DEFAULTS_ROUTES\n\n arr.to_json\n end",
"def shortest_path_lengths(source)\n seen = {}\n level = 0\n nextlevel = { source => 1 }\n until nextlevel.empty?\n thislevel = nextlevel\n nextlevel = {}\n thislevel.each do |v, _|\n if seen[v].nil?\n seen[v] = level\n nextlevel.update(neighbors_of(v).map { |w| [w, nil] }.to_h)\n end\n end\n level += 1\n end\n seen\n end",
"def a_u_path(node)\n path = \"[\"\n node_arr = []\n while node.parent\n node_arr.push(node.name)\n node = node.parent\n end \n path << \"'#{node.name}'\"\n node_arr.reverse_each do |n|\n path << \",#{n}\"\n end\n path << \"]\"\n end",
"def paths\n {\n :homepage => '/',\n :people => '/people',\n :work => '/work',\n :labs => '/labs',\n :\"find-us\" => '/find-us',\n :\"pebbles-good-code\" => '/pebbles-good-code'\n }\nend",
"def as_json(options = nil)\n super(options).tap do |hash|\n hash[\"base_path\"] = hash.delete(\"_id\")\n end\n end",
"def as_json(options = nil)\n super(options).tap do |hash|\n hash[\"base_path\"] = hash.delete(\"_id\")\n end\n end",
"def generate_json(title, freq)\n type = freq.attr('n').gsub(' ', '_') # like fool, aus.001.charactername, female\n display = _make_label(freq.attr('n'), freq.attr('display'), title)\n\n json = {\n \"id\" => freq.attr('n'),\n \"display\" => display,\n \"novel\" => titleize(title),\n \"unique_words\" => freq.attr('countOfUniqueWords'),\n \"speeches\" => freq.attr('speeches'),\n \"words\" => {}\n }\n frequencies = freq.css(\"w\")\n frequencies.length.times do |index|\n child = frequencies[index]\n if child\n word = child.text()\n num = child.attr('freq')\n json[\"words\"][word] = num if (word && num)\n end\n end # end of children looping\n write_to_file(\"public/frequencies/#{title}/#{type}.json\", JSON.pretty_generate(json))\nend",
"def subcategories_json\n {id: id, name: name, depth: depth}\n end",
"def subcategories_json\n {id: id, name: name, depth: depth}\n end",
"def output_map\n map_towrite = Hash.new\n metro_towrite = []\n route_towrite = []\n\n #encode cuty\n @metros.each do |city_code, city|\n metro_towrite.push(city.output_json)\n end\n\n #encode route\n @metros.each do |city_code, city|\n dest = city.destination\n dest.each do |dest_city_code, distance|\n if dest_city_code == city_code\n puts \"impossible #{dest_city_code}\"\n end\n ports = []\n ports.push(city_code)\n ports.push(dest_city_code)\n one_route = Hash.new\n one_route['ports']=ports\n one_route['distance']=distance\n route_towrite.push(one_route)\n end\n end\n map_towrite['data source'] = @data_source\n map_towrite['metros']= metro_towrite\n map_towrite['routes']= route_towrite\n map_towrite['single_route'] = 1\n IO.write(\"../data/output_file.json\", JSON.pretty_generate(map_towrite))\n #write to files\n return map_towrite.to_json\n end",
"def get_array_of_mapped_folder_names\n array = []\n flattened_diffs = @mapped_diffs.flatten \n i = 1 \n while i <= Babygitter.folder_levels.max\n folder_names = []\n for diff in flattened_diffs\n folder_names << diff.filename.scan(build_regexp(i)) \n end\n i += 1\n array << folder_names.flatten.uniq \n end\n array\n end",
"def json_ld; end",
"def get_path_pins(path); end",
"def get_path_pins(path); end",
"def prepare_json\n to_return = Hash.new()\n to_return[:version] = @version\n to_return[:file_path] = @file_path\n to_return[:backup_type] = @backup.type\n to_return[:html] = generate_html\n\n # Add in AppleNotesAccounts\n to_return[:accounts] = Hash.new()\n @accounts.each do |account_id, account|\n to_return[:accounts][account_id] = account.prepare_json\n end\n\n # Add in AppleCloudKitShareParticipants\n to_return[:cloudkit_participants] = Hash.new()\n @cloud_kit_participants.each do |record_id, cloudkit_participant|\n to_return[:cloudkit_participants][record_id] = cloudkit_participant.prepare_json\n end\n\n # Add in AppleNotesFolders\n to_return[:folders] = Hash.new()\n @folders.each do |folder_id, folder|\n to_return[:folders][folder_id] = folder.prepare_json if !folder.is_child?\n end\n\n # Add in AppleNotes\n to_return[:notes] = Hash.new()\n @notes.each do |note_id, note|\n to_return[:notes][note_id] = note.prepare_json\n end\n\n to_return\n end",
"def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end",
"def generate_paths(path)\n if path =~ /[0-9]/\n self.compressed_path = path\n self.uncompressed_path = uncompress_path(path)\n else\n self.uncompressed_path = path\n self.compressed_path = compress_path(path)\n end\n end",
"def format_shortest_path vertices, edges, format\n ret = []\n if format == \"xml\" then\n ret << \"<?xml version='1.0'?>\"\n ret << \"<route>\"\n #Converts to XML the first vertex\n ret << vertices.shift.to_xml\n edges.each do |edge|\n #For each edge, converts the edge to xml\n ret << edge.to_xml\n #Shifts to the next vertex and converts to xml\n ret << vertices.shift.to_xml\n end\n ret << \"</route>\"\n end\n end",
"def getResourceDir(imprint, json, logkey='')\n data_hash = Mcmlln::Tools.readjson(json)\n arr = []\n # loop through each json record to see if imprint name matches formalname\n data_hash['imprints'].each do |p|\n if p['formalname'] == imprint\n arr << p['shortname']\n end\n end\n # in case of multiples, grab just the last entry and return it\n if arr.nil? or arr.empty?\n path = \"generic\"\n else\n path = arr.pop\n end\n return path\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def jurisdiction_paths(patients)\n jurisdiction_paths = Hash[Jurisdiction.find(patients.pluck(:jurisdiction_id).uniq).pluck(:id, :path).map { |id, path| [id, path] }]\n patients_jurisdiction_paths = {}\n patients.each do |patient|\n patients_jurisdiction_paths[patient.id] = jurisdiction_paths[patient.jurisdiction_id]\n end\n patients_jurisdiction_paths\n end",
"def build_tree( n , d )\n \n if d.key?('v')\n n < d['v'] ? build_tree(n , d['l']) : build_tree(n, d['r'])\n else\n d['l'] = {}\n d['v'] = n\n d['r'] = {}\n end\n \nend",
"def contig_generation(kmers_a)\n graph = debruijn_graph_from_kmers(kmers_a)\n # puts graph.keys.length\n # puts graph.values.flatten.length\n # puts graph\n return maximal_non_branching_paths(graph)\n end",
"def regenerate_all_json\n courts = Dir.glob( File.join(File.dirname(__FILE__), 'courts', \"*.yaml\"))\n legislation = Dir.glob( File.join(File.dirname(__FILE__), 'legislation', \"*.yaml\"))\n regulation = Dir.glob( File.join(File.dirname(__FILE__), 'regulation', \"*.yaml\"))\n make_dirty_yamls_into_clean_jasons(courts)\n make_dirty_yamls_into_clean_jasons(legislation)\n make_dirty_yamls_into_clean_jasons(regulation)\n end",
"def fetch_common_json(common_conf_name, folders)\n common_json = {}\n folders.each_with_index do |client_conf_folder, index|\n next_conf_folder = folders.to_a[index + 1].nil? ? 0 : folders.to_a[index + 1]\n puts \"for file : #{common_conf_name} : client : #{client_conf_folder}\"\n common_json = compare_and_intersect(client_conf_folder, next_conf_folder, common_conf_name, common_json)\n end\n\n return common_json\n end",
"def optimize_index!\n @domain_index.each do |key, val|\n # Sort each path/name_key pair by the longest path\n @domain_index[key].sort! { |a, b|\n b[0].size <=> a[0].size\n }.uniq!\n end\n end",
"def to_json(opts={})\n get_triples_for_this_resource.dump(:jsonld)\n end",
"def height\n longest_tree_path(@root)\n end",
"def list_directory(building)\n names_and_apt = {}\n i = 0\n while i < building.apartments().length\n e = 0\n while e < building.apartments[i].renter().length \n names_and_apt[building.apartments[i].renter[e].name] = building.apartments[i].name\n e += 1\n end\n i += 1\n end\n puts names_and_apt.sort\nend",
"def jsonFinal(aryJson)\n\texit if aryJson.empty?\n\tfinalJson = \"{\"\n\taryJson.each do |i| \n\t\tif aryJson.first.eql? i\n\t\t\tfinalJson += \"\\n\"+i.toJson\n\t\telse\n\t\t\tfinalJson += \",\\n\"+i.toJson\n\t\tend\n\tend\n\tfinalJson += \"\\n}\"\nend",
"def write_json(out = \"#{self.class.name}_#{Time.now.to_i}\",\n opts = { tidy: false })\n path = nil\n\n File.open(\"#{out}.json\", 'w') do |f|\n path =\n f << if opts[:tidy] then to_tidy_json(opts)\n elsif instance_variables.empty? then to_json\n else stringify\n end\n end\n\n path&.path\n rescue Errno::ENOENT, Errno::EACCES, IOError, RuntimeError, NoMethodError => e\n warn \"#{__FILE__}.#{__LINE__}: #{e.message}\"\n end",
"def traverse_and_create path\n root = @folder_cache.values.find{|file| file.name == ROOT_FOLDER and file.parents.nil?}\n\n #DriveV3::File (actually folders)\n files = [root]\n places = path.split '/'\n places.each do |place|\n next if place == ''\n folder = folder_with_name place, files.last\n folder = create_folder(place, files.last) if folder.nil?\n files << folder\n end\n files.last\n end",
"def build_sub_tree( parent_id, path_names )\n path_name_tokens = path_names.split( \"|\" )\n zone = path_name_tokens[1] \n \n if db_request?( path_name_tokens ) \n sub_tree = build_db_tree( parent_id, zone )\n else\n db_name = path_name_tokens.last \n sub_tree = build_cltn_tree( parent_id, zone, db_name )\n end\n sub_tree\n end",
"def as_json(*args)\n {\n 'image' => parent_image,\n 'url' => url,\n 'path' => path,\n 'pathWithQuery' => path_with_query,\n 'width' => width,\n 'height' => height,\n 'x1' => x1,\n 'x2' => x2,\n 'y1' => y1,\n 'y2' => y2\n }\n end",
"def to_adj\n full_jsivt= []\n @nodes.each do |id, node_data|\n name = node_data[@name_key]\n data = node_data[:data]\n adjacencies = node_data[@children_key]\n jsivt = {}\n jsivt[\"id\"] = id\n jsivt[\"name\"] = name || \"id: #{id}\" #if no name show id\n jsivt[\"data\"] = data\n jsivt[\"adjacencies\"] = adjacencies\n full_jsivt << jsivt\n end \n full_jsivt.to_json \n end",
"def generate_data_files\n files = {}\n\n # extracted data\n @classes.each do |category|\n files[category] = {}\n folder = File.join(@res, 'data', category.to_s, 'extracted')\n\n files[category][:extracted] = File.join(folder, \"#{category}.json\")\n end\n\n # divided data\n @classes.each do |category|\n files[category][:divided] = {}\n folder = File.join(@res, 'data', category.to_s, 'divided')\n\n @subsets.each do |subset|\n files[category][:divided][subset] = File.join(folder,\n \"#{category}_#{subset}.json\")\n end\n end\n\n # preprocessed data\n @classes.each do |category|\n files[category][:preprocessed] = {}\n\n @preproc.each do |preprocess|\n folder = File.join(\n @res, 'data', category.to_s, 'preprocessed', preprocess.to_s)\n\n files[category][:preprocessed][preprocess] = {}\n\n @subsets.each do |subset|\n files[category][:preprocessed][preprocess][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n\n # transformed data\n if @trans.size > 0\n @classes.each do |category|\n files[category][:transformed] = {}\n\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'transformed', ctrans.to_s)\n\n files[category][:transformed][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:transformed][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n\n # classified data\n if @classifs.size > 0\n @classes.each do |category|\n files[category][:classified] = {}\n\n @classifs.each do |classifier|\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{classifier}_#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'classified', ctrans.to_s)\n\n files[category][:classified][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:classified][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n end\n files\n end",
"def make_path_time_map(settings)\n attrs = settings.fetch(:attrs)\n m = {}\n settings.fetch(:paths).each do |path|\n m[path] = attrs.fetch(path, {})[:slow] ? 100 : 1\n end\n m\nend"
] |
[
"0.6154557",
"0.5814891",
"0.5700766",
"0.5700766",
"0.56640106",
"0.5627103",
"0.5567338",
"0.552168",
"0.5510911",
"0.5458932",
"0.5442601",
"0.5441034",
"0.5424834",
"0.5400485",
"0.53824484",
"0.53822553",
"0.5371723",
"0.5341395",
"0.53331554",
"0.5294324",
"0.52785754",
"0.52723175",
"0.5231644",
"0.5182382",
"0.5173502",
"0.5158849",
"0.5129068",
"0.5112785",
"0.50931174",
"0.5088684",
"0.508695",
"0.50809366",
"0.5057998",
"0.50460225",
"0.5039721",
"0.5030016",
"0.5023183",
"0.50078934",
"0.5004002",
"0.5001391",
"0.49984398",
"0.4995348",
"0.49940184",
"0.49879706",
"0.49838227",
"0.49827915",
"0.49633414",
"0.49561304",
"0.49545828",
"0.4951276",
"0.49495497",
"0.4947904",
"0.49363643",
"0.49286813",
"0.4928387",
"0.49244976",
"0.4922196",
"0.4919678",
"0.49045485",
"0.49000803",
"0.48938036",
"0.48915252",
"0.48852092",
"0.48802528",
"0.48736286",
"0.4873117",
"0.48711944",
"0.4861913",
"0.4858032",
"0.4858032",
"0.48542497",
"0.48501143",
"0.48501143",
"0.4840553",
"0.48385233",
"0.48377216",
"0.48360208",
"0.48360208",
"0.48342544",
"0.48294634",
"0.4826549",
"0.4824799",
"0.48169988",
"0.48161784",
"0.48063147",
"0.48001215",
"0.47974023",
"0.4797055",
"0.4796185",
"0.47936428",
"0.47927976",
"0.478486",
"0.47835812",
"0.47824",
"0.47809163",
"0.47808436",
"0.47766745",
"0.4774404",
"0.47723055",
"0.4770973"
] |
0.6817712
|
0
|
build json for all nodes
|
def get_relationships(clear_cache = false)
File.delete(node_cache_file) if clear_cache && File.exist?(node_cache_file)
if File.exist?(node_cache_file)
content_type :json unless is_rake
send_file node_cache_file
else
neo = Neography::Rest.new(ENV['NEO4J_URL'] || 'http://localhost:7474')
out = {
:nodes => [],
:links => [],
}
users = {}
repos = []
repo_index = 0
user_index = 0
get_repos(neo).each do |repo|
relationships = get_relationships_for_repo(neo, repo)
repos << {
:name => repo[1],
:type => :repo,
:id => repo[0],
:group => 1,
}
relationships.each do |n|
unless users.has_key?(n[0])
users[n[0]] = {
:name => n[1],
:type => :user,
:id => n[0],
:group => 2,
:index => user_index,
}
user_index = user_index + 1
end
out[:links] << {
:source => repo_index,
:target => n[0],
:value => 1,
}
end
repo_index = repo_index + 1
end
# set the target index correctly for the javascript
out[:links].each do |l|
l[:target] = users[l[:target]][:index] + repo_index
end
out[:nodes] = repos.concat(users.values.to_a).flatten
File.open(node_cache_file, 'w'){ |f| f << out.to_json }
unless is_rake
content_type :json
#JSON.pretty_generate(out) # pretty print
out.to_json # normal out
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_json\n @nodes.map(&:to_json)\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n node_name: node_name, node_type: node_type,\n node_count: node_count, nodes: nodes,\n icons: icons, title: title,\n note: note, io: io\n }\n end",
"def to_adj\n full_jsivt= []\n @nodes.each do |id, node_data|\n name = node_data[@name_key]\n data = node_data[:data]\n adjacencies = node_data[@children_key]\n jsivt = {}\n jsivt[\"id\"] = id\n jsivt[\"name\"] = name || \"id: #{id}\" #if no name show id\n jsivt[\"data\"] = data\n jsivt[\"adjacencies\"] = adjacencies\n full_jsivt << jsivt\n end \n full_jsivt.to_json \n end",
"def to_json\n model = { 'nodes' => [], 'links' => [] }\n\n self.each do |node, adjacency|\n if node.instance_of?(Aquanaut::PageNode)\n group = 1\n else\n asset_groups = { 'image' => 2, 'stylesheet' => 3 }\n group = asset_groups[node.type]\n end\n\n model['nodes'] << { 'name' => node.uri, 'group' => group }\n source = @nodes.values.index(node)\n\n adjacency.each do |adjacency_node|\n target = @nodes.values.index(adjacency_node)\n model['links'] << { 'source' => source, 'target' => target }\n end\n end\n\n return model.to_json\n end",
"def to_json\n json_obj = []\n\n nodes = @nodes_s | @nodes_v\n nodes.each do |n|\n s = closest_s(n).name if @nodes_v.include?(n)\n json_obj << {\n name: n.name,\n coord: {x: n.x, y: n.y},\n s: s\n }\n end\n\n json_obj.to_json\n end",
"def build_jason\n if @content.is_a?(Array)\n @content[0] = build_header_and_text_hashs @content[0] unless @content[0].empty?\n @content[2] = build_header_and_text_hashs @content[2] unless @content[2].empty?\n content_hash = {}\n content_hash = content_hash.merge(@content[0]) unless @content[0] || @content[0].empty?\n content_hash = content_hash.merge(@content[1])\n content_hash = content_hash.merge(@content[2]) unless @content[2] || @content[2].empty?\n @content = content_hash\n else\n @content = build_header_and_text_hashs @content\n end\n back_hash = build_back_portion @content\n document_hash = build_front_portion.merge( @content ).merge( back_hash ); back_hash = {}\n @content = {\n \"id\" => sha,\n \"nodes\" => document_hash\n }\n end",
"def json_hash\r\n if children.size > 0\r\n children.collect { |node| { node.name => node.json_hash }.to_json }\r\n else\r\n { node.name => node.products.find(:all).collect(&:name) }.to_json\r\n end\r\n end",
"def to_json(*a)\n begin\n require 'json/pure'\n\n json_hash = {\n \"name\" => name,\n \"content\" => content,\n \"node_type\" => node_type,\n \"node_class\" => node_class,\n JSON.create_id => self.class.name\n }\n\n if has_children?\n json_hash[\"children\"] = children\n end\n\n return json_hash.to_json\n\n rescue LoadError => e\n warn \"The JSON gem couldn't be loaded. Due to this we cannot serialize the tree to a JSON representation\"\n end\n end",
"def build_JSON\n temp_hash = Hash.from_xml(build_XML)\n temp_hash[\"Envelope\"].delete(\"xmlns:xsi\")\n temp_hash[\"Envelope\"].delete(\"xsi:noNamespaceSchemaLocation\")\n temp_hash = json_recursive_reformat(temp_hash)\n json_result = JSON.pretty_generate(temp_hash) # Making the result more human-readable.\n return json_result\n end",
"def build(*nodes, attributes: {}, infos: nil, recursive: true)\n\t\t\tnodes.each do |node|\n\t\t\t\tcase node\n\t\t\t\twhen Hash\n\t\t\t\t\tnode.each do |name,children|\n\t\t\t\t\t\tadd_node(name,children: [*children], attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadd_node(node, attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\tend\n\t\t\tend\n\t\t\tself\n\t\tend",
"def to_json(_ = nil)\n { @root => wrap_objects.as_json(root: false) }.to_json\n end",
"def json()\n tmp = @plan_ir.map {|plan| plan.json()}\n @tiles = @plan_ir.empty? ? {} : @plan_ir[0].tiles.merge(*@plan_ir[1..].map{|ir|ir.tiles})\n tmp\n end",
"def json_serialize\n components = []\n properties = []\n\n @children.each do |_, child_group|\n child_group.each do |child|\n if child.is_a?(Component)\n components << child.json_serialize\n else\n properties << child.json_serialize\n end\n end\n end\n\n [\n @name.downcase,\n properties,\n components\n ]\n end",
"def as_json(_opts = {})\n {}.tap do |root|\n root[TYPE_KEY] = type\n root[ID_KEY] = object_identifier\n root[ATTRIBUTES_KEY] = generate_attributes\n append_relationships(root)\n append_meta(root)\n append_includes(root)\n end\n end",
"def getJSON(tab)\n\n # All nodes get a name. Native support for to_json in Ruby is awesome, btw\n json = \"#{tab}{\\t\\\"name\\\" : #{name.to_json},\\n\"\n \n if (missione_id.to_json != \"null\") \n json += \"#{tab}\\t\\\"id_missione\\\" : #{missione_id.to_json},\\n\"\n end\n\n if (categoria_code.to_json != \"null\") \n json += \"#{tab}\\t\\\"code_categoria\\\" : #{categoria_code.to_json},\\n\"\n end\n\n\n \n # I think we fixed this, but sometimes we were getting null values for size, so we're checking before we add the value line\n # The D3 examples I based this off used both size and value for the amount in the tree, that's why they aren't consistent. I'll fix that later.\n if (size.to_json != \"null\") \n json += \"#{tab}\\t\\\"value\\\" : #{size.to_json},\\n\"\n end\n\n # If we have kids, add them to the json\n if (children.count > 0)\n\n #json = json.chom \n json += \"#{tab}\\t\\\"children\\\" : [\\n\"\n \n # Our recursive call with a couple of extra tabs. Two seemed better than one.\n children.each do |kid|\n json += kid.getJSON(\"\\t\\t\" + tab) \n end \n \n # Chomp off the trailing comma. There's probably a Ruby method for cutting off the comma without removing the newline. Need to google that\n json = json.chomp(\",\\n\") + \"\\n\"\n\n # Close the json array\n json += \"\\n#{tab}\\t]\\n\"\n\n else\n # No kids, so close up shop\n json = json.chomp(\",\\n\")\n json += \"\\n\"\n end\n\n # Doing this recursively, I'm not sure how to pass it back and not have a comma at the very end. Currently chomping it when I call it at the end of the script.\n # I could always check for how many tabs I have, but that seems sort of wrong.\n json += \"#{tab}},\\n\"\n \n return json\n end",
"def as_json\n {}.tap do |root|\n root[:id] = id\n root[:type] = self.class.type\n root[:attributes] = generate_attributes\n root[:relationships] = generate_relationships\n root[:meta] = generate_metadata\n end\n end",
"def json_attributes\n attributes.merge(\n node_from_id: from_character_id, \n node_to_id: to_character_id,\n strengh: force.abs,\n label: title)\n end",
"def tojson\n\t\tend",
"def gen_tree\n new_tree = {}\n node_list = {}\n @json_tree.each do |k, v|\n if v['child_of'].nil?\n # top\n new_tree[k] = v\n node_list[k] = new_tree[k]\n else\n parent = v['child_of']\n if v['condition'] == 'and'\n node_list[parent]['and'] ||= {}\n node_list[parent]['and'][k] = v\n node_list[k] = node_list[parent]['and'][k]\n elsif v['condition'] == 'or'\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n else\n # TODO: sink?\n node_list[parent]['or'] ||= {}\n node_list[parent]['or'][k] = v\n node_list[k] = node_list[parent]['or'][k]\n end\n end\n end\n\n @json_tree_type = 'tree'\n @json_tree = new_tree\n end",
"def generate_json\n members = []\n @rs.members.each do |member|\n machine = @machine.env.machine(member[:host], @machine.provider_name)\n copy = member.dup\n copy[:host] = get_ip_address(machine)\n members << copy\n end\n\n { :_id => @rs.name, :members => members }.to_json\n end",
"def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n @ssh.write \"/tmp/node.json\", content: JSON.generate(run_list), sudo: true\n end",
"def generate_json\n @array = []\n Rental.all.each do |rental|\n @actions = []\n Action.all.each do |action|\n action.rental_id = rental.id\n @actions.push(who: action.who, type: action.type, amount: action.amount)\n end\n @array.push(\n id: rental.id,\n options: Option.types(rental.id),\n actions: @actions\n )\n end\n JSON.pretty_generate(rentals: @array)\nend",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def create_json(gunclocks)\n# gunclocks = [gunclocks] unless gunclocks.class == Array #for 1 gunclock\n\n# gunclocks = gunclocks.inject([]){ |arr, gunclock|\n# arr << {\n# :id => gunclock.id,\n# :size => gunclock.size,\n# :color => gunclock.color,\n# :created_at => gunclock.created_at\n# }; arr\n# }\n# { :gunclocks => gunclocks }.to_json\n\n# p gunclocks\n gs = []\n gunclocks.each do |gunclock|\n p gunclock\n gs << {\n :id => gunclock.id,\n :size => gunclock.size,\n :color => gunclock.color,\n :created_at => gunclock.created_at\n }\n end\n { :gunclocks => gs }.to_json\n\n end",
"def json_files\n return if @skip_run\n\n @json_dumper.dump_dir = @config[:json_files_dir]\n # Generate all the jsons, even if 1 hostname is given, as it might be useful for the rest of the graph.\n @json_dumper.dump_json_for(@nodes_handler.known_nodes)\n end",
"def hacky_json(nodes)\n meta = {}\n hosts = []\n nodes.each do |node|\n hosts.push(node['fqdn'])\n meta[node['fqdn']] = { 'ansible_host' => node['ipaddress'] }\n end\n meta = { '_meta' => { 'hostvars' => meta } }\n hosts = { 'all' => { 'hosts' => hosts } }\n JSON.generate(hosts.merge(meta))\nend",
"def json\n\n JSON.fast_generate(@gltf)\n\n end",
"def build(node)\n\n # add <node.name to write_array\n @write_array << \"<#{node.name}\"\n\n # if node has classes, append them to last element of write array\n unless node.classes == nil\n @write_array[-1] = @write_array[-1] + \" classes=\\\"#{node.classes.join(\" \")}\\\"\"\n end\n\n # if node has id's, append them to last element of write array. else append closing bracket\n if node.id == nil\n @write_array[-1] = @write_array[-1] + \">\\n\"\n else\n @write_array[-1] = @write_array[-1] + \" id=\\\"#{node.id}\\\">\\n\"\n end\n\n # add tag text to array if available\n unless node.text == \"\"\n @write_array << node.text + \"\\n\"\n end\n\n # build children\n unless node.children == []\n node.children.each do |child|\n build(child)\n end\n else\n @write_array << \"</#{node.name}>\\n\"\n return\n end\n\n # add closing tag e.g. </html>\n @write_array << \"</#{node.name}>\\n\"\n\n end",
"def as_json( options={} )\n { :id => id.to_s + \"_fsd\", :name => name, :data => description, :children => functions }\n end",
"def json(indent=0)\n Oj.dump(@root, mode: :wab, indent: indent)\n end",
"def generate_json\n @array = []\n Rental.all.each do |rental|\n @actions = []\n Action.all.each do |action|\n action.rental_id = rental.id\n @actions.push(who: action.who, type: action.type, amount: action.amount)\n end\n @array.push(\n id: rental.id,\n actions: @actions\n )\n end\n JSON.pretty_generate(rentals: @array)\nend",
"def nodes\n @nodes ||= {}\n end",
"def nodes\n @nodes ||= {}\n end",
"def all_nodes\n Pathname.glob(node_file(\"*\", false)).map do |file|\n json = JSON.parse(file.read)\n Config::Node.from_json(json)\n end\n end",
"def toJson()\n json = { 'class' => self.class.to_s }\n json['id'] = @id ;\n json['index'] = @index ;\n json['allow'] = @allow ;\n json['disallow'] = @disallow ;\n json['speed'] = @speed ;\n json['length'] = @length ;\n json['originalId'] = @originalId ;\n\n json['shape'] = genShapeJson() ;\n\n return json ;\n end",
"def to_json_object\n {'type' => 'ntable', 'axes' => @structure.to_json_array, 'values' => @parent ? _compacted_vals : @vals}\n end",
"def data\n @map = Map.find(params[:map_id])\n @categories = @map.categories\n p \"--------- @map ---------\"\n p @map.nodes.to_json\n response = { nodes: [], edges: []}\n @map.nodes.each do |n|\n response[:nodes] << {id: n.id, name: n.name, description: n.description}\n n.rels.each do |rel|\n start = idIndex(@map.nodes, rel.start_node.id)\n stop = idIndex(@map.nodes, rel.end_node.id)\n if !start.nil? && !stop.nil?\n response[:edges] << {source: start, target: stop, type: rel.rel_type }\n end\n end\n end\n index_offset = @map.nodes.count \n @categories.each do |n|\n response[:nodes] << {id: n.id, name: n.name}\n n.rels.each do |rel|\n start = idIndex(@map.nodes, rel.start_node.id)\n stop = idIndex(@categories, rel.end_node.id, index_offset)\n if !start.nil? && !stop.nil?\n response[:edges] << {source: start, target: stop, type: rel.rel_type }\n end\n end\n end\n p \"------------ response -----------\"\n puts response.to_json\n respond_to do |format|\n format.html { render 'graph/show'}\n format.json { render json: response}\n end\nend",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def json\n fields = dataset.dataset_fields\n e_doc = Hpricot(open(url))\n data = {\"id\"=> id, \"url\"=> url }\n fields.each do |field|\n p field\n data[field.name] = (e_doc/field.css).text.strip\n end\n puts data.inspect \n \n data.to_json \n end",
"def generateJSON\n \n tableau_url = get_townhall_urls\n #/ pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n File.open(\"../db/emails.json\",\"w\") do |f|\n for townhall_url in tableau_url do\n f.write(JSON.pretty_generate(get_townhall_email(townhall_url)))\n end\n end\n\n end",
"def build\n evaluate(@src_path)\n result = @structure.deep_stringify_keys\n JSON.pretty_generate(result) unless result.empty?\n end",
"def to_json\n keys = [\"tsn\", \"unit_name1\", \"parent_tsn\", \"kingdom_id\", \"complete_name\"]\n self.attributes.filter(*keys).to_json\n end",
"def output\n output = {}\n\n Netgen.plugins.each do |plugin|\n plugin.autogen_node(self.class, self.name, output, @index)\n end\n output['links'] = {}\n\n @connections.each do |peer|\n peer_name = peer[0].name\n peer[1].each do |connection|\n local, remote = connection\n output['links'][local] = {}\n output['links'][local]['peer'] = [peer_name, remote]\n end\n end\n output\n end",
"def to_json(*)\n #This is a stub, used for indexing\n end",
"def render_process_tree_json (expressions)\n\n OpenWFE::Json.encode(expressions.tree)\n end",
"def gen_json(site, output_path)\n site_data_hierarchy = load_data_hierarchy\n site_data_hierarchy.delete_if { |key| key != 'sites' }\n site_data_hierarchy['sites'].delete_if { |key| key != site }\n site_data_hierarchy['sites'][site].delete_if { |key| key != 'clusters' }\n site_data_hierarchy['sites'][site].fetch('clusters', {}).to_h.each do |_cluster_uid, cluster_hash|\n cluster_hash.delete_if { |key| key != 'nodes' }\n cluster_hash['nodes'].to_h.each do |_node_uid, node_hash|\n node_hash.delete_if { |key| key != 'software' }\n node_hash['software'].delete_if { |key| key != 'standard-environment' }\n end\n\n cluster_hash['nodes'] = cluster_hash['nodes'].sort_by{|node_uid, _node_hash| node_uid[/(\\d+)/].to_i }.to_h\n end\n site_data_hierarchy['sites'][site]['clusters'] = site_data_hierarchy['sites'][site].fetch('clusters', {}).sort_by{ |cluster_uid, _cluster_hash| cluster_uid }.to_h\n\n output_file = File.new(output_path, 'w')\n output_file.write(JSON.pretty_generate(site_data_hierarchy))\nend",
"def as_json(node)\n json = {\n name: node.name,\n ipaddress: node.ipaddress,\n domain: (node.domain if node.has_key?('domain')),\n os_version: node.os_version,\n recipes: (node.recipes.as_json if node.has_key?('recipes')),\n hostname: node.hostname,\n tags: node.tags.as_json,\n }\n if node.has_key?('network')\n network = {}\n network['default_interface'] = node.network.default_interface\n interfaces = {}\n node.network.interfaces.select{|k, v| k.start_with?('eth')}.each do |ifname, v|\n interface = {}\n if v['addresses']\n v['addresses'].each do |address, v|\n interface[v['family']] = address\n end\n end\n interfaces[ifname] = interface\n end\n network['interfaces'] = interfaces\n json['network'] = network\n end\n json\n end",
"def gen_node_infos(config)\n\n config\n # master_n = config['master_n']\n # master_mem = config['master_mem']\n # slave_n = config['slave_n']\n # slave_mem = config['slave_mem']\n # force_zk = config['force_zk']\n # zk_mem = config['zk_mem']\n # master_ipbase = config['master_ipbase']\n # slave_ipbase = config['slave_ipbase']\n # zk_ipbase = config['zk_ipbase']\n\n # master_infos = (1..master_n).map do |i|\n # { :hostname => \"master#{i}\",\n # :ip => master_ipbase + \"#{10+i}\",\n # :mem => master_mem }\n # end\n # slave_infos = (1..slave_n).map do |i|\n # { :hostname => \"slave#{i}\",\n # :ip => slave_ipbase + \"#{10+i}\",\n # :mem => slave_mem }\n # end\n\n # zk_n = master_n > 1 ? 3 : (force_zk ? 1 : 0)\n # zk_infos = (1..zk_n).map do |i|\n # { :hostname => \"zk#{i}\",\n # :ip => zk_ipbase + \"#{10+i}\",\n # :mem => zk_mem }\n # end\n\n # return { :master => master_infos, :slave=>slave_infos, :zk=>zk_infos }\nend",
"def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n ssh.write \"#{CHEF_VAR_PATH}/node.json\", content: JSON.generate(run_list), sudo: true\n end",
"def as_json(_opts = {})\n # Rails.logger.debug \"Tag #{id}: as_json\"\n hash = super(_opts)\n hash.reject! {|k,v| v.blank? }\n hash[:gml] = self.gml_hash && self.gml_hash['gml']\n hash[:gml] ||= self.gml_hash && self.gml_hash['GML']\n hash[:gml] ||= {}\n hash\n end",
"def to_json(*a)\n { \n 'id' => self.id,\n 'user_id' => self.user_id,\n 'parent_or_child' => self.parent_or_child,\n 'description' => self.description,\n 'type' \t => self.type,\n 'created_at' => self.created_at, \n 'created_at_time' =>created_at_time,\n }.to_json(*a)\n end",
"def to_json(*maybe_generator_state)\n as_json(root: false).to_json(*maybe_generator_state)\n end",
"def serialize_sub_folder_to_json(node)\n json = {\n 'nodeinfo' => node,\n 'name' => node.get_name,\n 'type' => node.type,\n 'key' => params[:reactParams2][:key],\n 'private' => node.get_private,\n 'creation_date' => node.get_creation_date,\n 'updated_date' => node.get_modified_date\n }\n if (node.type == 'CourseNode') || (node.type == 'AssignmentNode')\n json['directory'] = node.get_directory\n json['instructor_id'] = node.get_instructor_id\n json['instructor'] = node.get_instructor_id ? User.find(node.get_instructor_id).name(session[:ip]) : nil\n json['is_available'] = course_is_available?(node)\n serialize_assignment_to_json(node, json) if node.type == 'AssignmentNode'\n end\n\n json\n end",
"def to_nifty_json\n self.recursive_delete_if_nil.jsonify.to_json\n end",
"def to_json\n att = self.instance_variables.map {|v| v.to_s }\n links = []\n data = {}\n\n att.delete(\"@url\")\n att.delete(\"@client\")\n\n self.links.each do |l|\n links << l.values.first.to_hash\n end\n att.delete(\"@links\")\n\n att.each do |opt|\n data[opt.delete(\"@\")] = instance_variable_get(opt)\n end\n data['links'] = links\n data.to_json\n end",
"def json_for(node)\n JSON.parse(File.read(\"#{@repository_path}/nodes/#{node}.json\"))\n end",
"def to_json(options = {})\n options[:root] = true unless options.key?(:root)\n super(options)\n end",
"def to_json\n io = StringIO.new << \"{\"\n\n io << JSON.create_id.to_json << \":\" << self.class.name.to_json << \",\"\n\n @data.each {|key, value|\n io << key.to_json.to_s << \":\" << value.to_json << \",\"\n }\n\n io.seek(-1, IO::SEEK_CUR)\n io << \"}\"\n\n io.string\n end",
"def generate\n graph = crate.entities.map(&:properties).reject(&:empty?)\n JSON.pretty_generate('@context' => context, '@graph' => graph)\n end",
"def to_jaxb_json_hash\n _h = super\n _h['id'] = id.to_jaxb_json_hash unless id.nil?\n _h['version'] = version.to_jaxb_json_hash unless version.nil?\n _h['description'] = description.to_jaxb_json_hash unless description.nil?\n _h['url'] = url.to_jaxb_json_hash unless url.nil?\n _h['name'] = name.to_jaxb_json_hash unless name.nil?\n _h['organization'] = organization.to_jaxb_json_hash unless organization.nil?\n _h['issueManagement'] = issueManagement.to_jaxb_json_hash unless issueManagement.nil?\n _h['scm'] = scm.to_jaxb_json_hash unless scm.nil?\n _h['ciManagement'] = ciManagement.to_jaxb_json_hash unless ciManagement.nil?\n if !licenses.nil?\n _ha = Array.new\n licenses.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['licenses'] = _ha\n end\n if !mailingLists.nil?\n _ha = Array.new\n mailingLists.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['mailingLists'] = _ha\n end\n if !dependencies.nil?\n _ha = Array.new\n dependencies.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['dependencies'] = _ha\n end\n _h['incomplete'] = incomplete.to_jaxb_json_hash unless incomplete.nil?\n return _h\n end",
"def json_directional(name, logger)\n\t# return '{\"nodes\":[], \"links\":[], \"constraints\":[]}'\n\t\n\t\n\t\n\t\n\t# input sanitization???\n\t# I mean, the name is coming from a URL piece, so it could be anything...\n\t\n\t\n\t# logger.info @rake.methods.grep(/task/).inspect\n\t# logger.info @rake.tasks.inspect\n\t\n\tshort_path = 'public/CS_BS_all.yaml'\n\t\n\tregenerate_graph = false\n\t@rake[short_path].invoke ->(){\n\t\t# --- this callback runs when YAML file in 'short_path' is regenerated\n\t\tlogger.info \"graph generation callback\"\n\t\t\n\t\tregenerate_graph = true\n\t}\n\t\n\t# Generate graphs if\n\t# 1) no graph yet in memory\n\t# 2) source YAML file was modified\n\tif regenerate_graph or @graphs[short_path].nil?\n\t\t@graphs[short_path] = SummerResearch::DependencyGraph.new.tap do |graph|\n\t\t\traw_data = Models::Utilities.load_yaml_file(short_path)\n\t\t\t# raw_data = \n\t\t\t\t# if name.include? 'split'\n\t\t\t\t# \tModels::Utilities.load_yaml_file \"public/#{name}.yaml\"\n\t\t\t\t# else\n\t\t\t\t\t# Models::Utilities.load_yaml_file(short_path)\n\t\t\t\t# end\n\t\t\t\n\t\t\t# NOTE: just get the node and vert information first. The data will be converted to the proper output format later.\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- add basic node and edge information to the graph\n\t\t\tnodes = raw_data.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t\n\t\t\tlinks =\n\t\t\t\traw_data.collect do |course, deps|\n\t\t\t\t\tdeps.collect do |dependency|\n\t\t\t\t\t\t[course, dependency]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tlinks = links.flatten(1) # remove extra level of nesting\n\t\t\tlinks.delete_if do |course, dependency|\n\t\t\t\tcourse == dependency # remove self-links resulting from messy data\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tlogger.info nodes.inspect\n\t\t\tlogger.info links.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tnodes.each do |vertex|\n\t\t\t\tgraph.add_vertex(vertex)\n\t\t\tend\n\t\t\t\n\t\t\tlinks.each do |course, dependency|\n\t\t\t\tgraph.add_edge(dependency, course)\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- debug printing to make sure that worked\n\t\t\t\n\t\t\t# NOTE: the first item in either of these lists, is the requested node.\n\t\t\t# ie) ancestors of CS 367 includes CS 367 itself, even if all self-loops were removed\n\t\t\t# NOTE: was able to fix this by returning a slightly different Enumerator from the DependencyGraph class.\n\t\t\tlogger.info \"Ancestors\"\n\t\t\tlogger.info graph.ancestors(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Parents\"\n\t\t\tlogger.info graph.parents(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Children\"\n\t\t\tlogger.info graph.children(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Descendants\"\n\t\t\tlogger.info graph.descendants(\"CS 367\").to_a.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tlogger.info graph.each_vertex.to_a\n\t\t\tlogger.info graph.each_edge.to_a\n\t\tend\n\tend\n\t\n\t# pull graph from the cache\n\tgraph = @graphs[short_path]\n\t\n\traise \"Could not find DependencyGraph data. Should have been generated after #{short_path} was made, but it seems like that as not the case.\" if graph.nil?\n\t\n\t\n\t# if short_path == 'data/CS_BS_all.yaml'\n\t\t[\n\t\t\t'CS 310',\n\t\t\t'CS 330',\n\t\t\t'CS 367',\n\t\t\t# 'ENGH 302',\n\t\t\t# # 'CS 262',\n\t\t\t# # 'CS 351',\n\t\t\t# # 'MATH 351',\n\t\t\t# # 'MATH 203',\n\t\t\t# 'STAT 344',\n\t\t\t# # 'MATH 125',\n\t\t\t# 'ECE 445',\n\t\t\t# # 'CS 222',\n\t\t\t# # 'CS 112',\n\t\t\t# # 'STAT 346',\n\t\t\t# 'SYST 210',\n\t\t].each do |course|\n\t\t\t# graph.cut course\n\t\tend\n\t# end\n\t\n\t# graph.remove_vertex('MATH 112') # Discrete Math for IT\n\t# graph.remove_vertex('CS 222') # \"Computer Programming for Engineers\", basically like CS 262\n\t\n\t\n\t\n\t\n\trequirement_by_type_file = 'data/CS_BS_requirements_by_type.yaml'\n\t@rake[requirement_by_type_file].invoke\n\t\n\trequirement_by_type = Models::Utilities.load_yaml_file(requirement_by_type_file)\n\t\n\t\n\t\n\trequired_courses = requirement_by_type[:required].to_set\n\telective_courses = requirement_by_type[:elective].to_set\n\t\n\t\n\t\n\t\n\t\n\t\n\trequirements_file = 'data/CS_BS_requirements.yaml'\n\t@rake[requirements_file].invoke\n\t\n\tdegree_requirements = Models::Utilities.load_yaml_file(requirements_file)\n\tdegree_requirements\n\t\n\telective_category = \n\t\tdegree_requirements.select{ |name, sector| sector[:data].is_a? Hash }\n\t\t .collect { |name, sector|\n\t\t \t sector[:data].collect{ |category, course_id|\n\t\t \t \t[course_id, name]\n\t\t \t }\n\t\t }\n\t\t .flatten(1) # array of [course_id, name] pairs\n\t\n\t# convert [course_id, name] relation into { course_id => i }, where i is an integer corresponding to 'name' in a list of all values for 'name'\n\telective_category = elective_category.to_h\n\t\n\tname_list = elective_category.values.uniq\n\tname_to_number = name_list.each_with_index.to_h\n\t\n\tlogger.info name_list.inspect\n\t\n\telective_category = \n\t\telective_category.collect{ |course_id, name|\n\t\t\t[course_id].flatten.collect { |id|\n\t\t\t\t[ id, name_to_number[name] ]\n\t\t\t}\n\t\t}\n\t\t.flatten(1)\n\t\t.to_h\n\t\n\tlogger.info elective_category.inspect\n\t\n\t\n\treturn graph.to_json_d3v3_cola(required_courses, elective_courses, elective_category)\n\t\n\t\n\t\n\t# below is a bunch of old code, to generate the graph the old way\n\t# still keeping it around, because some of these constraints have not been implemented\n\t# in the new system.\n\t# Also, this alternative way of specifying colors is interesting.\n\t# -------------------------------------------------------------------\n\t\n\t\n\t\n\t\n\t# === Create Constraints\n\t# basic constraint: prereqs go above later courses.\n\t\t# (overall visual flow: top to bottom as skill increases)\n\t\t# defined as local property.\n\t\t# graph ends up showing global properties.\n\tc1 =\n\t\traw_data2.collect do |course, deps|\n\t\t\tdeps.collect do |d|\n\t\t\t\ti_left =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == course}\n\t\t\t\t\n\t\t\t\ti_right =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == d}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => 25\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tc1.flatten!\n\t\n\tconstraints = c1\n\t\n\t# TODO: implement constraint such that all 100-level courses are above the 200-level ones, etc etc.\n\t# (want to stratify course levels)\n\t# logger.info \"HEY\"\n\tgap = 500\n\tc2 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\"left\" => 28, \"right\" => i_left, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c2\n\tconstraints.flatten!\n\t\n\t\n\t\n\t# all nodes want to have horizontal spacing\n\tgap = 25\n\tc3 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t\ttrue\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"x\", \n\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c3\n\tconstraints.flatten!\n\t\n\t\n\t\n\t\n\t# TODO: implement constraint that causes all courses from a single department to clump\n\t\n\t\n\t\n\t\n\t\n\t# === additional processing on the graph\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t# === rough packaging for output\n\tout = {\n\t\t# 'name' => name,\n\t\t'nodes' => nodes,\n\t\t'links' => links,\n\t\t'constraints' => constraints\n\t}\n\t\n\t\n\t# === style the nodes\n\t\n\tcolor_key ||= {\n\t\t:gated_elective_clump => \"#10D588\", # light green\n\t\t:split_link => \"#3399FF\", # blue\n\t\t\n\t\t:required => \"#CC2300\", # red / orange\n\t\t:elective => \"#242424\", # black\n\t\t:not_required => \"#AAA\" # grey\n\t}\n\t\n\trequired =\n\t\t@data[:required].collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\telective = \n\t\t@data[:elective].values\n\t\t.collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\t\n\tout['nodes'].each do |node|\n\t\t# --- color assigment\n\t\ttype = node_type(node['name'], required, elective)\n\t\t# node['color'] = color_key[type]\n\t\tnode['class'] = type.to_s.tr('_', '-')\n\t\t\n\t\t\n\t\t# --- do other things with type\n\t\t# leaves << node['id'] if type == :not_required\n\tend\n\t\n\t\nend",
"def to_json_compatible\n json_scene = {}\n json_scene[:id] = @identifier\n # the toys are represented by their identifiers\n json_toys = []\n @toys.each do |toy|\n json_toys << toy.to_json_compatible\n end\n json_scene[:toys] = json_toys\n json_edges = []\n @edges.each do |edge_part|\n json_edges << edge_part.to_json_compatible\n end\n json_scene[:edges] = json_edges\n json_scene[:gravity] = @gravity.dy\n json_scene[:wind] = @gravity.dx\n json_scene[:boundaries] = @boundaries\n\n Constants::BACKGROUND_COLOUR_LIST.each_with_index do |c, index|\n if c == @background\n json_scene[:background] = index\n end\n end\n json_scene[:backgroundURL] = @backgroundURL\n\n json_scene\n end",
"def to_json(opts={})\n get_triples_for_this_resource.dump(:jsonld)\n end",
"def build_json_from_params \n #Construct array for holding categories\n arr = [] \n get_categories.each do |cat| #Meow\n #For each category create a map {}\n new_cat = {}\n new_cat[\"name\"] = cat[0]\n new_cat[\"steps\"] = []\n get_steps(cat).each do |step|\n #For each step create a map {}\n new_cat_step = {}\n new_cat_step[\"name\"] = step[2]\n #get options returns a list of maps of options\n new_cat_step[\"options\"] = get_options(step) \n new_cat[\"steps\"] << new_cat_step\n end \n arr << new_cat\n end\n json = {\"categories\" => arr, \"prompt\" => params[:prompt]}\n return json\n end",
"def jsonProperties\n\n\t\t\t#self.addRuntimeObject({:_hooCanvas => @parentCanvas.varName });\n\n\t\t\tallItems = {\n\t\t\t}\n\n\t\t\tallItems.merge!( { :bindings => @bindings } ) unless @bindings.nil?\n\t\t\tallItems.merge!( { :javascriptActions => @javascriptActions } ) unless @javascriptActions.nil?\n\t\t\treturn allItems\n\n\t\tend",
"def generate_json\n @array = []\n Rental.all.each do |rental|\n commission = Commission.new(rental.id)\n @array.push(\n id: rental.id,\n price: rental.price,\n commission: {\n insurance_fee: commission.insurancefee,\n assistance_fee: commission.assistancefee,\n drivy_fee: commission.drivyfee\n }\n )\n end\n JSON.pretty_generate(rentals: @array)\nend",
"def build_node_from_model( n )\n return {\n 'id' => n['key'].to_i,\n 'parent_id' => n['parent'].to_i,\n 'children' => [],\n 'weight' => n['weight'].to_i / 100.0,\n 'operation' => n['name'],\n 'metric' => n['dataname']\n }\n end",
"def build_json_query(node_type, phenotype)\r\n phenotype_params = {}\r\n phenotype.each{|component, id| phenotype_params[component] = {:id => id} }\r\n query = {:phenotype => [phenotype_params]}\r\n query[node_type] = [{:id => params[:node_id]}]\r\n query[:include_inferred] = (params[:include_inferred] == 'true')\r\n query[:publication] = []\r\n params[:publications].each{|index, id| query[:publication] << {:id => id} } if params[:publications]\r\n return URI.encode(JSON.generate(query))\r\n end",
"def to_builder\n Jbuilder.new do |json|\n json.index block_index\n json.timestamp timestamp.to_i\n json.proof proof\n\n json.transactions(transactions) do |transaction|\n json.merge! transaction.to_builder.attributes!\n end\n json.previousBlockHash previous_block_hash\n end\n end",
"def build_internal_nodes\n names.each do |tmp_geo_area|\n recurse_nodes(tmp_geo_area.parent_names, tmp_geo_area)\n end\n end",
"def to_json\n i = 0\n datas = Array.new\n td = Array.new\n\n ds = @data\n ds.each_with_index do |row,index|\n data = \"{\"\n td.clear\n row.each_pair do |key,value|\n td.push(\"#{format(key)}: #{format(value)}\")\n end\n\n data +=td.join(\",\")\n data += \"}\"\n datas.push(data)\n end\n data = \"[#{datas.join(\",\")}]\"\n data\n end",
"def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end",
"def to_jaxb_json_hash\n _h = {}\n _h['artifact'] = artifact.to_jaxb_json_hash unless artifact.nil?\n if !childs.nil?\n _ha = Array.new\n childs.each { | _item | _ha.push _item.to_jaxb_json_hash }\n _h['childs'] = _ha\n end\n return _h\n end",
"def all_as_json\n Oj.dump(@map,@json_opts)\n end",
"def addresses\n nodename = params[:node_id]\n @node = nodename == \"admin\" ? Node.admin.where(:available => true).first : Node.find_key(nodename)\n if params[:network]\n @net = Network.find_key(params[:network])\n res = {\n \"node\" => @node.name,\n \"network\" => @net.name,\n \"category\" => @net.category,\n \"addresses\" => @net.node_allocations(@node).map{|a|a.to_s}\n }\n render :json => res, :content_type=>cb_content_type(:addresses, \"object\")\n else\n res = []\n\n if params[:category]\n nets = Network.in_category(params[:category])\n else\n nets = Network.all\n end\n\n nets.each do |n|\n ips = n.node_allocations(@node)\n next if ips.empty?\n\n res << {\n \"node\" => @node.name,\n \"network\" => n.name,\n \"category\" => n.category,\n \"addresses\" => ips.map{|a|a.to_s}\n }\n end\n\n render :json => res, :content_type=>cb_content_type(:addresses, \"array\")\n end\n end",
"def json_serialize\n end",
"def toJson\n\t\tjson = \" {\\n\"\n\t\tself.instance_variables.each_with_index do |i,index|\n\t\t\tjson += \" \\\"#{i[1..-1]}\\\": \\\"#{self.instance_variable_get(i)}\\\"\"\n\t\t\tif index != self.instance_variables.size - 1\n\t\t\t\tjson += \",\\n\"\n\t\t\telse\n\t\t\t\tjson += \"\\n\"\n\t\t\tend\n\t\tend\n\t\tjson += \" }\"\n\tend",
"def toJson\n\t\tjson = \" {\\n\"\n\t\tself.instance_variables.each_with_index do |i,index|\n\t\t\tjson += \" \\\"#{i[1..-1]}\\\": \\\"#{self.instance_variable_get(i)}\\\"\"\n\t\t\tif index != self.instance_variables.size - 1\n\t\t\t\tjson += \",\\n\"\n\t\t\telse\n\t\t\t\tjson += \"\\n\"\n\t\t\tend\n\t\tend\n\t\tjson += \" }\"\n\tend",
"def nodes_to_s\n string = \"\"\n @nodes.each do |name, node|\n string +=\"#{name}:\\n\\t(#{node.name})\\n\"\n end\n string\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'a' => [ first, last, exclude_end? ]\n }\n end",
"def encoded_json_from_ordering(node)\n ordering = { 'id' => node[:id].to_s }\n\n order_list.each do |field|\n field_name = field.attribute_name\n ordering[field_name] = node[field_name].to_s\n end\n\n encode(ordering.to_json)\n end",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def build_nodes(builder, root, child_ns)\n root.each(&->(k, v) { build_node builder, child_ns, k, v })\n end",
"def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"#{@type}\\\", \\\"id\\\": \\\"A#{@@id}\\\", \\\"value\\\": \\\"#{@value}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}\" +\n \"}\"\n end",
"def create\n\n\n @node = Node.new(params[:node])\n @node.user_id = current_user[:id]\n @json = Node.where(:user_id => current_user[:id]).to_gmaps4rails\n current_user[:optimized] = false\n\n if @node.save\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n end\n\n\n\n respond_to do |format|\n if @node.save\n format.html { redirect_to(nodes_path, :notice => 'Node was successfully created.') }\n format.xml { render :xml => @node, :status => :created, :location => @node }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def build_elements(node, obj)\n node.elements.each do |e|\n case\n when e.name == \"names\"\n obj << (build_names(e))\n when e.name == \"date\"\n obj << (build_date(e))\n when e.name == \"label\"\n obj << (build_label(e))\n when e.name == \"text\"\n obj << (build_text(e))\n when e.name == \"group\"\n obj << (build_group(e))\n when e.name == \"choose\"\n obj << (build_conditions(e))\n end\n end\n end",
"def to_json(options={ })\n Rabl::Renderer.json(self, 'inodes/create')\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'a' => [ first, last, exclude_end? ]\n }\n end",
"def to_json(*args); end",
"def generate_class_tree\n debug_msg \"Generating class tree\"\n tree = generate_class_tree_level\n debug_msg \" writing class tree to %s\" % TREE_FILE\n File.open(TREE_FILE, \"w\", 0644) do |f|\n f.write('var tree = '); f.write(tree.to_json(:max_nesting => 0))\n end unless $dryrun\nend",
"def to_json(context)\n\t\tif parent_id\n\t\t\tkids = children.collect { |s|\n\t\t\t\ts.to_json(context)\n\t\t\t} + test_cases.sort_by { |x|\n\t\t\t\tx.issue.subject\n\t\t\t}.collect { |tc|\n\t\t\t\ttc.to_json(context)\n\t\t\t}\n\t\telse\n\t\t\tkids = children.select { |x|\n\t\t\t\t(x.name != '.Obsolete') && (x.name != '.Unsorted')\n\t\t\t}.collect { |s|\n\t\t\t\ts.to_json(context)\n\t\t\t} + test_cases.sort_by { |x|\n\t\t\t\tx.issue.subject\n\t\t\t}.collect { |tc|\n\t\t\t\ttc.to_json(context)\n\t\t\t} + children.select { |x|\n\t\t\t\t(x.name == '.Obsolete') || (x.name == '.Unsorted')\n\t\t\t}.collect { |s|\n\t\t\t\ts.to_json(context)\n\t\t\t}\n\t\tend\n\t\t{\n\t\t\t'suite_id' => id,\n\t\t\t'text' => name,\n\t\t\t'id' => ((name != '.Obsolete') && (name != '.Unsorted')) ? \"suite_#{id}\" : name,\n\t\t\t'expandable' => true,\n\t\t\t'expanded' => false,\n\t\t\t'editable' => !(\n\t\t\t\t((name == '.Unsorted') || (name == '.Obsolete')) && parent.parent.nil?\n\t\t\t) && !parent.nil?,\n\t\t\t'children' => kids,\n\t\t\t'draggable' => (\n\t\t\t\t!parent.nil? && !(\n\t\t\t\t\t((name == '.Unsorted') || (name == '.Obsolete')) && parent.parent.nil?\n\t\t\t\t)\n\t\t\t),\n\t\t\t'state' => { 'opened' => parent.nil? },\n\t\t\t'type' => 'suite'\n\t\t}\n\tend",
"def hojas_arbol_nodo\n children_array = []\n\n nivel_categoria = @especie.categoria_taxonomica.nivel1\n ancestry = @especie.is_root? ? @especie.id : \"#{@especie.ancestry_ascendente_directo}/%#{@especie.id}%\"\n\n taxones = Especie.select_basico(['ancestry_ascendente_directo', 'conteo', 'categorias_taxonomicas.nivel1']).datos_basicos.\n categoria_conteo_join.where(\"categoria='7_00' OR categoria IS NULL\").where(\"ancestry_ascendente_directo LIKE '#{ancestry}'\").\n where(\"nombre_categoria_taxonomica IN ('#{CategoriaTaxonomica::CATEGORIAS_OBLIGATORIAS.join(\"','\")}')\").\n where(\"nivel1=#{nivel_categoria + 1} AND nivel3=0 AND nivel4=0\"). # Con estas condiciones de niveles aseguro que es una categoria principal\n where(estatus: 2)\n\n taxones.each do |t|\n children_hash = hash_arbol_nodo(t)\n\n # Acumula el resultado del json anterior una posicion antes de la actual\n children_array << children_hash\n end\n\n render :json => children_array.to_json\n end",
"def to_json(**options)\n Granola.json.(attributes, options)\n end",
"def build_json_data(h)\n # building each item of the json data\n json_items = h.keys().map { |k| \"\\\"#{k}\\\": \\\"#{h[k]}\\\"\" }\n\n # actually returning the json data\n return \"{#{json_items.join(', ')}}\"\n end",
"def uniprotxml2json (xmlRes)\n\t\txmlDoc = Document.new xmlRes\n\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\tfieldsArray = Array.new\n\t\tcolumnsArray = Array.new\n\t\trecordsArray = Array.new\n\n\t\tentries.each { |ent|\n#\t\t\tfieldsArray.clear\n#\t\t\tcolumnsArray.clear\n\n\t\t\tentryHash = Hash.new\n\t\t\tif fieldsArray.empty?\nputs \"Filling medatada...\"\n\t\t\t\tfieldsArray.push({'name' => 'pdbimg', 'type'=>'auto'})\n\t\t\t\tfieldsArray.push ({'name' => 'proteinFullName', 'type'=>'auto'})\n\t\t\t\tfieldsArray.push({'name' => 'accessions', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'name', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'keywords', 'type'=>'auto'})\n\t\t\t\tfieldsArray.push ({'name' => 'genes', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'primaryName', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'synonim_name', 'type'=>'auto'})\n\t\t\t\tfieldsArray.push ({'name' => 'organismSciName', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'organism_comm_name', 'type'=>'auto'})\n\t\t\t\tfieldsArray.push ({'name' => 'function', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'numOfRefs', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push ({'name' => 'sequence', 'type'=>'auto'})\n#\t\t\t\tfieldsArray.push({'name' => 'pdbs', 'type'=>'auto'})\n\t\t\tend\n\n\t\t\tif columnsArray.empty?\nputs \"Filling columns...\"\n\t\t\t\tcolumnsArray.push(set_column('PDB', 'pdbimg', nil, nil, nil, 'renderPdb'))\n\t\t\t\tcolumnsArray.push (set_column('Target name', 'proteinFullName'))\n\t\t\t\tcolumnsArray.push(set_column('Accessions', 'accessions', {'type' => 'string'},'templatecolumn',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"<tpl for=\\\"accessions\\\">{.}<br/></tpl>\"))\n\t\t\t\tcolumnsArray.push(set_column('Genes', 'genes', {'type' => 'string'}, 'templatecolumn',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \"<tpl for=\\\"genes\\\">{.}<br/></tpl>\"))\n#\t\t\t\tcolumnsArray.push(set_column('Name', 'name'))\n#\t\t\t\tcolumnsArray.push (set_column('Keywords', 'keywords'))\n\n#\t\t\t\tcolumnsArray.push (set_column('Gen primary name','primaryName'))\n#\t\t\t\tcolumnsArray.push (set_column('Gene synonim name', 'synonim_name'))\n\t\t\t\tcolumnsArray.push (set_column('Organism', 'organismSciName'))\n#\t\t\t\tcolumnsArray.push (set_column('Common name', 'organism_comm_name'))\n\t\t\t\tcolumnsArray.push (set_column('Target function', 'function'))\n#\t\t\t\tcolumnsArray.push (set_column('Citations', 'numOfRefs', {'type' => 'int'}))\n#\t\t\t\tcolumnsArray.push (set_column('Sequence', 'sequence', {'type' => 'auto'},\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'templatecolumn',\"Length: {sequence.length}. Mass: <b>{sequence.mass}</b><br/>{sequence.seq}\"))\n\n\t\t\tend\n\n\n#\t \t\tpdbs = ent.elements.collect (\"dbReference[@type='PDB']\") {|pdb| pdb.attributes['id'] } # pdbs[i].elements[j>1]\n#\t\t entryHash['pdbs'] = pdbs\n\n\t\t\tentryHash = decode_uniprot_entry (ent)\n\t\t\trecordsArray << entryHash\n\t\t} # EO entries loop\n\n\t\ttopHash = Hash.new\n\t\ttopHash['ops_records'] = recordsArray\n\t\ttopHash['totalCount'] = entries.length\n\t\ttopHash['success'] = true\n\t\ttopHash['metaData'] = {'fields' => fieldsArray, 'root' => 'ops_records'}\n\t\ttopHash['columns'] = columnsArray\n# puts \"\\njson:\\n#{topHash.to_json}\"\n\n\t\ttopHash\n#\t\ttopHash.to_json\n\n\tend",
"def json_serialize\n # A vcard does not have sub-components, so we're overriding this\n # method to remove that array element.\n properties = []\n\n children.each do |child|\n properties << child.json_serialize\n end\n\n [@name.downcase, properties]\n end"
] |
[
"0.6977531",
"0.6825319",
"0.6772934",
"0.67488813",
"0.66589576",
"0.66501456",
"0.66181034",
"0.63208383",
"0.6315895",
"0.6177996",
"0.61653864",
"0.61204296",
"0.6077013",
"0.6068352",
"0.6061612",
"0.60474",
"0.604183",
"0.6036265",
"0.60155046",
"0.60061306",
"0.5948582",
"0.5927606",
"0.5913853",
"0.5913853",
"0.5909981",
"0.59021735",
"0.5897115",
"0.58963436",
"0.5877678",
"0.5865114",
"0.58445615",
"0.58360356",
"0.5827983",
"0.5827983",
"0.57917506",
"0.5775558",
"0.57753384",
"0.57697153",
"0.5763027",
"0.5763027",
"0.5763027",
"0.5756169",
"0.57529056",
"0.57454646",
"0.5735164",
"0.57301265",
"0.572702",
"0.57170063",
"0.57141215",
"0.56975085",
"0.5691287",
"0.56876576",
"0.5687534",
"0.5683401",
"0.56629086",
"0.56541866",
"0.5642104",
"0.5629634",
"0.56238437",
"0.5613134",
"0.56089497",
"0.56026804",
"0.5598034",
"0.55948806",
"0.5578211",
"0.5569308",
"0.5559663",
"0.5558517",
"0.5557835",
"0.5550645",
"0.55408555",
"0.5535541",
"0.5534885",
"0.5527332",
"0.5525662",
"0.5524348",
"0.5516307",
"0.5515605",
"0.5510644",
"0.55083567",
"0.55083567",
"0.54963845",
"0.5495562",
"0.5484058",
"0.5477798",
"0.5477798",
"0.54758644",
"0.5474015",
"0.5468322",
"0.5467929",
"0.5462922",
"0.5461144",
"0.5455712",
"0.54531795",
"0.5441508",
"0.54243827",
"0.5423667",
"0.54215103",
"0.54197645",
"0.5417148"
] |
0.5570575
|
65
|
PUSH Push the register value on to the stack. Leave the value in the register. ADD Pops a value from the stack and adds it to the register value, storing the result in the register. SUB Pops a value from the stack and subtracts it from the register value, storing the result in the register. MULT Pops a value from the stack and multiplies it by the register value, storing the result in the register. DIV Pops a value from the stack and divides it into the register value, storing the integer result in the register. MOD Pops a value from the stack and divides it into the register value, storing the integer remainder of the division in the register. POP Remove the topmost item from the stack and place in register PRINT Print the register value
|
def string_is_integer?(n)
n == n.to_i.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def mod\n x, y = stack.pop(2)\n push x % y\n end",
"def div\n x, y = stack.pop(2)\n push x / y\n end",
"def stackEval(cmdStack, resStack, memState)\n # cmdStack => the command stack implemented using a list\n # resStack => the results stack implemented using a list\n # memState => the memory state implemented using a block. Will contain a map for variable names and their integers\n\n # create a map to convert vals in resStack to actual operators\n # stack will be an array where elements are added to front and removed from front\n i = 0\n while true do\n if cmdStack.length == 0\n break\n end\n if cmdStack[0].is_a?(GCConst)\n #puts \"const\"\n #puts cmdStack[0].value\n # add constants from control stack to results stack\n resStack.unshift(cmdStack[0].value) # puts the value from cmdStack[i] into the start of resStack\n cmdStack = cmdStack.drop(1) # remove top value (index 0) from command stack\n i += 1\n elsif cmdStack[0].is_a?(GCTrue)\n # add booleans from control stack to results stack\n resStack.unshift(cmdStack[0].value) # puts the value from cmdStack[i] into the start of resStack\n cmdStack = cmdStack.drop(1)\n i += 1 \n elsif cmdStack[0].is_a?(GCFalse)\n # add booleans from control stack to results stack\n resStack.unshift(cmdStack[0].value) # puts the value from cmdStack[i] into the start of resStack\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0].is_a?(GCOp)\n #puts \"op\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1) \n cmdStack.unshift(a.op) #add operator to the stack\n cmdStack.unshift(a.e2) # add second expr to cmdStack\n cmdStack.unshift(a.e1) # add first expr to cmdStack\n i += 1\n\n # binary operators on cmd stack\n elsif cmdStack[0] == :plus\n b = resStack[0] # get first value from resStack. This will be the second expr in the operator statement\n resStack = resStack.drop(1)\n a = resStack[0] # get next value from resStack. This will be the first expr in the operator statement\n resStack = resStack.drop(1)\n resStack.unshift(a + b) #apply operator and put it back on resStack\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0] == :minus\n b = resStack[0]\n resStack = resStack.drop(1)\n a = resStack[0]\n resStack = resStack.drop(1)\n resStack.unshift(a - b)\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0] == :times\n b = resStack[0]\n resStack = resStack.drop(1)\n a = resStack[0]\n resStack = resStack.drop(1)\n resStack.unshift(a * b)\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0] == :div\n b = resStack[0]\n resStack = resStack.drop(1)\n a = resStack[0]\n resStack = resStack.drop(1)\n resStack.unshift(a / b)\n cmdStack = cmdStack.drop(1)\n i += 1\n\n # variable\n elsif cmdStack[0].is_a?(GCVar)\n # apply memoryState function to variable and add to resultStack\n\n x = memState.call(cmdStack[0].value)\n #puts \"var\"\n #puts x\n resStack.unshift(memState.call(cmdStack[0].value))\n # remove GCVar from commandstack\n cmdStack = cmdStack.drop(1)\n i += 1\n\n # Test compare\n elsif cmdStack[0].is_a?(GCComp)\n #puts \"comp\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1)\n cmdStack.unshift(a.op) #add operator to the stack\n cmdStack.unshift(a.e2) # add second expr to cmdStack\n cmdStack.unshift(a.e1) # add first expr to cmdStack\n i += 1 \n\n # less\n elsif cmdStack[0] == :less\n #puts \"less\"\n a = resStack[1]\n b = resStack[0]\n resStack = resStack.drop(2)\n resStack.unshift(a < b)\n cmdStack = cmdStack.drop(1)\n\n # greater\n elsif cmdStack[0] == :greater\n a = resStack[1]\n b = resStack[0]\n #puts \"greater\"\n resStack = resStack.drop(2)\n resStack.unshift(a > b)\n cmdStack = cmdStack.drop(1)\n\n # eq\n elsif cmdStack[0] == :eq\n a = resStack[0]\n b = resStack[1]\n resStack = resStack.drop(2)\n resStack.unshift(a == b)\n cmdStack = cmdStack.drop(1)\n\n elsif cmdStack[0].is_a?(GCAnd)\n #puts \"and gc\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1)\n cmdStack.unshift(\"and\")\n cmdStack.unshift(a.t2)\n cmdStack.unshift(a.t1)\n\n elsif cmdStack[0] == \"and\"\n a = resStack[0]\n b = resStack[1]\n #puts a&b\n resStack = resStack.drop(2)\n cmdStack = cmdStack.drop(1)\n resStack.unshift(a & b)\n\n elsif cmdStack[0].is_a?(GCOr)\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1)\n cmdStack.unshift(\"or\")\n cmdStack.unshift(a.t2)\n cmdStack.unshift(a.t1)\n\n elsif cmdStack[0] == \"or\"\n a = resStack[0]\n b = resStack[1]\n resStack = resStack.drop(2)\n cmdStack.drop(1)\n resStack.unshift(a | b)\n\n\n\n # skip\n elsif cmdStack[0].is_a?(GCSkip)\n # no changes to result stack or memState\n cmdStack = cmdStack.drop(1)\n break\n i += 1\n\n # variable assignment\n elsif cmdStack[0].is_a?(GCAssign)\n # add to memState the new variable substitution \n #puts \"assign\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1) # remove GCAssign from cmdstack\n cmdStack.unshift(a.s) # add symbol to be assigned\n cmdStack.unshift(\"assign\") # add assign statement\n cmdStack.unshift(a.e) # add expression to be evaluated\n i += 1\n \n #assignment operator\n # command stack [\"assign\",symbol,...]\n # res stack [const,...]\n elsif cmdStack[0] == \"assign\"\n memState = updateState(memState, cmdStack[1], resStack[0])\n cmdStack = cmdStack.drop(2) # remove assign and symbol\n resStack = resStack.drop(1) # remove constant \n i += 1\n\n # compose\n elsif cmdStack[0].is_a?(GCCompose)\n #puts \"compose\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1) # remove GCCompose from command stack\n cmdStack.unshift(a.st2) # add 2nd statement to be evaluated\n cmdStack.unshift(a.st1) # add first statement to be evaluated\n i += 1\n\n # if statement breakdown\n elsif cmdStack[0].is_a?(GCIf)\n p = cmdStack[0] # top element from stack. Should be of type GCIf\n cmdStack = cmdStack.drop(1) #remove GCIf from cmdStack\n l = p.pairlist # get list from GCIf\n if l.length == 0\n cmdStack.unshift(GCSkip.new())\n else\n randval = rand(l.length) # get random value \n pair = l[randval]\n l.delete_at(randval) # remove statement from index randval\n \n # re-add broken down GCIf to command stakc\n cmdStack.unshift(GCIf.new(l)) # add remaining statements\n cmdStack.unshift(pair[1]) # add statement \n cmdStack.unshift(\"if\") # add if\n cmdStack.unshift(pair[0]) # add boolean guard\n i += 1\n end\n elsif cmdStack[0] == \"if\"\n b = resStack[0] # get the boolean that would have been evaluated from result stack\n if b == true \n s1 = cmdStack[1] # get the statement to be executed\n cmdStack = cmdStack.drop(3) # remove the if, s1 and remaining GCIf block \n resStack = resStack.drop(1) # remove that boolean check\n cmdStack.unshift(s1) #place the s1 value back on command stack\n else \n cmdStack = cmdStack.drop(2) # remove \"if\" and s1. The top element on stack should now be the remaining GCIf statements \n resStack = resStack.drop(1) # remove the boolean \n end\n\n # while loop\n # logic: get random statement from list and place it at top of command stack\n # check if the guard is true. If so then do that statement and repeat\n # if false, can either find another statement or do nothing\n # in this implementation, I will do nothing in the false case\n elsif cmdStack[0].is_a?(GCDo)\n #puts \"do\"\n w = cmdStack[0] # get Do statement off command stack\n #cmdStack = cmdStack.drop(1) # remove statement\n #cmdStack.unshift(GCDo.new(w.pairlist)) \n if w.pairlist.length == 0 # if no pairs, do nothing\n cmdStack.unshift(GCSkip.new())\n else\n randval = rand(w.pairlist.length) # get random value\n pair = w.pairlist[randval] # get random pair\n cmdStack = cmdStack.drop(1) # remove GCDo\n cmdStack.unshift(pair[1]) # add statement\n cmdStack.unshift(pair[0]) # add boolean check\n cmdStack.unshift(\"while\")\n cmdStack.unshift(pair[0]) # condition\n i += 1\n # command stack should look like [guard, \"while\", guard, statement, ...]\n end\n elsif cmdStack[0] == \"while\"\n # command stack will be in form [\"while\", guard, statement, ...]\n # resStack will be in form [true/false, ...]\n b = resStack[0] # check evaluated condition\n g = cmdStack[1] # guard\n s = cmdStack[2] # statement \n if b == true\n cmdStack.unshift(g) # place guard to front of stack\n cmdStack.unshift(s) # place statement to front of stack to be evaluated\n resStack = resStack.drop(1) # remove previously evaluated condition\n # new command stack will be in form [statement, guard, \"while\", guard, statement]\n else\n #puts \"while guard was false\"\n cmdStack.drop(3) #remove while, guard and statement from command stack\n cmdStack.unshift(GCSkip.new()) #end loop\n resStack = resStack.drop(1) # remove previously computed bool\n i += 1\n end\n else \n puts \"Invalid input\"\n break\n end\n end\n return memState \n\n end",
"def arithmeticUnary(op)\n str = getTopOfStack + \"M=\"+op+\"M\"+\"\\n\"\n return str+\"\\n\"\nend",
"def minilang(program)\n register = 0\n stack = []\n\n program.split.each do |step|\n p step\n case step\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = step.to_i\n end\n p stack\n end\nend",
"def divide()\n \t\terror?\n \t\tsecond = @stack.pop\n \t\tfirst = @stack.pop\n \t\t@stack << (first.to_f / second.to_f)\n end",
"def minilang(string)\n register = 0\n stack = []\n\n string.split(' ').each do |cmd|\n case cmd\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop.to_i\n when 'SUB' then register -= stack.pop.to_i\n when 'MULT' then register *= stack.pop.to_i\n when 'DIV' then register /= stack.pop.to_i\n when 'MOD' then register %= stack.pop.to_i\n when 'POP' then register = stack.pop.to_i\n when 'PRINT' then puts register\n else register = cmd.to_i\n end\n end\nend",
"def pop\n # store top value in variable\n node_value = @data.value\n # replace top node with next node in stack\n @data = @data.next_node\n # return top node value\n return node_value\n end",
"def arithmeticBinary(op)\n str = getTopTwoFromStack + \"M=M\"+op+\"D\"+\"\\n\"\n return str+\"\\n\"\nend",
"def minilang(str)\n register = 0\n stack = []\n\n str.split.each do |el|\n case \n when el == 'ADD' then register += stack.pop\n when el == 'SUB' then register -= stack.pop\n when el == 'MULT' then register *= stack.pop\n when el == 'DIV' then register /= stack.pop \n when el == 'MOD' then register %= stack.pop \n when el == 'PUSH' then stack.push(register)\n when el == 'POP' then register = stack.pop \n when el == 'PRINT' then puts register \n else register = el.to_i\n end\n end\nend",
"def push(value)\n @handle.puts \" $PUSH #{value & 0x7f}\"\n end",
"def minilang(string)\n register = 0\n stack = []\n string.split.each do |command|\n case command\n when \"PUSH\" then stack << register\n when \"ADD\" then register += stack.pop\n when \"SUB\" then register -= stack.pop\n when \"MULT\" then register *= stack.pop\n when \"DIV\" then register /= stack.pop\n when \"MOD\" then register %= stack.pop\n when \"POP\" then register = stack.pop\n when \"PRINT\" then puts register\n else register = command.to_i\n end\n end\nend",
"def pop\n value2Return = nil\n if @data == nil\n puts \"Stack is empty\" \n else\n value2Return = @data.value\n @data = @data.next_node\n end\n value2Return\n end",
"def rpn(operation)\n rpn_stack = Stack.new\n tokens = parse_tokens(operation)\n puts tokens.to_s\n tokens.each do |token|\n if !is_operator?(token)\n puts \"pushing token #{token}\"\n rpn_stack.push(token)\n else\n val2 = rpn_stack.pop\n val1 = rpn_stack.pop\n rpn_stack.push(calculate(val1,val2, token))\n end # end of if\n end # end of each\n rpn_stack.pop\nend",
"def minilang(commands)\n stack = []\n register = 0\n command_arr = commands.split\n\n command_arr.each do |command|\n case command\n when \"PUSH\"\n stack.push(register)\n when \"ADD\"\n register += stack.pop\n when \"SUB\"\n register -= stack.pop\n when \"MULT\"\n register *= stack.pop\n when \"DIV\"\n if stack.last == 0\n puts \"Divide by zero error. Can't perform \\\"DIV\\\" command.\"\n else\n register /= stack.pop\n end\n when \"MOD\"\n if stack.last == 0\n puts \"Divide by zero error. Can't perform \\\"MOD\\\" command.\"\n else\n register %= stack.pop\n end\n when \"POP\"\n register = stack.pop\n when \"PRINT\"\n puts register\n else\n register = command.to_i\n end\n end\nend",
"def rpn_calculator\n operators_list = ['+','-','*','/']\n stack = []\n \n def add(stack)\n stack.push(stack.pop + stack.pop)\n end\n \n def minus(stack)\n var1, var2 = stack.pop, stack.pop\n stack.push(var2 - var1)\n end\n \n def multiply(stack)\n stack.push(stack.pop * stack.pop)\n end\n \n def divide(stack)\n stack.push(stack.pop / stack.pop)\n end\n \n def get_user_input\n puts \"enter number or operator into calculator\"\n\n gets.chomp\n end\n \n puts \"enter 'quit' to quit\"\n loop do\n user_choice = get_user_input\n break if user_choice == \"quit\"\n \n if !(operators_list.include?(user_choice))\n stack << user_choice.to_i\n end\n \n case (user_choice)\n when \"+\"\n add(stack)\n when \"-\"\n minus(stack)\n when \"*\"\n multiply(stack)\n when \"/\"\n divide(stack)\n end \n \n \n p stack\n end \nend",
"def value(ext_call = true)\t\t\t\t\n\t\t@temp_stack = @stack.clone if ext_call\n\t\t# puts \"temp stack value from value: #{@temp_stack}\"\n\t\tcall_op = @temp_stack.pop\t\t\t\n\t\tif call_op == :+\n\t\t\tvalue = calc_plus\n\t\telsif call_op == :-\n\t\t\tvalue = calc_minus\n\t\telsif call_op == :*\n\t\t\tvalue = calc_times\n\t\telsif call_op == :/\n\t\t\tvalue = calc_divide\n\t\tend\n\t\treturn value\n\tend",
"def op15(interp)\n b, a = interp.stack.pop, interp.stack.pop \n interp.stack.push(Integer(a % b))\n end",
"def do_percent s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(b%a); end",
"def round\n raise StandardError.new(\"Not enough numbers on stack\") if @stack.length<1\n num = pop\n result = num.round\n push(result)\n return result\n end",
"def pop\n #if the stack is already empty do nothing\n if empty?\n nil\n else\n #set popped equal to the element at index @top, which isthe top of the stack\n popped = @store[@top]\n #set the value at the top of the stack to nil\n @store[@top] = nil\n # subtract 1 from the value of @top\n @top = @top.pred #@top--\n #returns the value that was popped\n popped\n end\n end",
"def mul\n x, y = stack.pop(2)\n push x * y\n end",
"def divide\n return error_message if stack.empty?\n x = stack.pop.to_f\n y = stack.pop.to_f\n stack << y / x \n @value = y / x \n end",
"def push(num)\n @stack << num\n\n return num\n end",
"def %\n pop\n end",
"def minilang(command_string)\n stack = []\n register = 0\n command_string.split(' ').each do |command|\n case command\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\n register\nend",
"def pop()\n return \"Stack is empty\" if is_empty\n\n if @head.next == nil\n temp = @head.value\n @head = nil\n return temp\n end\n\n temp = @head.value\n @head = @head.next\n @current_size -= 1\n\n return temp\n end",
"def pop\n # check if stack is empty\n if @data.nil?\n return \"nil\"\n elsif @data.next_node != nil\n value = @data.value\n @data = @data.next_node\n return value\n else\n value = @data.value\n @data = @data.next_node\n return value\n end\n end",
"def op10(interp) \n interp.stack.push(Integer(interp.stack.pop + interp.stack.pop))\n end",
"def minilang(program)\n stack = []\n register = 0\n commands = program.split\n commands.each do |command|\n case command\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register = register * stack.pop\n when 'DIV' then register = register / stack.pop\n when 'MOD' then register = register % stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\n nil\nend",
"def evaluate\n stack = Stack.new\n\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_i)\n elsif token == \"+\"\n # handle addition\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs + rhs)\n elsif token == \"*\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs * rhs)\n elsif token == \"-\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs - rhs)\n elsif token == \"/\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs / rhs)\n elsif token == \"^\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs ** rhs)\n elsif token == \"%\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(lhs % rhs)\n elsif token == \"max\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push([lhs, rhs].max)\n elsif token == \"min\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push([lhs, rhs].min)\n elsif token == \"rand\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push(rand(lhs..rhs))\n elsif token == \"sample\"\n rhs = stack.pop # right-hand side\n lhs = stack.pop # left-hand side\n stack.push([lhs, rhs].sample)\n elsif token == \"!\"\n num = stack.pop\n stack.push(factorial(num))\n else\n raise \"omg what is this token even?\"\n end\n end\n\n stack.pop\n end",
"def push(num)\n stack << num\n end",
"def postfix_evaluator(equation)\n stack = []\n for i in equation do\n if str_to_num(i)\n stack.push(str_to_num(i))\n puts stack\n elsif (\"+-*/\").include?(i)\n second_num = stack.pop\n if stack != []\n first_num = stack.pop\n result = math(i, first_num, second_num)\n stack.push(result)\n else\n raise \"Not enough arguments\"\n end\n else\n raise \"Invalid number\"\n end\n end\n stack.pop()\nend",
"def do_plus s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(a+b); end",
"def do_asterisk s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(a*b); end",
"def minilang(str)\n stack = []\n register = 0\n\n str.split.each do |char|\n case char\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register += stack.shift\n when 'PRINT' then puts register\n else register = char.to_i\n end\n end\nend",
"def minilang(str)\n stack = []\n reg = 0\n\n # puts str\n cmds = str.split\n cmds.each do |cmd|\n # puts \"cmd == #{cmd}\"\n case cmd\n when 'PUSH' then stack << reg\n when 'ADD' then reg += stack.pop\n when 'SUB' then reg -= stack.pop\n when 'MULT' then reg *= stack.pop\n when 'DIV' then reg /= stack.pop\n when 'MOD' then reg %= stack.pop\n when 'POP' then reg = stack.pop\n when 'PRINT' then puts reg\n else reg = cmd.to_i # integer\n end\n end\n puts\nend",
"def op14(interp)\n b, a = interp.stack.pop, interp.stack.pop \n interp.stack.push(Integer(a / b))\n end",
"def /\n a = pop\n b = pop\n push b / a\n end",
"def minilang(program)\n register = 0\n stack = []\n program.split.each do |token|\n case token\n when 'PRINT' then puts \"register: #{register}, stack:#{stack}\"\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n else register = token.to_i\n end\n end\nend",
"def pop\r\n # I RETURN A VALUE\r\n if @data == nil \r\n return print \"nil\" \r\n else \r\n print \"#{@data.value}\" \r\n end\r\n @data = @data.next_node\r\n end",
"def minilang(str)\n register = 0\n stack = []\n\n command = str.split(' ')\n command.map! { |element| element.to_i.to_s == element ? element.to_i : element }\n p command\n\n command.each do |element|\n case element\n when 'PUSH'\n stack.push(register)\n when 'ADD'\n register += stack.pop\n when 'SUB'\n register -= stack.pop\n when 'MULT'\n register *= stack.pop\n when 'DIV'\n register /= stack.pop\n when 'MOD'\n register %= stack.pop\n when 'POP'\n register = stack.pop\n when 'PRINT'\n puts register\n else\n register = element\n end\n end\nend",
"def sub\n x, y = stack.pop(2)\n push x - y\n end",
"def pop\n if @top == nil\n return \"nil\"\n else\n value = @top.value\n @top = @top.next_node\n return value\n end\n end",
"def pop()\n @VAR_STACK.pop()\n end",
"def pop(tape)\n\ta = Array.new\n\t# Move back to the stack seperator\n\ta.push Action.new(:left, tape)\n\n\t# Erase the stack seperator and the value\n\t(BitWidth + 1).times{\n\t\ta.push Action.new(BlankSymbol, tape)\n\t\ta.push Action.new(:right, tape)\n\t}\n\n\tm = SubMachine.empty \"pop-#{tape}\"\n\tm.states[m.first].transitions = [Transition.new( Hash.new, a, m.last)]\n\n\t# Now we're on top of the last bit of the prev. value on stack\n\tm2 = moveDistance(tape, (2*BitWidth) + 1, :left)\n\tm.simpleMerge(m2)\n\n\tm\nend",
"def push(val)\n if @stacks.empty?\n @stacks[0] = [val]\n if @capacity > 1\n @left[0] = 0\n else\n @right[0] = 0\n end\n else\n @left << @stacks.size if @left.empty?\n index = @left[0]\n @stacks[index] ||= []\n @stacks[index] << val\n if @stacks[index].size == @capacity\n @left.shift\n i = @right.bsearch_index { |j| j >= index } || @right.size\n @right.insert(i, index)\n end\n end\n end",
"def writePushPop(command, seg, index)\n\t\tseg.rstrip!\n\t\tseg.gsub!(/\\d/, '')\n\t\tif command == $PUSH\n if seg == \"constant\" \n @file.write(\"@\" + index.to_s + \"\\n\")\n @file.write(\"D=A\\n\")\n push()\n elsif seg == \"argument\"\n locInMem(\"ARG\")\n pfRAM(index)\n elsif seg == \"local\"\n locInMem(\"LCL\")\n pfRAM(index)\n elsif seg == \"this\"\n locInMem(\"THIS\")\n pfRAM(index)\n elsif seg == \"that\"\n locInMem(\"THAT\")\n pfRAM(index)\n elsif seg == \"temp\"\n plMemory(\"5\")\n pfRAM(index)\n elsif seg == \"pointer\"\n plMemory(\"3\")\n pfRAM(index)\n elsif seg == \"static\"\n\t\t\t\t@file.write(\"//push static\\n\")\n @file.write(\"@\" + @currentName + \".\" + index.to_s + \"\\n\")\n\t\t\t\tputs @currentName + \".\" + index.to_s\n @file.write(\"D=M\\n\")\n push()\n else\n puts(\"ERROR: seg undefined, seg given - \" + seg)\n\t\t\tend\n elsif command == $POP\n if seg == \"argument\"\n locInMem(\"ARG\")\n storeRAM(index)\n elsif seg == \"local\"\n locInMem(\"LCL\")\n storeRAM(index)\n elsif seg == \"this\"\n locInMem(\"THIS\")\n storeRAM(index)\n elsif seg == \"that\"\n locInMem(\"THAT\")\n storeRAM(index)\n elsif seg == \"temp\"\n plMemory(\"5\")\n storeRAM(index)\n elsif seg == \"pointer\"\n plMemory(\"3\")\n storeRAM(index)\n elsif seg == \"static\"\n pop()\n\t\t\t\t@file.write(\"//pop static\\n\")\n @file.write(\"@\" + @currentName + \".\" + index.to_s + \"\\n\")\n\t\t\t\tputs @currentName + \".\" + index.to_s\n @file.write(\"M=D\\n\")\n else\n puts(\"ERROR: seg undefined, seg given - \" + seg)\n\t\t\tend\n\t\tend\n\tend",
"def pop()\n if @head == nil\n puts \"There is nothing to remove.\"\n elsif @head.next == nil\n puts \"#{@head.data} has been removed from the Stack.\"\n @head = nil\n @min = nil\n else\n puts \"#{@head.data} has been removed from the Stack.\"\n if(@head.data == @min.data)\n curMin = @min\n @min = curMin.next\n puts \"#{@min.data} is the new Minimum Value.\"\n end\n current = @head\n @head = current.next\n end\n end",
"def test_full_stack_push_and_pop\n puts \"test_full_stack_push_and_pop\"\n (rand(10) + 2).times do\n expects = []\n 100.times do\n expects << random_string\n pr = push(expects[-1])\n assert_equal(0, pr, \"expected 0, got #{pr}\")\n end\n\n 100.times do\n r = pop\n s = expects.pop\n assert_equal(s, r, \"expected #{s}, got #{r}\")\n end\n end\n end",
"def pop\n self.top = @stack[1]\n @stack.shift\n end",
"def pop\n \" (void)stack_pop();\"\n end",
"def execute_RET(operand=nil)\n\t\t@ip.direct_value = pop_stack_word\n\t\t@sp.value += operand.value if operand\n\tend",
"def push(x)\n @stack << x \n end",
"def pop\n\t\t@stack.pop.cleaup\n\tend",
"def push(x)\n @stack1 << x\n end",
"def plus\n if @stack == []\n raise ArgumentError, \"calculator is empty\"\n else\n last_two = @stack.last(2)\n @stack = @stack[0..-3]\n # map(&:to_i)\n plus_result = last_two.inject(:+)\n @stack << plus_result\n @stack\n end\n end",
"def pop\n\t\t\t@last = @stack.pop||\"\"\n\t\t\t@last\n\t\tend",
"def plus\n if stack.size > 1\n a = stack.pop\n b = stack.pop\n stack.push(a + b)\n else\n raise Exception.new (\"calculator is empty\")\n end\n end",
"def minilang(str)\n stack = []\n reg = 0\n \n commands = str.split(' ')\n \n commands.each {|command|\n case command\n when 'PRINT'\n puts reg\n when 'PUSH'\n stack.push(reg)\n when 'POP'\n reg = stack.pop\n when 'ADD'\n reg += stack.pop \n when 'SUB'\n reg -= stack.pop \n when 'MULT'\n reg *= stack.pop \n when 'DIV'\n reg /= stack.pop \n when 'MOD'\n reg %= stack.pop\n else\n reg = command.to_i\n end\n }\nend",
"def minilang(program_str)\n register = 0\n stack = []\n commands = program_str.split(' ')\n\n commands.each do |command|\n case command\n when 'PUSH' then stack << register\n when 'ADD' then register += (stack.pop).to_i\n when 'SUB' then register -= (stack.pop).to_i\n when 'MULT' then register *= (stack.pop).to_i\n when 'DIV' then register /= (stack.pop).to_i\n when 'MOD' then register %= (stack.pop).to_i\n when 'POP' then register = (stack.pop).to_i\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\nend",
"def push(x)\n stack.push(x)\n end",
"def _calc operator\n (operand1, operand2) = @stack.pop 2\n @stack.unshift @stack.first\n @stack.push operand1.send(operator.to_sym, operand2)\nend",
"def put\n\t\t\tputs STACK.last \n\t\tend",
"def eval_math(string)\n number_stack = []\n operator_stack = []\n tokens = string.split(\" \")\n tokens.each_with_index do |n, i|\n if n == \"*\" \n number_stack << number_stack.pop.to_i * tokens[i+1].to_i\n tokens.delete_at(i+1)\n elsif n == \"/\" \n number_stack << number_stack.pop.to_i / tokens[i+1].to_i\n tokens.delete_at(i+1)\n elsif ['+','-'].include? n\n operator_stack << n\n else\n number_stack << n\n end\n puts \"evaling n: #{n}, number_stack #{number_stack} operator_stack #{operator_stack}\"\n end\n result = 0\n operator_stack.each do |o|\n if o == '+'\n number_stack[0] = number_stack.first.to_i + number_stack.delete_at(1).to_i\n end\n if o == '-'\n number_stack[0] = number_stack.first.to_i - number_stack.delete_at(1).to_i\n end\n end\n\n return number_stack[0]\n\nend",
"def test_proper_stack\n stack = TokenStack.new\n stack.push('4')\n stack.push('3')\n stack.push('*')\n terp = Interpreter.new(false, true)\n\n result = terp.binary_operation(0, stack)\n assert_equal 12, result\n end",
"def push(operation, value)\n @stack.push [operation, value]\n end",
"def pop\r\n return nil if @top_node.nil?\r\n temp_node = @top_node\r\n @top_node = temp_node.next_node\r\n return temp_node.value\r\n end",
"def pop()\n return @VAR_STACK.pop()\n end",
"def pop()\n return @VAR_STACK.pop()\n end",
"def push(value)\n return \"Stack is full\" if is_full\n\n @stack.push(value)\n @current_size += 1\n end",
"def pop\n # begining of if statement\n # if the method empty? returns true\n if empty?\n #return nil\n nil\n # if the method empty? returns false\n else\n # assign to the the local var popped the value in the array @store\n # that is is the array position of the value of @top\n popped = @store[@top]\n # assign the value nil to the positon of the value of @top in the array @store\n @store[@top] = nil\n # subtract one from the value of the instance var @top\n # and assign the value back to the instance var @top\n @top = @top.pred\n # return the value of the local var popped\n popped\n # end if/else statement\n end\n # end pop method\n end",
"def pop\n if @items.nil?\n\t raise \"Empty Stack -- nothing can be poped\"\n end\n\tpt = @items\n\t@items = @items.next\n\tpt.next = nil\n\treturn pt.value\n end",
"def pop\n # I RETURN A VALUE\n if @data.nil? \n puts \"nil\"\n else\n value = @data.value\n @data = @data.next_node\n value\n end\n end",
"def push(x)\n @stack1.push(x)\n end",
"def evaluate(ex)\n @stack=[]\n @expr.each do |el|\n case el\n when HopExprVar\n # evaluate variable\n var,dot,field=el.value.partition('.')\n if field==''\n # scalar\n val=VarStor.getScalar(ex,el.value)\n else\n # cortege field\n begin\n val=VarStor.getCortege(ex,var)[field]\n rescue\n warn \">> Opppps: #{var}.#{field}\"\n nil\n end\n end\n @stack.push val\n\n when Numeric, String\n # constant\n @stack.push el\n\n when HopExprOp\n case el.value\n when '+'\n a1=@stack.pop\n a2=@stack.pop\n warn \">>PLUS: #{a1},#{a2}\"\n raise SyntaxErrHopError if a2.nil?\n @stack.push a1.to_f+a2.to_f\n when '*'\n a1=@stack.pop\n a2=@stack.pop\n raise SyntaxErrHopError if a2.nil?\n @stack.push a1.to_f*a2.to_f\n when '-'\n a1=@stack.pop\n a2=@stack.pop\n warn \">>MINUS: #{a1},#{a2}\"\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f-a1.to_f\n when '/'\n a1=@stack.pop\n a2=@stack.pop\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f/a1.to_f\n when '%'\n a1=@stack.pop\n a2=@stack.pop\n raise SyntaxErrHopError if a2.nil?\n @stack.push a2.to_f%a1.to_f\n else\n raise SyntaxErrHopError\n end\n end #~case\n end # ~each expression\n raise SyntaxErrHopError.new(@expr.to_s+' ('+@stack.to_s+')') if @stack.size>1\n\n return @stack.pop\n end",
"def push(x)\n @stack << x\n end",
"def evaluate_with_two_stacks(string)\n vals = Stack.new\n ops = Stack.new\n\n string.each_char do |char|\n case char\n when \"(\"\n # do nothing\n when \"+\"\n ops.push(char)\n when \"*\"\n ops.push(char)\n when \")\"\n op = ops.pop\n case op\n when \"+\"\n vals.push(vals.pop + vals.pop)\n when \"*\"\n vals.push(vals.pop * vals.pop)\n end\n else\n vals.push(char.to_i)\n end\n end\n\n vals.pop\nend",
"def pop()\n\t\t@stack.pop\n\tend",
"def eval\n return @value unless @value.nil?\n \n debug \"\\nfor RPN expression: #{expression}\\nTerm\\tAction\\tStack\"\n stack = []\n expression.split.each do |term|\n if Operators.has_key?(term)\n a, b = stack.pop(2)\n raise ArgumentError, \"not enough operands on the stack\" if b.nil?\n a = a.to_f if term == \"/\"\n op = (term == \"^\" ? \"**\" : term)\n stack.push(a.method(op).call(b))\n debug \"#{term}\\t#{Operators[term].english}\\t#{stack}\"\n else\n begin\n number = Integer(term) rescue Float(term)\n rescue ArgumentError\n raise ArgumentError, \"cannot handle term: #{term}\"\n end\n stack.push(number)\n debug \"#{number}\\tPUSH\\t#{stack}\"\n end\n end\n @value = stack.pop\n debug \"Value = #@value\"\n @value\n end",
"def writePushPop(command, seg, index)\n\t\tseg.rstrip!\n\t\tif command == $PUSH\n if seg == \"constant\" \n @file.write(\"@\" + index.to_s + \"\\n\")\n @file.write(\"D=A\\n\")\n push()\n elsif seg == \"argument\"\n locInMem(\"ARG\")\n pfRAM(index)\n elsif seg == \"local\"\n locInMem(\"LCL\")\n pfRAM(index)\n elsif seg == \"this\"\n locInMem(\"THIS\")\n pfRAM(index)\n elsif seg == \"that\"\n locInMem(\"THAT\")\n pfRAM(index)\n elsif seg == \"temp\"\n plMemory(\"5\")\n pfRAM(index)\n elsif seg == \"pointer\"\n plMemory(\"3\")\n pfRAM(index)\n elsif seg == \"static\"\n @file.write(\"@\" + @currentName + \".\" + index.to_s + \"\\n\")\n @file.write(\"D=M\\n\")\n push()\n else\n print(\"ERROR: seg undefined, seg given - \" + seg)\n\t\t\tend\n elsif command == $POP\n if seg == \"argument\"\n locInMem(\"ARG\")\n storeRAM(index)\n elsif seg == \"local\"\n locInMem(\"LCL\")\n storeRAM(index)\n elsif seg == \"this\"\n locInMem(\"THIS\")\n storeRAM(index)\n elsif seg == \"that\"\n locInMem(\"THAT\")\n storeRAM(index)\n elsif seg == \"temp\"\n plMemory(\"5\")\n storeRAM(index)\n elsif seg == \"pointer\"\n plMemory(\"3\")\n storeRAM(index)\n elsif seg == \"static\"\n pop()\n @file.write(\"@\" + @currentName + \".\" + index.to_s + \"\\n\")\n @file.write(\"M=D\\n\")\n else\n print(\"ERROR: seg undefined, seg given - \" + seg)\n\t\t\tend\n\t\tend\n\tend",
"def minilang(command_string)\n command_array = command_string.split\n register = 0\n stack = []\n counter = 0\n until counter > command_array.size do\n if is_string_int?(command_array[counter])\n register = command_array[counter].to_i\n else\n case command_array[counter]\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n end\n end\n counter += 1\n end\nend",
"def push(x)\n @stack.push(x)\n end",
"def plus\n return error_message if stack.empty?\n x = stack.pop\n y = stack.pop\n stack << x + y\n @value = x + y\n end",
"def ropstack_memmove\n ropstack = []\n\n # 0x6003D17B : # XCHG EAX,ECX # RETN \t[Module : ijl15.dll] ** \n ropstack.push(0x6003d17b)\n # 0x763CC3D8 : # XCHG EAX,ESI # RETN \t[Module : comdlg32.dll] ** \n ropstack.push(0x763cc3d8)\n # eax = 128\n ropstack.concat(ropstack_gen_pow2(6))\n # 0x6003D17B : # XCHG EAX,ECX # RETN \t[Module : ijl15.dll] ** \n ropstack.push(0x6003d17b)\n # 0x763CC3D8 : # XCHG EAX,ESI # RETN \t[Module : comdlg32.dll] ** \n ropstack.push(0x763cc3d8)\n\n # 0x10010407 : # ADD EAX,ECX # POP EBP # RETN \t[Module : GCDSRV32.dll] ** \n for i in 1..10\n ropstack.push(0x10010407)\n ropstack.push('JUNK')\n end\n\n # 0x6002B45E : # ADD EAX,8 # RETN \t[Module : ijl15.dll] ** \n ropstack.push(0x6002B45E)\n # 0x1001DDDE : # INC EAX # RETN \t[Module : GCDSRV32.dll] ** \n ropstack.push(0x1001ddde)\n ropstack.push(0x1001ddde)\n ropstack.push(0x1001ddde)\n ropstack.push(0x1001ddde)\n\n # 0x1001C116 : # XCHG EAX,EBP # ADD EAX,5D5B5E10 # RETN \t[Module : GCDSRV32.dll] ** \n ropstack.concat(xchg_eax_ebp())\n\n # restore size\n # 0x763CC3D8 : # XCHG EAX,ESI # RETN \t[Module : comdlg32.dll] ** \n ropstack.push(0x763cc3d8)\n\n # memmove()\n ropstack.push(0x7C873C2B)\n # make room for arguments\n for i in 1..3\n ropstack.push('JUNK')\n end\n # 0x60040DAD : # RETN \t[Module : ijl15.dll] ** \n ropstack.push(0x60040dad) # seip of memmove()\n for i in 1..6\n ropstack.push('JUNK')\n end\n\n return ropstack\n end",
"def evaluate\n stack = Stack.new\n\n tokens.each do |token|\n if numeric?(token)\n stack.push(token.to_i)\n elsif operator?(token)\n args = []\n\n (SYMBOL_TABLE[token].arity - 1).times do\n # This adds the return value of stack.pop to the beginning of the\n # args array\n args.unshift(stack.pop)\n end\n\n # The *args syntax might be unfamiliar. It's called the \"splat\"\n # operator and among other things it lets you turn an array into\n # a list of arguments.\n stack.push(call_operator(stack, token, *args))\n else\n stack.push(token)\n end\n end\n\n stack.pop\n end",
"def evaluate_postfix(postfix_expression)\n operands = Set['+', '-', '*', '/'] # assume only these four operands for now\n stack = Stack.new # track operation results\n\n postfix_expression.each_char do |c| # assume expresion is valid\n if operands.include?(c) # is operand\n b = stack.pop # get second number pushed\n a = stack.pop # pop again for first number pushed\n\n new_top = 0\n\n # calculate new number to push into stack\n new_top += case c\n when '+' \n a + b\n when '-'\n a - b\n when '/'\n a / b\n when '*'\n a * b\n end\n\n stack.push(new_top) # add back to top of stack\n\n else # is number\n stack.push(c.to_i)\n end\n end\n\n return stack.pop\nend",
"def evaluate(postfix)\n stack = Stack.new\n operators = \"+-*/^\"\n for i in 0..postfix.size-1\n if !operators.include?(postfix[i])\n stack.push(postfix[i].to_i)\n else\n case postfix[i]\n when '+'\n value = stack.pop() + stack.pop\n when '-'\n b = stack.pop()\n value = stack.pop() - b\n when '*'\n value = stack.pop() * stack.pop\n when '/'\n b = stack.pop()\n value = stack.pop() / b\n when '^'\n b = stack.pop()\n value = stack.pop ^ b\n end\n stack.push(value)\n end\n end\n stack.pop\nend",
"def stack_eval_infix(string)\n raise \"Bad characters\" if string =~ INVALID_CHARACTERS\n op_stack = LinkedStack.new\n value_stack = LinkedStack.new\n string.chars do | ch |\n case\n when ch =~ /\\d/ || ch == ')'\n if ch == ')'\n raise \"Missing left parenthesis\" if op_stack.empty? || op_stack.top != '('\n op_stack.pop\n else\n value_stack.push(ch.to_i)\n end\n while !op_stack.empty? && op_stack.top =~ OPERATORS\n op = op_stack.pop\n raise \"Missing argument\" if value_stack.empty?\n right_arg = value_stack.pop\n raise \"Missing argument\" if value_stack.empty?\n left_arg = value_stack.pop\n value_stack.push( evaluate(op, left_arg, right_arg) )\n end\n when ch =~ OPERATORS || ch == '('\n op_stack.push(ch)\n end\n end\n raise \"Missing expression\" if value_stack.empty?\n raise \"Too many arguments\" unless value_stack.size == 1\n raise \"Missing argument\" unless op_stack.empty?\n value_stack.pop\nend",
"def unit\n\t\t\tpush [pop]\n\t\tend",
"def op12(interp)\n interp.stack.push(Integer(interp.stack.pop * interp.stack.pop))\n end",
"def pop\n if(@stk.empty?)\n\t p \"Stack empty\"\n\telse\n\t @stk[@count] = nil\n\t @count = @count - 1\n\tend\n end",
"def do_slash s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(b/a); end",
"def writePushPop(command, segment, index)\n assembly_builder = []\n # Push\n if command == 'C_PUSH'\n if segment == 'constant'\n assembly_builder.push(\n \"@#{index}\",\n 'D=A',\n '@SP',\n 'A=M',\n 'M=D',\n '@SP',\n 'M=M+1'\n )\n elsif segment == 'temp'\n assembly_builder.push(\n \"@#{5 + index.to_i}\", # A = 10\n 'D=M', # D = M[10]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 258\n 'M=D', # M[258] = D\n '@SP', # A = 0\n 'M=M+1' # M[0] = 258 + 1\n )\n elsif segment == 'pointer'\n assembly_builder.push(\n \"@#{3 + index.to_i}\", # A = 10\n 'D=M', # D = M[10]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 258\n 'M=D', # M[258] = D\n '@SP', # A = 0\n 'M=M+1' # M[0] = 258 + 1\n )\n elsif segment == 'static'\n assembly_builder.push(\n \"@#{file_name_without_ext}.#{index}\", # A = 10\n 'D=M', # D = M[10]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 258\n 'M=D', # M[258] = D\n '@SP', # A = 0\n 'M=M+1' # M[0] = 258 + 1\n )\n else\n segment_symbol = case segment\n when 'local'\n 'LCL'\n when 'argument'\n 'ARG'\n when 'this'\n 'THIS'\n when 'that'\n 'THAT'\n end\n\n assembly_builder.push(\n \"@#{index}\",\n 'D=A',\n \"@#{segment_symbol}\", # A = THAT = 4\n 'A=M',\n 'A=A+D', # A = 3010 + 5\n 'D=M', # D = M[3015]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 257\n 'M=D', # M[257] = D = M[3015]\n '@SP', # A = 0\n 'M=M+1' # M[0] = 257 + 1\n )\n end\n # Pop\n elsif command == 'C_POP'\n if segment == 'temp'\n assembly_builder.push(\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1\n 'D=M', # D = M[257]\n \"@#{5 + index.to_i}\", # A = 5 + index\n 'M=D'\n )\n elsif segment == 'pointer'\n assembly_builder.push(\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1\n 'D=M', # D = M[257]\n \"@#{3 + index.to_i}\", # A = 5 + index\n 'M=D'\n )\n elsif segment == 'static'\n assembly_builder.push(\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1\n 'D=M', # D = M[257]\n \"@#{file_name_without_ext}.#{index}\", # A = 6 + index\n 'M=D'\n )\n else\n segment_symbol = case segment\n when 'local'\n 'LCL'\n when 'argument'\n 'ARG'\n when 'this'\n 'THIS'\n when 'that'\n 'THAT'\n end\n\n assembly_builder.push(\n # RAM[RAM[SP]] -> RAM[RAM[segment]]\n \"@#{index}\", # A = 3\n 'D=A', # D = 3\n \"@#{segment_symbol}\", # A = 1\n 'D=M+D', # D = M[1] + 3 = 300 + 3\n 'M=D', # M[1] = 303\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1 = 258 -1\n 'D=M', # D = M[257]\n \"@#{segment_symbol}\", # A = 1\n 'A=M', # A = M[1] = 303\n 'M=D', # M[303] = M[257]\n \"@#{index}\", # A = 3\n 'D=A', # D = 3\n \"@#{segment_symbol}\", # A = 1\n 'M=M-D' # M[1] = M[1] - 3 = 303 - 3\n )\n end\n end\n\n return assembly_builder\n end",
"def pop()\n (@stack1.size-1).times { @stack2.push(@stack1.pop) }\n result = @stack1.pop\n @stack2.times { @stack1.push(@stack2.pop) }\n\n result\n end",
"def calculate(operator)\n operands = @memory.stack.pop(2)\n @memory.stack.push(operands.inject(operator))\n end",
"def pop\n if @data == nil\n return @data\n else\n get_value = @data.value\n @data = @data.next_node #give me the value stored in next node\n return get_value #give me the value stored in variable\n end\n end",
"def minilang(input)\n\tstack = Array.new\n\tregister = 0\n\tinput.split.each do |x|\n\t\tcase x\n\t\twhen 'PUSH' then stack.push(register)\n\t\twhen 'ADD' then register += stack.pop\n\t\twhen 'SUB' then register -= stack.pop\n\t\twhen 'MULT' then register *= stack.pop\n\t\twhen 'DIV' then register /= stack.pop\n\t\twhen 'MOD' then register %= stack.pop\n\t\twhen 'POP' then register = stack.pop\n\t\twhen 'PRINT' then p register\n\t\telse\n\t\t\tregister = x.to_i\n\t\tend\n\tend\n\tregister\nend",
"def push(value)\n return \"Stack is full\" if is_full\n\n new_node = Node.new(value)\n\n if is_empty\n @head = new_node\n else\n new_node.next = @head\n @head = new_node\n end\n\n @current_size += 1\n end",
"def push_stack\n bb = {:black => get_black,:white => get_white}\n @stack.push(Marshal.load(Marshal.dump(bb)))\n @stack.shift if @stack.size > @options[:stack_limit]\n end",
"def pop\n # I RETURN A VALUE\n return nil if @top.nil?\n original_top = @top.value\n @top = @top.next_node\n original_top\n end"
] |
[
"0.6116837",
"0.6102596",
"0.59521824",
"0.59485286",
"0.591534",
"0.5882558",
"0.5867398",
"0.5863072",
"0.5847665",
"0.5843689",
"0.5841853",
"0.5830007",
"0.58064175",
"0.5754235",
"0.57235336",
"0.5722366",
"0.572175",
"0.5720563",
"0.5720343",
"0.57072103",
"0.5670372",
"0.5626676",
"0.561335",
"0.56119204",
"0.56035686",
"0.5589259",
"0.55785424",
"0.5569153",
"0.5546489",
"0.552992",
"0.5515021",
"0.5505484",
"0.5498865",
"0.54967785",
"0.5487019",
"0.5480559",
"0.54536885",
"0.5446347",
"0.54147696",
"0.54038405",
"0.5391526",
"0.5391207",
"0.5390751",
"0.538861",
"0.53881687",
"0.53651714",
"0.5344334",
"0.5336473",
"0.5333963",
"0.5316471",
"0.53120184",
"0.53104323",
"0.529395",
"0.529123",
"0.52896076",
"0.52827466",
"0.52664614",
"0.5263729",
"0.5260473",
"0.52598643",
"0.5252546",
"0.52430594",
"0.523656",
"0.523541",
"0.5235088",
"0.5231893",
"0.52220243",
"0.521404",
"0.52113783",
"0.52113783",
"0.5207028",
"0.5206196",
"0.5205041",
"0.5204321",
"0.5203041",
"0.5194001",
"0.51894087",
"0.51850116",
"0.51846033",
"0.5181267",
"0.51799464",
"0.51756805",
"0.51673925",
"0.5148939",
"0.51421064",
"0.51417553",
"0.5138524",
"0.51358813",
"0.5133693",
"0.51312643",
"0.5131231",
"0.5127693",
"0.51242363",
"0.51217395",
"0.51212853",
"0.51200986",
"0.51183236",
"0.51159835",
"0.50999457",
"0.50948745",
"0.5092703"
] |
0.0
|
-1
|
This method should be called to reset dirty information before dump
|
def clear_changes!
remove_instance_variable(:@original_hash) if defined?(@original_hash)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reset_dirty_flag\n\t\t@dirty = false\n\tend",
"def dirty!\n @dirty = true\n end",
"def dirty!\n @dirty = true\n end",
"def dirty!\n @dirty = true\n end",
"def dirty; end",
"def _dump() end",
"def dump!\n @dump = true\n end",
"def restore; end",
"def dump\n do_dump(0)\n end",
"def _dump()\n #This is a stub, used for indexing\n end",
"def dump() end",
"def _dump\n end",
"def prepare_to_dump!\n @call_set = nil\n @store = nil\n @recorder = nil\n @agent_context = nil\n end",
"def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end",
"def restore\n {}\n end",
"def mark_clean\n @dirty = false\n end",
"def mark_dirty\n\t\t@dirty = true\n\tend",
"def restore\n end",
"def dump_pending\n end",
"def dump_pending\n end",
"def wipe_snapshots_data; end",
"def wipe_snapshots_data; end",
"def wipe_snapshots_data\n @snapshots_cycle = 0\n @snapshot_groups = {}\n end",
"def touch\n @saved = false\n end",
"def reset\n @printed = false\n @structs.each(&:reset)\n end",
"def reset\n @config = {}\n write_config\n end",
"def clean_dirty_attributes!\n @dirty_attribute_keys = []\n end",
"def flush\n write_cache if @dirty\n @dirty = false\n end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def save_unknown!\n\t\t @saved = []\n\t end",
"def mark_as_restored\n @restored = true\n end",
"def clear_modified\n @modified = false\n nil\n end",
"def start_dump\n end",
"def start_dump\n end",
"def scrooge_dump_unflag_this\n Thread.current[:scrooge_dumping_objects].delete(object_id)\n end",
"def backup\n snapshot.clear and snapshot.replace(responses.deep_clone)\n end",
"def discard_saved_state\n end",
"def reset\n # TODO\n end",
"def reset()\n \n end",
"def reset\n cleanup(true)\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset\n super\n end",
"def restore!\n restore\n save!(validate: false)\n end",
"def dirty\n data\n end",
"def reset\n Billygen::CodeObjects::BCodeObject.complete_store = {}\n end",
"def structure_dump() end",
"def reset\n # Empty, but subclasses will override this.\n end",
"def reset\n @lists = {}\n @references = {}\n @serialized = {}\n @graphs = {}\n @subjects = {}\n end",
"def refresh\n @deserialized_values = {}\n super\n end",
"def reset() end",
"def reset\n @debug_indent = 0\n @uri_to_term_or_curie = {}\n @uri_to_prefix = {}\n @references = Hash.new{|h,k| h[k] = 0}\n @prefixes = {}\n @serialized = {}\n @subjects = {}\n @ordered_subjects = []\n @titles = {}\n @doc_title = \"\"\n end",
"def restore\r\n self.update(deleted: false)\r\n end",
"def marshall_dump\n end",
"def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end",
"def reset\n end",
"def reset\n end",
"def clean!\n @changes = []\n end",
"def reset ; end",
"def reset\n\t\tend",
"def dirty=(_arg0); end",
"def reset!\n self.colors = {}\n self.texts = {}\n self.ifs = {}\n self.theme_images = []\n self.save\n end",
"def clean!\n @data = freezer(@data.merge(@dirty))\n @dirty.clear\n self\n end",
"def flush\n data = {}\n end",
"def freeze\n @original_deserialized_values ||= {}\n @original_deserialized_values.freeze\n super\n end",
"def clear\n\t\t@data.clear\n\t\t@modified = true\n\tend",
"def reset!\n @committed = 0.0\n @not_committed = 0.0\n end",
"def restore_merge_state; end",
"def restore_merge_state; end",
"def before_dump(value)\n self.value = value if !value.nil?\n if !@block.nil?\n value = @parent.instance_exec( self, :dump, &@block )\n end\n self.value = value if !value.nil?\n end",
"def flush()\n #This is a stub, used for indexing\n end",
"def reset_log_data\n without_logging { update_all(log_data: nil) }\n end",
"def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end",
"def flush\n @property_hash.clear\n end",
"def flush\n @property_hash.clear\n end",
"def flush\n @property_hash.clear\n end",
"def _dump\n self.contents\n end",
"def flush # :nodoc:\n end",
"def reset\n @data = nil\n end",
"def mark_modified\n @modified = true\n nil\n end",
"def flush\n File.open(\"data/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n File.open(\"data2/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n puts \"=\"\n end",
"def save_self(safe = true)\n super && embedments.values.each do |e|\n e.loaded?(self) && Array(e.get!(self)).each { |r| r.original_attributes.clear }\n end\n end",
"def cleanup_dump\n redis.hdel(DUMP_REDIS_KEY, self.name)\n end",
"def dump_mode!\n @_dump_mode = !!!@_dump_mode\n end"
] |
[
"0.70948994",
"0.70257753",
"0.70257753",
"0.7000007",
"0.6939666",
"0.6887448",
"0.68706995",
"0.68345654",
"0.6794764",
"0.67717564",
"0.65945256",
"0.65343106",
"0.6477704",
"0.6464261",
"0.6459617",
"0.6453976",
"0.6423587",
"0.6374783",
"0.63198507",
"0.63198507",
"0.62894315",
"0.62894315",
"0.62180233",
"0.6212069",
"0.6211666",
"0.6209191",
"0.614565",
"0.61410165",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6135053",
"0.6118126",
"0.6115804",
"0.61129653",
"0.6066842",
"0.6066842",
"0.6054459",
"0.6052917",
"0.60311586",
"0.6021848",
"0.6021392",
"0.6016918",
"0.6012475",
"0.6012475",
"0.60050553",
"0.60035133",
"0.6002586",
"0.5995485",
"0.59821653",
"0.59751743",
"0.5973951",
"0.5969878",
"0.59691554",
"0.5963796",
"0.59352356",
"0.5933518",
"0.5918435",
"0.5899217",
"0.5899217",
"0.5882991",
"0.5873282",
"0.5862843",
"0.58535296",
"0.5844802",
"0.58411574",
"0.58397055",
"0.5837792",
"0.58332247",
"0.5832253",
"0.5830729",
"0.5830729",
"0.58294326",
"0.5823914",
"0.5820599",
"0.58171374",
"0.5810965",
"0.5810965",
"0.5810965",
"0.58052427",
"0.57990706",
"0.57961404",
"0.5795495",
"0.57934314",
"0.5790149",
"0.578972",
"0.5789393"
] |
0.0
|
-1
|
Show the details of one place
|
def show
@place = Place.find_by(:id=> params["id"])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @place = Place.find(params[:id])\n end",
"def show_place_detail(params, options = {})\n query_str = params[:text]\n query_str = query_str.match(/「(.*)」の情報/)\n query_str = query_str[1]\n res = get_place_info(query_str)\n place_info = JSON.load(res.body)\n if place_info[\"status\"] != \"OK\"\n return {text: \"結果が取得できませんでした\"}.merge(options).to_json\n end\n photo_ref = get_photo_ref(place_info)\n\n res = get_place_id(place_info)\n res = get_place_detail(res)\n place_detail = JSON.load(res.body)\n\n res = extract_data_from_json(place_detail)\n photo = get_place_photo(photo_ref)\n p photo = photo.body # html\n photo = extract_photo_url(photo)\n\n user_name = params[:user_name] ? \"<@#{params[:user_name]}>\" : \"\"\n res_text = \"#{user_name} \\n【 *#{res[\"name\"]}* 】 #{res[\"open_status\"]} \\n*価格帯*:moneybag:: #{res[\"price_level\"]} *評価*:star:: #{res[\"rating\"]}/5 *URL*:computer:: #{res[\"website\"]} \\n*レビュー*:information_desk_person:: \\n#{res[\"latest_review\"]} \\n#{photo}\"\n\n return {text: res_text}.merge(options).to_json\n end",
"def more_info\n temp_place = white_listed_params[:place]\n @place = Place.find_by(id: temp_place)\n\n end",
"def show\n respond_with @place, status: :ok, location: places_path(@place)\n end",
"def show\n render json: @place\n end",
"def show\n gon.place = @place\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n @places = @client.places.page params[:place_page]\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def show\n @dataele_place = DataelePlace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataele_place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n #debugger\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n @place = @event.places.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def info\n @historic_place = HistoricPlace.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { render :xml => @historic_place }\n format.json { render :json => @historic_place }\n end\n end",
"def show\n @place = Place.find(params[:id])\n render json: @place\n end",
"def show\n if params[:distancia]\n distancia = params[:distancia]\n else\n distancia = 100\n end\n url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@place.latitude},#{@place.longitude}&radius=#{distancia}&type=#{params[:tipo]}&key=#{Rails.application.secrets.google_places_key}\"\n uri = URI(url)\n http_call = Net::HTTP.get(uri)\n response = JSON.parse(http_call, {:symbolize_names => true})\n @locations = response[:results]\n @hash = Gmaps4rails.build_markers(@place) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow place[:name]\n end\n end",
"def show\n place = Place.find(params[:id])\n\n render json: place\n end",
"def place_details(place_id:, language: nil)\n params = {'placeid' => place_id }\n if language\n params['language'] = language\n end\n\n self.client.request(url: \"/maps/api/place/details/#{self.client.response_format}\", params: params)\n end",
"def show\n @place = Place.find(params[:id])\n respond_with(@place)\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @place }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place.to_xml(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n format.json { render :json => @place.to_json(:only => [:name, :vicinity, :type_poi, :lat, :lon, :thumbnail, :address, :phoneNumber, :description]) }\n end\n end",
"def show\n @location = Location.find(params[:id])\n @pagetitle = \"Locations - #{@location.name}\"\n end",
"def show\n @id = params[:id] \n if (Place.exists?(@id)) \n @place = Place.find(@id) \n else \n redirect_to \"/\" \n end \n end",
"def show\n render json: @place\n end",
"def show\n\t@meta[:title] = \"DondeVoyAComer.com | Detalles del local de comida\"\n @place = Place.find(params[:id])\n\t@review = Review.new\n\t@review.place_id = @place.id\n\t@review.owner_user_id = current_user.id if !current_user.nil?\n\n\t\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def show\n\t\t@place = Place.find_by(:id => params[\"id\"])\n\t\t@reviews = Review.where(:place_id => params[\"id\"]).order(id: :desc)\n\n\t\tif @place != nil\n\t\t\trender \"show\"\n\t\telse\n\t\t\tredirect_to \"/\", notice: \"Place not found in this app!\"\n\t\tend\n\tend",
"def show\n @travel_place = TravelPlace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @travel_place }\n end\n end",
"def show\n # binding.pry\n @place = Place.find(params[:id])\n @place_json = Place.find(params[:id]).as_json({ :properties => :all })\n @json = Place.find(params[:id]).to_gmaps4rails\n @comments = @place.comments\n @rates = @place.rates\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:place_info => @place_json, :comments => @comments, :rating => @place.average_rating} }\n end\n end",
"def show \n @place = Place.find(params[:id]) \n render json: {status:'SUCCESS',message:'Louded place',data:@place},status: :ok\n\n\n end",
"def show\n @place = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def show\n puts \"\n ID: #{id}\n Last Name: #{last_name}\n First Name: #{first_name}\n Address: #{address}\n City: #{city}\n State: #{state}\"\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n format.plist { render plist: @place }\n end\n end",
"def show\n @place = @site.places.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => 'mobile'}\n end\n end",
"def show\n @location = Location.find(params[:id])\n @page_title = @location.name\n end",
"def show\n @place = Place.find(params[:id])\n @locals = Local.all\n @ticket_type_groups = TicketTypeGroup.order(:value)\n @statuses = Status.order(:value)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @place }\n end\n end",
"def place\n if !@place.nil?\n \tPlace.find(@place.to_s)\n end\n end",
"def details\n\n end",
"def show\n @places = Place.all\n @hash = Gmaps4rails.build_markers(@places) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow render_to_string(:partial => \"places/infowindow\", :locals => { :place => place})\n\n end\n client = Instagram.client(:access_token => session[:access_token])\n @results = client.media_search(@place.latitude, @place.longitude, :distance => 11)\n \n end",
"def show\n @placemark = Placemark.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @placemark }\n end\n end",
"def show\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n redirect_to(:action=>'index')\n #sess = Patron::Session.new\n # sess.base_url = \"https://maps.googleapis.com/\"\n # res = sess.get \"maps/api/place/textsearch/json?query=#{params[:text]}&sensor=true&key=AIzaSyAXRfKe3awvT9mFVx5J2ppYaMeWZ3KMkc4\"\n # value = res.body\n #@place= JSON.parse(value)[\"results\"] \n #render :layout=>false \n\n\n end",
"def show\n @place = Place.find(params[:id])\n @comment = Comment.new(place_id: @place.id)\n @json = Place.find(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @place }\n end\n end",
"def details\n end",
"def show\n render json: @place_visit\n end",
"def show \n coach = Coach.find_by(id: params[:id])\n @details = coach.details\n render :show\n end",
"def show\n @details = current_custom.details\n end",
"def show\n @place = Place.find(params[:id])\n @comment = Comment.new\n @photo = Photo.new\n end",
"def show\n authorize @place\n end",
"def show\n @curpg = :admintools\n @location = Location.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def get_place_detail(place_id)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_DETAILS)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n place_id: place_id,\n key: google_places_api_key\n })\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end",
"def show\n @maps = MapsService.new\n @listing.depart_maps_id = @maps.get_address(@listing.depart_maps_id)\n @listing.dest_maps_id = @maps.get_address(@listing.dest_maps_id)\n end",
"def show\n @apartment.update_visits_count\n @comment = Comment.new\n @hash = Gmaps4rails.build_markers(@apartment) do |apartment, marker|\n marker.lat apartment.latitude\n marker.lng apartment.longitude\n end\n end",
"def display_details()\n puts \"Customer id is #{@id} \"\n puts \"Customer name is #{@name} \"\n puts \"Customer address is #{@address} \"\n end",
"def show_location\n\n end",
"def show\n @location = Location.find(params[:id])\n end",
"def show\n @location = Location.find(params[:id])\n end",
"def show\n @location = Location.find(params[:id])\n end",
"def show\n @location = Location.find(params[:id])\n end",
"def show\n @mapURL = map_url(@location.address)\n render :show\n end",
"def show\n gon.datas = {}\n #gon.info_templates = []\n #gon.houses = []\n House.order('created_at desc').limit(3).each do |h|\n gon.datas[h.address] = h.to_json#{ id: \"#{h.id}\", price: \"#{h.price}\" }\n #gon.info_templates << content_tag(:div, \"#{h.price}\", id: \"house#{h.id}\")\n end\n @comments = @house.comments.recent#.page params[:page]\n @new_comment = @house.comments.new\n #render layout: \"house_panel\"\n end",
"def show_information(name)\n id = self.search_for(name).first[\"id\"]\n url = @base_url\n url += \"/show/\" + id.to_s\n @client.query(url)\n end",
"def show_details\n print @name.upcase + \": #{@name} has #{@moons} moons and a diameter of #{@diameter} miles.\"\n print \"It is #{@color} in color and associated with the #{@zodiac} zodiac sign.\"\n puts \"#{@name} is #{@distance} miles from the sun and has a solar rotation of #{@rotation} earth days!\"\n end",
"def show\n @loc = Loc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loc }\n end\n end",
"def show\n begin\n \n @location = Location.find(params[:id])\n @person = @location.person\n @nodes = Node.find(:all, :conditions => [\"location_id=?\", params[:id]] )\n @nets = Nets.find(:all, :conditions => [\"location_id=?\", params[:id]] )\n @googlemap = 'https://karte.graz.funkfeuer.at/?'\n @googlemap += \"lng=#{@location.lon}\"\n @googlemap += \"&lat=#{@location.lat}\"\n @googlemap += \"&res=17\"\n @googlemap += \"&marker=all\"\n\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Error, Location with ID #{params[:id]} not found!\"\n redirect_to :action => 'list'\n end\n end",
"def new\n @place = Place.new\n \n render_standard :data => @place\n end",
"def show\n render :partial => 'show', :object => @address\n end",
"def show\n redirect_to(root_url) unless current_user.id == @place.user.id\n\n @user = current_user\n @place = Place.find(params[:id])\n @comments = Comment.where(place_id: @place).order(\"created_at DESC\")\n end",
"def show\n # @location_array = Accuweather.city_search(name: 'vancouver')\n # @vancouver = location_array.first\n end",
"def show\n @position = Position.find_by_id(@exceller.position_id)\n @recommended_for = Position.find_by_id(@exceller.recommended_for_id)\n @employment_type = EmploymentType.find_by_id(@exceller.employment_type_id)\n @duty_station = DutyStation.find_by_id(@exceller.duty_station_id)\n @address = Address.find_by_id(@exceller.address_id)\n end",
"def show\n @address = Address.find(params[:id])\n end",
"def show\n @address = Address.find(params[:id])\n end",
"def show\n @panel = Panel.find(params[:id])\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel }\n end\n end",
"def show\n #Look up place\n @place = Place.find(params[:id])\n #Lets add new comment\n @comment = Comment.new\n #Lets add new photo\n @photo = Photo.new\n end",
"def get_details\n location = MapTopic::Location.find(params[:id])\n return render_json_dump serialize_data(location, MapTopic::LocationDetailedSerializer, root: false)\n end",
"def show\n slug = params[:id]\n @location = Location.find_by_slug(slug)\n\n unless @location\n slug_redirect = SlugRedirect.find_by_slug(slug)\n\n if slug_redirect\n redirect_to location_path(slug_redirect.location.slug), :status => :moved_permanently and return\n end\n\n raise ActiveRecord::RecordNotFound.new(\"No such club: #{params[:id]}\")\n end\n\n respond_to do |format|\n format.html do\n @title = @location.name\n\n @map = create_map(@location)\n\n pushpin_for_club(@location, :show_info_window => true) if @map\n end\n format.xml { render :xml => @location }\n end\n end",
"def show\n # FIXME really this should be the other way around: 'Bank of America' and\n # 'Americard Points' should be 2 separate columns which we join, not split,\n # in the view\n name.sub(/\\s+\\(.*\\)\\s*/, '')\n end",
"def display_details()\n puts \"Customer id #@cust_id\"\n puts \"Customer name #@cust_name\"\n puts \"Customer address #@cust_addr\"\n end",
"def show\n @location = Location.find(params[:id]) \n end",
"def show\n @stid = @day_road_listid.station\n @stname = Station.find(@stid)\n @stn = @stname.name\n end",
"def place\n Place.find(@place) if !@place.nil?\n end",
"def show\n @admin_route = Admin::Route.find(params[:id])\n\t\t@route_markers = @admin_route.route_markers\n\t\t@markers = @admin_route.route_markers.to_gmaps4rails do |object, marker|\n\t\t\tmarker.infowindow \"<h4>#{object.name}</h4><p>#{object.city}#{' - ' unless object.quarter.blank?}#{object.quarter}</p>\"\n\t\t\t#marker.picture({:picture => view_context.image_path(\"shared/#{object.kind.parameterize}.png\"), :width => 40, :height => 40})\n\t\t\tmarker.title object.name\n\t\t\tmarker.json({:id => \"#{object.id}\"})\n\t\tend\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_route }\n end\n end",
"def display_details()\n puts \"Customer name: #@cust_name\"\n puts \"Customer ID: #@cust_id\"\n puts \"Customer address: #@cust_addr\"\n end",
"def show_info\n @planets.each do |planet|\n planet.show_details\n end\n end",
"def show\n @members = @plan.users\n @place = Place.new\n @place.pins.build\n @places = @plan.places.order(:route)\n\n i = 1\n @hash = Gmaps4rails.build_markers(@places) do |place, marker|\n marker.lat place.latitude\n marker.lng place.longitude\n marker.infowindow \"場所:#{place.address}<br>希望者:#{place.user.name}<br>\n 行きたい度:#{place.show_star}<br>コメント:#{place.pins[0].comment}\"\n marker.picture({\n :url => \"/#{i}.png\",\n #:url => \"https://graph.facebook.com/#{place.user.uid}/picture?width=32&height=32\",\n :width => \"28.00000000001\",\n :height => \"21.00000000001\"\n })\n marker.json({title: place.address})\n i = i + 1\n end\n\n @point = []\n @hash.each do |hash|\n temp= []\n temp.push(hash[:lat])\n temp.push(hash[:lng])\n @point.push(temp)\n end\n\n if @members.ids.include?(current_user.id)\n render \"show\"\n else\n render \"plan_reference\"\n end\n\n end",
"def info\n\t\t\"#{name}, #{location}\"\n\tend",
"def edit\n@place = Place.find(params[:id])\nend",
"def info_content\n\n info = []\n info << \"<b>\" + @place[:title].escape_html + \"</b>\"\n unless $params.election_description.empty?\n info << \"<i>\" + $params.election_description.escape_html + \"</i>\"\n info << \"\"\n end\n\n a = \"#{@place[:name]}, #{@place[:street]}, #{@place[:city]}, #{@place[:state]} #{@place[:zip]}\"\n info << \"<a href=\\\"http://maps.google.com/?daddr=#{a.escape_uri}\\\" target=\\\"_blank\\\">#{@place[:name].escape_html}</a>\"\n info << @place[:street].escape_html\n info << \"#{@place[:city]}, #{@place[:state]} #{@place[:zip]}\".escape_html\n info << \"\"\n info << \"Hours of operation:\"\n info += @place[:schedule_formatted].escape_html.split(\"\\n\").map {|s| \"\\u2022 \" + s}\n unless @place[:notes].empty?\n info << \"\"\n info << @place[:notes].escape_html\n end\n unless $params.election_info.empty?\n info << \"\"\n info << $params.election_info\n end\n info.join(\"\\n\")\n end",
"def show\n find_location\n #@images = @location.images.showable.published.find(:all, {:order => 'is_main_image DESC'})\n #@images = @location.images.showable.find(:all, {:order => 'is_main_image DESC'})\n \n @locations_close_to_this = locations_close_to_this(@location)\n\n if gl = @location.geo_location\n @map_locations = [\n {:lat => gl.lat, :lng => gl.lng}, \n {\n :lat => gl.lat, :lng => gl.lng, :title => @location.name,\n :icon => {\n :url => \"http://#{@frontend_config['DOMAIN']['FULL_NAME']}\" + self.class.helpers.path_to_image('gmaps_marker.png'), \n :scaled_size => 'new google.maps.Size(32,32)'\n }\n }\n ]\n end\n \n @page_header_tags_configurator.set_location(@location)\n \n get_review_template_with_questions(@location)\n end",
"def show\n\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end",
"def show\n end"
] |
[
"0.79349697",
"0.75223684",
"0.75033444",
"0.7499598",
"0.74456936",
"0.74244684",
"0.734506",
"0.734506",
"0.734506",
"0.7254699",
"0.7235666",
"0.7235666",
"0.7235666",
"0.7235666",
"0.7235666",
"0.72238415",
"0.7218615",
"0.72095394",
"0.7178379",
"0.7168021",
"0.7164558",
"0.71293235",
"0.71074104",
"0.7087746",
"0.70733094",
"0.7055547",
"0.700418",
"0.6993571",
"0.69915164",
"0.6984285",
"0.69841385",
"0.6952069",
"0.69423085",
"0.69297904",
"0.69108105",
"0.6910447",
"0.682732",
"0.6823115",
"0.6817117",
"0.68066406",
"0.6782556",
"0.67638624",
"0.6746732",
"0.66962683",
"0.66819066",
"0.66668427",
"0.6648104",
"0.6643023",
"0.6639438",
"0.66189593",
"0.6595872",
"0.6593458",
"0.6590931",
"0.65542847",
"0.6552317",
"0.6551244",
"0.6530378",
"0.6527372",
"0.6496603",
"0.6468247",
"0.6468247",
"0.6468247",
"0.6468247",
"0.64671636",
"0.6466982",
"0.64625704",
"0.64515924",
"0.6442782",
"0.6442386",
"0.64372355",
"0.64358044",
"0.6434621",
"0.64336884",
"0.64266884",
"0.6419962",
"0.6419962",
"0.6416235",
"0.6415683",
"0.64120173",
"0.6407105",
"0.64066863",
"0.6406466",
"0.6396735",
"0.6392834",
"0.6379265",
"0.6371919",
"0.6371843",
"0.6366462",
"0.6346311",
"0.63458735",
"0.6345535",
"0.6338379",
"0.63375133",
"0.6327655",
"0.63108945",
"0.63108945",
"0.63108945",
"0.63108945",
"0.63108945",
"0.63108945"
] |
0.766379
|
1
|
Delete a place from the database
|
def delete
@place = Place.find_by(:id => params["id"]) # Find out what link has been clicked
@place.delete # Delete the item which has been clicked
redirect_to root_url # Show home page to verify that the place has been deleted
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @place.destroy\n \n \n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n redirect_to places_path\n end",
"def destroy\n @place.destroy\n head :no_content\n end",
"def delete\n\t\t@place = Place.find_by(:id => params[\"id\"])\n\n\t\tif @place != nil\n\t\t\ttitle = @place.title\n\t\t\t@place.delete\n\t\t\tredirect_to \"/\", notice: title + \" was deleted!\"\n\t\telse\n\t\t\tredirect_to \"/\", notice: \"Place not found in this app!\"\n\t\tend\n\tend",
"def delete\n CONNECTION.execute(\"DELETE FROM locations WHERE id = #{self.id};\")\n end",
"def destroy\n place = Place.find(params[:id])\n place.destroy\n\n head :no_content\n end",
"def destroy\n @place.destroy\n redirect_to places_url, notice: \"Place was successfully destroyed.\"\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @parking_place.destroy\n end",
"def destroy\n Log.logit!(:places, :notice, \"User deleted place \" + @place.name, {:user_id => @current_user.id, :place_id => @place.id})\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n @place.destroy\n respond_to do |format|\n format.html { redirect_to admin_places_url, notice: t('messages.deleted', model:Place.model_name.human) }\n format.json { head :no_content }\n end\n rescue ActiveRecord::InvalidForeignKey => e\n flash[:error] = t 'errors.messages.delete_fail.being_used', model:@place.name\n flash[:error_details] = e\n redirect_to [:admin, @place]\n rescue ActiveRecord::StatementInvalid => e\n flash[:error] = t 'errors.messages.ops'\n flash[:error_details] = e\n redirect_to [:admin, @place]\n end\n end",
"def destroy\n # find the record the user wants to delete\n @place = Place.find(params[:id])\n # Only user who created place can delete\n if @place.user != current_user\n return render text: 'Not Allowed, Human Scum', status: :forbidden\n end\n # Delete the record\n @place.destroy\n # Redirect user to homepage\n redirect_to root_path\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_vi_place.destroy\n end",
"def delete_google_place_id(name, place_id)\n update_google_place_id(name, from_place_id: place_id, to_place_id: nil)\n end",
"def destroy\n @dataele_place = DataelePlace.find(params[:id])\n @dataele_place.destroy\n\n respond_to do |format|\n format.html { redirect_to dataele_places_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @place.destroy\n \n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n \n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n # delete the place and its evaluations\n @place.destroy\n # delete the summaries for this place\n PlaceSummary.where(:place_id => params[:id]).destroy_all\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: \"Place was successfully destroyed.\" }\n end\n end",
"def delete(id_to_delete)\n DATABASE.execute(\"DELETE FROM locations WHERE id = '#{id_to_delete}'\")\n end",
"def destroy\n @place_visit.destroy\n\n head :no_content\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to partner_places_path, notice: 'Le lieu a été supprimé.' }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @place = @site.places.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to site_places_url(@site) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = @event.places.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_places_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @place.destroy\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Delete failed.\"]}\n end\n end",
"def destroy\n @travel_place = TravelPlace.find(params[:id])\n @travel_place.destroy\n\n respond_to do |format|\n format.html { redirect_to(travel_places_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to cms_places_path, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @place\n @place.destroy\n respond_to do |format|\n format.html { redirect_to admin_places_path, notice: 'Place was successfully destroyed.' }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.status = Status.active\n @place.save\n respond_to do |format|\n format.html { redirect_to(places_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n # DELETE\n # TODO: removes a specific restaurant\n DB.execute(\"DELETE FROM restaurants WHERE id = #{@id}\")\n nil\n end",
"def destroy\n begin\n @place = Place.find_by_id(params[:id])\n @placename = @place.placename\n if Place.find_by_id(params[:id]).nil?\n render json: { error: \"The place was not found. Did wou provide the correct id?\" }, status: :not_found\n else\n \n @location = Location.find(@place.location_id) if Location.exists?(id: @place.location_id)\n @location_places = Place.where(location_id: @place.location_id)\n \n unless @location_places.nil? || @location.nil?\n # Destroy location only if the place was the \"only\" place associated with the resource.\n @location.destroy if @location_places.count <= 1\n end\n @place.destroy\n render json: { success: \"#{@placename} är raderad\"}, status: :accepted\n end\n rescue\n render json: { error: \"Something went wrong, the place do not exist. Did you provide the right id?\" }, status: :bad_request\n end\n end",
"def destroy\n @cat_place.destroy\n respond_to do |format|\n format.html { redirect_to admin_cat_places_path, notice: 'Cat place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n @place.comments.delete_all\n @place.rates.delete_all\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end",
"def destroy\n @admin_place.destroy\n respond_to do |format|\n format.html { redirect_to admin_places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @edit_schedule_place.destroy\n respond_to do |format|\n format.html { redirect_to schedule_places_url, notice: 'Schedule place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to places_url } #, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tourist_place.destroy\n respond_to do |format|\n format.html { redirect_to tourist_places_url, notice: 'Tourist place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html do\n redirect_to places_url, notice: 'Place was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def db_deleter(database, id)\n database.execute(\"DELETE FROM wine_cellar where id=#{id}\")\nend",
"def delete\n\n DB.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end",
"def destroy\n @place_been.destroy\n respond_to do |format|\n format.html { redirect_to place_beens_url, notice: 'Place been was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_entry(db, id)\r\n\tdb.execute(\"DELETE FROM games WHERE id=?\", id)\r\n\tputs \"Entry deleted.\"\r\nend",
"def destroy\n @user_place.destroy\n respond_to do |format|\n format.html { redirect_to user_places_url, notice: 'User place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n DATABASE.execute(\"DELETE from students WHERE id = #{id}\")\n end",
"def destroy\n @planned_place.destroy\n respond_to do |format|\n format.html { redirect_to planned_places_url, notice: 'Planned place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # if the place was unapproved, add it to our import blacklist\n unless @place.approved?\n Blacklist.create(fb_id: @place.fb_id, name: @place.name)\n end\n\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end",
"def delete\n DATABASE.execute(\"DELETE FROM students WHERE id = #{@id}\")\n end",
"def destroy\n @restaurant_place.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_places_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place.destroy\n respond_to do |format|\n format.html { redirect_to new_place_url, notice: 'Country was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house.destroy\n end",
"def destroy\n @visited_place.destroy\n respond_to do |format|\n format.html { redirect_to visited_places_url, notice: 'Visited place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n\n db = PG.connect({dbname: \"pizza_shop\", host: \"localhost\"})\n sql = \"DELETE FROM pizza_orders WHERE id = $1\"\n values = [@id]\n db.prepare(\"Delete\", sql)\n db.exec_prepared(\"Delete\", values)\n db.close\n\n end",
"def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end",
"def delete_loc_time\n delete_loc = user_choice_of_object_in_class(LocationTime)\n try_to_update_database{\n if LocationTime.delete_record(delete_loc.location_id, delete_loc.timeslot_id)\n puts \"Deleted.\"\n else\n puts \"Not deleted. This object id exists in another table.\"\n end\n }\n loc_time_menu\n end",
"def delete_listing(db, id)\n\tdb.execute(\"DELETE FROM cars WHERE id=?\", [id])\nend",
"def remove_place(*place)\n reset_places\n unless place.blank?\n what.query[:places] && what.query[:places] >> place.flatten\n changed\n end\n end",
"def delete\n @address = Address.find(params[:address_id])\n end",
"def destroy\n @parking_place.destroy\n respond_to do |format|\n format.html { redirect_to parking_places_url, notice: 'Parking place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_utility_place.destroy\n respond_to do |format|\n format.html { redirect_to session['previous_url'] || admin_utility_places_url, notice: \"#{@place_types[@place_type.to_sym]} cancellata con successo!.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete object from the DB\n # DB.execute(\"DELETE .....\")\n end",
"def destroy\n @truck = Truck.find(@time_and_place.truck_id)\n @time_and_place.destroy\n respond_to do |format|\n format.html { redirect_to @truck, notice: 'Location was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Venue.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to venues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @place = Place.find(params[:id])\n if @place.user != current_user\n return render text: 'Not Allowed', status: :forbidden\n end\n\n @place.destroy\n redirect_to root_path\n end",
"def destroy\n Post.destroy(@place.post_ids)\n render json: @place.destroy\n end",
"def delete_saved_game(game_id)\n @db.query(\"DELETE FROM SavedGames WHERE GameID = #{game_id};\")\n end",
"def delete_make(db, id)\n db.execute(\"DELETE FROM makes WHERE id=?\", [id])\nend",
"def delete_plant_row(delete_name)\n CONNECTION.execute(\"DELETE FROM backyard WHERE name = '#{delete_name}';\")\nend",
"def delete\n \n end",
"def destroy\n @availability_parking_place.destroy\n respond_to do |format|\n format.html { redirect_to availability_parking_places_url, notice: 'Availability parking place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # expire_page :action => :index\n @place = Place.find(params[:id])\n @place.destroy\n respond_with(@place)\n end",
"def delete()\n db = PG.connect({ dbname: 'Music_Collection', host: 'localhost'})\n sql = \n \"\n DELETE FROM Music_Collection where id = #{@id};\n \"\n db.exec(sql)\n db.close()\nend",
"def delete\n end",
"def destroy; delete end",
"def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend",
"def delete\n FC::DB.query(\"DELETE FROM #{self.class.table_name} WHERE id=#{@id.to_i}\") if @id\n end",
"def destroy\n @parking_place.destroy\n respond_to do |format|\n format.html { redirect_to @parking_place.parking, notice: t(:parking_place_destroyed) }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @user= User.find(current_user.id)\n redirect_to(root_url) unless current_user.id == @place.user.id\n\n @place.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city.destroy\n end",
"def delete!\n deleted\n save!\n end",
"def destroy\n @join_region_to_place.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_place_path(@place), notice: 'La région a été retirée.' }\n format.json { head :no_content }\n end\n end",
"def delete\n table = self.class.to_s.pluralize.underscore\n\n DATABASE.execute(\"DELETE FROM #{table} WHERE id = #{@id};\")\n end"
] |
[
"0.7879893",
"0.77100843",
"0.7655565",
"0.75244796",
"0.7475509",
"0.744981",
"0.74018425",
"0.7312178",
"0.72758377",
"0.7233697",
"0.71646184",
"0.71539354",
"0.70906746",
"0.70906746",
"0.70906746",
"0.70906746",
"0.70906746",
"0.70906746",
"0.70906746",
"0.707276",
"0.70609474",
"0.7043007",
"0.7027163",
"0.70230025",
"0.70230025",
"0.70230025",
"0.70230025",
"0.70230025",
"0.7013893",
"0.69936955",
"0.6979436",
"0.69648546",
"0.6958938",
"0.69113207",
"0.68978804",
"0.6890925",
"0.68887067",
"0.6816294",
"0.68151826",
"0.6809456",
"0.6799651",
"0.67865753",
"0.677395",
"0.6771486",
"0.6766543",
"0.6759662",
"0.6759662",
"0.6759662",
"0.6759662",
"0.6759662",
"0.6755472",
"0.6715176",
"0.6678009",
"0.6652993",
"0.664189",
"0.6628587",
"0.6569766",
"0.6565673",
"0.6557349",
"0.6528769",
"0.651142",
"0.65002453",
"0.6498332",
"0.64962673",
"0.6492103",
"0.6491268",
"0.6490626",
"0.6471454",
"0.6465249",
"0.6462451",
"0.64600396",
"0.64406323",
"0.64380133",
"0.64375865",
"0.64254826",
"0.6424025",
"0.64219844",
"0.64206916",
"0.6420285",
"0.64092505",
"0.6396573",
"0.63826877",
"0.63797355",
"0.63789725",
"0.63711995",
"0.63616306",
"0.63588643",
"0.6355238",
"0.6331174",
"0.6318185",
"0.6316617",
"0.63091165",
"0.6304773",
"0.63030666",
"0.6302629",
"0.629426",
"0.62938535",
"0.6293411",
"0.6281509",
"0.627304"
] |
0.7719449
|
1
|
Create a new place along with its description
|
def new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new_place\n @place = Place.new\n @category = get_lookup_values(\"Place_Type\")\n end",
"def new\n @place = Place.new\n end",
"def new\n \t@place = Place.new\n end",
"def place\n Place.new(place_name, organisation_name)\n end",
"def new_city_workplace \n new_city_workplace = Workplace.create(city_id: self.id, name: \"#{self.name} Workplace\", description: \"Main workplace for the City of #{self.name}. This private workplace is automatically provided for #{self.name} and for city officials to collaborate within it.\", is_citys: true)\n puts \"New City Workplace was created: #{new_city_workplace.inspect}\"\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(admin_place_path(@place), :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @place = Place.new\n end",
"def new\n @place = Place.new\n end",
"def create\n\t\tp = Place.new\n\t\tp.title = params['title']\n\t\tp.photo_url = params['photo_url']\n\t\tp.admission_price = params['admission_price']\n\t\tp.description = params['description']\n\t\tp.save\n\t\tredirect_to \"/\"\n\tend",
"def create_placement(tower_class)\n @placed_tower = Model::Placement.new(tower_class)\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\", :layout=>false }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\t@place.active = true\n\n respond_to do |format|\n if @place.save\n\t\tcurrent_user.points += APP_CONFIG['new_place']\n\t\tcurrent_user.save\n\n\t\tact = Action.new({:owner_user_id => current_user.id, :code => :new_place})\n\t\tact.set_attributes({:place => @place})\n\t\tact.save\n\n\n format.html { redirect_to(@place, :notice => 'El local fue creado correctamente!') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = @event.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to([@event,@place], :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(place_params)\n if @place.save\n redirect_to @place, notice: \"Place was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n @place = Place.new(place_params.except(:location))\n @place.creator_id = @current_creator.id\n \n # Create a new location or use an existing location\n if !place_params[:location] || place_params[:location].nil?\n render json: { error: \"The location was not provided\"}, status: :bad_request\n else\n get_location\n @place.location = @location\n \n #Save the place\n if @place.save\n render json: serialize_place(@place), status: :created\n else\n render json: { error: \"Something went wrong, the place could not be saved\" }, status: :bad_request\n end\n end \n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n place = Place.new(params[:place])\n\n if place.save\n render json: place, status: :created, location: place\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end",
"def create\n super\n show(PLACEMENT_SCREEN)\n end",
"def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\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 @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\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 @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\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 @cat_place = CatPlace.new cat_place_params\n\n respond_to do |format|\n if @cat_place.save\n format.html { redirect_to [\"admin\", @cat_place], notice: 'Cat place was successfully created.' }\n format.json { render :show, status: :created, location: @cat_place }\n else\n format.html { render :new }\n format.json { render json: @cat_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n super\n show(PLACEMENT_SCREEN)\n end",
"def create\n @place = Place.new(place_params)\n respond_to do |format|\n if @place.save\n format.html { redirect_to [:admin, @place], notice: t('messages.created', model:Place.model_name.human) }\n format.json { render action: 'show', status: :created, location: @place }\n else\n format.html { render action: 'new' }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(place_params)\n\n \n @place.save\n \n \n \n end",
"def create\n @admin_place = Admin::Place.new(admin_place_params)\n\n respond_to do |format|\n if @admin_place.save\n format.html { redirect_to @admin_place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @admin_place }\n else\n format.html { render :new }\n format.json { render json: @admin_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n add_missing_translation_content(@place.place_translations)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to place_path(@place), notice: t('app.msgs.success_created', :obj => t('activerecord.models.place')) }\n format.json { render json: @place, status: :created, location: @place }\n else\n @place.name = params[:place][:name]\n @place.address = @place.place_translations.first.address\n @venue_categories = VenueCategory.with_venues\n @show_map = true\n\n gon.show_place_form = true\n gon.edit_place_form = true\n gon.default_address_selection_index = params[:address]\n gon.address_search_path = address_search_places_path\n gon.near_venue_id = @place.venue_id\n if @place.lat.present? && @place.lon.present?\n gon.lat = @place.lat\n gon.lon = @place.lon\n end\n\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place } #, notice: 'Place was successfully created.' }\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 @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to cms_places_path, notice: 'Place was successfully created.' }\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 @place = @region.places.new(place_params)\n @place.user = current_user\n if @place.save\n render :show, status: :created, location: @place\n else\n render json: @place.errors, status: :unprocessable_entity\n end\n end",
"def create\n @place = Place.new(place_params)\n # @trip = Trip.find(params[:trip_id])\n # @trip.places << @place\n # @place.author = current_user\n respond_to do |format|\n if @place.save\n format.html { redirect_to partner_places_path, notice: 'Le lieu a été crée.' }\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 @place = Place.new(place_params)\n \n @place.user = current_user\n \n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n \n format.json { render :show, status: :created, location: @place }\n else\n format.html { redirect_to new_place_path, alert: @place.errors.messages.first[1][0] }\n \n format.json { render json: @place.errors, status: :unprocessable_entity }\n end \n end\n end",
"def new\n @place = Place.new\n \n render_standard :data => @place\n end",
"def create\n @api_vi_place = Api::Vi::Place.new(api_vi_place_params)\n\n if @api_vi_place.save\n render :show, status: :created, location: @api_vi_place\n else\n render json: @api_vi_place.errors, status: :unprocessable_entity\n end\n end",
"def create_location(address, rent)\n # binding.pry\n Location.new(address, rent, self)\n # binding.pry\n end",
"def add_place(place)\n if place.validate && !@places.include?(place.name) \n @places[place.name] = place.id\n @objects[place.id] = place\n place.net = self\n return place.id\n end\n changed_structure\n return false\n end",
"def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to new_service_direction_path, notice: 'place was successfully created.' }\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 @dataele_place = DataelePlace.new(params[:dataele_place])\n\n respond_to do |format|\n if @dataele_place.save\n format.html { redirect_to @dataele_place, notice: 'Dataele place was successfully created.' }\n format.json { render json: @dataele_place, status: :created, location: @dataele_place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dataele_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n super\n show(PLACEMENT_SCREEN)\n end",
"def create\n @place = @site.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to organisation_site_path(@site.organisation, @site), notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_location(params)\n new_location = Location.create(name: params[:name], address: params[:address], city: params[:city])\n self.update(location_id: new_location.id)\n end",
"def create\n @travel_place = TravelPlace.new(params[:travel_place])\n\n respond_to do |format|\n if @travel_place.save\n flash[:notice] = 'TravelPlace was successfully created.'\n format.html { redirect_to(@travel_place) }\n format.xml { render :xml => @travel_place, :status => :created, :location => @travel_place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel_place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(params[:place])\n\n if not @place.address == \"\"\n @place.lat = Geocoder.coordinates(@place.address)[0];\n @place.lon = Geocoder.coordinates(@place.address)[1];\n end\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_place(*place)\n reset_places\n unless place.blank?\n what.query.add(:places) << place.flatten \n changed\n end\n end",
"def create\n super\n show(PLACEMENT_SCREEN)\n end",
"def create\n\t\tsuper\n\t\tshow(PLACEMENT_SCREEN)\n\tend",
"def create\n @tourist_place = TouristPlace.new(tourist_place_params)\n\n respond_to do |format|\n if @tourist_place.save\n format.html { redirect_to @tourist_place, notice: 'Tourist place was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_place }\n else\n format.html { render :new }\n format.json { render json: @tourist_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notable_place = @system.notable_places.new(notable_place_params)\n\n respond_to do |format|\n if @notable_place.save\n format.html { redirect_to campaign_system_notable_places_path(@campaign, @system), notice: \"Notable place was successfully created.\" }\n format.json { render :show, status: :created, location: @notable_place }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @notable_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @planned_place = PlannedPlace.new(planned_place_params)\n\n respond_to do |format|\n if @planned_place.save\n format.html { redirect_to @planned_place, notice: 'Planned place was successfully created.' }\n format.json { render :show, status: :created, location: @planned_place }\n else\n format.html { render :new }\n format.json { render json: @planned_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_feature(title_str, name_str, description_str = '', \n coordinates_hash = {:longitude => nil, :latitude => nil, :elevation => '0.0'})\n response = @@client.post post_url, create_placemark_kml(title_str, name_str, description_str, coordinates_hash)\n # Feature.new response.parse_xml.at_css('atom|entry')\n feed_entry = response.parse_xml.at_css('atom|entry')\n feed_entry ? Feature.new(feed_entry) : nil\n end",
"def create\n redirect_to(root_url) unless current_user\n\n @place = current_user.places.build(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\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 @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n respond_if_is_true_web(format, places_url, 'Place was successfully created.', :show, :created, @place)\n else\n respond_if_is_false_web(format, :new, :unprocessable_entity, @place.errors, :unprocessable_entity)\n end\n end\n end",
"def new\n @place = @event.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def place(direct, preposition, target, detail = 'default')\n ItemRelationship.create!(\n source: direct,\n target: target,\n detail: detail,\n preposition: preposition\n )\nend",
"def place(place)\n # extract position x & y\n place_options = place.gsub(\"PLACE \", \"\").split(\",\")\n place_robot([place_options[0].to_i, place_options[1].to_i], \n place_options[2])\n end",
"def create\n @schedule_place = SchedulePlace.new(schedule_place_params)\n\n respond_to do |format|\n if @schedule_place.save\n format.html { redirect_to schedule_places_path }\n format.json { render :show, status: :created, location: @schedule_place }\n else\n format.html { render :new }\n format.json { render json: @schedule_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_places_window\n y = @legend_window.y + @legend_window.height\n height = Graphics.height - @mission_window.height - @legend_window.height\n @places_window = Window_PlaceList.new(y, height)\n @places_window.set_handler(:ok, method(:place_selection))\n @places_window.set_handler(:cancel, method(:return_scene))\n @places_window.activate\n end",
"def create\n @place = Place.new(place_params)\n\n @place.user_id = current_user.id\n\n add_tags\n \n if @place.save\n @place.update(place_params)\n render json: @place\n else\n render json: @place.errors\n end\n end",
"def new\n @location = Location.new\n @page_title = 'Create new location'\n end",
"def create\n @join_region_to_place = JoinRegionToPlace.new\n @join_region_to_place.place_id = params[:place_id]\n @join_region_to_place.region_id = params[:region_id]\n\n respond_to do |format|\n if @join_region_to_place.save\n format.html { redirect_to edit_admin_place_path(@place), notice: 'La région a été ajoutée.' }\n format.json { render :show, status: :created, location: @join_region_to_place }\n else\n format.html { render :new }\n format.json { render json: @join_region_to_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_place\n @place = Place.friendly.find(params[:id])\n end",
"def new\n @place = Place.new\n respond_with(@place)\n end",
"def create\n place = Place.new(place_params)\n\n if place.save\n render json: place, status: 201\n\n else\n render json: { errors: place.errors}, status: 422\n end\n\n end",
"def create\n @parking_place = ParkingPlace.new(parking_place_params.merge(parking: @parking))\n\n respond_to do |format|\n if @parking_place.save\n format.html { redirect_to @parking_place, notice: t(:parking_place_created) }\n format.json { render :show, status: :created, location: @parking_place }\n else\n format.html { render :new }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = current_user.places.create(place_params)\n if @place.valid?\n redirect_to root_path\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n @my_map = current_my_map\n place = Place.find(params[:place_id])\n @way_point = @my_map.add_place(place.id)\n\n respond_to do |format|\n if @way_point.save\n format.html { redirect_to @way_point.my_map, notice: 'マイマップに追加しました。' }\n format.json { render action: 'show', status: :created, location: @way_point }\n else\n format.html { render action: 'new' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # place_id を選択せずに場所名のみを入力してきた場合\n if params[:event][:place_id] == '' && params[:place_name] != ''\n # 場所名を部分一致検索\n places = Place::where(\"name LIKE ?\", \"%#{params[:place_name]}%\")\n \n if places.count == 1\n params[:event][:place_id] = places[0].id\n elsif places.count == 0\n @place = Place.new(:name => params[:place_name])\n is_save_place = @place.save ? true : false\n params[:event][:place_id] = @place.id\n else\n raise \"place count error\"\n end\n end\n\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 @assign_group_place = AssignGroupPlace.new(assign_group_place_params)\n @assign_group_place.save\n end",
"def create\n @place = current_user.places.create(place_params)\n #Check if validations are passed and the record actually got saved to our database\n if @place.valid?\n redirect_to root_path\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def createLocation _args\n \"createLocation _args;\" \n end",
"def create\n @visited_place = VisitedPlace.new(visited_place_params)\n\n respond_to do |format|\n if @visited_place.save\n format.html { redirect_to @visited_place, notice: 'Visited place was successfully created.' }\n format.json { render :show, status: :created, location: @visited_place }\n else\n format.html { render :new }\n format.json { render json: @visited_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n super\n show PLACEMENT_SCREEN\n end",
"def create\n\n @place_been = PlaceBeen.create ({:latitude => params[:latitude], :longitude => params[:longitude], :address => params[:address], :description => params[:description], :title => params[:title], :user_id => current_user.id})\n\n flash[:success] = \"A new marker has been added!\"\n redirect_to vacations_path\n\n # @place_been = PlaceBeen.new(place_been_params)\n # respond_to do |format|\n # if @place_been.save\n # format.html { redirect_to @place_been, notice: 'Place been was successfully created.' }\n # format.json { render :show, status: :created, location: @place_been }\n # else\n # format.html { render :new }\n # format.json { render json: @place_been.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @restaurant_place = RestaurantPlace.new(restaurant_place_params)\n\n respond_to do |format|\n if @restaurant_place.save\n format.html { redirect_to @restaurant_place, notice: 'Restaurant place was successfully created.' }\n format.json { render action: 'show', status: :created, location: @restaurant_place }\n else\n format.html { render action: 'new' }\n format.json { render json: @restaurant_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_city_workplace(admin)\n city = admin.city\n new_city_workplace = city.workplaces.create(name: \"#{self.name} Workplace\", description: \"Main workplace for the City of #{self.name}. This private workplace is automatically provided for #{self.name} and for city officials to collaborate within it.\", is_citys: true)\n puts \"New City Workplace was created: #{new_city_workplace.inspect}\"\n end",
"def new_address\n @client.new_address(name)\n end",
"def create\n @parking_place = ParkingPlace.new(parking_place_params)\n\n if @parking_place.save\n render :show, status: :created, location: @parking_place\n else\n render json: @parking_place.errors, status: :unprocessable_entity\n end\n end",
"def create\n @availability_parking_place = AvailabilityParkingPlace.new(availability_parking_place_params)\n\n respond_to do |format|\n if @availability_parking_place.save\n format.html { redirect_to @availability_parking_place, notice: 'Availability parking place was successfully created.' }\n format.json { render :show, status: :created, location: @availability_parking_place }\n else\n format.html { render :new }\n format.json { render json: @availability_parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addPlace\n params[:new_place]\n end",
"def create\n # find if this place is already created by searching its latitude and longitude\n @place = Place.find_by_sql([\"select * from Place where latitude = ? and longitude = ?\", params[:latitude], params[:longitude]])[0]\n if !@place.nil?\n respond_to do |format|\n format.html { redirect_to @place, notice: 'Place was already created.' }\n format.json { render :json => {:GUID => @place.placeId} }\n end\n else\n @place = Place.new\n @place.placeId = 'I-' + UUIDTools::UUID.timestamp_create.to_s\n @place.label = params[:label]\n @place.latitude = params[:latitude]\n @place.longitude = params[:longitude]\n @place.version = 1\n\n respond_to do |format|\n if @place.save\n @point = Point.new\n @point.placeId = @place.placeId\n @point.save\n\n @spatialThing = SpatialThing.new\n @spatialThing.placeId = @point.placeId\n @spatialThing.latitude = params[:latitude]\n @spatialThing.longitude = params[:longitude]\n @spatialThing.altitude = 0.0\n @spatialThing.type = \"Place\"\n @spatialThing.save\n\n @idTableName = IdTableName.new\n @idTableName.id = @place.placeId\n @idTableName.tableName = \"Place\"\n @idTableName.version = 1\n @idTableName.save\n\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :json => {:GUID => @place.placeId} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @time_and_place = TimeAndPlace.new(time_and_place_params)\n\n # create path for page to be rendered if save is successful\n new_path = '/trucks/' + @time_and_place.truck_id.to_s\n\n respond_to do |format|\n if @time_and_place.save\n format.html { redirect_to new_path, notice: 'Location was successfully saved.' }\n format.json { render :show, status: :created, location: @time_and_place }\n else\n format.html { render :new }\n format.json { render json: @time_and_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place = Place.new(place_params)\n \n #@place added for validates :name, presence: true ELSE error!\n @places = Place.all.order('name asc') \n \n if @place.save\n flash[:success]='New record added'\n redirect_to new_place_path\n else \n flash[:danger]='Denied. Record existed or spaces entered'\n render 'new'\n end\n end",
"def create\n @place = current_merchant.places.new(place_params)\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\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 @place.cuisine_type_ids = params[:place][:cuisine_type_ids]\n @place.highlight_ids = params[:place][:highlight_ids]\n @place.dining_type_ids = params[:place][:dining_type_ids]\n end",
"def new\n @place = @site.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def place_goal(loc)\n place_object(3, loc)\n end",
"def place_params\n params.require(:place).permit(:region_id, :name, :description)\n end",
"def new\n\t@meta[:title] = \"DondeVoyAComer.com | Ingresar nuevo local de comida\"\n\t @current_page = \"add\"\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end",
"def create\n @join_specific_content_to_place = JoinSpecificContentToPlace.new(join_specific_content_to_place_params)\n\n respond_to do |format|\n if @join_specific_content_to_place.save\n format.html { redirect_to @join_specific_content_to_place, notice: 'Join specific content to place was successfully created.' }\n format.json { render :show, status: :created, location: @join_specific_content_to_place }\n else\n format.html { render :new }\n format.json { render json: @join_specific_content_to_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @market_place = MarketPlace.new(market_place_params)\n\n respond_to do |format|\n if @market_place.save\n format.html { redirect_to @market_place, notice: \"Market place was successfully created.\" }\n format.json { render :show, status: :created, location: @market_place }\n else\n format.html { render :new }\n format.json { render json: @market_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def place\n term_values([:origin_info, :place, :placeTerm])\n end",
"def create\n @join_region_to_place = JoinRegionToPlace.new\n @join_region_to_place.place_id = params[:place_id]\n @join_region_to_place.region_id = params[:region_id]\n\n respond_to do |format|\n if @join_region_to_place.save\n format.html { redirect_to edit_place_path(@place), notice: 'La région a été ajoutée.' }\n format.json { render :show, status: :created, location: @join_region_to_place }\n else\n format.html { render :new }\n format.json { render json: @join_region_to_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def from_place_details details\n\n components = details[:address_components]\n unless components.nil?\n components.each do |component|\n types = component[:types]\n if types.nil?\n next\n end\n if 'street_address'.in? types\n self.address = component[:long_name]\n elsif 'route'.in? types\n self.route = component[:long_name]\n elsif 'street_number'.in? types\n self.street_number = component[:long_name]\n elsif 'administrative_area_level_1'.in? types\n self.state = component[:long_name]\n elsif 'locality'.in? types\n self.city = component[:long_name]\n elsif 'postal_code'.in? types\n self.zip = component[:long_name]\n end\n end\n end\n\n self.raw_address = details[:formatted_address]\n self.lat = details[:geometry][:location][:lat]\n self.lng = details[:geometry][:location][:lng]\n self.name = details[:name]\n self.google_place_id = details[:place_id]\n self.stop_code = details[:stop_code]\n self.types = details[:types]\n self.address_components_raw = details[:address_components]\n\n if self.raw_address.nil?\n self.raw_address = self.name\n end\n\n if self.name.nil?\n self.name = self.raw_address\n end\n\n self.save\n\n end",
"def create\n\t\t@place = Place.new \n\t\t@place.location = params[:location]\n\t\t@place.description = params[:description]\n\t\t@place.place = params[:place]\n\t\t@place.date = params[:date]\n\t\t@place.time = params[:time]\n\t\t\n\t \tputs @place\n\t\t\n\t\trespond_to do |format|\n\t if @place.save\n\t # format.html { redirect_to @event.league, notice: 'Team was successfully created.' }\n\t format.json { \n\t \trender :json => { :status=>:success, :message=>@place },\n\t \t:status=>200,\n\t \t:callback => params['callback'] \n\t }\n\n\t else\n\t # format.html { render action: 'new' }\n\t format.json { render :json=> { :status=>\"Can't process info\", :message=>@place.errors}, \n\t \t:status=> 422, \n\t \t:callback => params['callback'] \n\t }\n\t end\n\t end\n\t\t# if @event.save\n\t # \trender :json => { :status => \"success\", :message => @post}, :status => 200\n\t # else\n\t # \trender :json => { :status => \"error\", :message => \"Unable to save\" }, :status => 422\n\t # end\n\t\t# render :json => @place, :callback => params['callback']\n\tend",
"def create\n @parking_place = current_user.parking_places.new(parking_place_params)\n\n respond_to do |format|\n if @parking_place.save\n format.html { redirect_to @parking_place, notice: 'Parking place was successfully created.' }\n format.json { render :show, status: :created, location: @parking_place }\n else\n format.html { render :new }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @article = Article.new\n @article.build_location\n end"
] |
[
"0.78425795",
"0.6871505",
"0.68252426",
"0.6783428",
"0.67754894",
"0.6685155",
"0.6683857",
"0.6683857",
"0.6633084",
"0.65508616",
"0.65299225",
"0.65247804",
"0.65154636",
"0.6500561",
"0.6500561",
"0.6481588",
"0.6447001",
"0.6410156",
"0.6408066",
"0.6408066",
"0.6408066",
"0.6408066",
"0.63990176",
"0.6390945",
"0.638638",
"0.638638",
"0.638638",
"0.6384218",
"0.63703865",
"0.6370213",
"0.6361207",
"0.6348268",
"0.6328334",
"0.63248235",
"0.6321632",
"0.6294392",
"0.6224942",
"0.61884224",
"0.6174179",
"0.6150633",
"0.6144327",
"0.613901",
"0.6133206",
"0.6116562",
"0.611499",
"0.6102423",
"0.60883784",
"0.6087189",
"0.60871625",
"0.60858786",
"0.6068454",
"0.6062093",
"0.60590696",
"0.60562",
"0.60235137",
"0.60055524",
"0.60049975",
"0.59821147",
"0.59688485",
"0.5959266",
"0.5954509",
"0.5932388",
"0.59190977",
"0.5895623",
"0.58845115",
"0.58811235",
"0.58666337",
"0.58554345",
"0.58524835",
"0.58457917",
"0.5838145",
"0.58349615",
"0.5824606",
"0.58225286",
"0.5815254",
"0.58070385",
"0.5805275",
"0.5795713",
"0.5792439",
"0.57852536",
"0.57838696",
"0.5767865",
"0.57598925",
"0.5759049",
"0.5755227",
"0.57519424",
"0.57459223",
"0.5736924",
"0.5728078",
"0.5717582",
"0.5715551",
"0.57127076",
"0.57062405",
"0.57031566",
"0.56981784",
"0.5685608",
"0.568208",
"0.567278",
"0.56517106",
"0.5647706",
"0.5640331"
] |
0.0
|
-1
|
Edit an exisiting place
|
def edit
@place = Place.find_by(:id => params["id"])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit\n puts \"\\n******* edit *******\"\n end",
"def edit\n puts \"******* edit *******\"\n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\n \n end",
"def edit\r\n end",
"def go_to(new_place)\n @curr_place = new_place\n end",
"def edit\r\n \r\n end",
"def edit \n end",
"def edit \n end",
"def edit\n #Nothing necessary\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n raise NotImplementedError\n end",
"def edit\n\n wid = get_wid or return\n\n load_workitem wid\n end",
"def edit\n\t\t\n\tend",
"def edit\n\n end",
"def edit\n\n end",
"def editar\n end",
"def edit\n@place = Place.find(params[:id])\nend",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] |
[
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.6929099",
"0.68861115",
"0.68820316",
"0.65830284",
"0.65251845",
"0.65251845",
"0.65251845",
"0.65251845",
"0.65251845",
"0.65251845",
"0.65251845",
"0.6422011",
"0.6404952",
"0.6375123",
"0.63598704",
"0.63598704",
"0.63341177",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6319477",
"0.6277322",
"0.62580967",
"0.6229564",
"0.6205224",
"0.61981523",
"0.6182908",
"0.61619157",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6152579",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245",
"0.6138245"
] |
0.0
|
-1
|
Update the details of an existing place
|
def update
@place = Place.find_by(:id => params["id"])
@place.title = params["title"]
@place.photo_url = params["photo_url"]
@place.admission_price = params["price"]
@place.description = params["description"]
@place.save
redirect_to "/places/#{@place.id}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n if @place.update(place_params)\n render :show, status: :ok, location: @place\n else\n render json: @place.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @place.update(place_params)\n redirect_to @place, notice: \"Place was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update\n\t\tp = Place.find_by(:id=> params[\"id\"])\n\n\t\tif p != nil\n\t\t\tp.title = params['title']\n\t\t\tp.photo_url = params['photo_url']\n\t\t\tp.admission_price = params['admission_price']\n\t\t\tp.description = params['description']\n\t\t\tp.save\n\t\t\tredirect_to \"/\"\n\t\telse\n\t\t\tredirect_to \"/\", notice: \"Place not found in this app!\"\n\t\tend\n\tend",
"def update\n puts place_params\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to partner_place_path(@place[:id]), notice: 'Les modifications ont été enregistrées.' }\n # format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n # format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n place = Place.find(params[:id])\n map = Map.find(params[:map_id])\n #place.update(place_params)\n place_attrs = place_params\n #binding.pry\n map.adjust_place(place, place_attrs)\n redirect_to edit_map_path(map)\n end",
"def update!(**args)\n @place_infos = args[:place_infos] if args.key?(:place_infos)\n end",
"def update!(**args)\n @place_infos = args[:place_infos] if args.key?(:place_infos)\n end",
"def update!(**args)\n @place_infos = args[:place_infos] if args.key?(:place_infos)\n end",
"def update!(**args)\n @place_infos = args[:place_infos] if args.key?(:place_infos)\n end",
"def update!(**args)\n @place_id = args[:place_id] if args.key?(:place_id)\n @place_name = args[:place_name] if args.key?(:place_name)\n end",
"def update\n @place = @site.places.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to [@site, @place], notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n if not @place.address == \"\"\n @place.lat = Geocoder.coordinates(@place.address)[0];\n @place.lon = Geocoder.coordinates(@place.address)[1];\n end\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to cms_places_path, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n place = Place.find(params[:id])\n\n if place.update_attributes(params[:place])\n head :no_content\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(admin_place_path(@place), :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place } #, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = @event.places.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to([@event, @place], :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update!(**args)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update!(**args)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n flash[:notice] = 'Place was successfully updated.'\n format.html { redirect_to(@place) }\n format.xml { head :ok }\n format.json { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n format.json { render :nothing => true }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n flash[:notice] = 'Place was successfully updated.'\n format.html { redirect_to(@place) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n flash[:notice] = 'Place was successfully updated.'\n format.html { redirect_to(@place) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n flash[:notice] = 'Place was successfully updated.'\n format.html { redirect_to(@place) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n place_params = params.require(:place).permit(:name, :city_id, :address, :hours, :phone, :url, :about)\n user_id = session[:user_id]\n @user = User.find_by_id user_id\n @place.user_id = @user.id\n @city = City.find_by_id(params[:id])\n @place.update_attributes(place_params)\n @cities = City.all\n redirect_to place_path\n end",
"def update\n if @parking_place.update(parking_place_params)\n render :show, status: :ok, location: @parking_place\n else\n render json: @parking_place.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @place.update(place_params)\n flash[:success]='Record updated'\n redirect_to new_place_path\n else \n flash[:danger]='Denied. Record existed or spaces entered' \n @places = Place.all.order('name asc') \n render 'new' \n end\n end",
"def update\n if params[:place_id]\n @safe_house = Place.find(params[:place_id])\n place_id_present = true\n end\n\n respond_to do |format|\n if place_id_present && @safe_house.update_attributes( :name => params[:name],\n :zombie_probability => params[:zombie_probability],\n :latitude => params[:latitude],\n :longitude => params[:longitude],\n :has_weapons => params[:has_weapons],\n :has_food => params[:has_food],\n :has_people => params[:has_people])\n format.json { render :json => { :status => \"OK\", :response => {:updated => true} }}\n else\n format.json { render :json => { :status => \"Error\", :response => {} }}\n end\n end\n end",
"def update!(**args)\n @places = args[:places] if args.key?(:places)\n end",
"def update\n respond_to do |format|\n if @admin_place.update(admin_place_params)\n format.html { redirect_to @admin_place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_place }\n else\n format.html { render :edit }\n format.json { render json: @admin_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # find the record the user wants to update\n @place = Place.find(params[:id])\n # Only user who created place can update\n if @place.user != current_user\n return render text: 'Not Allowed, Human Scum', status: :forbidden\n end\n # Update the record and save changes to the places database\n @place.update_attributes(place_params)\n # Validation error\n if @place.valid?\n # Redirect user to homepage\n redirect_to root_path\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update\n @dataele_place = DataelePlace.find(params[:id])\n\n respond_to do |format|\n if @dataele_place.update_attributes(params[:dataele_place])\n format.html { redirect_to @dataele_place, notice: 'Dataele place was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataele_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n if @place.update(place_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Update failed.\"]}\n end\n end",
"def update\n if @api_vi_place.update(api_vi_place_params)\n render :show, status: :ok, location: @api_vi_place\n else\n render json: @api_vi_place.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n \n format.json { render :show, status: :created, location: @place }\n else\n format.html { redirect_to edit_place_path(@place), alert: @place.errors.messages.first[1][0] }\n \n format.json { render json: @place.errors, status: :unprocessable_entity }\n end \n end\n end",
"def update\n redirect_to(root_url) unless current_user.id == @place.user.id\n\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place.user = current_user\n\n respond_to do |format|\n if @place.update_attributes(params[:place])\n Log.logit!(:places, :notice, \"User updated place \" + @place.name, {:user_id => @current_user.id, :place_id => @place.id})\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n @place.assign_attributes(params[:place])\n\n add_missing_translation_content(@place.place_translations)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to place_path(@place), notice: t('app.msgs.success_updated', :obj => t('activerecord.models.place')) }\n format.json { head :ok }\n else\n @venue_categories = VenueCategory.with_venues\n @show_map = true\n gon.show_place_form = true\n gon.edit_place_form = true\n gon.default_address_selection_index = params[:address]\n gon.address_search_path = address_search_places_path\n gon.near_venue_id = @place.venue_id\n if @place.lat.present? && @place.lon.present?\n gon.lat = @place.lat\n gon.lon = @place.lon\n end\n\n format.html { render action: \"edit\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to [:admin, @place], notice: t('messages.updated', model:Place.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking_place.update(parking_place_params)\n format.html { redirect_to @parking_place, notice: 'Parking place was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_place }\n else\n format.html { render :edit }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_place\n @place = Place.find(params[:id])\n \n end",
"def update\n @travel_place = TravelPlace.find(params[:id])\n\n respond_to do |format|\n if @travel_place.update_attributes(params[:travel_place])\n flash[:notice] = 'TravelPlace was successfully updated.'\n format.html { redirect_to(@travel_place) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @travel_place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tourist_place.update(tourist_place_params)\n format.html { redirect_to @tourist_place, notice: 'Tourist place was successfully updated.' }\n format.json { render :show, status: :ok, location: @tourist_place }\n else\n format.html { render :edit }\n format.json { render json: @tourist_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking_place.update(parking_place_params)\n format.html { redirect_to @parking_place, notice: t(:parking_place_updated) }\n format.json { render :show, status: :ok, location: @parking_place }\n else\n format.html { render :edit }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n @locals = Local.all\n respond_to do |format|\n if @place.update_attributes(params[:place])\n format.html { redirect_to(@place, :notice => 'Place was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @place.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @availability_parking_place.update(availability_parking_place_params)\n format.html { redirect_to @availability_parking_place, notice: 'Availability parking place was successfully updated.' }\n format.json { render :show, status: :ok, location: @availability_parking_place }\n else\n format.html { render :edit }\n format.json { render json: @availability_parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cat_place.update cat_place_params\n format.html { redirect_to [ \"admin\", @cat_place ], notice: 'Cat place was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_place }\n else\n format.html { render :edit }\n format.json { render json: @cat_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @place\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to admin_places_path, notice: 'Place was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @edit_schedule_place.update(schedule_place_params)\n format.html { redirect_to schedule_places_path, notice: 'Schedule place was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule_place }\n else\n format.html { render :edit }\n format.json { render json: @schedule_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @place.update(place_params)\n respond_if_is_true_web(format, places_url, 'Place was successfully updated.', :show, :ok, @place)\n else\n respond_if_is_false_web(format, :new, :unprocessable_entity, @place.errors, :unprocessable_entity)\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_place.update(user_place_params)\n format.html { redirect_to @user_place, notice: 'User place was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_place }\n else\n format.html { render :edit }\n format.json { render json: @user_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_place\n @place = Location.where(place_id: params[:id])\n end",
"def edit\n @place = Place.find_by(:id => params[\"id\"]) \n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @place_id = args[:place_id] if args.key?(:place_id)\n end",
"def set_place\n @place = Place.find_by(id: params[:id])\n end",
"def update\n\n @place.tags.destroy_all\n\n @place.user_id = current_user.id\n\n add_tags\n\n if @place.update(place_params)\n render json: @place\n else\n render json: @place.errors\n end\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def set_place\n @place = Place.find(params[:id])\n end",
"def update\n # expire_page :action => :index\n @place = Place.find(params[:id])\n @place.update_attributes(params[:place])\n respond_with(@place)\n end",
"def update\n # respond_to do |format|\n # if @place_been.update(place_been_params)\n # format.html { redirect_to @place_been, notice: 'Place been was successfully updated.' }\n # format.json { render :show, status: :ok, location: @place_been }\n # else\n # format.html { render :edit }\n # format.json { render json: @place_been.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @visited_place.update(visited_place_params)\n format.html { redirect_to @visited_place, notice: 'Visited place was successfully updated.' }\n format.json { render :show, status: :ok, location: @visited_place }\n else\n format.html { render :edit }\n format.json { render json: @visited_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @place = Place.find(params[:id])\n\n if @place.user != current_user\n return render text: 'Not Allowed', status: :forbidden\n end\n\n @place.update_attributes(place_params)\n if @place.valid?\n redirect_to place_path(@place)\n # redirect_to root_path\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def edit\n@place = Place.find(params[:id])\nend",
"def update\n respond_to do |format|\n if @planned_place.update(planned_place_params)\n format.html { redirect_to @planned_place, notice: 'Planned place was successfully updated.' }\n format.json { render :show, status: :ok, location: @planned_place }\n else\n format.html { render :edit }\n format.json { render json: @planned_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_place\n @place = Place.find(params[:id])\n end"
] |
[
"0.7869142",
"0.7840684",
"0.7805384",
"0.7679539",
"0.75550485",
"0.7553718",
"0.7553718",
"0.7553718",
"0.7553718",
"0.74998826",
"0.7481315",
"0.74808025",
"0.74399173",
"0.7431598",
"0.7425476",
"0.7425476",
"0.7425476",
"0.7425476",
"0.7425476",
"0.74167114",
"0.74167114",
"0.74167114",
"0.7400557",
"0.7392544",
"0.73718816",
"0.7360161",
"0.7360161",
"0.73565435",
"0.73565435",
"0.73565435",
"0.7356146",
"0.73400444",
"0.73400444",
"0.73400444",
"0.73381996",
"0.73131806",
"0.72650176",
"0.7253394",
"0.72397596",
"0.7215137",
"0.72060823",
"0.7201905",
"0.7191654",
"0.7174228",
"0.7167384",
"0.7167046",
"0.71630305",
"0.71499383",
"0.7112217",
"0.70708424",
"0.70700926",
"0.70589834",
"0.7051051",
"0.70381105",
"0.7028236",
"0.7027657",
"0.7017341",
"0.69808763",
"0.6924621",
"0.6922008",
"0.6901684",
"0.6888869",
"0.6885999",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.68832785",
"0.688152",
"0.688152",
"0.688152",
"0.6876047",
"0.68672895",
"0.68503237",
"0.68460727",
"0.68460727",
"0.68460727",
"0.68460727",
"0.68460727",
"0.68460727",
"0.6835434",
"0.68301487",
"0.6820604",
"0.67978406",
"0.67928815",
"0.6789553",
"0.6777652"
] |
0.78253436
|
2
|
TODO: Split this up into multiple methods Normalizes the guide by flattening the file paths
|
def normalize!
normalize
save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def normalize\n @epub.log \"Normalizing guide...\"\n doc = xmldoc\n\n # TODO: Handle this better\n if doc.size < 1\n return\n end\n\n normalize_paths\n to_s\n end",
"def normalize!\n begin\n create_base_directories!\n\n # Ensure all files are properly formatted\n standardize!\n\n # normalize the files\n toc.normalize!\n guide.normalize!\n manifest.normalize!\n \n clean_empty_dirs!\n\n report\n\n rescue => ex\n log \"failed to normalize\\n #{ex.to_s}\"\n raise ex\n end\n end",
"def normalized_path(file); end",
"def normalize_path(path); end",
"def normalize_path(path); end",
"def normalize\n if defined?(@extra_rdoc_files) and @extra_rdoc_files\n @extra_rdoc_files.uniq!\n @files ||= []\n @files.concat(@extra_rdoc_files)\n end\n\n @files = @files.uniq if @files\n @extensions = @extensions.uniq if @extensions\n @test_files = @test_files.uniq if @test_files\n @executables = @executables.uniq if @executables\n @extra_rdoc_files = @extra_rdoc_files.uniq if @extra_rdoc_files\n end",
"def normalize_paths\n new_sass = \"\"\n sass.each_line do |line|\n line = SassLine.new(@epub, self, line)\n line.normalize_paths if line.has_path?\n new_sass += \"#{line.to_s}\\n\"\n end\n\n self.sass = new_sass\n end",
"def standardize!\n begin\n # Standardize the urls\n toc.standardize!\n guide.standardize!\n manifest.standardize!\n\n rescue => ex\n log \"failed to standardize\\n #{ex.to_s}\"\n raise ex\n end\n \n end",
"def docClean\n dir = Pathname.new pathDocuments\n fileCleanPath(dir)\nend",
"def cleaned_relative_path; end",
"def cleaned_relative_path; end",
"def fix_asset_references\n asset_converter = Hash.new\n \n Dir.chdir(@docs_dir)\n file_list = Dir.glob(\"**/*.*\").reject {|fn| File.directory?(fn) }\n \n # generate the converter list\n file_list.each do |f|\n case File.extname(f)\n when \".js\"\n when \".css\"\n asset_converter[File.basename(f)] = f\n end\n end\n \n file_list.each do |f|\n absoluteFilePath = File.join(@plugin_directory, @docs_dir, f)\n \n if File.extname(f) == \".html\"\n doc = Nokogiri::HTML(File.open(absoluteFilePath))\n \n # remove javascript if desired\n if @strip_javascript\n doc.xpath(\"//script\").remove\n \n # when scraping this method wont be called\n # set to false for when we are not scraping so generate_structure can strip JS if needed\n @strip_javascript = false\n end\n \n # relink css\n doc.xpath(\"//link\").each do |link|\n originalLinkPath = File.basename(link[\"href\"])\n \n next if File.extname(originalLinkPath) != \".css\"\n next if not asset_converter.has_key? File.basename(originalLinkPath)\n \n # convert the link paths\n link[\"href\"] = (\"../\" * (f.count \"/\")) + asset_converter[File.basename(link[\"href\"])]\n end\n \n # relink images\n \n # write the converted file\n File.open(absoluteFilePath, \"w\") { |file| file.puts doc }\n end\n end\n end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def guides\n @guides ||= begin\n root_path = File.expand_path(File.join(__dir__, '..', '..', 'guides'))\n files = Dir.children(root_path).sort\n\n files.each_with_object({}) do |file, guides|\n next if file !~ /\\.(yaml|yml)\\z/\n # The \".*\" here removes any suffix\n topic = File.basename(file, \".*\")\n guides[topic] = File.join(root_path, file)\n end\n rescue SystemCallError => e\n raise Bolt::FileError.new(\"#{e.message}: unable to load guides directory\", root_path)\n end\n end",
"def migrate_document_structure\n set_previous_migrations\n\n GuidesGenerator::Parser::doc_hash.each do |version, data|\n text = get_version_index_text(data['files'], version)\n version_record = get_or_create_version(version, text)\n\n if data['files'] then migrate_documents(data['files'], nil, version_record) end\n if data['sections'] then migrate_sections(data['sections'], version_record) end\n end\n\n destroy_removed_migrations\n end",
"def doc_file_path\n \"#{@structure[:working_path]}/docs/#{@structure[:full_relation_name]}.md\"\n end",
"def filepathFromAbsOrRel(absOrRel)\n if(absOrRel[\"isRelative\"].to_i != 0) then\n adir = Pathname.new(File.dirname($filepathYaml)).join(absOrRel[\"path\"])\n else\n Pathname.new(absOrRel[\"path\"])\n end\nend",
"def relative_directory; end",
"def normalize!\n # Read the css\n data = read\n\n sass = css_to_sass(data)\n\n # Resolve the images in the sass to there new location\n new_sass = \"\"\n\n remove_on_condition = nil\n directive_indent = -1\n sass.each_line do |line|\n line.chomp!\n\n # Get the indent size\n indent = line.sub(/^(\\s+).*$/, \"\\\\1\").size\n\n # Remove if the last indent was a directive\n if remove_on_condition\n if indent > directive_indent\n next\n end\n end\n\n # If its a css directive remove it!\n if line =~ /^\\s+@/\n directive_indent = indent\n remove_on_condition = true\n next\n end\n\n remove_on_condition = false\n\n # Grab all the url('path') definitions\n if line =~ /url\\(.*\\)/\n # Split it up into its parts\n line.gsub!(/(url\\([\"']?)(.+?)([\"']?\\))/) do |m|\n # Array for the new rule\n new_rule = [$1, nil, $3]\n src = $2\n\n # Check its not an external url\n if src !~ /^http[s]?:\\/\\// && src && src != ''\n # Delete any anchors (just incase)\n src = src.sub(/^(.*)\\#$/, \"$1\")\n\n # Build the filename\n src_item = get_item(src)\n new_rule[1] = src_item.normalized_hashed_path(:relative_to => self)\n\n # override the original string\n m.replace new_rule.join\n end\n end\n end\n new_sass += \"%s\\n\" % line\n end\n\n sass = new_sass\n\n sass = convert_fonts(sass)\n\n # Parse SASS\n engine = Sass::Engine.new(sass)\n\n # Render CSS and add it to the string\n css = engine.render\n\n write(css)\n end",
"def fullpath; end",
"def definition_file_paths=(_arg0); end",
"def update_file_paths \n if self.url_part_was && self.url_part && self.short_name_changed?\n old_url_part = self.url_part\n old_ref_path = self.assignment_reference_repository.git_path\n set_url_part\n \n if old_url_part == self.url_part\n # Nothing changes\n return\n end\n \n self.save\n \n # Move reference repository folder if necessary\n if File.directory?(old_ref_path) \n new_ref_path = String.new(old_ref_path)\n new_ref_path[new_ref_path.index(File.basename(new_ref_path))..-1] = self.url_part\n \n FileUtils.mv old_ref_path, new_ref_path\n end\n \n # Move assignment repositories if necessary\n self.assignment_offerings.each do |assignment_offering|\n old_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n old_url_part)\n \n if File.directory?(old_assignment_repo_path)\n new_assignment_repo_path = File.join(\n assignment_offering.course_offering.storage_path,\n 'assignments',\n self.url_part) \n \n FileUtils.mv old_assignment_repo_path, new_assignment_repo_path\n end \n \n end\n end\n end",
"def process_documents(docs)\n docs.each do |doc|\n relativize_urls doc\n end\n end",
"def process_documents(docs)\n docs.each do |doc|\n relativize_urls doc\n end\n end",
"def convert_path(base: self.class.pwd, mode: :clean, checkdir: false)\n\t\t\t\tcase mode\n\t\t\t\twhen :clean\n\t\t\t\t\tcleanpath\n\t\t\t\twhen :clean_sym\n\t\t\t\t\tcleanpath(consider_symlink: true)\n\t\t\t\twhen :rel\n\t\t\t\t\trel_path(base: base, checkdir: checkdir)\n\t\t\t\twhen :relative\n\t\t\t\t\trel_path(base: base, checkdir: checkdir) unless self.relative?\n\t\t\t\twhen :absolute,:abs\n\t\t\t\t\tabs_path(base: base, mode: :abs)\n\t\t\t\twhen :abs_clean\n\t\t\t\t\tabs_path(base: base, mode: :clean)\n\t\t\t\twhen :abs_cleansym\n\t\t\t\t\tabs_path(base: base, mode: :cleansym)\n\t\t\t\twhen :abs_real\n\t\t\t\t\tabs_path(base: base, mode: :real)\n\t\t\t\twhen :abs_realdir\n\t\t\t\t\tabs_path(base: base, mode: :realdir)\n\t\t\t\telse\n\t\t\t\t\tself\n\t\t\t\tend\n\t\t\tend",
"def validate_paths(paths)\n normalize_paths paths\n nil\nend",
"def once\n convert\n source_doc = Sphonglepress::STATIC_DIR.join(\"document\", \"site.html\")\n cleaned = clean(source_doc)\n @segments = segment cleaned\n end",
"def relative_path\n @relative_path ||= File.join(doc.relative_path, \"#excerpt\")\n end",
"def normalize_filename\n self.filename = Pathname.normalize_path(filename)\n end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def normalized_file_list(options, relative_files, force_doc = false, exclude_pattern=nil)\n file_list = []\n\n relative_files.each do |rel_file_name|\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n case type = File.stat(rel_file_name).ftype\n when \"file\"\n file_list << rel_file_name.sub(/^\\.\\//, '') if force_doc || ParserFactory.can_parse(rel_file_name)\n when \"directory\"\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)\n if File.file?(dot_doc)\n file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))\n else\n file_list.concat(list_files_in_directory(rel_file_name, options))\n end\n else\n raise RDocError.new(\"I can't deal with a #{type} #{rel_file_name}\")\n end\n end\n file_list\n end",
"def relative!\n super\n replace '' if self == '.'\n end",
"def definition_file_paths; end",
"def pathSourceDoc\n\t\"./documentation/\"\nend",
"def summarize_file(path); end",
"def build_document_hash\n # Generate the base version keys for the doc_hash by gobbing all files and folders in the base directory. This means that any folder in the base directory will be treated as a version when being migrated. **You must have at least one version folder**.\n Dir.glob(\"*.*.*\").each {|version| GuidesGenerator::Parser::doc_hash[version] = {};}\n\n # With the version added to the base level of the `doc_hash` now we recursively generate the document structure for each version.\n GuidesGenerator::Parser::doc_hash.each {|version, hash| add_files_and_sections(version, hash);} \n end",
"def file_utils; end",
"def replace_relative_references2(ts_path, source, context)\n ts_dir = File.dirname(File.expand_path(ts_path))\n escaped_dir = ts_dir.gsub(/[\"\\\\]/, '\\\\\\\\\\&') # \"\\\"\" => \"\\\\\\\"\", '\\\\' => '\\\\\\\\'\n\n # Why don't we just use gsub? Because it display odd behavior with File.join on Ruby 2.0\n # So we go the long way around.\n (source.each_line.map do |l|\n if l.start_with?('///') && !(m = %r{^///\\s*<reference\\s+path=(?:\"([^\"]+)\"|'([^']+)')\\s*/>\\s*}.match(l)).nil?\n matched_path = m.captures.compact[0]\n if matched_path.start_with? '.'\n abs_path = File.join(escaped_dir, matched_path)\n else\n abs_path = File.expand_path(URI.parse(context.resolve(matched_path)).path)\n end\n\n l = l.sub(matched_path, abs_path)\n end\n next l\n end).join\n end",
"def shortpath(fullpath); end",
"def pathDocuments\n \"./documents/\"\nend",
"def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind.flat_map do |asset|\r\n\t\t\t\tasset.properties.select{ |name,prop| prop.type=='Texture' }.flat_map do |name,prop|\r\n\t\t\t\t\tasset[name].values.compact.uniq.map{ |path| absolute_path(path) }\r\n\t\t\t\tend\r\n\t\t\tend +\r\n\t\t\tfind(_type:'Text').flat_map do |asset|\r\n\t\t\t\tasset['font'].values.compact.map{ |font| absolute_path(font) }\r\n\t\t\tend +\r\n\t\t\t@doc.xpath('/UIP/Project/Classes/*/@sourcepath').map{ |att| absolute_path att.value }\r\n\t\t).uniq\r\n\tend",
"def sanitizeFilePath(path)\n path = path.gsub(/[^-a-z A-Z0-9_.\\/]/, '_').split(\"/\").map { |part|\n part.sub(/^\\.+/, '_').sub(/\\.+$/, '_')\n }.join('/')\nend",
"def parse_dot_doc_file(in_dir, filename, options)\n # read and strip comments\n patterns = File.read(filename).gsub(/#.*/, '')\n\n result = []\n\n patterns.split.each do |patt|\n candidates = Dir.glob(File.join(in_dir, patt))\n result.concat(normalized_file_list(options, candidates))\n end\n result\n end",
"def parse_dot_doc_file(in_dir, filename, options)\n # read and strip comments\n patterns = File.read(filename).gsub(/#.*/, '')\n\n result = []\n\n patterns.split.each do |patt|\n candidates = Dir.glob(File.join(in_dir, patt))\n result.concat(normalized_file_list(options, candidates))\n end\n result\n end",
"def parse_dot_doc_file(in_dir, filename, options)\n # read and strip comments\n patterns = File.read(filename).gsub(/#.*/, '')\n\n result = []\n\n patterns.split.each do |patt|\n candidates = Dir.glob(File.join(in_dir, patt))\n result.concat(normalized_file_list(options, candidates))\n end\n result\n end",
"def canonicalize\n FilePath.new(File.expand_path(to_s))\n end",
"def translate_paths(body, env); end",
"def cleaned_relative_path\n @cleaned_relative_path ||=\n relative_path[0..-extname.length - 1]\n .sub(collection.relative_directory, \"\")\n .gsub(%r!\\.*\\z!, \"\")\n end",
"def normalize!\n doc = xmldoc\n nodes doc.xpath(ITEMS_XPATH) do |node|\n content_node = node.xpath(ITEM_FILE_XPATH).first\n src = content_node.attributes['src'].to_s\n\n src = URI(src)\n item = get_item(src.to_s)\n\n filepath = URI(item.normalized_hashed_path(:relative_to => self))\n if src.fragment\n filepath.fragment = src.fragment\n end\n\n content_node['src'] = filepath.to_s\n end\n\n\n root = read_xml\n\n # Replace the node, bit messy\n node = root.xpath(ROOT_XPATH).first\n doc_partial = Nokogiri::XML(doc.to_s)\n node.replace(doc_partial.root)\n\n # Write it back\n data = root.to_s\n write(data)\n end",
"def document(path); end",
"def adjust(files)\n files.map { |file| @options[:path] + \"/\" + file }\n end",
"def path\n @absolute_path.sub(%r{^#{Slimdown.config.location}/(.*)\\.md}, '\\1')\n end",
"def initial_paths; end",
"def path() end",
"def path() end",
"def path() end",
"def rnformat\n\n\t# Get the state we need\n\tcheckTools();\n\t\n\ttheArgs = getArguments();\n\n\n\n\t# Reformat the files\n\treformatFiles(theArgs);\n\nend",
"def git_convert_all!\n Dir[\"#{@path}/**/*.erb\"].each do |file|\n haml_file = file.gsub(/\\.erb$/, '.haml')\n temp_file = file.gsub(/\\.erb$/, '.tmp')\n begin\n puts \"Copying #{file} to #{temp_file}\"\n File.copy_stream file, temp_file\n puts \"Renaming #{file} to #{haml_file}\"\n `git mv #{file} #{haml_file}`\n puts \"Converting #{File.basename(file)} to #{File.basename(haml_file)}\"\n `html2haml -rx #{temp_file} #{haml_file}`\n puts \"Removing #{temp_file}\"\n File.delete temp_file\n rescue\n File.rename(temp_file, file)\n File.delete(temp_file)\n end\n end\n end",
"def relative; end",
"def helpers_paths=(_arg0); end",
"def helpers_paths=(_arg0); end",
"def path_list(doc, reference, word)\n reset\n #Where the word and ref don't match and it\n #looks like a Class name switch to it.\n if reference != word\n if word =~ /^[A-Z]/\n reference = word\n end\n end\n\n type = find_type(doc, reference)\n\n return [] unless type\n\n paths = imported_class_to_file_path(doc, type)\n\n #If we searched any superclasses their paths have been stored\n @loaded_documents.each { |path|\n f = File.open(path,\"r\" ).read.strip\n paths << imported_class_to_file_path(strip_comments(f), type)\n }\n\n create_src_list()\n existing_paths = []\n\n @src_dirs.each do |d|\n\n paths.flatten.uniq.each do |path|\n\n uri = d.chomp + \"/\" + path.chomp\n as = \"#{uri}.as\"\n mx = \"#{uri}.mxml\"\n\n if File.exists?(as)\n existing_paths << as\n elsif File.exists?(mx)\n existing_paths << mx\n end\n\n end\n\n end\n\n return { :paths => existing_paths.uniq, :type => type }\n\n end",
"def suit_up!(options = {})\n options = {\n :directories => ['./views'],\n :extensions => ['.md'],\n :excludes => ['layout.erb'],\n :layout_engine => :erb\n }.merge(options)\n \n [:extensions, :excludes, :directories].each do |option|\n if options[option].is_a? String\n options[option] = [options[option]]\n end\n end\n \n # a little Regexp to filter out exclusions\n directories_regexp = Regexp.new(options[:directories].join('|'))\n \n # loop and then loop and then GLOB!!\n options[:directories].each do |dir|\n options[:extensions].each do |ext|\n Dir.glob(\"#{ dir }/**/*#{ ext }\") do |file|\n file_name = file.gsub(directories_regexp, '')\n \n next if options[:excludes].include?(file_name.gsub(/\\//, ''))\n \n file_route = file_name.gsub(ext, '')\n file_title = file_route.split('/').last\n file_title = file_title.gsub(/\\-/, ' ').split(' ').each do |word|\n word.capitalize!\n end.join(' ')\n \n @@hats << { :path => file_route, :title => file_title, :extension => ext }\n end\n end\n end\n \n # bind some GET requests\n @@hats.each do |link|\n get link[:path] do\n @title = link[:title]\n \n case link[:extension]\n when '.md', '.markdown'\n markdown link[:path].to_sym, layout_engine: options[:layout_engine]\n when '.erb'\n erb link[:path].to_sym, layout_engine: options[:layout_engine]\n end\n end\n end # /@@hats.each\n end",
"def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end",
"def relative_paths(smart_path)\n raise NotImplementedError.new\n end",
"def process!\n process_previews! if self.class.preview?\n\n versions.each do |name, blk|\n path = File.join(@dir, \"#{name}_#{@filename}\")\n process_version!(path, &blk)\n @paths << path\n end\n\n @paths\n end",
"def docs = require_relative 'scaffold/docs'",
"def method_missing(*args)\n path = args.first.to_s\n if args.length == 1 && path.end_with?('.md')\n convert(path)\n else\n return super(*args)\n end\n end",
"def fix_normalize_trailing_newlines(options)\n # This would use the input option, however that may not work since\n # we touch lots of directories as part of an import.\n # input_file_spec = options['input'] || 'rtfile_dir/repositext_files'\n # Repositext::Cli::Utils.change_files_in_place(\n # config.compute_glob_pattern(input_file_spec),\n # /.\\z/i,\n # \"Normalizing trailing newlines\",\n # options\n # ) do |contents, filename|\n # [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n # end\n\n which_files = :all # :content_at_only or :all\n case which_files\n when :content_at_only\n base_dirs = %w[content_dir]\n file_type = 'at_files'\n when :all\n # Process all subfolders of root. Don't touch files in root.\n base_dirs = %w[\n content_dir\n folio_import_dir\n idml_import_dir\n plain_kramdown_export_dir\n reports_dir\n subtitle_export_dir\n subtitle_import_dir\n subtitle_tagging_export_dir\n subtitle_tagging_import_dir\n ]\n file_type = 'repositext_files'\n else\n raise \"Invalid which_files: #{ which_files.inspect }\"\n end\n base_dirs.each do |base_dir_name|\n input_file_spec = \"#{ base_dir_name }/#{ file_type }\"\n Repositext::Cli::Utils.change_files_in_place(\n config.compute_glob_pattern(input_file_spec),\n /.\\z/i,\n \"Normalizing trailing newlines in #{ base_dir_name }/#{ file_type }\",\n options\n ) do |contents, filename|\n [Outcome.new(true, { contents: contents.gsub(/(?<!\\n)\\n*\\z/, \"\\n\") }, [])]\n end\n end\n end",
"def altered_files\n parse!\n @altered_files\n end",
"def collection_dir(*files); end",
"def normalized_file_list(options, relative_files, force_doc = false,\n exclude_pattern = nil)\n file_list = []\n\n relative_files.each do |rel_file_name|\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n stat = File.stat(rel_file_name)\n case type = stat.ftype\n when \"file\"\n next if @last_created and stat.mtime < @last_created\n file_list << rel_file_name.sub(/^\\.\\//, '') if force_doc || ParserFactory.can_parse(rel_file_name)\n when \"directory\"\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)\n if File.file?(dot_doc)\n file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))\n else\n file_list.concat(list_files_in_directory(rel_file_name, options))\n end\n else\n raise RDoc::Error, \"I can't deal with a #{type} #{rel_file_name}\"\n end\n end\n\n file_list\n end",
"def file() = pathname.relative_path_from(Cnfs.config.paths.definitions)",
"def _output_paths(file)\n input_file_dir = File.dirname(file)\n file_name = _output_filename(file)\n file_name = \"#{file_name}.erb\" if _append_html_ext_to_output_path?(file_name)\n input_file_dir = input_file_dir.gsub(Regexp.new(\"#{options[:input]}(\\/){0,1}\"), '') if options[:input]\n\n if options[:output]\n Array(options[:output]).map do |output_dir|\n File.join(output_dir, input_file_dir, file_name)\n end\n else\n if input_file_dir == ''\n [file_name]\n else\n [File.join(input_file_dir, file_name)]\n end\n end\n end",
"def remove_extra_slashes\n self.home = StringConstructor.sanitized_filepath self.home\n end",
"def convert_exts\n if Rails.configuration.convertDocs.empty?\n []\n else\n Rails.configuration.convertDocs.split(\"|\")\n end\n end",
"def friendly_path\n case type\n when :gem then\n parent = File.expand_path '..', @path\n \"gem #{File.basename parent}\"\n when :home then RDoc.home\n when :site then 'ruby site'\n when :system then 'ruby core'\n else @path\n end\n end",
"def build_view_paths(paths); end",
"def normalized_file_list(options, relative_files, force_doc = false,\n exclude_pattern = nil)\n file_list = []\n\n relative_files.each do |rel_file_name|\n next if exclude_pattern && exclude_pattern =~ rel_file_name\n stat = File.stat rel_file_name rescue next\n\n case type = stat.ftype\n when \"file\"\n next if @last_created and stat.mtime < @last_created\n\n if force_doc or ::RDoc::Parser.can_parse(rel_file_name) then\n file_list << rel_file_name.sub(/^\\.\\//, '')\n end\n when \"directory\"\n next if rel_file_name == \"CVS\" || rel_file_name == \".svn\"\n dot_doc = File.join(rel_file_name, DOT_DOC_FILENAME)\n if File.file?(dot_doc)\n file_list.concat(parse_dot_doc_file(rel_file_name, dot_doc, options))\n else\n file_list.concat(list_files_in_directory(rel_file_name, options))\n end\n else\n raise RDoc::Error, \"I can't deal with a #{type} #{rel_file_name}\"\n end\n end\n\n file_list\n end",
"def update\n DOCUMENT_PATHS.each do |attr_name, path|\n if path.match(/\\*/)\n instance_variable_get(\"@#{attr_name}\").each do |simple_file_name, contents|\n replace_entry(\"word/#{simple_file_name}.xml\", contents.serialize(save_with: 0))\n end\n else\n xml_document = instance_variable_get(\"@#{attr_name}\")\n replace_entry path, xml_document.serialize(save_with: 0) if xml_document\n end\n end\n end",
"def do_stupid_prepend!\n #rewrite file paths in works\n works.each do |w|\n\n # w[:files].map!{|rel_path| File.join(@base_path, rel_path)}\n end\n\n #rewrite file paths in works in collections\n collections.each do |c|\n c[:works] && c[:works].each do |w|\n w[:files].map!{|rel_path| File.join(@base_path, rel_path)}\n end\n end\n end",
"def relative_path\n @relative_path ||= path.sub(\"#{site.collections_path}/\", \"\")\n end",
"def normalize!\n end",
"def transform_paths(attrs)\n [:stdout_logfile, :stderr_logfile].each do |key|\n value = attrs.send key\n path = Pathname.new(value)\n next if value.empty? || path.absolute?\n new_value = \"#{attrs.working_dir}/#{path}\"\n attrs.send \"#{key}=\".to_sym, new_value\n end\n end",
"def normalize_paths(paths)\n # do the hokey-pokey of path normalization...\n paths = paths.collect do |path|\n path = path.\n gsub(\"//\", \"/\"). # replace double / chars with a single\n gsub(\"\\\\\\\\\", \"\\\\\"). # replace double \\ chars with a single\n gsub(%r{(.)[\\\\/]$}, '\\1') # drop final / or \\ if path ends with it\n\n # eliminate .. paths where possible\n re = %r{[^/\\\\]+[/\\\\]\\.\\.[/\\\\]}\n path.gsub!(re, \"\") while path.match(re)\n path\n end\n\n # start with longest path, first\n paths = paths.uniq.sort_by { |path| - path.length }\n end",
"def split_path; end",
"def full_path; end",
"def fs_to_doc_path(fs_path)\n fs_path.gsub /(README)?\\.md$/, \"\"\n end",
"def original_fullpath; end",
"def path_without_name_and_ref(path); end",
"def merge_path_elements(dir, name, format)\n result = ::File.join([@page_file_dir, dir, self.page_file_name(name, format)].compact)\n result = Pathname.new(result).cleanpath.to_s\n if @page_file_dir\n raise Gollum::IllegalDirectoryPath unless result.start_with?(\"#{@page_file_dir}/\")\n result\n else\n result[0] == '/' ? result[1..-1] : result\n end\n end",
"def clean\n @paths = {}\n @paths[''] = Path.new(self, '')\n @prepares = []\n self\n end",
"def file_path; end"
] |
[
"0.6913567",
"0.669432",
"0.6129934",
"0.58422315",
"0.58422315",
"0.57970256",
"0.579325",
"0.57706195",
"0.5717497",
"0.5534543",
"0.5534543",
"0.54787713",
"0.5421049",
"0.5421049",
"0.5421049",
"0.5421049",
"0.5421049",
"0.53937674",
"0.5380835",
"0.5379329",
"0.522008",
"0.5218606",
"0.5196349",
"0.51908195",
"0.5138768",
"0.511941",
"0.51135033",
"0.51135033",
"0.5100683",
"0.50962543",
"0.5075948",
"0.50718415",
"0.5066352",
"0.5047975",
"0.5047975",
"0.5047975",
"0.5047975",
"0.5047975",
"0.50469035",
"0.50345904",
"0.50314355",
"0.5026286",
"0.50144374",
"0.50108445",
"0.5009553",
"0.50061446",
"0.5001848",
"0.49910572",
"0.49842298",
"0.49797016",
"0.49755812",
"0.49755812",
"0.49755812",
"0.4960379",
"0.4956098",
"0.49519107",
"0.49481738",
"0.49465117",
"0.49396548",
"0.493834",
"0.49379852",
"0.49275923",
"0.49275923",
"0.49275923",
"0.4923912",
"0.49191588",
"0.4917155",
"0.4913974",
"0.4913974",
"0.49056578",
"0.49053785",
"0.49009067",
"0.48986563",
"0.48976198",
"0.48922125",
"0.48909444",
"0.48848492",
"0.48792976",
"0.48733515",
"0.48715755",
"0.48685038",
"0.48665038",
"0.4866436",
"0.486227",
"0.48537636",
"0.48508584",
"0.4849919",
"0.48459923",
"0.4843728",
"0.48412046",
"0.48388046",
"0.48371112",
"0.48368979",
"0.48353404",
"0.48325098",
"0.48318666",
"0.48318624",
"0.48280296",
"0.4827319",
"0.48148614",
"0.4814536"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.