query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns only the Races with +results+
def races_with_results races.select(&:any_results?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_results(race)\n Result.all(\n :include => [:race, {:person => :team}, :team, {:race => [:event, :category]}],\n :conditions => [%Q{\n members_only_place between 1 AND #{point_schedule.size - 1}\n and results.person_id is not null\n and events.type = 'SingleDayEvent' \n and events.sanctioned_by = \"#{RacingAssociation.current.default_sanctioned_by}\"\n and categories.id in (#{category_ids_for(race).join(\", \")})\n and (races.bar_points > 0 or (races.bar_points is null and events.bar_points > 0))\n and events.date between '#{date.beginning_of_year}' and '#{date.end_of_year}'\n }],\n :order => 'person_id'\n )\n end", "def source_results(race)\n return [] if event.events.empty?\n \n event_ids = event.events.collect do |event|\n event.id\n end\n event_ids = event_ids.join(', ')\n category_ids = category_ids_for(race)\n \n Result.find_by_sql(\n %Q{ SELECT results.id as id, race_id, racer_id, team_id, place FROM results \n JOIN races ON races.id = results.race_id \n JOIN categories ON categories.id = races.category_id \n JOIN standings ON races.standings_id = standings.id \n JOIN events ON standings.event_id = events.id \n WHERE (standings.type = 'Standings' or standings.type is null)\n and place between 1 and 18\n and categories.id in (#{category_ids})\n and events.id in (#{event_ids})\n order by racer_id\n }\n )\n end", "def source_results(race)\n category_ids = category_ids_for(race).join(\", \")\n\n Result.all(\n :include => [:race, {:person => :team}, :team, {:race => [{:event => { :parent => :parent }}, :category]}],\n :conditions => [%Q{\n (events.type in ('Event', 'SingleDayEvent', 'MultiDayEvent') or events.type is NULL)\n and bar = true\n and categories.id in (#{category_ids})\n and (events.discipline = '#{race.discipline}'\n or (events.discipline is null and parents_events.discipline = '#{race.discipline}')\n or (events.discipline is null and parents_events.discipline is null and parents_events_2.discipline = '#{race.discipline}'))\n and (races.bar_points > 0\n or (races.bar_points is null and events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points is null and parents_events_2.bar_points > 0))\n and events.date between '#{date.year}-01-01' and '#{date.year}-12-31'\n }],\n :order => 'person_id'\n )\n end", "def source_results(race)\n query = Result.\n select([\"results.id as id\", \"person_id as participant_id\", \"people.member_from\", \"people.member_to\", \"place\", \"results.event_id\", \"race_id\", \"events.date\", \"year\"]).\n joins(:race, :event, :person).\n where(\"place != 'DNS'\").\n where(\"races.category_id is not null\").\n where(\"events.type = 'SingleDayEvent' or events.type = 'Event' or events.type is null\").\n where(\"events.ironman = true\").\n where(\"results.year = ?\", year)\n\n Result.connection.select_all query\n end", "def source_results(race)\n if race.discipline == 'Road'\n race_disciplines = \"'Road', 'Circuit'\"\n else\n race_disciplines = \"'#{race.discipline}'\"\n end\n \n # Cat 4/5 is a special case. Can't config in database because it's a circular relationship.\n category_ids = category_ids_for(race)\n category_4_5_men = Category.find_by_name(\"Category 4/5 Men\")\n category_4_men = Category.find_by_name(\"Category 4 Men\")\n if category_4_5_men && category_4_men && race.category == category_4_men\n category_ids << \", #{category_4_5_men.id}\"\n end\n\n Result.find(:all,\n :include => [:race, {:person => :team}, :team, {:race => [{:event => { :parent => :parent }}, :category]}],\n :conditions => [%Q{\n place between 1 AND #{point_schedule.size - 1}\n and (events.type in ('Event', 'SingleDayEvent', 'MultiDayEvent', 'Series', 'WeeklySeries', 'TaborOverall') or events.type is NULL)\n and bar = true\n and events.sanctioned_by = \"#{ASSOCIATION.default_sanctioned_by}\"\n and categories.id in (#{category_ids})\n and (events.discipline in (#{race_disciplines})\n or (events.discipline is null and parents_events.discipline in (#{race_disciplines}))\n or (events.discipline is null and parents_events.discipline is null and parents_events_2.discipline in (#{race_disciplines})))\n and (races.bar_points > 0\n or (races.bar_points is null and events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points > 0)\n or (races.bar_points is null and events.bar_points is null and parents_events.bar_points is null and parents_events_2.bar_points > 0))\n and events.date between '#{date.year}-01-01' and '#{date.year}-12-31'\n }],\n :order => 'person_id'\n )\n end", "def source_results(race)\n Result.find_by_sql(\n %Q{SELECT results.points, results.id as id, race_id, racer_id, team_id, place \n FROM results \n LEFT OUTER JOIN races ON races.id = results.race_id \n LEFT OUTER JOIN standings ON races.standings_id = standings.id \n LEFT OUTER JOIN events ON standings.event_id = events.id \n LEFT OUTER JOIN categories ON races.category_id = categories.id \n where results.id in (select source_result_id \n from scores \n LEFT OUTER JOIN results as competition_results \n ON competition_results.id = scores.competition_result_id\n LEFT OUTER JOIN races as competition_races \n ON competition_races.id = competition_results.race_id\n LEFT OUTER JOIN standings as competition_standings \n ON competition_races.standings_id = competition_standings.id \n LEFT OUTER JOIN events as competition_events \n ON competition_standings.event_id = competition_events.id \n where competition_events.type = 'Bar' \n and competition_events.date >= '#{date.year}-01-01' \n and competition_events.date <= '#{date.year}-12-31')\n order by team_id}\n )\n end", "def after_source_results(results, _race)\n results.reject do |result|\n result[\"category_name\"][\"Junior\"] &&\n result[\"category_ages_begin\"] &&\n (\n result[\"category_ages_begin\"] > ::Categories::Ages::JUNIORS.begin ||\n result[\"category_ages_end\"] < ::Categories::Ages::JUNIORS.end\n )\n end\n end", "def get_results\n\t\trace_id = params[:id]\n\t\t\n\t\trace = Race.find_by_id(race_id)\n\t\tresults = Result.get_race_results(race_id)\n\t\t\n\t\trender :json=>{:results=>results}\n\tend", "def source_results(race)\n []\n end", "def competition_results\n results.select(&:competition_result?)\n end", "def create_competition_results_for(results, race)\n competition_result = nil\n results.each_with_index do |source_result, index|\n logger.debug(\"#{self.class.name} scoring result: #{source_result.date} race: #{source_result.race.name} pl: #{source_result.place} mem pl: #{source_result.members_only_place if place_members_only?} #{source_result.last_name} #{source_result.team_name}\") if logger.debug?\n\n racer = source_result.racer\n points = points_for(source_result)\n if points > 0.0 && (!members_only? || member?(racer, source_result.date))\n \n if first_result_for_racer(source_result, competition_result)\n # Intentionally not using results association create method. No need to hang on to all competition results.\n # In fact, this could cause serious memory issues with the Ironman\n competition_result = Result.create!(\n :racer => racer, \n :team => (racer ? racer.team : nil),\n :race => race)\n end\n \n Competition.benchmark('competition_result.scores.create_if_best_result_for_race') {\n competition_result.scores.create_if_best_result_for_race(\n :source_result => source_result, \n :competition_result => competition_result, \n :points => points\n )\n }\n end\n \n # Aggressive memory management. If competition has a race with many results, \n # the results array can become a large, uneeded, structure\n results[index] = nil\n GC.start if index > 0 && index % 1000 == 0\n end\n end", "def create_competition_results_for(results, race)\n competition_result = nil\n for source_result in results\n logger.debug(\"#{self.class.name} scoring result: #{source_result.race.name} #{source_result.place} #{source_result.name} #{source_result.team_name}\") if logger.debug?\n\n teams = extract_teams_from(source_result)\n logger.debug(\"#{self.class.name} teams for result: #{teams}\") if logger.debug?\n for team in teams\n if member?(team, source_result.date)\n\n if first_result_for_team(source_result, competition_result)\n # Bit of a hack here, because we split tandem team results into two results,\n # we can't guarantee that results are in team-order.\n # So 'first result' really means 'not the same as last result'\n competition_result = race.results.detect {|result| result.team == team}\n competition_result = race.results.create(:team => team) if competition_result.nil?\n end\n\n score = competition_result.scores.create(\n :source_result => source_result, \n :competition_result => competition_result, \n :points => points_for(source_result).to_f / teams.size\n )\n end\n end\n end\n end", "def create_competition_results_for(results, race)\n competition_result = nil\n results.each_with_index do |source_result, index|\n logger.debug(\"#{self.class.name} scoring result: #{source_result.date} race: #{source_result.race.name} pl: #{source_result.place} mem pl: #{source_result.members_only_place if place_members_only?} #{source_result.last_name} #{source_result.team_name}\") if logger.debug?\n\n racer = source_result.racer\n points = points_for(source_result)\n \n # We repeat some calculations here if a racer is disallowed\n if points > 0.0 && (!event.completed? || (event.completed? && raced_minimum_events?(racer, race))) && (!members_only? || member?(racer, source_result.date))\n\n if first_result_for_racer(source_result, competition_result)\n # Intentionally not using results association create method. No need to hang on to all competition results.\n # In fact, this could cause serious memory issues with the Ironman\n competition_result = Result.create!(\n :racer => racer, \n :team => (racer ? racer.team : nil),\n :race => race)\n end\n\n Competition.benchmark('competition_result.scores.create_if_best_result_for_race') {\n competition_result.scores.create_if_best_result_for_race(\n :source_result => source_result, \n :competition_result => competition_result, \n :points => points\n )\n }\n end\n\n # Aggressive memory management. If competition has a race with many results, \n # the results array can become a large, uneeded, structure\n results[index] = nil\n if index > 0 && index % 1000 == 0\n logger.debug(\"GC start after record #{index}\")\n GC.start\n end\n\n end\n end", "def results_with_query(results)\n results.find_all do |result|\n query.all? do |attribute, value|\n result.send(attribute) == value\n end\n end\n end", "def event_results(reload = true)\n if reload\n return Result\n .includes(:team, :person, :scores, :category, race: %i[event category])\n .where(\"people.id\" => id)\n .reject(&:competition_result?)\n end\n results.reject(&:competition_result?)\n end", "def filter(results)\n if params[:q].present?\n results = Project.search(results, params[:q])\n end\n \n if params[:tag].present?\n results = Project.match_tag(results, params[:tag])\n end\n \n return results\n end", "def any_results?\n races.any?(&:any_results?)\n end", "def process_round_results(results_feed)\n race_table = results_feed['RaceTable']\n races = race_table['Races']\n round = race_table['round']\n race = races.first\n finishers = race['Results']\n race_result = {}\n qly_result = {}\n\n finishers.each do |finisher|\n driver = finisher['Driver']\n if finisher['position'].to_i <= 10\n race_result[finisher['position']] = get_driver_id(driver)\n end\n\n if finisher['grid'].to_i <= 3\n qly_result[finisher['grid']] = get_driver_id(driver)\n end\n end\n\n seed_race_result(round, race_result[\"1\"], race_result[\"2\"], race_result[\"3\"],\n race_result[\"4\"], race_result[\"5\"], race_result[\"6\"],\n race_result[\"7\"], race_result[\"8\"], race_result[\"9\"],\n race_result[\"10\"])\n seed_qly_result(round, qly_result[\"1\"], qly_result[\"2\"], qly_result[\"3\"])\n end", "def exclude_results(results, options)\n exclude_oob = options.fetch(:excluding_out_of_bounds, false)\n exclude_occupied = options.fetch(:excluding_occupied_spaces, false)\n\n results = excluding_out_of_bounds(results) if exclude_oob\n results = excluding_occupied_spaces(results) if exclude_occupied\n results\n end", "def fill_in_missing_results\n Result.all.group_by(&:race).each do |race, results|\n all_results=results.collect(&:place) #get an array of just places for this race \n results.sort!{|a,b| a.place.to_i <=> b.place.to_i} #important to get last place in last\n need_results=[]\n (1..results.last.place.to_i).reverse_each {|res|\n unless all_results.include?(res.to_s)\n #we need a result, there is a gap here\n race.results.create!(:place => res)\n end \n }\n end\n end", "def search_results(*args)\n ranks_and_ids = search_result_ranks_and_ids(*args)\n search_results_from_ids(ranks_and_ids.map(&:last))\n end", "def results\n \t\t@teams = Team.all\n\tend", "def merge_movie_search_results(results)\n results.flatten\n end", "def search_results(game_type)\n CombinedReplayData.search do\n all do\n any_of do\n with(:p1_rank).between(1..5)\n without(:p1_legend_rank, nil)\n end\n any_of do\n with(:p2_rank).between(1..5)\n without(:p2_legend_rank, nil)\n end\n end\n with(:played_at).greater_than(5.days.ago)\n with(:game_type, game_type)\n facet :p1_class_and_archetype\n facet :p2_class_and_archetype\n end\n end", "def get_rt_search_results\n search_results = RottenMovie.find(:title => \"#{params[:search]}\", :limit => 20)\n if search_results.length == nil #check if search returned a single object\n search_results = [search_results] #make it an array\n end\n search_results.each do |x| #capture relevant info from rottentomatoes\n film = Film.new(\"title\"=>\"#{x.title}\", \"year\"=>\"#{x.year}\", \"length\"=>\"#{x.runtime}\", \"synopsis\"=>\"#{x.synopsis}\", \"trailer\"=>\"\", \"rt_rating\"=>\"#{x.ratings.critics_score}\")\n @results << film\n \n if x.posters.thumbnail == nil\n @thumbs << \"/Users/skylersidner/Code/2015-02-13-reel-bad-night/public/images/poster_default.gif\"\n else\n @thumbs << x.posters.thumbnail\n end\n end #each\n @results\n end", "def results\n fetch unless @results\n @results\n end", "def results\n results = result_maker(RACER_RECORDS)\n total_time = total_time_maker(RACER_RECORDS)\n @view.display_results(results, total_time)\n end", "def test_results_filter(test_results)\n test_results.select do |tr|\n # Non TestResult items are never filtered.\n next true unless tr.kind_of?(Automation::TestDatabase::TestResult)\n entity_result(tr) != Automation::Result::Pass\n end\n end", "def run_results()\n sql = \"SELECT * FROM results\"\n results = run(sql)\n results.each do |result|\n event = Event.find(result['event_id'].to_i)\n knight = filter(result['knight_id'].to_i)\n trophy = Trophy.new(event,result['position'].to_i)\n knight.add_trophy(trophy)\n end\n end", "def get_likely_racers(race_id)\n already_registered = StartItem.where(:race_id => race_id).pluck(:racer_id)\n if already_registered.length > 0\n likely_racers = Racer.where([\"(race_count > ? OR current_streak > ?) AND id not in (?)\", 20, 0, already_registered]).order(\"current_streak DESC, race_count DESC\").first(20)\n else\n likely_racers = Racer.where([\"race_count > ? OR current_streak > ?\", 20, 0]).order(\"current_streak DESC, race_count DESC\").first(20)\n end\n return likely_racers\n end", "def show\n authorize @race\n @user_participations = current_user ? current_user.participations : nil\n @results = @race.results.page(params[:page])\n end", "def results_as_objects(results)\n results_as_objects = []\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects \n end", "def isobib_results_filter(result, refid)\n missed_years = []\n result.each do |r|\n /\\((?:\\d{2}\\/)?(?<pyear>\\d{4})\\)/ =~ r.hit[:code]\n if !refid.year || refid.year == pyear\n ret = r.fetch\n return { ret: ret } if ret\n end\n\n missed_years << pyear\n end\n { years: missed_years }\n end", "def process_results (results)\n\t\t\tresults.each do |result|\n\t\t\t\tresult = process_result(result)\n\t\t\tend\n\t\t\treturn results\n\t\tend", "def races\n \tContest.where(\"entrants.racer_id\"=> self.id).map {|contest| contest.entrants.where(:racer_id=>self.id).first}\n end", "def find_with(results, with = nil)\n ret = QueryResult.new\n ret << results if results\n ret << with if with\n ret.flatten!\n\n ret.size == 1 ? ret[0] : ret\n end", "def results\n @results\n end", "def results_from_search(query_results)\n ids = query_results.map do |result|\n result['id']\n end\n find_from_search(*ids)\n end", "def get_races(seasonid, raceweek)\n res = $client.post('/memberstats/member/GetSeriesRaceResults',\n \"seasonid=#{seasonid}&raceweek=#{raceweek}&invokedBy=SeriesRaceResults\",\n $headers)\n JSON.parse res.body\nend", "def results\n @results ||= with_hit.map(&:first)\n end", "def games\n self.results.map {|r|;r.game}\n end", "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end", "def index\n #@results = Result.all\n @run = Run.find(params[:run_id]) if params[:run_id] && params[:run_id].to_i > 0\n @runs = Run.find(:all, :order => \"eventday desc\", :conditions => {:showresults => true})\n #@results = Result.all\n @categories = Result.find_by_sql(\"select run_id, cat from results group by run_id, cat;\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @results }\n end\n end", "def results_for_division(division)\n if division == :all\n @results\n else\n sections = @festival_info.sections(division)\n @results.select { |section, result| sections.include? section }\n end\n end", "def results\n # @search_result = Recipe.where(\"name like ?\", \"%#{params[:search]}%\")\n\n @search_result = Recipe.joins(:food_items).joins(:directions).where(\"food_items.name ILIKE ? OR recipes.name ILIKE ? OR directions.instruction ILIKE ?\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").distinct\n \n end", "def all_competitor_results\n nil\n end", "def all_competitor_results\n nil\n end", "def all_competitor_results\n nil\n end", "def all_competitor_results\n nil\n end", "def all_competitor_results\n nil\n end", "def fill_in_missing_results\n Result.all.group_by(&:race).each do |race, results|\n all_results = results.collect(&:place)\n # important to get last place in last\n results.sort! { |a,b| a.place.to_i <=> b.place.to_i }\n (1..results.last.place.to_i).reverse_each { |res|\n unless all_results.include?(res.to_s)\n # we need a result, there is a gap here\n race.results.create!(:place => res)\n end \n }\n end\n end", "def contests(year)\n pc_results.joins(:c_result => :contest).where('year(contests.start) = ?', year).all\n end", "def results(params)\n fetch({'VarTargetCount' => RACE_CAP}.merge params)\n end", "def index\n if params[:timer_id]\n @timer = Timer.find(params[:timer_id])\n else\n return redirect_to timer_results_path(Timer.last)\n end\n\n scope = @timer.results.order(\"result asc\")\n\n if params[:result_ids]\n scope = scope.where(id: params[:result_ids])\n end\n\n if params[:min_id]\n scope = scope.newer_than(params[:min_id])\n end\n\n if params[:category_id]\n @results = scope.in_category(params[:category_id])\n else\n @results = scope\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @results }\n format.json do\n if params[:with_names]\n @results = @results.select{ |res| res.name.present? }\n end\n render :json => @results.to_json(:methods => [:name, :bib_number, :category_name])\n end\n format.js do\n render :partial => @results\n end\n end\n end", "def index\n @races = Race.all.where(:user_id => session[:user_id])\n end", "def fetch_race_links(link, curr_step, races = {})\r\n\t\tfilename, data = load_or_fetch_page(link)\r\n\t\tpage = Nokogiri::HTML(data)\r\n\r\n\t\tfilters = curr_step.filters\r\n\t\tputs \"fetch race_links: #{races.size}\"\r\n\t\tfound = filters.map do |f| \r\n\t\t\th = f.to_h\r\n\r\n\t\t\tputs \"filter: #{f.inspect}\"\r\n\r\n\t\t\telements = page.css(f[\"container\"])\r\n\r\n\t\t\telements.map do |element|\r\n\t\t\t\tdate = \"\"\r\n\t\t\t\tif h.key? :race_date\r\n\t\t\t\t\tsel = h[:race_date]\r\n\t\t\t\t\tdate = element.css(sel).text\r\n\t\t\t\tend\r\n\r\n\t\t\t\tlink = \"\"\r\n\t\t\t\tif h.key? :links\r\n\t\t\t\t\tsel = h[:links]\r\n\t\t\t\t\tlink = element.css(sel).first.attributes[\"href\"].value\r\n\t\t\t\tend\r\n\t\t\t\t# puts \"link: #{link}\"\r\n\r\n\t\t\t\tif h.key? :race_name\r\n\t\t\t\t\tsel = h[:race_name]\r\n\t\t\t\t\tname = element.css(sel).text\r\n\r\n\t\t\t\t\t# add info to already found race, or create race\r\n\t\t\t\t\trace = races[name] || Race.new(name)\r\n\t\t\t\t\trace.date ||= date # only set if not already set\r\n\t\t\t\t\trace.results_link ||= []\r\n\t\t\t\t\trace.results_link << link\r\n\t\t\t\t\traces[name] = race\r\n\t\t\t\t\tputs \"found race #{name} results_link: #{race.results_link}\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\traces\r\n\tend", "def cache_results(results)\n return if search_param.length > 2\n results.each_with_index do |result, index|\n redis.zadd(cache_set, index, result)\n end\n redis.expire(cache_set, 24 * 60 * 60)\n end", "def filter_results(current_role, results, filter_data)\n if filter_data['annotationText'].present?\n results = results.joins(annotations: :annotation_text)\n .where('lower(annotation_texts.content) LIKE ?',\n \"%#{AnnotationText.sanitize_sql_like(filter_data['annotationText'].downcase)}%\")\n end\n if filter_data['section'].present?\n results = results.joins(grouping: :section).where('section.name': filter_data['section'])\n end\n if filter_data['markingState'].present?\n remark_results = results.where.not('results.remark_request_submitted_at': nil)\n .where('results.marking_state': Result::MARKING_STATES[:incomplete])\n released_results = results.where.not('results.id': remark_results).where('results.released_to_students': true)\n case filter_data['markingState']\n when 'remark_requested'\n results = remark_results\n when 'released'\n results = released_results\n when 'complete'\n results = results.where.not('results.id': released_results)\n .where('results.marking_state': Result::MARKING_STATES[:complete])\n when 'in_progress'\n results = results.where.not('results.id': remark_results).where.not('results.id': released_results)\n .where('results.marking_state': Result::MARKING_STATES[:incomplete])\n end\n end\n\n unless current_role.ta? || filter_data['tas'].blank?\n results = results.joins(grouping: { tas: :user }).where('user.user_name': filter_data['tas'])\n end\n if filter_data['tags'].present?\n results = results.joins(grouping: :tags).where('tags.name': filter_data['tags'])\n end\n unless filter_data.dig('totalMarkRange', 'max').blank? && filter_data.dig('totalMarkRange', 'min').blank?\n result_ids = results.ids\n total_marks_hash = Result.get_total_marks(result_ids)\n if filter_data.dig('totalMarkRange', 'max').present?\n total_marks_hash.select! { |_, value| value <= filter_data['totalMarkRange']['max'].to_f }\n end\n if filter_data.dig('totalMarkRange', 'min').present?\n total_marks_hash.select! { |_, value| value >= filter_data['totalMarkRange']['min'].to_f }\n end\n results = Result.where('results.id': total_marks_hash.keys)\n end\n unless filter_data.dig('totalExtraMarkRange', 'max').blank? && filter_data.dig('totalExtraMarkRange', 'min').blank?\n result_ids = results.ids\n total_marks_hash = Result.get_total_extra_marks(result_ids)\n if filter_data.dig('totalExtraMarkRange', 'max').present?\n total_marks_hash.select! do |_, value|\n value <= filter_data['totalExtraMarkRange']['max'].to_f\n end\n end\n if filter_data.dig('totalExtraMarkRange', 'min').present?\n total_marks_hash.select! do |_, value|\n value >= filter_data['totalExtraMarkRange']['min'].to_f\n end\n end\n results = Result.where('results.id': total_marks_hash.keys)\n end\n if filter_data['criteria'].present?\n results = results.joins(marks: :criterion)\n temp_results = Result.none\n num_criteria = 0\n filter_data['criteria'].each do |name, range|\n num_criteria += 1\n if range.present? && range['min'].present? && range['max'].present?\n temp_results = temp_results.or(results\n .where('criteria.name = ? AND marks.mark >= ? AND marks.mark <= ?',\n name, range['min'].to_f, range['max'].to_f))\n elsif range.present? && range['min'].present?\n temp_results = temp_results.or(results\n .where('criteria.name = ? AND marks.mark >= ?',\n name, range['min'].to_f))\n elsif range.present? && range['max'].present?\n temp_results = temp_results.or(results\n .where('criteria.name = ? AND marks.mark <= ?',\n name, range['max'].to_f))\n else\n temp_results = temp_results.or(results\n .where(criteria: { name: name }))\n end\n end\n results = temp_results.group(:id).having('count(results.id) >= ?', num_criteria)\n end\n results.joins(grouping: :group)\n end", "def results\n documents = [conditions, variables].any?(&:present?) ? IndexTankClient.new.search(conditions, variables) : []\n movie_results = documents.inject([]) do |movies, document|\n movies << Movie.convert_from_index_tank(document)\n end\n movie_results.sort_by(&:name)\n end", "def results\n numOfSearches = numEvents / @OFFSET #the number of searches we must make to return all values\n result = Array.new\n if (complete?)\n for i in 0..numOfSearches\n result.push( @client.get_request(\"/services/search/jobs/#{@sid}/results\", {'output_mode' => @OUTPUT_MODE, 'count' => @OFFSET, 'offset' => (@OFFSET * i)}))\n end\n end\n result\n end", "def results\n @results ||= Results.new(self)\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n end", "def parse_results(results)\n out = []\n results = [results] if results.is_a?(Hash) # no array if only one result\n results.each do |r|\n out << Result.new(r)\n end\n out\n end", "def results\n @students = Student.where('name LIKE ?', \"%#{params[:q]}%\")\n end", "def cyclist_result (cyclist, race)\n cyclist_result = [] \n if race.nil?\n cyclist.rosters.each do |roster|\n race = Race.find(roster.race_id)\n race.stages.each do |stage|\n stage_effort = cyclist.stage_efforts.find_by(stage_id: stage.id)\n race_name = \"#{race.name} - #{stage.name}\"\n if stage_effort\n time = stage_effort.elapsed_time ? Time.at(stage_effort.elapsed_time).utc.strftime('%H:%M:%S') : 'DNF'\n strava_url = stage_effort.strava_activity_url ? stage_effort.strava_activity_url : 'DNF'\n avg_watts = stage_effort.segment_avg_watts ? \"#{stage_effort.segment_avg_watts.to_f.round(1)}w\" : 'DNF'\n unless stage_effort.nil?\n temp = stage_effort.segment_avg_watts.to_f / cyclist.weight.to_f unless cyclist.weight.to_f == 0\n end \n watts_per_k = temp ? \"#{temp.to_f.round(1)}\" : 'DNF'\n time_stamp = stage_effort.created_at.to_formatted_s(:db)\n cyclist_result << { \n 'race' => race_name,\n 'stage' => stage.stage_no, \n 'time' => time, \n 'strava_url' => strava_url, \n 'avg_watts' => avg_watts, \n 'watts_per_k' => watts_per_k, \n 'time_stamp' => time_stamp\n }\n end\n end\n end \n cyclist_result.sort!{|a, b| [ a['time_stamp'] ] <=> [ b['time_stamp'] ] } unless cyclist_result.nil?\n cyclist_result.reverse! unless cyclist_result.nil? \n else\n race.stages.each do |stage|\n stage_effort = cyclist.stage_efforts.find_by(stage_id: stage.id)\n race_name = \"#{race.name} - #{stage.name}\"\n if stage_effort\n time = stage_effort.elapsed_time ? Time.at(stage_effort.elapsed_time).utc.strftime('%H:%M:%S') : 'DNF'\n strava_url = stage_effort.strava_activity_url ? stage_effort.strava_activity_url : 'DNF'\n avg_watts = stage_effort.segment_avg_watts ? \"#{stage_effort.segment_avg_watts.to_f.round(1)}w\" : 'DNF'\n unless stage_effort.nil?\n temp = stage_effort.segment_avg_watts.to_f / cyclist.weight.to_f unless cyclist.weight.to_f == 0\n end \n watts_per_k = temp ? \"#{temp.to_f.round(1)}\" : 'DNF'\n time_stamp = stage_effort.created_at.to_formatted_s(:db)\n # puts \"#{race_name}-#{time}-#{strava_url}-#{avg_watts}-#{watts_per_k}-#{time_stamp}\"\n cyclist_result << { 'race'=> race_name, 'stage'=> stage.stage_no, 'time'=> time, 'strava_url'=> strava_url, 'avg_watts'=> avg_watts, 'watts_per_k' => watts_per_k, 'time_stamp' => time_stamp }\n end\n end\n end\n \n return cyclist_result\n end", "def results\n @results ||= {}\n end", "def get_results\n \titems = self.possessions.find(:all, :limit => 20, :order => 'wants_count DESC')\n #reset data just for testing\n Possession.all.each do |item|\n item.new_owner = nil\n item.save\n end\n \t# items = prune(items)\n \tif items.count > 1\n \t\tfind_some_trades(items)\n \tend\n end", "def index\n @results = Result.all\n\n end", "def after_create_competition_results_for(race)\n race.results.each do |result|\n result.scores.sort! { |x, y| y.points <=> x.points }\n remove_duplicate_discipline_results result.scores\n\n if result.scores.size > 5\n lowest_scores = result.scores[5, result.scores.size - 5]\n lowest_scores.each do |lowest_score|\n result.scores.destroy lowest_score\n end\n # Rails destroys Score in database, but doesn't update the current association\n result.scores true\n end\n end\n end", "def team\n @team = Team.find(params[:team_id])\n set_date_and_year\n @results = Result.all(\n :conditions => [ \"team_id = ? and year = ? and competition_result = false and team_competition_result = false\", @team.id, @date.year ]\n )\n end", "def results_as_objects(results)\n array_of_objects = []\n results.each do |hash|\n array_of_objects << self.new(hash)\n end\n return array_of_objects\n end", "def index\n @races = Race.all\n end", "def results\n populate\n @results\n end", "def set_results(meeting_individual_results)\n @results = []\n meeting_individual_results.each do |meeting_individual_result|\n @results << meeting_individual_result\n end\n sort_results\n synchronize\n end", "def index\n @results = Result.all\n end", "def test_results(id)\n return [] unless @rule_results\n\n @rule_results.select { |r| r.idref == id }\n end", "def index\n @survey = Survey.find(params[:survey_id])\n @results = @survey.results.all\n end", "def get_results\n @results ||= @badge.meeting_individual_results.is_not_disqualified.sort_by_standard_points if @badge\n end", "def results(do_all=false)\n [].tap do |res|\n if do_all || term_matches.present?\n res << IndexedSearch::Match::Result.new(self, term_map, rank_multiplier, term_multiplier, limit_reduction_factor, type_reduction_factor)\n end\n end\n end", "def present_results(results)\n dash_separator\n add_results results\n dash_separator\n end", "def results\n index.results\n end", "def bib_results_filter(result, year)\n missed_years = []\n result.each do |r|\n item = r.fetch\n item.fetched = Date.today.to_s\n return { ret: item } if !year\n\n item.date.select { |d| d.type == \"published\" }.each do |d|\n return { ret: item } if year.to_i == d.on(:year)\n\n missed_years << d.on(:year)\n end\n end\n { years: missed_years }\n end", "def reify_results(ids)\n results = []\n \n ids_hash = {}\n ids.each do |class_name, id|\n (ids_hash[class_name] ||= []) << id\n end\n \n ids.map {|ary| ary.first}.uniq.each do |class_name|\n klass = class_name.constantize\n \n finder = (\n Ultrasphinx::Search.client_options['finder_methods'].detect do |method_name| \n klass.respond_to? method_name\n end or\n # XXX This default is kind of buried, but I'm not sure why you would need it to be \n # configurable, since you can use ['finder_methods'].\n \"find_all_by_#{klass.primary_key}\"\n )\n\n records = klass.send(finder, ids_hash[class_name])\n \n unless Ultrasphinx::Search.client_options['ignore_missing_records']\n if records.size != ids_hash[class_name].size\n missed_ids = ids_hash[class_name] - records.map(&:id)\n msg = if missed_ids.size == 1\n \"Couldn't find #{class_name} with ID=#{missed_ids.first}\"\n else\n \"Couldn't find #{class_name.pluralize} with IDs: #{missed_ids.join(',')} (found #{records.size} results, but was looking for #{ids_hash[class_name].size})\"\n end\n raise ActiveRecord::RecordNotFound, msg\n end\n end\n \n records.each do |record|\n results[ids.index([class_name, record.id])] = record\n end\n end\n \n # Add an accessor for global search rank for each record, if requested\n if self.class.client_options['with_global_rank']\n # XXX Nobody uses this\n results.each_with_index do |result, index|\n if result\n global_index = per_page * (current_page - 1) + index\n result.instance_variable_get('@attributes')['result_index'] = global_index\n end\n end\n end\n\n # Add an accessor for distance, if requested\n if self.options['location']['lat'] and self.options['location']['long']\n results.each_with_index do |result, index|\n if result\n distance = (response[:matches][index][:attributes]['@geodist'] or INFINITY)\n result.instance_variable_get('@attributes')['distance'] = distance\n end\n end\n end\n \n results.compact!\n \n if ids.size - results.size > Ultrasphinx::Search.client_options['max_missing_records']\n # Never reached if Ultrasphinx::Search.client_options['ignore_missing_records'] is false due to raise\n raise ConfigurationError, \"Too many results for this query returned ActiveRecord::RecordNotFound. The index is probably out of date\" \n end\n \n results \n end", "def index\n @load_javascript = true\n @race_results = RaceResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @race_results }\n end\n end", "def any_results_including_children?\n races.any?(&:any_results?) || children.any?(&:any_results_including_children?)\n end", "def run(results)\n if(use_multiple?(results))\n results = run_multiple(results)\n else\n results = run_single(results)\n end\n return results\n end", "def result_analytes\n self.specimen.includes(results: :analyte)\n .where(results: {reported_at: DateTime.new(2014,1,1)..DateTime.new(2014,4,1)})\n .pluck('distinct analytes.analyte_name')\n end", "def filtered_results(results)\n return [] if results.blank?\n\n members = results.first[:uniquemember]\n members = results.first[:member] if members.blank?\n members.map do |r|\n uid = r.split(\",\").first\n uid.split(\"=\", 2).last\n end\n end", "def plan_results\n if @results\n return @results\n end\n\n p 'Getting results for ' + last_commit_hash\n api = BambooAPI.new\n results = api.result_by_changeset(last_commit_hash)\n @results = results\n p results\n p results.class\n results\n end", "def index\n @search = search_params\n @results = InstructorInfo.order(\"RANDOM()\").limit(12)\n @tutor_reviews = Review.last(12).reverse\n unless @search[:min_rating].empty?\n @results = @results.where(\"avg_rating >= ?\", @search[:min_rating])\n end\n unless @search[:join_at].empty?\n if @search[:join_at] == \"半年内\"\n @results = @results.where(created_at: 6.month.ago..Date.today())\n elsif @search[:join_at] == \"半年到一年\"\n @results = @results.where(created_at: 1.year.ago..6.month.ago)\n elsif @search[:join_at] == \"一年以上\"\n @results = @results.where('created_at < ?', 1.year.ago)\n end\n end\n unless @search[:price_range] == '0,1000'\n min, max = @search[:price_range].split(',')\n @results = @results.where(price_base: min..max)\n end\n unless @search[:service].empty?\n or_results = nil\n for service in @search[:service]\n if service == \"早期咨询\"\n tmp = @results.where(is_early_consult: true)\n elsif service == \"头脑风暴\"\n tmp = @results.where(is_brainstorm_consult: true)\n elsif service == \"文书改写\"\n tmp = @results.where(is_essay_consult: true)\n elsif service == \"签证咨询\"\n tmp = @results.where(is_visa_consult: true)\n end\n or_results = or_results.nil? ? tmp : or_results.or(tmp)\n end\n @results = or_results\n end\n unless @search[:available_time].empty?\n end\n end", "def results\n @results ||= Results.new(klass, self)\n end", "def search_result\n freelancers = find_all FREELANCERS\n end", "def merge_results(*results); end", "def merge_results(*results); end", "def merge_results(*results); end", "def pupil_results( pupil, teacher, subject_name, school_class )\n curriculum = curriculum_for_teacher_with_subject_and_class( teacher, subject_name,\n school_class )\n if not curriculum.nil? and not pupil.nil?\n pupil.results.where(:curriculum_id => curriculum.id).first # Find results of pupil for chosen subject and class code.\n else\n nil\n end\n end", "def cache_results\n return unless current_user && !using_defaults\n\n # Do the results contain master_id? If so, get a unique list of master id results\n master_ids = results.map { |r| r['master_id'] }.uniq if field_index('master_id')\n\n # We through other stuff into the search attribute values that are not needed for storing results\n # Just pass over the real key-value pairs that correspond to the configured attributes\n real_search_attr_values = search_attr_values.slice(*search_attributes.keys)\n\n previous_filtering.store_results(report.id, report.name, master_ids, results.count, real_search_attr_values)\n end", "def check_for_results\n if @names[0] == \"You can also try results from Google...\"\n return {\n beer_1: {\n name: \"Sorry no results found on BA\",\n brewery: \"\",\n style: \"\",\n url: \"\"\n }\n }\n end\n create_result_hash\n end", "def results\r\n \r\n if params[:tag][:id].empty?\r\n params[:tag][:id] = nil\r\n end\r\n \r\n if params[:unitcode][:id].empty?\r\n params[:unitcode][:id] = nil\r\n end\r\n \r\n if params[:thread][:posted_after].empty?\r\n params[:thread][:posted_after] = nil\r\n end\r\n \r\n @threads = Athread.search(params[:search], params[:tag][:id], params[:unitcode][:id], params[:thread][:posted_after])\r\n \r\n end" ]
[ "0.72392356", "0.70322144", "0.69340986", "0.69137114", "0.6877534", "0.67981076", "0.6605429", "0.6552044", "0.64661694", "0.633136", "0.6317928", "0.62822217", "0.62274146", "0.6181003", "0.61339587", "0.59963137", "0.5985405", "0.5925433", "0.5776336", "0.5770774", "0.5759061", "0.5729884", "0.5728552", "0.5715455", "0.56708694", "0.566765", "0.56639206", "0.56456673", "0.56397337", "0.5635931", "0.5625904", "0.55948865", "0.5581198", "0.5566525", "0.5563794", "0.55630434", "0.55607074", "0.5552687", "0.55524254", "0.55476135", "0.5537422", "0.55361456", "0.5536059", "0.55334693", "0.5518055", "0.551669", "0.551669", "0.551669", "0.551669", "0.551669", "0.5498264", "0.54828376", "0.54744947", "0.54706335", "0.54600036", "0.5450792", "0.5448237", "0.5422233", "0.53996795", "0.5396779", "0.5388433", "0.5379447", "0.5379447", "0.5366539", "0.53634083", "0.5362794", "0.5350512", "0.53500515", "0.5346925", "0.5345067", "0.5335944", "0.53297377", "0.5329305", "0.53253716", "0.53166443", "0.5315359", "0.53116983", "0.5302282", "0.5300406", "0.5298574", "0.52848864", "0.52768654", "0.52683556", "0.5259555", "0.52584624", "0.5256845", "0.5242886", "0.5231131", "0.52221453", "0.5221631", "0.5221271", "0.52200973", "0.52167565", "0.5214014", "0.52139777", "0.52139777", "0.5212711", "0.5205616", "0.52046126", "0.5200157" ]
0.7977516
0
Helper method for as_json
def sorted_races races.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json arg\n as_json.to_json\n end", "def as_json(*)\n to_h\n end", "def json_serialize\n end", "def as_json\n to_s.as_json\n end", "def to_json_raw_object()\n #This is a stub, used for indexing\n end", "def to_json\n\n end", "def as_json(_opts={})\n raise NotImplementedError\n end", "def to_json_raw(*args)\n #This is a stub, used for indexing\n end", "def to_json(*options)\n as_json(*options).to_json(*options)\n \tend", "def to_json\r\n to_hash.to_json\r\n end", "def to_json(*)\n #This is a stub, used for indexing\n end", "def as_json\n JSON.parse self.to_json\n end", "def to_json\n JSON(as_json)\n end", "def to_json\n to_s.to_json\n end", "def to_json(*args); end", "def tojson\n\t\tend", "def to_json\n to_parsed.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 to_json *args\n as_json.to_json *args\n end", "def get_json\n return to_json()\nend", "def to_json\n raise StandardError, \"Not implemented!\"\n end", "def to_json\n to_hash.to_json\n end", "def as_json(*_args)\n as_extended_json\n end", "def to_json\n @json.to_json\n end", "def to_json\n to_raw.to_json\n end", "def to_json\n to_json_object.to_json\n end", "def to_json\n self.to_hash.to_json\n end", "def to_json\n self.to_hash.to_json\n end", "def as_json(*args)\n {}.as_json\n end", "def to_json\n return to_hash.to_json\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*args)\n as_json.to_json(*args)\n end", "def to_json(*args)\n as_json.to_json(*args)\n end", "def to_json(*args)\n as_json.to_json(*args)\n end", "def to_json(*args)\n as_json.to_json(*args)\n end", "def to_json(*args)\n as_json.to_json(*args)\n end", "def as_json\n record\n end", "def to_json(*_arg0); end", "def to_json(*_arg0); end", "def to_json\n to_h.to_json\n end", "def to_json\n to_h.to_json\n end", "def json\n @json_hash.to_json\n end", "def to_json *args \n self.to_hash.to_json\n end", "def to_json *args \n self.to_hash.to_json\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'a' => to_a,\n }\n end", "def to_json(*options)\n\t\tas_json(*options).to_json(*options)\n\tend", "def to_json(*a)\n @json\n end", "def to_json\n self.to_h.to_json\n end", "def as_json(*)\n values\n end", "def as_json(*args)\n { EXTENDED_JSON_KEY => to_s }\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def to_json(*a)\n as_json.to_json(*a)\n end", "def to_json\n to_a.to_json\n end", "def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end", "def as_json(options = nil)\n json = super\n json['id'] = d.to_i\n json\n end", "def as_json(*args)\n {}.update(self)\n end", "def for_json\n to_hash\n end", "def as_json(*args)\n to_h.as_json(*args)\n end", "def to_json\n @json ||= get_json\n end", "def as_json(**options)\n value\n end", "def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'a' => [ first, last, exclude_end? ]\n }\n end", "def as_json\n @data\n end", "def to_json(*)\n to_hash.to_json\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*options)\n as_json.to_json(*options)\n end", "def to_json\n to_hash.to_json\n end", "def to_json\n to_hash.to_json\n end", "def render_json\n end", "def to_json!\n self.to_hash.to_json\n end", "def to_json\n @data.to_json\n end", "def to_json(*a)\n as_json.to_json(*a)\n end", "def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end", "def to_json\n self.to_hash.to_json\n end" ]
[ "0.76731", "0.76194453", "0.75528324", "0.7465485", "0.7444888", "0.738793", "0.7385769", "0.73484665", "0.733767", "0.73314923", "0.7330415", "0.73260325", "0.7314121", "0.72811514", "0.72662497", "0.72452545", "0.723151", "0.7207924", "0.7207924", "0.7199949", "0.71953446", "0.7185261", "0.71700245", "0.7157908", "0.71571976", "0.7142167", "0.7138755", "0.7136767", "0.7136767", "0.71312445", "0.7131183", "0.71299946", "0.71299946", "0.71299946", "0.71299946", "0.71299946", "0.71299946", "0.71191925", "0.71191925", "0.71191925", "0.71191925", "0.71174854", "0.7103514", "0.70855725", "0.70855725", "0.70795923", "0.70795923", "0.70701236", "0.7044784", "0.7044784", "0.7039952", "0.69991386", "0.69939274", "0.6971352", "0.6967016", "0.6959537", "0.69490457", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.69437355", "0.6941257", "0.69402087", "0.69401145", "0.693945", "0.6936218", "0.6934119", "0.6933682", "0.6928024", "0.692717", "0.69228727", "0.6916722", "0.6897206", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68878067", "0.68803346", "0.68707216", "0.68707216", "0.68664384", "0.68641686", "0.6854535", "0.68512034", "0.68508947", "0.68485725" ]
0.0
-1
Load the next page of artists
def load_page respond_to do |format| format.html do load_artists_page render '_artist_rows' , layout: false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @next_artwork = get_next\n @previous_artwork = get_previous\n @fbLink = \"http://helenafogelberg.se/artworks/{@artwork.id}\"\n end", "def next_page\n\t\t\tFeed.parse_url(next_page_url,@browser)\n\t\tend", "def next_page(params = {})\n @items = load_page(params)\n end", "def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend", "def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\n @browser.pluggable_parser.html = Mechanize::Page\n\n previous_length != @results.size\n end", "def next_page; end", "def next_page\n end", "def get_next_page\n nextlink = @doc.search(\"//p[@class='nextprev']/a[@rel='nofollow next']\")\n nextlink.map! { |link| \"#{link['href']}\" }\n stringlink = nextlink[0]\n @doc = open(stringlink) { |f| Hpricot(f) }\n get_links\n end", "def next_page\n url = @entity[:next]\n return unless url\n\n query = URI.decode_www_form(URI(url).query).to_h\n query = query.to_h { |k, v| [k.to_sym, v] }\n self.class.list(**query)\n end", "def next_page; link 'next' end", "def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == 24 && @@load_favs == 0) || (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\tdestroy_window()\n\t\t\tif @@load_favs == 0\t\n\t\t\t\tshow()\n\t\t\telse\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend", "def show\n @gear_pages = GearPage.find(params[:id])\n @artist = Artist.new\n end", "def show\n @events = @artist.next_events\n @products = @artist.products\n end", "def next_page\n @page.link_with(:text => /Next/)\n end", "def next\n goto(@current_page + 1)\n end", "def next_page\n sync.get(next_page_url) if next_page?\n end", "def next_page\n string = QJ.next_string()\n url = BSU + string\n BR.goto(url)\nend", "def next_page\n @links['next']\n end", "def get_next_article(url)\n uri = URI(URI::Parser.new.escape(url))\n response = Net::HTTP.get(uri)\n\n doc = Nokogiri::HTML.parse(response)\n\n #article = doc.at('a:contains(\"Article suivant\")')\n article = doc.at('a:contains(\"Nächster Artikel\")')\n article['href']\nend", "def next_page\n begin\n next_btn = @driver.find_element(link_text: 'NEXT CHAPTER')\n rescue\n @end_state = true\n end\n if not @end_state\n next_btn.click\n end\n @current_title = @driver.find_element(tag_name: 'h1').text #update title\n end", "def next\n perform_request(next_page_uri) if next?\n end", "def show\n @murals = @artist.murals.page(params[:page])\n end", "def next_page\n # The only difference from the default here is we renamed the link to \"More\"\n # and added a custom class, twitter_pagination\n previous_or_next_page(@collection.next_page, '<div class=\"hover-move\"><img src=\"assets/next.png\" alt=\"next\"/></div><img src=\"assets/barre.png\"/>', 'next_pagination') if @collection.next_page\n end", "def show\n\t@artwork = Artwork.find(params[:id])\n\t@pictures = @artwork.pictures\n\t@page = 'artShow'\nend", "def next\n frm.button(:value=>\"Next\").click\n BeginAssessment.new(@browser)\n end", "def next_page\n set RGhost::Cursor.next_page\n end", "def next_page\n @page = info(@page[:next_page])\n end", "def next; pager.page(page + 1); end", "def next\n\t\tquiz.quizpages.where(\"id > ?\", id).order(\"id ASC\").first\n\tend", "def next\n return nil if next_page.nil? || next_page.empty?\n params = prepare_params(next_page)\n client = Singleplatform.new(\n client_id: ENV['SINGLEPLATFORM_CLIENT_ID'],\n client_secret: ENV['SINGLEPLATFORM_CLIENT_SECRET']\n )\n new_page = client.public_send(\n origin.to_sym,\n params.delete('date').first, params\n )\n refresh(new_page)\n end", "def show_next_page(type, event)\n @page_index += 1\n configure_buttons\n\n @panel.get_layout.next(@panel)\n end", "def next_page\n if next_page?\n @query[:startPage] += 1\n fetch\n end\n end", "def parse\n super\n if next_page_url\n @doc = get_document(URI(next_page_url))\n self.parse\n end\n self\n end", "def next_page\n @client.get(@raw_page['nextRecordsUrl']).body if has_next_page?\n end", "def next\n next_button.click\n end", "def next\n next_button.click\n end", "def next\n next_button.click\n end", "def next\n next_button.click\n end", "def next_page!\n next_page.tap { |page| update_self(page) }\n end", "def load(agent, type_id)\n page = ScraperWiki.get_var(PAGE, 0)\n url = SEARCH_BASE + \"?SEARCH=1&run=#{page}&corp_type_id=#{type_id}\"\n puts url\n\n # Finish loading and processing current results\n results_page = agent.get(url)\n reset_error_count()\n load_results(results_page)\n process_results(agent)\n\n # Move on to the next page\n while results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/)\n puts \"Next\"\n page = page + 1\n ScraperWiki.save_var(PAGE, page)\n\n # Load and process results\n results_page = results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/).click\n load_results(results_page)\n process_results(agent)\n end\n\n page = 0 # Reset page to 0\n ScraperWiki.save_var(PAGE, page)\nend", "def load(agent, type_id)\n page = ScraperWiki.get_var(PAGE, 0)\n url = SEARCH_BASE + \"?SEARCH=1&run=#{page}&corp_type_id=#{type_id}\"\n puts url\n\n # Finish loading and processing current results\n results_page = agent.get(url)\n reset_error_count()\n load_results(results_page)\n process_results(agent)\n\n # Move on to the next page\n while results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/)\n puts \"Next\"\n page = page + 1\n ScraperWiki.save_var(PAGE, page)\n\n # Load and process results\n results_page = results_page.link_with(:href => /^search_corps\\.php\\?SEARCH/, :text => /^Next/).click\n load_results(results_page)\n process_results(agent)\n end\n\n page = 0 # Reset page to 0\n ScraperWiki.save_var(PAGE, page)\nend", "def index\n @artists = Artist.paginate(page: params[:page], per_page:6)\n end", "def next\n return nil unless has_next?\n perform_request(next_page_uri)\n end", "def test_ajax_next\n photo_set = photo_sets('big_photo_set')\n photo = photo_set.photos[3]\n xhr :get, :carousel, {:dir => 'next.js', :photo_set => photo_set, :current => photo, :photo => '105'}\n assert_select_rjs :insert_html, :after, 'thumb_103', /thumb_102/\n assert_select_rjs :remove, 'thumb_105'\n assert_select_rjs :replace_html, 'thumbnav', /prev\\.js/\n assert_select_rjs :replace_html, 'thumbnav', /next\\.js/\n end", "def next_page\n go_to_page(@current_page+1)\n end", "def visit_next_page(model, **opt)\n click_on NEXT_LABEL, match: :first\n if block_given?\n yield\n else\n show_url\n end\n assert_valid_index_page(model, **opt)\n end", "def more_navigate\n page(FeedDetailsPage).await\n page(FooterTabBarPage).select_tab(\"More\")\n page(MorePage).seemenu\nend", "def next_page\n return nil if @query_str_next_page.empty?\n @url_str = next_url_str\n @page = InWebPage.new(@url_str)\n @page_count += 1\n\n # Prepare for getting the page which follows.\n @doc = REXML::Document.new(@page.to_s)\n @query_str_next_page = ''\n @doc.root.elements.each(XPATH_NEXT_PAGE){|e| @query_str_next_page = \"resumptionToken=#{e.text}\"}\n true\n end", "def next_page\n collection.next_page\n end", "def next_page\n page = @current_page + 1\n get_page(page)\n end", "def next_page\n @current_page = @agent.page.links.find { |l| l.text == \"Next →\" }.click\n rescue\n nil\n end", "def click_next_gallery\n click NEXT_GALLERY_BUTTON\n end", "def next\n\t\t@curItem.where(\"id > ?\", id).order(\"id ASC\").first || @curItem.first\n\t\t@curItem.show\n\tend", "def show\n extract_nxt_prv(@article)\n end", "def next_page(params = nil)\n perform_request(@next_page_link)\n end", "def next\n perform_get(links.next, self.class)\n end", "def load_item_page\n visit(ITEM_PAGE_URL)\n end", "def next\n self.next_id == -1 ? nil : self.story.cards.find(self.next_id)\n end", "def next_page(path)\n result = http_get(path)\n collection_from(result.body)\n end", "def get_art_for_page( rb, tagged, page )\n\n # Get the body of the page of art.\n if tagged then\n verbose( \"Getting page #{page} of your #{$params[ :product ]} tagged with \\\"#{tagged}\\\"\" )\n else\n verbose( \"Getting page #{page} of your #{$params[ :product ]}\" )\n end\n art = grab_art_page( rb, tagged, page )\n\n # Get the works from the body.\n works = art.elements.to_a( \"//span[@class='work-info']\" )\n\n # For each work found...\n works.each do |work|\n # ...emit the basic details for it.\n puts extract_work_id( work.elements.to_a( \"span[@class='title']/a\" ).first.attributes[ \"href\" ] ) +\n \"\\t\" +\n work.elements.to_a( \"span[@class='title']/a\" ).first.attributes[ \"title\" ] +\n \"\\t\" +\n work.elements.to_a( \"a/img\" ).first.attributes[ \"src\" ]\n end\n\n verbose( \"Done.\" )\n \nend", "def nextIngredients\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchIngredients.js'\n end", "def artist_details(artist)\n Scraper.scrape_individual_artist(artist) \n\n puts \"\"\n puts \"Here are more details about #{artist.name.bold}.\".black.on_light_white\n puts \"\"\n puts \"Representing Gallery: #{artist.gallery.name} \"\n puts \"\"\n puts \"Artist Bio: #{artist.bio}\"\n puts \"\"\n puts \"About the Artist : #{artist.about_art}\"\n puts \"\"\n\n end", "def next_image\n redirect_to_next_object(:next, Image, params[:id].to_s)\n end", "def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end", "def show\n require 'open-uri' #for screen scraping\n \n @album = Album.find(params[:id])\n @artists = @album.artists\n @sources = @album.sources\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @album }\n end\n \n #adding in automation functionality\n # if @album.catalognumber.blank? == true \n # url = @album.reference\n # if url.split('/')[2] == \"vgmdb.net\"\n # doc = Nokogiri::HTML(open(url))\n # @catalognum = doc.xpath(\"//table[@id='album_infobit_large']//tr[1]//td[2]\").text\n # @album.catalognumber = @catalognum.split(' ')[0]\n # @album.save\n # end\n # end\n\n end", "def next_page\n @collection.next_page\n end", "def next_page\n @collection.next_page\n end", "def show\n articleId = params[:id]\n @hasNext = (articleId != getNext(articleId))\n @hasPrevious = (articleId != getPrevious(articleId))\n end", "def page_load; end", "def artists\n link :top_artists, :Artist, name\n end", "def next_page!\n page = @doc.css(\".paginator span.pagination_current\").first\n @next_page = page.next_element[\"href\"] if page\n on_url(@next_page) if @next_page\n end", "def index\n @artist = Artist.find(params[:artist_id]) #why is this here?\n @arts = Art.paginate(page: params[:page], per_page: 15)\n end", "def get_next\n _info = self.get_next_list_entry!\n unless _info.nil?\n _url = _info[0]\n _imgurl = self.get_image_url _url\n unless _imgurl.nil?\n _filename = self.dl_image _imgurl\n return {\n 'filename' => _filename,\n 'author' => _info[1],\n 'title' => _info[2],\n 'origin' => _url\n }\n end\n end\n return nil\n end", "def show\n @arts = Array.new()\n @gallery.art_ids.each do |aid|\n @arts << Art.find(aid)\n end\n\n end", "def show\n french_scenes = @french_scene.scene.act.play.french_scenes\n french_scenes = french_scenes.sort { |a, b| a.pretty_name <=> b.pretty_name }\n index = french_scenes.index { |fs| fs.id == @french_scene.id }\n\n @next = french_scenes[index + 1]\n if index > 0\n @previous = french_scenes[index-1]\n end\n end", "def show\n #@artist = Artist.find(params[:id])\n searchString = params[:url_slug]\n @artist = Artist.find_by_url_slug(searchString)\n\n\n\t#for promo screen. Shows promo if coming from a Non artist URL, or if some one has clicked on the logo which is tagged with promo = ture param\n\n #checks to see if the referer exsists, and if it does assigned it to host for logic below\n unless request.referer.nil?\n\t\t@host = URI(request.referer).path\n\t\tlogger.info(\"path=\"+@host)\n end\n\n\t#checks to see if refering url has the artist path and doen't have promo. If true doesn't show promo\n\n\tif @host.try(:starts_with?,\"/\"+@artist.url_slug) && !params.has_key?(:promo)\n logger.info(\"path working\")\n\t\t#used to ensures the Info menu item is tagged with the selector by adding selector to the div.\n\t\t@tag_info = \"selected\"\n\n\telse\n\t\tlogger.info(\"show promo\")\n\t\t@show_promo = \"true\"\n\tend\n\n\n\n @playlist = @artist.songs\n\n artist_social(@artist)\n\n\t#sets the layout that will be loaded and the content div that it will be loaded into\n\tlayout(params[:layout])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artist }\n format.json {\n render :json => {\n :success => true,\n\t\t\t:\"#{@hook}\" => render_to_string(\n :action => 'show.html.erb',\n :layout => @layout\n ),\n\t\t\t:\"show\" => \"true\",\n }\n }\n\tend\n\n end", "def index\n @artworks = Artwork.order('created_at DESC').page(params[:page])\n end", "def next_page\n page = self.page() + 1\n request = @request.clone()\n request.replace_param( :page, page )\n @client.execute( request )\n end", "def article_next\n blog_data.articles.reverse.find { |a| a.date > date }\n end", "def updateNextURI\n # Parse next result page link from the currently marked one\n nextPagePath = @currentPage.at_css(\"table#nav tr td.cur\").next_sibling().at_css(\"a\")['href']\n\n # Construct the URI\n @nextURI = \"https://www.google.com\" + nextPagePath\n end", "def next\n @links.key?(:next) ? Page.new(@links[:next], {}, @headers) : nil\n end", "def c_page(n)\n BestiaryConfig::PAGEFX.play\n self.index += n\n end", "def set_page\n end", "def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend", "def get_next_page(page)\n # Todo: Put your code here to get the next page to be scraped\n if has_next_page(page)\n next_page_condition = page.at('input[id$=nextPageHyperLink]')\n link = get_next_url()\n \n page = @agent.get(link)\n return page\n else\n return nil\n end\nend", "def show\n @story = Story.find(params[:id])\n\n # Set meta information\n @page_title = @story.title\n @page_description = @story.subtitle\n\n if Arrowhead.is_arrowhead_story? @story\n @arrowhead_stories = Arrowhead.stories\n @i = @arrowhead_stories.find_index(@story)\n if @i\n @prev = @i > 0 ? @i - 1 : nil \n @next = @i < @arrowhead_stories.length - 1 ? @i + 1 : nil\n end\n set_meta_tags :og => {\n :title => @story.title,\n :description => @story.subtitle,\n :type => 'article',\n :url => url_for(@story),\n :image => URI.join(root_url, view_context.image_path('arrowhead_ogimage.jpg'))\n }\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story.to_json(:include => { :scenes => { :include => :paragraphs }}) }\n end\n end", "def next_link_for(records)\n page_link(records, page: 'next')\n end", "def get_next_set\n hash,url = perform_next_page_request\n Questions.new hash,url\n end", "def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend", "def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend", "def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend", "def get_next_page page\n link = page.search('.nextpostslink').first\n\n begin\n unless link[:href].nil? \n return @agent.get(link[:href])\n end\n rescue\n end\n\n return nil\nend", "def next_page(options = nil)\n next_page_async(options).get\n end", "def next\n return @page + 1\n end", "def next_page\n return unless @next_page\n \"<a class='btn' href=\\\"#{modify_page(1)}\\\">Next Page</a>\"\n end", "def next_image # :nologin: :norobots:\n redirect_to_next_object(:next, Image, params[:id].to_s)\n end", "def nextItems\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchItems.js'\n end", "def load\n return self if @entity[:next].nil? || @entity[:results].length == @entity[:total]\n\n np = self\n until np.next.nil?\n np = np.next_page\n @entity[:results].concat(np.results.map(&:to_h))\n end\n @entity[:next] = nil\n @entity[:per_page] = @entity[:total]\n self\n end", "def load_results(results_page)\n puts \"load results\"\n\n # Get all the links on the page\n links = results_page.links_with(:href => /^search_corps\\.php\\?DETAIL/)\n\n # Get the index of the last loaded link, or 0\n index = ScraperWiki.get_var(INDEX, 0)\n\n # Finish loading the rest of the links onthe page\n while index < links.length \n link = DETAIL_BASE + links[index].href\n puts \"load link \" + link\n\n # Load the current link\n begin\n ScraperWiki.sqliteexecute(\"INSERT INTO links (link) VALUES (?)\", [link])\n ScraperWiki.commit()\n rescue Exception => e\n puts \"Exception (#{e.inspect}) raised saving record #{link}\"\n end\n\n # Increment and save the index\n index = index + 1\n ScraperWiki.save_var(INDEX, index)\n end\nend" ]
[ "0.6552908", "0.647686", "0.6459508", "0.6339101", "0.63343966", "0.6294901", "0.62870866", "0.62775105", "0.625857", "0.62326616", "0.62267804", "0.6150444", "0.61068887", "0.6098317", "0.60848147", "0.6070348", "0.604677", "0.6037689", "0.6029649", "0.6014574", "0.6009815", "0.600373", "0.59986436", "0.59885347", "0.59784436", "0.59656715", "0.5933894", "0.592983", "0.5906026", "0.590164", "0.5888708", "0.5888536", "0.58860815", "0.585107", "0.5845415", "0.5845415", "0.5845415", "0.5845415", "0.5845226", "0.58321184", "0.58321184", "0.58265394", "0.5804558", "0.57885206", "0.578423", "0.5780007", "0.577389", "0.5723134", "0.57184964", "0.5710886", "0.5703021", "0.56980884", "0.56733686", "0.56722915", "0.5671425", "0.56650084", "0.5660337", "0.5642256", "0.5632782", "0.56279176", "0.5624234", "0.5623293", "0.56053257", "0.5601691", "0.5599639", "0.5599571", "0.5599571", "0.55993253", "0.5597897", "0.55922735", "0.5585766", "0.5570676", "0.5560621", "0.5553785", "0.55513877", "0.55234855", "0.55089605", "0.55065453", "0.55040145", "0.55034083", "0.5498113", "0.5497679", "0.5484281", "0.54808736", "0.54808736", "0.54752874", "0.54668707", "0.54639935", "0.5463909", "0.5463909", "0.5463909", "0.5463909", "0.54626524", "0.54615563", "0.545969", "0.54460293", "0.54420996", "0.5433422", "0.5431005" ]
0.65125763
2
Load the next page of albums
def load_page respond_to do |format| format.html do load_albums_page render '_album_rows' , layout: false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_page(params = {})\n @items = load_page(params)\n end", "def next_page\n url = @entity[:next]\n return unless url\n\n query = URI.decode_www_form(URI(url).query).to_h\n query = query.to_h { |k, v| [k.to_sym, v] }\n self.class.list(**query)\n end", "def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\n @browser.pluggable_parser.html = Mechanize::Page\n\n previous_length != @results.size\n end", "def next_page\n end", "def next_page; end", "def next\n goto(@current_page + 1)\n end", "def click_next_gallery\n click NEXT_GALLERY_BUTTON\n end", "def next_page\n sync.get(next_page_url) if next_page?\n end", "def next\n perform_request(next_page_uri) if next?\n end", "def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend", "def next_page\n # The only difference from the default here is we renamed the link to \"More\"\n # and added a custom class, twitter_pagination\n previous_or_next_page(@collection.next_page, '<div class=\"hover-move\"><img src=\"assets/next.png\" alt=\"next\"/></div><img src=\"assets/barre.png\"/>', 'next_pagination') if @collection.next_page\n end", "def next_page\n @links['next']\n end", "def next; pager.page(page + 1); end", "def next\n next_button.click\n end", "def next\n next_button.click\n end", "def next\n next_button.click\n end", "def next\n next_button.click\n end", "def next_page\n @client.get(@raw_page['nextRecordsUrl']).body if has_next_page?\n end", "def next_page(options = nil)\n next_page_async(options).get\n end", "def next_page\n\t\t\tFeed.parse_url(next_page_url,@browser)\n\t\tend", "def next_page\n if next_page?\n @query[:startPage] += 1\n fetch\n end\n end", "def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == 24 && @@load_favs == 0) || (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\tdestroy_window()\n\t\t\tif @@load_favs == 0\t\n\t\t\t\tshow()\n\t\t\telse\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend", "def next_page; link 'next' end", "def get_next_page\n nextlink = @doc.search(\"//p[@class='nextprev']/a[@rel='nofollow next']\")\n nextlink.map! { |link| \"#{link['href']}\" }\n stringlink = nextlink[0]\n @doc = open(stringlink) { |f| Hpricot(f) }\n get_links\n end", "def test_ajax_next\n photo_set = photo_sets('big_photo_set')\n photo = photo_set.photos[3]\n xhr :get, :carousel, {:dir => 'next.js', :photo_set => photo_set, :current => photo, :photo => '105'}\n assert_select_rjs :insert_html, :after, 'thumb_103', /thumb_102/\n assert_select_rjs :remove, 'thumb_105'\n assert_select_rjs :replace_html, 'thumbnav', /prev\\.js/\n assert_select_rjs :replace_html, 'thumbnav', /next\\.js/\n end", "def next_page\n collection.next_page\n end", "def next\n Photo.find_by_id(next_id) if next?\n end", "def next\n return nil unless has_next?\n perform_request(next_page_uri)\n end", "def index\r\n jump_to(\"/albums/list/#{session[:account_id]}\")\r\n end", "def next_page(path)\n result = http_get(path)\n collection_from(result.body)\n end", "def next_page\n set RGhost::Cursor.next_page\n end", "def next_page\n @page.link_with(:text => /Next/)\n end", "def next\n\t\tquiz.quizpages.where(\"id > ?\", id).order(\"id ASC\").first\n\tend", "def next_page\n go_to_page(@current_page+1)\n end", "def next_page\n string = QJ.next_string()\n url = BSU + string\n BR.goto(url)\nend", "def next_page\n page = self.page() + 1\n request = @request.clone()\n request.replace_param( :page, page )\n @client.execute( request )\n end", "def show\n @photo = Photo.find(params[:id])\n previous_rs = Photo.previous( @photo.id, @photo.album )\n @previous = previous_rs.first unless previous_rs.empty?\n next_rs = Photo.next( @photo.id, @photo.album )\n @next = next_rs.first unless next_rs.empty?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end", "def next\n perform_get(links.next, self.class)\n end", "def next_page\n @collection.next_page\n end", "def next_page\n @collection.next_page\n end", "def next_image\n redirect_to_next_object(:next, Image, params[:id].to_s)\n end", "def next_page!\n next_page.tap { |page| update_self(page) }\n end", "def show_next_page(type, event)\n @page_index += 1\n configure_buttons\n\n @panel.get_layout.next(@panel)\n end", "def next_page\n page = @current_page + 1\n get_page(page)\n end", "def next_page\n pagination_adapter.next_page\n end", "def next_page\n @page = info(@page[:next_page])\n end", "def next_page_link\n paging['next'] if paging\n end", "def next_page(params = nil)\n perform_request(@next_page_link)\n end", "def next\n @links.key?(:next) ? Page.new(@links[:next], {}, @headers) : nil\n end", "def next_page\n next_page? ? updated_collection(next_page_params.merge(from: from)) : self\n end", "def next\n return @page + 1\n end", "def next_page!\n return unless next_page?\n @page += 1\n clear!\n end", "def next\n\t\t@curItem.where(\"id > ?\", id).order(\"id ASC\").first || @curItem.first\n\t\t@curItem.show\n\tend", "def next_image # :nologin: :norobots:\n redirect_to_next_object(:next, Image, params[:id].to_s)\n end", "def next_page\n begin\n next_btn = @driver.find_element(link_text: 'NEXT CHAPTER')\n rescue\n @end_state = true\n end\n if not @end_state\n next_btn.click\n end\n @current_title = @driver.find_element(tag_name: 'h1').text #update title\n end", "def display_albums(margin, box_height, bar_width)\n spacing = 0\n spacing_add = box_height + margin\n i = @page\n while i < @viewable_albums + @page\n display_album(@data_array[i].title, spacing, box_height, margin, bar_width, PRIMARY, \"album_button_#{i}\",i) rescue nil\n spacing += spacing_add\n i += 1\n end\nend", "def visit_next_page(model, **opt)\n click_on NEXT_LABEL, match: :first\n if block_given?\n yield\n else\n show_url\n end\n assert_valid_index_page(model, **opt)\n end", "def show\n @album = Album.find(params[:id])\n\n Dir.chdir(Rails.root)\n Dir.chdir(ALBUMS_ROOT + @album.name + \"/pictures\")\n @pictures = Dir.glob(\"*\")\n\n @page_results = @pictures.paginate(:page=>params['page'], :per_page => 4)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @album }\n end\n end", "def next_page!\n if self.page < 5\n self.page += 1\n if self.page == 3 && self.group == 1\n # Control group skips questions about first survey\n self.page += 1\n elsif self.page == 5\n self.completed = true\n end\n self.save\n end\n end", "def load_album_photos\n # @pictures = Picture.paginate(:page => params[:page], :per_page => 5)\n @curr_album = Album.find(params[:id])\n @pictures = @curr_album.shared_pictures(@login_user.id,params[:page].to_i)\n end", "def show\n @next_artwork = get_next\n @previous_artwork = get_previous\n @fbLink = \"http://helenafogelberg.se/artworks/{@artwork.id}\"\n end", "def show\n @photos = @album.photos.includes(:album).page(params[:page])\n\n respond_to do |format|\n format.html do\n @page = @site.pages.find_by_name 'albums'\n @pages = @site.pages\n end\n format.js {}\n end\n end", "def next_page!\n page = @doc.css(\".paginator span.pagination_current\").first\n @next_page = page.next_element[\"href\"] if page\n on_url(@next_page) if @next_page\n end", "def parse\n super\n if next_page_url\n @doc = get_document(URI(next_page_url))\n self.parse\n end\n self\n end", "def load\n return self if @entity[:next].nil? || @entity[:results].length == @entity[:total]\n\n np = self\n until np.next.nil?\n np = np.next_page\n @entity[:results].concat(np.results.map(&:to_h))\n end\n @entity[:next] = nil\n @entity[:per_page] = @entity[:total]\n self\n end", "def index\n @albums = @artist.albums.all.page(params[:page] || 1).per(18)\n end", "def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end", "def link_to_next_document(next_document)\n link_opts = session_tracking_params(next_document, search_session['counter'].to_i + 1).merge(:class => \"next\", :rel => 'next')\n link_to_unless next_document.nil?, raw(t('views.pagination.next')), url_for_document(next_document), link_opts do\n content_tag :span, raw(t('views.pagination.next')), :class => 'next'\n end\n end", "def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def next_page_url\n \"#{request.path}?page=#{@page + 1}\"\n end", "def next_page\n num = @collection.current_page < @collection.total_pages && @collection.current_page + 1\n previous_or_next_page(num, @options[:next_label], 'next')\n end", "def next_link_for(records)\n page_link(records, page: 'next')\n end", "def nextItems\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchItems.js'\n end", "def populate_album_for_first_time(tag)\n @next_max_id = nil\n tag = find_or_create_tag(tag)\n\n 10.times do\n hit_api_to_get_photos\n photo_data = @photo_data # stubbed; will refactor this away later\n add_all_photos_from_one_page(tag.name, photo_data)\n end\n end", "def get_large_view_admin_next_pic(current_picture, something)\n next_pic = current_picture.next_pic_large_view_company_admin\n\n if not next_pic.nil?\n destination_url = large_picture_preview_for_company_admin_url( next_pic)\n return create_galery_navigation_button( NEXT_BUTTON_TEXT, \"next\",destination_url )\n else\n \"\"\n end\n\n end", "def set_album\n @album = Pagealbum.find(params[:id]) rescue Pagealbum.new\n @images=[]\n end", "def on_next_in_folder_clicked\n @wall.run(:next_in_folder, @settings.current_file) do |pic|\n inform_pic_change pic\n end\n end", "def next_page(extra_params = {})\n base, args = next_page_params\n base ? @api.get_page([base, args.merge(extra_params)]) : nil\n end", "def first\n # Modify the @next url to set the :limit to 1\n original_next = @next\n @next = @path\n fetch_next!(@options.merge(params: @options.fetch(:params, {}).merge({ limit: 1 })))\n # Restore the @next url to the original\n @next = original_next\n @data.first\n end", "def show\n render_attrs = @gallery_item.ajax_attrs(@role)\n gallery_item_ids = @gallery_item.gallery.gallery_item_ids\n gallery_item_ids.unshift(nil)\n gallery_item_ids.push(nil)\n (0..gallery_item_ids.size).each do |index|\n if(gallery_item_ids[index+1] == @gallery_item.id)\n render_attrs[:next_id] = gallery_item_ids[index+2]\n render_attrs[:prev_id] = gallery_item_ids[index]\n end\n end\n respond_to do |format|\n format.html { render }\n format.json { render :json => render_attrs }\n end\n end", "def next_list\n @_next ? @resource.list(abs_url: @_next) : nil\n end", "def next_page\n @current_page = @agent.page.links.find { |l| l.text == \"Next →\" }.click\n rescue\n nil\n end", "def next_page\n return unless @next_page\n \"<a class='btn' href=\\\"#{modify_page(1)}\\\">Next Page</a>\"\n end", "def next_page_path(response)\n response.get(\"_links.next.href\")\n end", "def setup_next_and_previous_documents\n if current_search_session_from_browse_category?\n setup_next_and_previous_documents_from_browse_category if current_browse_category\n elsif current_search_session_from_page? || current_search_session_from_home_page?\n # TODO: figure out how to construct previous/next documents\n else\n super\n end\n end", "def setup_next_and_previous_documents\n if current_search_session_from_browse_category?\n setup_next_and_previous_documents_from_browse_category if current_browse_category\n elsif current_search_session_from_page? || current_search_session_from_home_page?\n # TODO: figure out how to construct previous/next documents\n else\n super\n end\n end", "def show\n @photos = Photo.where('album_id' => params[:id]).paginate(:page => params[:page], :per_page => 20)\n end", "def index\n @albums = current_user.albums.page(params[:page]).per(10)\n end", "def test_next_image_search\n rolfs_favorite_image_id = images(:connected_coprinus_comatus_image).id\n image = Image.find(rolfs_favorite_image_id)\n\n # Create simple index.\n query = Query.lookup_and_save(:Image, :by_user, user: rolf)\n ids = query.result_ids\n assert(ids.length > 3)\n rolfs_index = ids.index(rolfs_favorite_image_id)\n assert(rolfs_index)\n expected_next = ids[rolfs_index + 1]\n assert(expected_next)\n\n # See what should happen if we look up an Image search and go to next.\n query.current = image\n assert(new_query = query.next)\n assert_equal(query, new_query)\n assert_equal(expected_next, new_query.current_id)\n\n # Now do it for real.\n params = {\n id: rolfs_favorite_image_id,\n params: @controller.query_params(query).merge({ flow: :next })\n }.flatten\n login\n get(:show, params: params)\n assert_redirected_to(action: :show, id: expected_next,\n params: @controller.query_params(query))\n end", "def next_page\n return nil if @query_str_next_page.empty?\n @url_str = next_url_str\n @page = InWebPage.new(@url_str)\n @page_count += 1\n\n # Prepare for getting the page which follows.\n @doc = REXML::Document.new(@page.to_s)\n @query_str_next_page = ''\n @doc.root.elements.each(XPATH_NEXT_PAGE){|e| @query_str_next_page = \"resumptionToken=#{e.text}\"}\n true\n end", "def next\n return nil if next_page.nil? || next_page.empty?\n params = prepare_params(next_page)\n client = Singleplatform.new(\n client_id: ENV['SINGLEPLATFORM_CLIENT_ID'],\n client_secret: ENV['SINGLEPLATFORM_CLIENT_SECRET']\n )\n new_page = client.public_send(\n origin.to_sym,\n params.delete('date').first, params\n )\n refresh(new_page)\n end", "def album\n # @friend_id = params[:object_id] unless (params[:object_id] == 'null' || params[:object_id].blank?)\n # if @friend_id\n # friend_data = current_user.picasa_client.user(@friend_id)\n # @friend_name = friend_data.author.name \n # end\n per_page = (params[:limit] ? params[:limit].to_i : 10)\n search_params = {\n albumId: params[:id],\n pageSize: per_page\n }\n if params[:page_token]\n search_params[:pageToken] = params[:page_token]\n end\n goog = GooglePhotosApi.new( current_user.picasa_identity.token )\n @photos = PicasaPhoto.picasa_request_with_refresh( current_user.picasa_identity ) do\n r = goog.search( search_params )\n @next_page_token = r[\"nextPageToken\"]\n Rails.logger.debug \"[DEBUG] r: #{r}\"\n (r[\"mediaItems\"] || []).map{|mi| PicasaPhoto.new_from_api_response( mi ) }\n end\n # @photos = PicasaPhoto.get_photos_from_album(current_user, params[:id], search_params) \n @synclink_base = params[:synclink_base] unless params[:synclink_base].blank?\n respond_to do |format|\n format.html do\n render :partial => 'photos/photo_list_form', \n :locals => {\n :photos => @photos, \n :index => params[:index],\n :synclink_base => nil, \n :local_photos => false,\n :organized_by_album => true\n }\n end\n end\n end", "def link_to_next_page(page)\n a = page.search(PAGER_NEXT_SELECTOR).first\n return unless a\n path = a.attribute('href').value.strip\n URI.join(WEBSITE_URL, path).to_s\n end", "def show\n require 'open-uri' #for screen scraping\n \n @album = Album.find(params[:id])\n @artists = @album.artists\n @sources = @album.sources\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @album }\n end\n \n #adding in automation functionality\n # if @album.catalognumber.blank? == true \n # url = @album.reference\n # if url.split('/')[2] == \"vgmdb.net\"\n # doc = Nokogiri::HTML(open(url))\n # @catalognum = doc.xpath(\"//table[@id='album_infobit_large']//tr[1]//td[2]\").text\n # @album.catalognumber = @catalognum.split(' ')[0]\n # @album.save\n # end\n # end\n\n end", "def next_page\n page + 1 if pages.include?(page + 1)\n end", "def next_page\n num = current_page + 1\n num if total_pages >= num\n end", "def next_page\n return if page >= total_pages\n page + 1\n end", "def get_next_url\n\n @index = @index + 1\n\n link = @url.to_s + \"?PageNumber=\"\n\n link = link + @index.to_s\n\n return link\n\nend", "def get_next_url\n\n @index = @index + 1\n\n link = @url.to_s + \"?PageNumber=\"\n\n link = link + @index.to_s\n\n return link\n\nend", "def next_page\n @rally_rest.query(@query.next_page(:start => self.start_index + self.page_size,\n\t\t\t\t :pagesize => self.page_size))\n end" ]
[ "0.6880548", "0.6715651", "0.6683551", "0.6676448", "0.6644789", "0.6635166", "0.6634454", "0.6629374", "0.6588594", "0.65644765", "0.6555333", "0.65095913", "0.65001845", "0.64515525", "0.64515525", "0.64515525", "0.64515525", "0.64504355", "0.6434916", "0.64340585", "0.6433738", "0.64118356", "0.6383656", "0.63814884", "0.63761663", "0.6366", "0.6306976", "0.6287649", "0.6283665", "0.62835974", "0.6281504", "0.6234871", "0.6228941", "0.6220073", "0.62180436", "0.621175", "0.6198694", "0.61782616", "0.61759025", "0.61759025", "0.61591953", "0.61451584", "0.6113516", "0.6104397", "0.6096357", "0.6077958", "0.60622025", "0.60599726", "0.6037362", "0.6009028", "0.6004252", "0.5999967", "0.59938914", "0.5989384", "0.59891284", "0.59656894", "0.59586024", "0.5930877", "0.5930494", "0.5905347", "0.5901184", "0.58819324", "0.58776605", "0.58625776", "0.5862235", "0.585825", "0.5848538", "0.5838747", "0.58344346", "0.58034635", "0.58001596", "0.5786646", "0.57799506", "0.57526726", "0.57478416", "0.5745503", "0.5745122", "0.5734137", "0.57221043", "0.5713844", "0.5710842", "0.57061166", "0.5702668", "0.5700879", "0.56959337", "0.56959337", "0.5683449", "0.5682636", "0.56743824", "0.5671557", "0.5669749", "0.56597096", "0.5654429", "0.5650766", "0.56422824", "0.56385964", "0.56358206", "0.56322545", "0.56322545", "0.5629991" ]
0.61821866
37
Action to suggest names on the filter
def suggest suggest_classes( [ Album , Artist ] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggest\n end", "def named_filter; end", "def autocomplete_on\n\t\tconditions = if params[:name]\n [\"name LIKE :name\", { :name => \"%#{params['name']}%\"} ]\n else\n {}\n end\n\t\t @objects = params[:model_name].classify.constantize.find(:all, :conditions => conditions)\n\t\t render :text => '<ul>'+ @objects.map{ |e| '<li>' + e.name + '</li>' }.join(' ')+'</ul>'\n\tend", "def auto_complete_for_ingredient_name\n value = params[:ingredient][:name]\n @ingredients = Ingredient.find(:all, \n :conditions => [ 'LOWER(name) LIKE ?',\n '%' + value.downcase + '%' ], \n :order => 'name ASC',\n :limit => 8)\n render :partial => 'ingredient_name_matches'\n end", "def suggestions\n suggest(search_suggestions)\n end", "def index\n params[:search] ? @actions = policy_scope(Action).where(\"lower(name) LIKE ?\", \"%#{params[:search][:name].downcase}%\").order(name: :asc) : @actions = policy_scope(Action).order(name: :asc)\n end", "def filters_dutch_name(*args)\n create_filtered_accessor(\"filter_dutch_name\", args)\n end", "def suggest\n unless request.post?\n render :nothing=>true\n return\n end\n tags = Tag.all.to_a.map(&:name)\n current = params[:current].split(/,/)\n current.map!{|tag_name| tag_name.strip}\n current = Set.new(current)\n found = Set.new\n tags.each do |tag|\n if params[:name] =~ /(\\s|^)#{Regexp.escape(tag)}(\\s|$)/i \\\n || params[:description] =~ /(\\s|^)#{Regexp.escape(tag)}(\\s|$)/i\n\n found << tag\n end\n end\n current.merge(found)\n @tags_list = current.to_a.sort.join(\", \")\n end", "def findorsuggest()\n \n end", "def suggester_name(url_params = nil)\n blacklight_config.autocomplete_suggester ||= DEF_AUTOCOMPLETE_SUGGESTER\n super\n end", "def auto_complete_for_person_name\n \tname = params[:person][:name].downcase\n \tnames = name.strip.split(' ')\n \t\n find_options = {\n :order => \"last_name, first_name ASC\",\n\t :limit => 10 }\n\n\t\tif names.size > 1\n\t\t\t# there are two names provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' AND LOWER(last_name) LIKE '%#{names[1]}%' OR LOWER(first_name) LIKE '%#{names[1]}%' AND LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\telse\n\t\t\t# only the first name or last name has been provided\n\t\t\tfind_options[:conditions] = \"LOWER(first_name) LIKE '%#{names[0]}%' OR LOWER(last_name) LIKE '%#{names[0]}%'\"\n\t\tend\n\t\n\t\t@items = Person.find(:all, find_options)\n\t\n\t\tRails.logger.info(\"@items.size = #{@items.size}\")\n\n render :inline => \"<%= auto_complete_result @items, 'name' %>\"\n end", "def index \n @customizing_names = CustomizingName.where(nil) # creates an anonymous scope\n # Filteranfragen beantworten\n if params[:name_search_text].present?\n @customizing_names = CustomizingName.where('name LIKE ?', '%' + params[:name_search_text] + '%').all\n else\n @customizing_names = CustomizingName.all\n end\n end", "def filter_options\n\t\t[\n\t\t\t['short_name', 'LENGTH(name) < 4', 'Short Name'],\n\t\t\t['medium_name', ['LENGTH(name) >= ? AND LENGTH(name) <= ?', 5, 10], 'Medium Name'],\n\t\t\t['long_name', lambda { |tag| tag.name.length > 10 }, 'Long Name']\n\t\t]\n\tend", "def autocomplete; end", "def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Name)\n show_selected_names(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search_form')\n end\n end", "def autocomplete_name\n @tags = Tag.where([\"name ILIKE ?\", \"*#{params[:term]}*\".to_escaped_for_sql_like]).order('LENGTH(name)', :name).limit(20).pluck(:name)\n respond_to do |format|\n format.json { render :json => @tags }\n end\n end", "def authored_names # :nologin: :norobots:\n query = create_query(:Name, :with_descriptions)\n show_selected_names(query)\n end", "def auto_complete_for_friend_name\n friend = params[:term]\n #@associates = current_user.associates.find(:all, :conditions => \"name like '%\" + friend + \"%'\")\n\n @associates = current_user.associates.find_by_name_like(friend)\n if @associates.present?\n render :json => @associates.map(&:name), :status => :ok\n else\n render :json => params[:term], :status => :ok\n end\n end", "def name_search # :nologin: :norobots:\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) and\n (name = Name.safe_find(pattern))\n redirect_to(:action => 'show_name', :id => name.id)\n else\n query = create_query(:Name, :pattern_search, :pattern => pattern)\n @suggest_alternate_spellings = pattern\n show_selected_names(query)\n end\n end", "def filter_by_name\n @search = Search::ByName.new(\n term: params[:name],\n country: params[:country]\n ).call\n end", "def suggest_results\n repository.auto_suggest(suggest_handler_path, request_params)\n end", "def autocomplete_sn\n render :partial => 'autocomplete', :object => Scientificname.find(:all, :conditions => ['name ILIKE ?', params[:sn] + '%' ])\n end", "def recipe_name_search\n key_word = User.prompt.ask(\"Please piece of recipe name\")\n key_word == nil ? (key_word = 'bdncjkascndxasklxnasmndxb') : (key_word)\n recipe_query = Recipe.all.filter{|recipe| recipe.name.include?(key_word.capitalize())}\n\n if recipe_query != []\n recipe_viewer(recipe_query)\n else\n puts 'Invalid Search!'.colorize(:red);\n end\n end", "def add_suggestions(name, items)\n # unless alternatives = compute_alternatives(name, items)\n # return\n # end\n # append_message(sprintf(' Did you mean \"%s\"?', implode('\", \"', alternatives)))\n end", "def candidates_for_name(name, filters)\n candidates = @name_mapper.find_terms(name)\n filters.inject(candidates) do |terms, filter|\n filter.apply(terms)\n end\n end", "def adv_search_name_typed\n @edit = session[:edit]\n @edit[:new_search_name] = params[:search_name] if params[:search_name]\n @edit[:search_type] = params[:search_type].to_s == \"1\" ? \"global\" : nil if params[:search_type]\n render :update do |page|\n page << javascript_prologue\n end\n end", "def suggest(name, text, completion = {})\n request(:post, \"_suggest\", nil, { name => { text: text, completion: completion } })\n end", "def suggest(name, text, completion={})\n request(:post, \"_suggest\", nil, {name => {:text => text, :completion => completion}})\n end", "def run_suggest\n puts suggest_pattern if suggest_pattern\n end", "def candidates_for_name(name, filters)\n candidates = @name_mapper.find_terms(name)\n filters.inject(candidates) do |terms, filter|\n filter.apply(terms)\n end\n end", "def auto_complete_for_filename_name\n auto_complete_responder_for_filename params[:filename][:name]\n end", "def suggestname(name)\n\t\t@namemutex.synchronize{\n\t\t\ti=1\n\t\t\twhile @names.include?(name+i.to_s)\n\t\t \t\ti+=1\n\t\t\tend\n\t\t\tname+i.to_s\n\t\t}\n\tend", "def suggest\n @suggestions = suggestions_service.suggestions\n render 'suggest', layout: false\n end", "def index\n @authors = Author.order(:name).where(\"name like ?\", \"%#{params[:term]}%\")\n autoload_helper(@authors, :name)\n end", "def selected_filter_option_names(filter)\n region_names = filter.regions(:name).sort\n country_names = filter.reduced_countries(:name).sort\n region_names.concat(country_names)\n end", "def typeahead\n model_name = controller_name.classify\n model_class = class_for_controller_name\n\n results = model_class.authorize_asset_collection(model_class.where('title LIKE ?', \"#{params[:query]}%\"), 'view')\n items = results.first(params[:limit] || 10).map do |item|\n contributor_name = item.contributor.try(:person).try(:name)\n { id: item.id, name: item.title, hint: contributor_name, type: model_name, contributor: contributor_name }\n end\n\n respond_to do |format|\n format.json { render json: items.to_json }\n end\n end", "def generics\n search_string = (params[:search_string] || '').upcase\n filter_list = params[:filter_list].split(/, */) rescue [] \n @drug_concepts = ConceptName.joins(\"INNER JOIN drug ON drug.concept_id = concept_name.concept_id AND drug.retired = 0\").where(\n [\"concept_name.name LIKE ?\", '%' + search_string + '%']).group(\"drug.concept_id\").select(\"concept_name.name\")\n render plain: \"<li>\" + @drug_concepts.map{|drug_concept| drug_concept.name }.uniq.join(\"</li><li>\") + \"</li>\"\n end", "def suggest_user\n skope = User.scoped\n skope = skope.where(\"username LIKE ?\", \"%#{params[:term]}%\")\n @team.members.all.each do |member|\n skope = skope.where(User.arel_table[:id].not_eq(member.user.id))\n end\n\n skope = skope.limit(10)\n\n respond_with(skope.all.map{|x| {:label => x.username, :value => x.id}})\n end", "def available_actions\n super.merge({ \"search\" => \"You search the grimy pool\"\n\n })\n end", "def suggest\n if (StartupHaveProject.check_ownership(Project.find(params[:project_id]), Startup.find(session[:entity_id])).size != 0)\n @suggested = Project.get_suggest(Project.find(params[:project_id]), Startup.find(session[:entity_id]))\n else\n render text: \"\"\n end\n end", "def index_name # :nologin: :norobots:\n query = find_or_create_query(:Name, :by => params[:by])\n show_selected_names(query, :id => params[:id].to_s, :always_index => true)\n end", "def autocomplete\n @leader = Leaders.find(:all, :conditions => [\"name like ?\",\"%\" + params[:term].upcase + \"%\"])\n render json: @leader \n end", "def autocomplete_tags\n if params[:query]\n @tags = Mindlog.published.topic_counts.where('name LIKE ?',\"#{params[:query].delete(\"#\")}%\")\n end\n end", "def bulk_name_edit # :prefetch: :norobots:\n @list_members = nil\n @new_names = nil\n if request.method == :post\n list = params[:list][:members].strip_squeeze rescue ''\n construct_approved_names(list, params[:approved_names])\n sorter = NameSorter.new\n sorter.sort_names(list)\n if sorter.only_single_names\n sorter.create_new_synonyms\n flash_notice :name_bulk_success.t\n redirect_to(:controller => 'observer', :action => 'list_rss_logs')\n else\n if sorter.new_name_strs != []\n # This error message is no longer necessary.\n flash_error \"Unrecognized names given, including: #{sorter.new_name_strs[0].inspect}\" if TESTING\n else\n # Same with this one... err, no this is not reported anywhere.\n flash_error \"Ambiguous names given, including: #{sorter.multiple_line_strs[0].inspect}\"\n end\n @list_members = sorter.all_line_strs.join(\"\\r\\n\")\n @new_names = sorter.new_name_strs.uniq.sort\n end\n end\n end", "def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end", "def suggest_results\n Blacklight.default_index.connection.send_and_receive(suggest_handler_path, params: request_params)['suggest']\n end", "def index\n filter = params[:searchString] || ''\n filter = filter.tr('^A-Za-zА-Яа-я0-9', '')\n if not filter.blank?\n @tags = Tag.where('lower(name) like ?', \"%#{filter.mb_chars.downcase.to_s}%\").order(:name)\n else\n @tags = Tag.all\n end\n end", "def suggest\n suggest_classes( [ Song , Artist , Album ] )\n end", "def filters\n end", "def auto_complete\n @users = if params[:term] =~ /(@[^\\s]+)\\s.*/\n elsif user_name = params[:term].match(/(@[^\\s]+)/)\n users = User.select('name').where('name LIKE ?', \"%#{user_name[1].to_s[1..-1]}%\")\n\n users.map {|user| {name: \"#@{user.name}\"} }\n end\n render json: @users.to_json\n end", "def filter_params\n params.require(:filter).permit(:name)\n end", "def add_custom_search_filters(search); end", "def filters; end", "def filters; end", "def name_search( type, search_for, order_by = 'name' )\n self.send(type.to_sym, { namesearch: search_for, order: order_by })\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def autocomplete_venue_name\n term = params[:term]\n if term && !term.empty?\n items = Venue.verified.select(\"name\").\n where(\"name like ?\", '%' + term.downcase + '%').\n limit(10).order(:name)\n else\n items = {}\n end\n render :json => json_for_autocomplete(items, :name)\n end", "def display_name(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end", "def suggest(options)\n candidates_to_exclude = options[:exclude]\n validation_block = options[:validate]\n number_of_suggestions = options[:num_suggestions]\n\n results = []\n candidates = name_combinations.clone\n while results.size < number_of_suggestions && !candidates.blank?\n candidate = candidates.shift\n if validation_block.try(:call, candidate)\n # Don't add the candidate to result\n elsif candidates_to_exclude.include? candidate\n candidates << find_extended_candidate(candidate, candidates_to_exclude)\n else\n results << candidate\n end\n end\n\n results\n end", "def suggestContextNames(username, contextname)\n\n # Put suggestions to resp and return it\n resp = Array.new\n \n sugg = contextname\n \n # Look for the context name for this user\n ctxName = ContextName.find_by_name_and_username(contextname, username )\n \n \n while resp.length < 3\n if ContextName.find_by_name_and_username(sugg, username) == nil\n resp.push(sugg)\n end\n sugg +=\"I\"\n end\n \n return resp\n end", "def adv_search_set_text\n if @edit[@expkey].history.idx.zero? # Are we pointing at the first exp\n @edit[:adv_search_applied][:text] = if @edit[:new_search_name]\n _(\" - Filtered by \\\"%{text}\\\"\") % {:text => @edit[:new_search_name]}\n else\n _(\" - Filtered by \\\"%{text}\\\" report\") %\n {:text => @edit[:adv_search_report]}\n end\n else\n @edit[:custom_search] = true\n @edit[:adv_search_applied][:text] = _(\" - Filtered by custom search\")\n end\n end", "def autofilter\n true\n end", "def name_from_params(namespace: nil)\n o_params = org_selectable_params.fetch(:org_autocomplete, {})\n namespace += '_' unless namespace.nil? || namespace.end_with?('_')\n return o_params[\"#{namespace}name\"] if in_list?(namespace: namespace) &&\n o_params[\"#{namespace}name\"].present?\n\n # If the user entered a custom entry then humanize it and capitalize each word\n o_params[\"#{namespace}user_entered_name\"]&.humanize&.split&.map(&:capitalize)&.join(' ')\n end", "def auto_complete_for_asset_developer_name\n name = params[:asset][\"developer_name\"]\n # OPTIMIZE: regexp or like can be expensive (cause full table search), instead use fulltext search if possible\n # @developers = Developer.find(:all, :conditions => [\"name LIKE ?\", \"%#{name}%\"])\n @developers = Developer.find(:all, :conditions => [\"name ~* ?\", name])\n if @developers.blank?\n render :nothing => true\n else\n render :inline => \"<%= content_tag :ul, @developers.map {|d| content_tag(:li, h(d.name))} %>\" \n end\n end", "def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end", "def autocomplete_doctor_name\n\n if params[:term].present?\n items = get_autocomplete_items(:model => Doctor, \n :method => :name,\n :term => params[:term], \n :options => { :full => true, :where => { :hospital_id => params[:id] } })\n end\n\n render :json => json_for_autocomplete(items || {}, :name)\n end", "def auto_complete_for_keyword_list\n auto_complete_responder_for_keyword params[:keyword][:list]\n end", "def filter_label(filter_name, filters)\n filters[filter_name].try(:[], :label) || filter_name.to_s.humanize\n end", "def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end", "def apply_filter\n end", "def action_search( contacts )\n puts\n pattern = ask \"Search for? \"\n puts\n contacts.each do |contact|\n\n #Patttern works on the first letter of first/sur name\n if contact[:name] =~ /\\b#{pattern}/i\n show ( contact )\n puts\n end\n end\nend", "def suggest\n tags = Tag.where('tags.name LIKE ?', \"#{params[:q]}%\").limit(10).order(:name)\n\n render json: {\n results: tags.map { |tag|\n {\n id: tag.name,\n text: \"#{tag.name} (#{tag.count})\"\n }\n },\n }\n end", "def auto_complete_for_user_name\n @users = session[:user].get_available_users(params[:user][:name])\n render inline: \"<%= auto_complete_result @users, 'name' %>\", layout: false\n end", "def show_selected_names(query, args={})\n store_query_in_session(query)\n @links ||= []\n args = {\n :action => 'list_names',\n :letters => 'names.sort_name',\n :num_per_page => (params[:letter].to_s.match(/^[a-z]/i) ? 500 : 50),\n }.merge(args)\n\n # Tired of not having an easy link to list_names.\n if query.flavor == :with_observations\n @links << [:all_objects.t(:type => :name), { :action => 'list_names' }]\n end\n\n # Add some alternate sorting criteria.\n args[:sorting_links] = [\n ['name', :sort_by_name.t],\n ['created_at', :sort_by_created_at.t],\n [(query.flavor == :by_rss_log ? 'rss_log' : 'updated_at'),\n :sort_by_updated_at.t],\n ['num_views', :sort_by_num_views.t],\n ]\n\n # Add \"show observations\" link if this query can be coerced into an\n # observation query.\n if query.is_coercable?(:Observation)\n @links << [:show_objects.t(:type => :observation), {\n :controller => 'observer',\n :action => 'index_observation',\n :params => query_params(query),\n }]\n end\n\n # Add \"show descriptions\" link if this query can be coerced into a\n # description query.\n if query.is_coercable?(:NameDescription)\n @links << [:show_objects.t(:type => :description), {\n :action => 'index_name_description',\n :params => query_params(query),\n }]\n end\n\n # Add some extra fields to the index for authored_names.\n if query.flavor == :with_descriptions\n show_index_of_objects(query, args) do |name|\n if desc = name.description\n [ desc.authors.map(&:login).join(', '),\n desc.note_status.map(&:to_s).join('/'),\n :\"review_#{desc.review_status}\".t ]\n else\n []\n end\n end\n else\n show_index_of_objects(query, args)\n end\n end", "def auto_complete\n @query = params[:auto_complete_query]\n @auto_complete = self.controller_name.classify.constantize.scoped(:limit => 10).search(@query)\n render :template => \"common/auto_complete\", :layout => nil\n end", "def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end", "def filter\n end", "def autosuggest(object, name, options={})\n options[:display] ||= name\n options[:limit] ||= 10\n options[:name] = name\n options[:search_in] ||= [name]\n options[:order] ||= \"#{options[:search_in].first} ASC\"\n\n define_method \"autosuggest_#{object}_#{name}\" do\n options.merge!(:query => params[:query], :object => object.to_s.camelize.constantize)\n query = ''\n values = []\n\n for column in options[:search_in]\n query += \"#{column} ILIKE ? OR \"\n values.push(\"#{options[:query]}%\")\n end\n results = options[:object].where(query[0..-4], *values).order(options[:order]).limit(options[:limit])\n render :json => Yajl::Encoder.encode(results.map{|r| {:name => r.send(options[:display]), :value => r.id.to_s}})\n end\n end", "def Filter=(arg0)", "def suggest\n if !params.has_key? :q then\n head :ok\n return\n end\n\n search_stmt = params[:q].upcase\n current_user_id = current_user.id\n\n results = UrContact.where.has{\n (user_id == current_user_id) &\n (upper(name).like \"%#{search_stmt}%\") |\n (upper(email).like \"%#{search_stmt}%\") |\n (upper(telephone).like \"%#{search_stmt}%\")\n }\n\n if params[:format] == \"search\" then\n formattedResults = results\n else\n formattedResults = {query:params[:q], suggestions:results.map{|x| {value:x.name, data:x}} }\n end\n\n #render json: {query:params[:q], suggestions:results}\n render json: formattedResults\n end", "def searchauthor\n end", "def bu_autocomplete\n search_term = params[:term]\n\n species_id = Specie.find_by_scientificname(params[:species])\n\n cultivars = Cultivar.where(\"specie_id = ?\", species_id)\n\n logger.debug(\"cultivars for autocompletion: #{cultivars.inspect}\")\n\n filtered_cultivars = cultivars.where(\"LOWER(name) LIKE LOWER(?)\", '%' + search_term + '%')\n\n if filtered_cultivars.size > 0 || search_term.size > 1\n cultivars = filtered_cultivars\n # else if there are no matches and the user has only typed one letter, just return every cultivar associated with the chosen species\n end\n\n cultivars = cultivars.to_a.map do |item|\n item.name.squish\n end\n\n # don't show rows where name is null or empty\n # TO-DO: eliminate these from the database and prevent them with a constraint\n cultivars.delete_if { |item| item.nil? || item.empty? }\n\n if cultivars.empty?\n cultivars = [ { label: \"No matches\", value: \"\" }]\n end\n\n respond_to do |format|\n format.json { render :json => cultivars }\n end\n end", "def display_names names\n names.each do |name|\n name = expand_name name\n\n display_name name\n end\n end", "def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end", "def updateFilter(sender)\n CanastoLog.debug @searchField.stringValue\n end", "def index\n @rentables = params[:q] ? Rentable.where(['LOWER(name) LIKE ?', \"%#{params[:q].downcase}%\"]) : Rentable.all\n end", "def prepare_label_for_suggestion(label, index)\n validate_language_rule\n label.gsub(full_name, language_rule.default_transform(self, piped_params)) \n end", "def list_name_descriptions # :nologin:\n query = create_query(:NameDescription, :all, :by => :name)\n show_selected_name_descriptions(query)\n end", "def names_by_editor # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:Name, :by_editor, :user => user)\n show_selected_names(query)\n end\n end", "def auto_complete_model_for_person_fullname\n @result = Person.non_student.find_all{|p| p.fullname.downcase.include?(params[:person][:fullname].downcase)}[0..10]\n render :partial => \"auto_complete\", :object => @result, :locals => { :highlight_phrase => params[:person][:fullname] }\n end", "def suggest\n # For some reason, Rails is not respecting the include_root_in_json for this action. So need to specify manually.\n render(:root => false, :json => OptionSuggester.new.suggest(current_mission, params[:q]).as_json(:for_option_set_form => true))\n end", "def auto_complete_for_technician_enquiry_from\n re = Regexp.new(\"^#{params[:technician][:name]}\", \"i\")\n find_options = { :order => \"name ASC\" }\n @technicians = Technician.find(:all, find_options).collect(&:name).select { |org| org.match re }\n render :template => 'sales/auto_complete_for_technician_name',:layout=>false\n end", "def suggest_params\n params.require(:suggest).permit(:name, :phone, :email, :content)\n end", "def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end", "def updateFilter(sender)\n NSLog @searchField.stringValue\n\n end", "def find_names(*types)\n return @actions.map(&:name) if types.empty?\n self.find(*types).map(&:name)\n end", "def name_filter(column, filter)\n value = filter[:value].to_s.parameterize.split('-')\n\n regex = value.map do |v|\n if v =~ /^\\d+$/\n roman = RomanNumerals.to_roman(Integer v).downcase\n v = \"(#{v}|#{roman})\"\n end\n # [[:<:]] begining of a word\n '[[:<:]]' + v + '.*?'\n end.join\n\n sanitize_sql_array([\"name_slug ~ ?\", regex])\n end", "def index_name_description # :nologin: :norobots:\n query = find_or_create_query(:NameDescription, :by => params[:by])\n show_selected_name_descriptions(query, :id => params[:id].to_s,\n :always_index => true)\n end", "def articlePartialMatchNames\n names = []\n if partial_name_match #If partial name matches are allowed for this place\n #Add any words required for a match before each trimmed name\n if before_name_article_accept_strings.length != 0\n\ttrimmed_names.uniq.each do |name|\n\t before_name_article_accept_strings.each do |string|\n\t names << string + \" \" + name\n\t end\n\tend\n else\n\tnames += trimmed_names\n end\n end\n names\n end", "def related_product_suggestion_names=(list)\n self.related_products.clear\n for name in list do\n p = Product.find_by_code(name.split(':')[0])\n next if !p || p == self\n self.related_products << p\n end\n end" ]
[ "0.70022655", "0.6608478", "0.65723145", "0.63832057", "0.63699627", "0.62765175", "0.6245165", "0.62160397", "0.62155634", "0.6190264", "0.6174676", "0.6166369", "0.6155536", "0.60924155", "0.6084375", "0.6057311", "0.6053701", "0.6035973", "0.6030637", "0.6016009", "0.60001326", "0.5991961", "0.5956783", "0.59504443", "0.5945371", "0.5931303", "0.59261876", "0.59107107", "0.5904416", "0.5866717", "0.58631384", "0.58367723", "0.5813306", "0.5792836", "0.57895654", "0.57824016", "0.5780536", "0.57719374", "0.5738196", "0.5727388", "0.5724848", "0.5719258", "0.5717077", "0.5716359", "0.5696414", "0.56807405", "0.56759316", "0.56601524", "0.5650165", "0.5644968", "0.5637398", "0.5634712", "0.56188864", "0.56188864", "0.5617315", "0.56124586", "0.5610793", "0.5608191", "0.5604583", "0.56025213", "0.5599796", "0.55824983", "0.5570434", "0.55670863", "0.5561866", "0.55603975", "0.555546", "0.555458", "0.5554139", "0.5552843", "0.5551076", "0.55222523", "0.5513138", "0.5512265", "0.54964083", "0.5485023", "0.5475337", "0.54732096", "0.5466217", "0.546621", "0.5459216", "0.54546994", "0.5452161", "0.5448119", "0.54453427", "0.54449064", "0.5441749", "0.54389787", "0.54369295", "0.54344815", "0.54287064", "0.54286397", "0.5426548", "0.54259676", "0.54236346", "0.5421806", "0.5420162", "0.5399549", "0.5398874", "0.53964347" ]
0.5699424
44
Get available song ids from the request parameters. (Overrides def on MusicBaseController) [+returns+] Array of songs ids
def get_selected_song_ids return get_songs_column( 'songs.id' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_songs_ids\n if @song_ids\n return @song_ids\n else\n return get_songs.map { |x| x[IDX_SONG_ID] }\n end\n end", "def song_ids\n @song_ids ||= input[\"songs\"].map{|song| song[\"id\"]}\nend", "def get_play_list_song_ids\n return [] if !@play_list\n\n if @play_list_song_ids\n return @play_list_song_ids\n else\n return get_songs.map { |x| x[IDX_PLAYLIST_ID] }\n end\n end", "def get_selected_song_ids\n return get_songs_relation.pluck( 'songs.id' )\n end", "def identifiers\n request[:ids]\n end", "def getQueueSongListFromSongIDs(songIDs)\n request('getQueueSongListFromSongIDs', {'songIDs' => songIDs})\nend", "def index\n @trackers = Tracker.all\n @trackers = @trackers.where(id: params[:ids].split(',')) if params[:ids].present?\n end", "def songlist_params\n params.fetch(:songlist, {})\n end", "def track_ids\n tracks || []\n end", "def get_song_ids(resource:, query:)\n # simple ID for Redis key = 'resource-query', ex: artist-jamesbrown, song-whatawonderfulworld\n # most queries will only be part of a word, ex: artist-ja, song-whata\n # uniform format with reg exps to remove whitespace and all lowercase\n if query.present?\n simple_id = resource.gsub(/\\s+/, \"\").downcase + '-' + query.gsub(/\\s+/, \"\").downcase\n resource_ids = $redis.get(simple_id) || set_redis(resource: resource, query: query.downcase, simple_id: simple_id)\n JSON.parse(resource_ids)\n else\n :no_input\n end\n end", "def get_tracks(*ids)\n song_list = []\n ids.each do |id|\n song_list << @tracks.find {|s| s.track_id == id}\n end\n return song_list.compact\n end", "def songs_found\n get_songs\n return @songs\n end", "def getTagUnion\n\t\tplaylistids = params[:playlistids]\n\t\tsongs = []\n\t\tuserid = current_user.uid\n\t\tplaylistids.each do |playlistid|\n\t\t\tresult = Playlist.get_playlist_songs(playlistid, userid)\n\t\t\tsongs += result\n\t\tend\t\t\n\t\tsongs = songs.compact.uniq { |t| t.id }\n\t\trender json: songs\n\tend", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n \t@songs = Album.find(params[:id])\n songs = RSpotify::Track.search(@songs.name)\n \t@songs = songs.map do |s_songs|\n \tSong.new_from_spotify_song(s_songs)\n end\n render json: {data:@songs}\n end", "def getPlayerIds\n @socket.request 'world.getPlayerIds()'\n end", "def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end", "def songs\n Song.find_by_album(@id)\n end", "def songs\n Song.all\n end", "def songs\n @songs\nend", "def songs \n @songs\n end", "def player\n song_ids = params[:song_ids]\n render :partial => 'player', :locals => {:song_ids => song_ids}\n end", "def paginated_songs\n\t\treturn @paginated_songs\n\tend", "def songs\n Song.all\n end", "def songs\n\t\t@musician = User.find_by_id(current_user.id)\n\tend", "def player_ids\n\t\tmy_ids = []\n\t\tplayers.each { |player|\n\t\t\tmy_ids << player.id\n\t\t}\n\t\treturn my_ids\n\tend", "def index\n @song_requests = SongRequest.all\n end", "def songs\n # @@songs.select { |song| song.name == @name }\n @songs\n end", "def multi_ids\n params[multi_id_key].split(',')\n end", "def song_params\n params.fetch(:song, {})\n end", "def current_track_ids\n tracks.where.not(id: nil).ids\n end", "def get_playlist_vids(playlist)\n Log.log.debug \"Returning playlist vids\"\n vids = Array.new\n playlist.playlist_items.each {|item| vids << item.video_id}\n return vids\nend", "def set_songlist\n @songlist = Songlist.find(params[:id])\n end", "def identifier_list(*ids, **opt)\n cid = current_id.presence\n ids = params.values_at(*id_param_keys) if ids.blank?\n super(ids, **opt).tap do |result|\n result.map! { |v| CURRENT_ID.casecmp?(v) ? cid : v } if cid\n end\n end", "def set_songs\n @mix = Mix.find(params[:mix_id])\n end", "def ids\n @ids ||= []\n end", "def index\n if params[:q].present?\n @songs = Song.search(params[:q])\n else\n @songs = Song.all\n end\n end", "def song_ids=(ids)\n ids.each do |id|\n if !id.blank?\n song = Song.find(id)\n \n self.songs << song\n end \n end\n end", "def playlist\n split_and_hash(send_request('playlistinfo'))\n end", "def track_ids(opts = {})\n limit = opts[:limit] ? opts[:limit].to_i : 10\n offset = opts[:offset].to_i # Defaulting to 0\n\n shuffler = Smoothie::Shuffler.new(favorite_track_ids, @seed)\n return shuffler.get(:offset => offset, :limit => limit)\n end", "def ids\n options[:id][1..-2].split(\",\").map(&:to_i)\n end", "def all_songs\n end", "def set_song_list\n @song_list_song = SongListSong.find(params[:id])\n end", "def songs\n @songs ||= Song.where(:artist => info(:name))\n end", "def song_ids=(ids)\n ids.each do |id|\n song = Song.find(id)\n self.songs << song\n end\n end", "def index\n # @songs = Song.find_by_artist_id params[:artist_id]\n @songs = Song.find_all_by_artist_id params[:artist_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @songs }\n end\n end", "def index\n\n \tif params[:album_id].nil? && params[:artist_id].nil?\n \t\t@songs = Song.all\n else\n \tif params[:artist_id]\n \t\t@songs = Song.where(\"artist_id=#{params[:artist_id]}\")\n \telsif params[:album_id]\n \t\t@songs = Song.where(\"album_id=#{params[:album_id]}\")\n \tend\n\n \tif @songs.size <= 0\n \t\t\tflash.now[:notice] = \"No songs exist yet for this album!\"\n \tend\n end\n\n end", "def getAudioFeatures\n\t\tuserid = current_user.uid\n\t\tsongids = params[:songIds]\n\t\taudio_features = GetAudioFeaturesFromSpotify.build.call(songids)\n\t\trender json: audio_features\n\tend", "def campaign_ids\n (params[:campaign_ids] || []).map(&:to_i)\n end", "def ids\n pluck(:id)\n end", "def valid_songs(songs)\n song_ids & songs\nend", "def sounds_list(params = {})\n get \"sounds\", params\n end", "def index\n if params[:admin].present?\n cookies[:admin] = params[:admin]\n end\n @current = decide_song\n @songs_in_playlist = Song.all\n end", "def song_params\n args = params.require(:song)\n .permit(:title, :title_translation, :description, :lyric_url, :video_url, :lyric)\n .to_h\n .map { |k, v| [k, v.to_s.strip] }\n .to_h\n\n singers = {\n \"singer_id\": :singer_attributes,\n \"composer_id\": :composer_attributes,\n }\n singers.each do |k, v|\n singer = params.require(:song).require(v).permit(:id, :name, :name_translation)\n args[k] = Singer.find_singer(singer[\"name\"], singer[\"name_translation\"]).id\n end\n\n return args\n end", "def show_songs_in_playlist\n \n file_name = params[:file_name]\n\n @song_list = []\n File.read(\"#{Rails.root}/public/Playlist/#{params[:file_name]}\").each_line do |line|\n @song_list << line.chop\n end\n end", "def songbook_params\n params.require(:songbook).permit(:name, :description, song_ids: [])\n end", "def playlist_items_list_by_playlist_id(service, part, **params)\n\n params = params.delete_if { |p, v| v == ''}\n response = service.list_playlist_items(part, params)\n # print_results(response)\n \nend", "def showUsersSongs\n @songs = Array.new\n @user = User.where(:id => params[:id]).first\n @user.songs.each do |song|\n @songs << song\n end\n respond_to do |format|\n format.html\n format.js\n end\n end", "def favorite_track_ids\n\n # Recompute them if not present or out of date\n Smoothie::PlaylistSyncer.new('id' => @user.id).async_run\n\n # Cache and return them\n @favorite_track_ids ||= @user.track_ids.members \n end", "def song_list_song_params\n params.require(:song_list_song).permit(:song_id, :song_list_id)\n end", "def selected_ids(param_name)\n @selected_ids = params[param_name] || params[:selected_ids]\n if(@selected_ids && @selected_ids.kind_of?(Array))\n @selected_ids = @selected_ids.join(\",\") \n end\n @selected_ids = @selected_ids.split(',')\n end", "def extract_ids\n # no-op\n end", "def getCurrentTagsForSong\n\t\tsongid = params[:songId]\n\t\tuserid = current_user.uid\n\t\ttags = UserSongTagging.get_tags_for_song(userid, songid)\n\t\tdb_playlists = tags.map { |tag| tag.playlist}\n\n\t\trender json: db_playlists\n\tend", "def async_ids\n async.ids\n end", "def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end", "def index\n #pass songs where song id associated with current_user\n @songs = Song.all\n #pass categories available in something like a drop down with some form_for select (drop down)\n end", "def get_ids(params)\n if params[:ids]\n type = [\"doi\", \"pmid\", \"pmcid\", \"arxiv\", \"wos\", \"scp\", \"ark\", \"url\"].find { |t| t == params[:type] } || \"pid\"\n type = \"canonical_url\" if type == \"url\"\n ids = params[:ids].nil? ? nil : params[:ids].split(\",\").map { |id| get_clean_id(id) }\n collection = Work.where(works: { type => ids })\n elsif params[:q]\n collection = Work.query(params[:q])\n elsif params[:publisher_id] && publisher = cached_publisher(params[:publisher_id])\n collection = Work.where(publisher_id: publisher.id)\n elsif params[:contributor_id] && contributor = Contributor.where(pid: params[:contributor_id]).first\n collection = Work.joins(:contributions).where(\"contributions.contributor_id = ?\", contributor.id)\n elsif params[:id]\n id_hash = get_id_hash(params[:id])\n if id_hash.present?\n key, value = id_hash.first\n collection = Work.where(key => value)\n else\n collection = Work.none\n end\n else\n collection = Work.tracked\n end\n\n if params[:source_id] && source = cached_source(params[:source_id])\n collection = collection.joins(:results)\n .where(\"results.source_id = ?\", source.id)\n .where(\"results.total > 0\")\n end\n\n if params[:relation_type_id] && relation_type = cached_relation_type(params[:relation_type_id])\n collection = collection.joins(:relations)\n .where(\"relations.relation_type_id = ?\", relation_type.id)\n end\n\n if params[:registration_agency_id] && registration_agency = cached_registration_agency(params[:registration_agency_id])\n collection = collection.where(registration_agency_id: registration_agency.id)\n end\n\n collection\n end", "def song_plays\n SongPlay.where(:song_path => path)\n end", "def included_in_params\n params.require(:included_in).permit(:song_id, :album_id)\n end", "def index\n @album = Album.find_by(id: params[:album_id])\n @tracks = Track.where(album_id: params[:album_id])\n end", "def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend", "def songs_from_query\n logger.info \"Grooveshark :: Query request initiated.\"\n if params[:query]\n query = URI.escape(params[:query])\n url = URI.parse(\"#{TINY_SONG_API}/s/#{query}?format=json&limit=#{NUM_SEARCH_RESULTS}&key=#{TINY_SONG_API_KEY}\")\n response = Net::HTTP.get_response(url).body\n response_json = ActiveSupport::JSON.decode(response)\n @song_results = response_json.map do |song_json|\n Song.find_or_create(song_json[\"SongID\"], song_json[\"SongName\"],\n song_json[\"AlbumID\"], song_json[\"AlbumName\"],\n song_json[\"ArtistID\"], song_json[\"ArtistName\"])\n end\n logger.info \"Grooveshark :: query results #{@song_results}.\"\n if @song_results.empty?\n render :text => \"No results were found.\"\n else\n render :partial => 'songs/song_list', :locals => {:songs => @song_results},\n :layout => false\n end\n else\n render :text => \"No query.\"\n end\n end", "def all_item_ids\n [id] + item_ids\n end", "def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end", "def solr_document_ids_params(ids = [])\n solr_documents_by_field_values_params blacklight_config.solr_document_model.unique_key, ids\n end", "def get_products_by_ids\n products_ids = params[:products_ids]\n products = Array.new\n JSON.parse(products_ids).each do |product_id|\n product = Product.find_by_id(product_id)\n if product\n products.push(product)\n end\n end\n render json: {products: serialized_products(products)}, status: :ok\n end", "def get_ids_for_query\n if param.field.options[:definition]\n definition = param.field.options[:definition]\n else\n # Set up a definition\n definition = Definition.new\n definition.base = param.field.options[:base].is_a?(Proc) ? param.field.options[:base].call : param.field.options[:base]\n\n # Get the fields which we should search for\n fields = @field.is_a?(Array) ? @field : [@field]\n fields.each do |field|\n definition.fields << DefinitionField.new(field, :condition => Local, :value_transmogrification => param.field.options[:value_transmogrification])\n end\n end\n\n # Set up a query\n query = Query.new(definition)\n\n # Add all the fields\n query.group(:any) do |params|\n fields.each do |field|\n params << query.param(field, @operator, @value)\n end\n end\n\n ids = query.results.pluck(param.field.options[:foreign_key])\n\n if @operator == :blank\n all_ids = param.query.definition.base.pluck(:id)\n present_ids = definition.base.pluck(param.field.options[:foreign_key])\n ids = (all_ids - present_ids) + ids\n end\n\n ids\n\n end", "def songs\n ret = Jbuilder.encode do |json|\n _songs = Song.where(category_id: params[:id])\n json.array! _songs do |song|\n json.(song, :title, :id, :artist, :category_id, :created_at) \n json.path song.path\n end\n end\n render json: ret\n end", "def song_tokens=(tokens)\n self.song_ids = Song.ids_from_tokens(tokens)\n end", "def available_ids\n %w(bounce deliver drop spam unsubscribe click open).map(&:to_sym)\n end", "def liked_song_params\n params.fetch(:liked_song, {})\n end", "def index\n @playlists = Playlist.accessible_by(current_ability)\n .includes(:tracks)\n .scoped(search_params)\n .page(params[:page])\n end", "def relatedartists(genre = \"\")\n @related = Array.new\n @genre = \"\\\"#{genre}\\\"\"\n genreSearch = RSpotify::Artist.search(\"genre:#{@genre}\")\n genreSearch.each do |artist|\n name = artist.name\n @related.push(name)\n end\n session[:related] = @related\nend", "def get_ids(api_key)\n old_ids_url = \"https://na.api.pvp.net/api/lol/na/v1.2/champion?api_key=\" + api_key\n ids_url = \"https://na1.api.riotgames.com/lol/platform/v3/champions?api_key=\" + api_key\n response = HTTParty.get(ids_url)\n ids = [13]\n case response.code\n when 200\n response_hash = response.parsed_response\n champions = response_hash[\"champions\"]\n champions.each do |champ|\n ids += [champ[\"id\"]]\n end\n when 404\n puts \"404 - could not find champion list\"\n end\n return ids\nend", "def execute(input_set = nil)\n resp = super(input_set)\n results = ListPlaylistsByIDResultSet.new(resp)\n return results\n end", "def albums_tracks(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s.gsub(/[_]/,'/')\n http_get(path, query)\n end", "def songs \n Song.all.select{|song| add_song(song)}.to_a\n # binding.pry\n end", "def albums\n if params[:artist_id]\n albums = Artist.find(params[:artist_id]).albums\n else\n albums = Album.all\n end\n render json: albums\n end", "def index\n set_song_list\n end" ]
[ "0.7265411", "0.701385", "0.6784159", "0.67386943", "0.6480067", "0.6397592", "0.61705416", "0.61416066", "0.612541", "0.6064909", "0.6058923", "0.60139734", "0.5964355", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.593254", "0.5912532", "0.5912532", "0.5897995", "0.5894411", "0.58810765", "0.58767587", "0.58465147", "0.58465135", "0.5838077", "0.58278936", "0.5802064", "0.5798534", "0.57972634", "0.577403", "0.5771039", "0.5747647", "0.5731971", "0.5713655", "0.5710651", "0.5708959", "0.5666357", "0.5648907", "0.5642015", "0.56416196", "0.56357515", "0.56315744", "0.5628937", "0.56156445", "0.55998844", "0.55975616", "0.558511", "0.5565577", "0.5556899", "0.55444145", "0.55433017", "0.5541237", "0.5534764", "0.5508082", "0.54937476", "0.54841435", "0.5479688", "0.5454275", "0.54104376", "0.5406599", "0.5393107", "0.53909326", "0.53860503", "0.5370471", "0.53703344", "0.5352917", "0.53468615", "0.53438413", "0.5321906", "0.53212243", "0.53105897", "0.5274748", "0.52692586", "0.52568686", "0.52555156", "0.5255198", "0.525106", "0.5246661", "0.52256465", "0.52064216", "0.51996905", "0.5180317", "0.5178012", "0.5162967", "0.51544887", "0.51511097", "0.5151057", "0.5144027", "0.514357", "0.5141047", "0.51399004", "0.5139577", "0.5137775" ]
0.68085366
2
Returns an array with the relative path of the selected songs (Overrides def on MusicBaseController)
def get_selected_paths return get_songs_column( :path ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_selected_paths\n return get_songs_relation.pluck( :path )\n end", "def song_plays\n SongPlay.where(:song_path => path)\n end", "def path\n File.expand_path File.join(songs.first.path, '..').gsub(' ','\\ ')\n end", "def path # getter method \n # - this method will get the path passed through the MusicImporter object\n @path\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs \n @songs\n end", "def songs\n @songs\nend", "def songs\n Song.all\n end", "def show_songs_in_playlist\n \n file_name = params[:file_name]\n\n @song_list = []\n File.read(\"#{Rails.root}/public/Playlist/#{params[:file_name]}\").each_line do |line|\n @song_list << line.chop\n end\n end", "def all_songs\n end", "def files\n\t\t@array_of_mp3s = Dir[\"#{@path}/*.mp3\"]\n\t\t@array_of_mp3s.map do |mp3|\n\t\t\tmp3.slice!(\"#{@path}/\")\n\t\t\tmp3\n\t\tend\n\tend", "def songs\n MusicImporter.new(path).print_songs\n end", "def songs\n Song.find_by_album(@id)\n end", "def songs\n Song.all\n end", "def files\n # fetch the appropriate files\n filenames = Dir.glob(@path + \"/*.mp3\")\n filenames.map { |filename| @files << File.basename(filename) }\n @files\n end", "def songs\n # @@songs.select { |song| song.name == @name }\n @songs\n end", "def files\n Dir.glob(self.path + '**/*.mp3').collect {|file| File.basename(file)}\n end", "def files\n # fetch the appropriate files\n file_paths = Dir.glob(@path + \"/*.mp3\")\n file_paths.map { |file_path| @files << File.basename(file_path) }\n @files\n end", "def files\n @files_array ||= Dir.glob(\"#{@path}/*.mp3\").collect do |filename|\n filename.rpartition(\"/\").last \n end \n end", "def pathlist\n @path\n end", "def get_selected_song_ids\n return get_songs_column( 'songs.id' )\n end", "def files\n Dir[\"#{@path}/*.mp3\"].collect {|path| path.split('/')[-1]}\n end", "def songs\n\t\t@musician = User.find_by_id(current_user.id)\n\tend", "def files\n filename = Dir.entries(@path).find_all {|file| file.include?(\".mp3\")}\n # binding.pry\n # [[\"Thundercat - For Love I Come - dance.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\"]]\n\n #binding.pry\n end", "def get_selected_song_ids\n return get_songs_relation.pluck( 'songs.id' )\n end", "def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end", "def files\n get_back_here = Dir.pwd\n Dir.chdir(@path)\n @files = Dir.glob(\"*.mp3\")\n Dir.chdir(get_back_here)\n @files\n end", "def play_songs\n MusicImporter.new(path).play_song\n end", "def index\n @songs = @album.songs.all\n end", "def files\n\t\t(Dir.glob(\"#{@path}/*.mp3\")).map do |path_filename|\n\t\t @files = File.basename(path_filename)\n\t\tend\n\tend", "def files\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{|file|\n#normalize the filename to just the MP3 filename with no path\n file.gsub(\"#{path}/\", \"\")}\n end", "def files\n array_full_names = Dir.glob(\"#{@path}/*.mp3\")\n array_full_names.collect do |full_name|\n full_name[21..-1]\n end\n end", "def files\n # Dir.glob(\"*.mp3\") #this grabs mp3s from path\n Dir.chdir(@path) do \n @mp3s = Dir.glob(\"*.mp3\") \n end\n end", "def files # loads all the mp3 files in the path directory / normalizes the filename to just the mp3 filename with no path\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{ |f| f.gsub(\"#{path}/\", \"\") } # then using the .collect method and gsub to just return the filename with out path\n end", "def files\n filename = Dir.glob(\"#{path}/*.mp3\")\n filename = filename.collect{|a_string| a_string.sub(\"#{path}/\", \"\")}\n end", "def path\n @path || []\n end", "def songs_found\n get_songs\n return @songs\n end", "def files\n Dir.entries(\"#{path}\").select {|song_filename| song_filename.include?(\"mp3\")}\n end", "def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end", "def full_path(settings)\n return File.join( settings.music_dir_path , self.path )\n end", "def songs\n @songs ||= Song.where(:artist => info(:name))\n end", "def songs\n #use select to iterate thru songs\n Song.all.select{|song| song.artist == self}\n end", "def albums\n Dir[_(\"*\")].collect do |alb| \n album(File.basename(alb))\n end\n end", "def index\n @base_songs = BaseSong.all\n end", "def paths\n @paths ||= []\n @paths\n end", "def paths\n @paths ||= []\n @paths\n end", "def path_arr()\n return @paths\n end", "def files \n @files = Dir.glob(\"#{path}/*.mp3\")\n @files.collect! {|filename| filename.gsub(/#{path}\\//, \"\")}\n @files\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def audio_path(source)\n compute_public_path(source, 'audios')\n end", "def index\n set_song_list\n end", "def patharray\n return @pathArray\n end", "def music_shuffle(filenames_array)\n filenames_array.each do |song|\n song_path = song.split '/'\n\n end\nend", "def songs\n Song.all_by_artist(self)\n end", "def file_paths\n @file_paths ||= BrowseEverythingFilePaths.new(selected_files)\n end", "def list\n for song in self.songs\n puts song.name\n end\n end", "def songs # to entre the Song class then within the song class take the class variable all to use to select and go thought the songs listed in that array\n Song.all.select { |song| song.artist == self } # use the .select to gather the information we want from the all array in songs - go thought and assign each song artist to this current instance\n end", "def files\n Dir.glob(\"#{path}/*.mp3\").collect {|file| file.gsub(\"#{path}/\",\"\")}\n end", "def index\n if @album.present? \n @songs = @album.songs\n elsif @artist.present?\n @songs = @artist.songs\n else\n @songs = Song.all\n end\n end", "def set_songs\n @mix = Mix.find(params[:mix_id])\n end", "def paginated_songs\n\t\treturn @paginated_songs\n\tend", "def files\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{ |filename|filename.gsub(\"#{path}/\", \"\")}\n end", "def paths\n root.paths\n end", "def path_to\n\t\tresult = [self]\n\t\tresult = @parent.path_to + result if @parent\n\t\treturn result\n\tend", "def soundtrack_list\n Soundtrack.all.collect do |s|\n if @event.soundtrack == s\n [\"#{s.id} - #{s.name}\", s.id, {selected: true}]\n else\n [\"#{s.id} - #{s.name}\", s.id]\n end\n end\n end", "def index\n @plsbgmusic_mediafiles = PlsbgmusicMediafile.all\n end", "def files\n files = Dir[\"#{path}/*.mp3\"].each {|file_name| next if File.directory? file_name}\n norm_files = files.collect {|filename| File.basename(filename)}\n norm_files\n end", "def albums\n self.album\n end", "def files\n real_path = self.path[2...-1] + \"s/*\"#trim './' and add 's/*' \n \n Dir[real_path].map{|file| file.split(\"/\")[-1]} \n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select{|song| song.artist == self}\n end", "def index\n @songs = Song.all\n @songs_with_names = Song.all.map{|s| [s, s.artist ? s.artist.name : \"\"]}\n end", "def songs\n Song.all.select do |song|\n song.artist == self.name\n end\n end", "def songs\n Song.all.select {|song| song.artist == self }\n end", "def current_song\n Song.find(params[:id])\n end", "def ls\n @files.each_with_index.map do |file, i|\n { file: (@path.nil? ? file.path : file.path.relative_path_from(@path)).to_s, selected: @selected_files.include?(file) }\n end\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist == self}\n end", "def songs\n Song.all.select {|song| song.artist = self}\n end", "def songs\n ret = Jbuilder.encode do |json|\n _songs = Song.where(category_id: params[:id])\n json.array! _songs do |song|\n json.(song, :title, :id, :artist, :category_id, :created_at) \n json.path song.path\n end\n end\n render json: ret\n end", "def songs\n Song.all.select{|song|song.artist == self}\n end", "def index\n #pass songs where song id associated with current_user\n @songs = Song.all\n #pass categories available in something like a drop down with some form_for select (drop down)\n end", "def show\n @songs = @set_list.songs\n end", "def list_songs \n self.lib.songs.each do |song|\n puts song.to_s_simple\n end\n end", "def songs\n Song.all.select {|songs|songs.artist == self}\n end" ]
[ "0.7602469", "0.6756914", "0.6566635", "0.6497871", "0.64439666", "0.64439666", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6416481", "0.6335312", "0.63043845", "0.62646556", "0.6229565", "0.6189326", "0.6186246", "0.6181002", "0.61462206", "0.61374694", "0.61339235", "0.6132415", "0.6128909", "0.6118086", "0.61145043", "0.6097472", "0.60402614", "0.60012543", "0.5999181", "0.59886813", "0.5973032", "0.5970898", "0.5962647", "0.5941949", "0.58866763", "0.5866591", "0.58665484", "0.585648", "0.5821957", "0.58119535", "0.5809925", "0.5802694", "0.5795564", "0.5777054", "0.5768771", "0.574903", "0.57458967", "0.5734645", "0.5730293", "0.5721042", "0.5706623", "0.5706623", "0.569803", "0.56978023", "0.5696096", "0.5696096", "0.5696096", "0.5696096", "0.5696096", "0.56922406", "0.56895727", "0.5685569", "0.5684115", "0.5642912", "0.56246036", "0.56198484", "0.56152797", "0.56128436", "0.561083", "0.5590033", "0.55841464", "0.5580957", "0.55734944", "0.556883", "0.55672526", "0.55519164", "0.55453086", "0.5542444", "0.5536828", "0.55295414", "0.5524675", "0.551954", "0.551875", "0.5512311", "0.5512159", "0.55080056", "0.55079526", "0.55079526", "0.5494554", "0.54921895", "0.54870224", "0.5481687", "0.54639864", "0.54365325", "0.5433918" ]
0.7722529
0
NOTE do not pattern your production application after this (refer to test_should_create_customer_profile_transaction_auth_only_and_then_prior_auth_capture_requests instead as the correct way to do an auth then capture). capture_only "is used to complete a previously authorized transaction that was not originally submitted through the payment gateway or that required voice authorization" and can in some situations perform an auth_capture leaking the original authorization.
def test_should_create_customer_profile_transaction_auth_only_and_then_capture_only_requests @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_only)) assert response = @gateway.create_customer_profile_transaction( transaction: { customer_profile_id: @customer_profile_id, customer_payment_profile_id: @customer_payment_profile_id, type: :auth_only, amount: @amount } ) assert_instance_of Response, response assert_success response assert_equal response.authorization, response.params['direct_response']['transaction_id'] assert_equal 'This transaction has been approved.', response.params['direct_response']['message'] assert_equal 'auth_only', response.params['direct_response']['transaction_type'] assert_equal 'Gw4NGI', approval_code = response.params['direct_response']['approval_code'] @gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:capture_only)) assert response = @gateway.create_customer_profile_transaction( transaction: { customer_profile_id: @customer_profile_id, customer_payment_profile_id: @customer_payment_profile_id, type: :capture_only, amount: @amount, approval_code: approval_code } ) assert_instance_of Response, response assert_success response assert_equal 'This transaction has been approved.', response.params['direct_response']['message'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_authorization_and_capture\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert capture = @gateway.capture(@amount, authorization.authorization)\n assert_success capture\n assert_match(/This transaction has been approved/, capture.message)\n end", "def auth_capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_CAPTURE\"\n )\n\n astro_curl(@validator_url, data)\n end", "def authorize_and_capture\n \n resp = StdClass.new \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.create(\n :amount => (self.total * 100).to_i,\n :currency => 'usd',\n :customer => self.customer.stripe_customer_id,\n :capture => true,\n :metadata => { :invoice_id => self.id },\n :statement_descriptor => \"#{self.site.description.truncate(22)}\"\n ) \n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => c.id,\n :transaction_type => InvoiceTransaction::TYPE_AUTHCAP,\n :payment_processor => sc.pp_name,\n :amount => c.amount / 100.0,\n :captured => true,\n :date_processed => DateTime.now.utc,\n :success => c.status == 'succeeded'\n )\n if c.status == 'succeeded'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n \n end \n end \n return resp\n end", "def authorized_with_capture(options = {})\n options = { date_authorized: Date.current, date_captured: Date.current }.merge(options)\n request_params = {\n 'customerID' => customer_id,\n 'cartID' => cart_id,\n 'orderID' => order_id,\n 'dateAuthorized' => xml_date(options[:date_authorized]),\n 'dateCaptured' => xml_date(options[:date_captured])\n }\n\n response = TaxCloud.client.request :authorized_with_capture, request_params\n TaxCloud::Responses::AuthorizedWithCapture.parse response\n end", "def capture_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_auth_code' => approval_code,\n 'x_type' => \"CAPTURE_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end", "def capture(_, authorization, options = {})\n transaction { transaction_api.capture_transaction(preferences[:access_token], location_id, authorization) }\n end", "def create_transaction_auth_capture(amount, profile_id, payment_profile_id, order = nil, options = {})\n create_transaction(:auth_capture, amount, profile_id, payment_profile_id, order, options)\n end", "def authorized_with_capture(options = {})\n options = { :date_authorized => Date.today, :date_captured => Date.today }.merge(options)\n request_params = {\n 'customerID' => customer_id,\n 'cartID' => cart_id,\n 'orderID' => order_id,\n 'dateAuthorized' => options[:date_authorized],\n 'dateCaptured' => options[:date_captured]\n }.merge(TaxCloud.auth_params)\n\n response = TaxCloud.client.request :authorized_with_capture, :body => request_params\n end", "def test_authorization_and_capture\n assert authorization = @gateway.authorize(@amount, @good_card, @options)\n assert_success authorization\n\n assert capture = @gateway.capture(@amount, authorization.authorization)\n assert_success capture\n assert capture.params['aux_msg'].include? 'has been successfully marked for settlement.'\n assert_equal 'Success', capture.message\n end", "def capture(money, authorization, options = {})\n post = { trans_id: authorization }\n add_customer_data(post, options)\n commit('PRIOR_AUTH_CAPTURE', money, post)\n end", "def capture\n raise InvalidOperation unless authorized?\n raise InvalidOperation if captured?\n\n @payment_gateway.capture(@payment_gateway_transaction_identifier)\n\n apply(Payments::CaptureSucceeded.strict(data: {\n transaction_identifier: @transaction_identifier,\n payment_gateway_identifier: @payment_gateway.identifier,\n payment_gateway_transaction_identifier: @payment_gateway_transaction_identifier,\n order_number: @order_number,\n amount: @amount,\n currency: @currency\n }))\n rescue PaymentGatewayCaptureFailed\n apply(Payments::CaptureFailed.strict(data: {\n transaction_identifier: @transaction_identifier,\n payment_gateway_identifier: @payment_gateway.identifier,\n order_number: @order_number\n }))\n end", "def test_authorization_and_capture\n assert authorization = @gateway.authorize(100, @good_creditcard)\n assert authorization.success?\n \n assert capture = @gateway.capture(100, authorization.authorization)\n assert capture.success?\n assert_equal 'Success', capture.message\n end", "def purchase!\n if ratepay?\n capture!\n elsif adyen_cc_payment?\n authorize!\n capture!\n else\n super\n end\n end", "def capture_payment(options = {})\n # transaction do\n capture = OrderTransaction.capture(amount, authorization_reference, options)\n self.save!\n self.order_transactions << capture\n\n if capture.success?\n self.payment_captured!\n else\n self.transaction_declined!\n end\n\n capture\n # end\n end", "def process_with_active_merchant\n options = populate_options\n auth = authorize_payment(options)\n save!\n if APP_CONFIG['pre_and_post_authorization'] == true\n if auth.success == true\n capture_payment(options)\n save!\n end\n end\n end", "def test_credit_card_authorize_and_capture_amount_low\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert capture = @gateway.capture(@amount-100, auth.authorization, @credit_card, @options)\n assert_success capture\n assert_equal 'Approved', capture.message\n end", "def test_authorize_and_capture\n amount = @amount\n assert response = @gateway.authorize(amount, @credit_card, @options)\n assert_success response\n assert_nil response.message\n assert response.authorization\n assert capture = @gateway.capture(amount, response.authorization)\n assert_success capture\n end", "def test_successful_authorize_and_capture\n response = @gateway.authorize(@amount, @credit_card, @options)\n assert_success response\n\n response = @gateway.capture(@amount, response.authorization)\n assert_success response\n end", "def capture!(capture_amount = nil)\n if hpp_payment? || adyen_cc_payment? || ratepay?\n amount = money.money.cents\n process do\n payment_method.send(\n :capture, amount, response_code, gateway_options)\n end\n else\n super\n end\n end", "def create_transaction_prior_auth_capture(transaction_id, amount, order = nil, options = {})\n handle_transaction_id(transaction_id)\n create_transaction(:prior_auth_capture, amount, nil, nil, order, options)\n end", "def capture(\n amazon_authorization_id,\n capture_reference_id,\n amount,\n currency_code: @currency_code,\n seller_capture_note: nil,\n soft_descriptor: nil,\n provider_credit_details: nil,\n merchant_id: @merchant_id,\n mws_auth_token: nil\n )\n\n parameters = {\n 'Action' => 'Capture',\n 'SellerId' => merchant_id,\n 'AmazonAuthorizationId' => amazon_authorization_id,\n 'CaptureReferenceId' => capture_reference_id,\n 'CaptureAmount.Amount' => amount,\n 'CaptureAmount.CurrencyCode' => currency_code\n }\n\n optional = {\n 'SellerCaptureNote' => seller_capture_note,\n 'SoftDescriptor' => soft_descriptor,\n 'MWSAuthToken' => mws_auth_token\n }\n\n optional.merge!(set_provider_credit_details(provider_credit_details)) if provider_credit_details\n\n operation(parameters, optional)\n end", "def capture(amount, authorization, options = {})\n xml = signon_app_cert_rq\n response = commit('session_ticket', xml)\n if response.success?\n options[:session_ticket] = response.authorization\n xml = customer_credit_card_capture_rq(amount, authorization, options)\n commit('capture', xml)\n end\n end", "def capture(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_financial_data(request, money, options)\r\n request.Set(RocketGate::GatewayRequest::TRANSACT_ID, authorization)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformTicket(request, response)\r\n return create_response(response)\r\n end", "def capture(money, authorization, options = {})\n post = {}\n\n # remove last 4 digits of cc number as they are not required here\n post[:postonly] = authorization[0...-4]\n\n commit(post[:userprofileid] ? :profile_sale : :ns_quicksale_cc, money, post)\n end", "def capture(money, authorization, options = {})\n requires!(options, :order_id) \n \n order = retrieve_order(options[:order_id])\n return order if order.is_a?(Response)\n commit(build_capture_request(money, options[:order_id], order[:payment_product_id])) \n end", "def capture(transaction_id, amount)\n\t\t\traise \"Sorry we haven't compelted this functionality yet.\"\n\t\tend", "def get_auth_transaction\n\t\ttrans = self.create_transaction\n\t\t# Set order specific fields\n\t\ttrans.type = 'AUTH_CAPTURE'\n\t\treturn trans\n\tend", "def purchase!\n if adyen_cc_payment?\n capture!\n else\n super\n end\n end", "def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end", "def can_capture?(payment)\n (payment.pending? || payment.checkout?) && !payment.response_code.blank?\n end", "def capture(money, authorization, options = {})\n requires!(@options, :advanced_login, :advanced_password)\n\n post = options.merge(TransNo: authorization)\n\n add_amount(post, money, options)\n add_advanced_user(post)\n add_standard_parameters('capture', post, options[:unique_id])\n add_tx_source(post, options)\n\n commit(post)\n end", "def capture(money, authorization, options = {})\n requires!(options, :credit_card)\n\n form = {}\n add_salestax(form, options)\n add_approval_code(form, authorization)\n add_invoice(form, options)\n add_creditcard(form, options[:credit_card])\n add_customer_data(form, options)\n add_test_mode(form, options)\n commit(:capture, money, form)\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def can_capture?(payment)\n payment.pending? || payment.checkout?\n end", "def capture_payment(options = {})\n options = populate_options if options.size == 0\n\n amount = if options[:amount] \n options[:amount] * 100\n else\n self.total_in_cents\n end\n\n transaction do\n capture = OrderTransaction.capture(amount, authorization_reference, options)\n self.transactions << capture\n if capture.success?\n payment_captured!\n else\n transaction_declined!\n end\n capture\n end\n end", "def capture(amount = nil)\n \n return { :error => \"This invoice doesn't seem to be authorized.\" } if !self.success\n \n ct = InvoiceTransaction.where(:parent_id => self.id, :transaction_type => InvoiceTransaction::TYPE_CAPTURE, :success => true).first \n return { :error => \"Funds for this invoice have already been captured.\" } if ct\n \n # Make sure the amount given isn't greater than the invoice total \n return { :error => \"Amount given to capture is greater than the current invoice total.\" } if amount && amount.to_f > self.invoice.total.to_f \n amount = self.invoice.total if amount.nil? \n \n resp = Caboose::StdClass.new\n sc = self.invoice.site.store_config \n case sc.pp_name\n \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin \n c = Stripe::Charge.retrieve(self.transaction_id) \n return { :error => \"Amount given to capture is greater than the amount authorized. amount = #{amount}, c.amount = #{c.amount}\" } if (amount*100).to_i > c.amount \n amount = (amount.to_f * 100.0).to_i\n if amount == c.amount \n c = c.capture\n else\n c = c.capture({ :amount => amount })\n end\n bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)\n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end\n \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.invoice_id,\n :parent_id => self.id,\n :transaction_id => bt.id,\n :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n :payment_processor => sc.pp_name,\n :amount => bt.amount / 100.0, \n :date_processed => DateTime.strptime(bt.created.to_s, '%s'),\n :success => bt.status == 'succeeded' || bt.status == 'pending'\n )\n if bt.status == 'succeeded' || bt.status == 'pending'\n self.captured = true\n self.save \n self.invoice.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.invoice.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n \n end\n return resp\n \n end", "def capture!\n if hpp_payment? || adyen_cc_payment?\n amount = money.money.cents\n process do\n payment_method.send(\n :capture, amount, response_code, gateway_options)\n end\n else\n super\n end\n end", "def test_authorization_and_void\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert void = @gateway.void(authorization.authorization)\n assert_success void\n assert_match(/This transaction has been approved/, void.message)\n end", "def can_capture?(payment)\n payment.state == 'pending' || payment.state == 'checkout'\n end", "def should_request_capture?(response, requires_approval)\n !capture_requested?(response) && requires_approval != false\n end", "def test_authorize_and_void\n amount = @amount\n assert response = @gateway.authorize(amount, @credit_card, @options)\n assert_success response\n assert_nil response.message\n assert response.authorization\n assert capture = @gateway.void(response.authorization)\n assert_success capture\n end", "def can_capture?(payment)\n payment.checkout?\n end", "def capture!(transaction_uuid)\n post(nil, \"#{collection_path}/transaction-uuid-#{transaction_uuid}/capture\")\n end", "def capture(amount, authorization, options={})\n adjust_and_save(amount.abs * -1, :capture, {:authorization => authorization}.merge(options))\n end", "def capture(_, transaction_id, __)\n Response.parse self, api.payment.capture(transaction_id)\n end", "def capture(account, merchant, transaction_id)\n url = \"/#{CGI::escape(account)}/transactions/#{transaction_id}/capture\"\n post_json url, {capture_request: {merchant: merchant}}\n expect_status! 'CAPTURED'\n # puts @response.inspect\n end", "def find_captured_authorization(authorization_number)\n self.transactions.find(:first, :conditions => [\n \"authorization = ? AND action = ?\", authorization_number, 'capture'\n ])\n end", "def capture(unique_id)\n request('payment/capture', :capture => {:unique_id => unique_id} )\n end", "def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end", "def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end", "def can_capture?(payment)\n ['pending'].include?(payment.state)\n end", "def capture(transaction_id, amount)\n params = {\n :transaction_amount => amount,\n :transaction_id => transaction_id,\n :operation => 'CAPTURE',\n }\n\n process_response params\n end", "def capture(money, authorization, options={})\n execute_dependant(:capture, money, authorization, options)\n end", "def can_capture?(payment)\n logger.debug \"\\n----------- #{self.invoice_number} -----------\\n\"\n ['checkout', 'pending', 'processing'].include?(payment.state) && !self.invoice_number.blank?\n end", "def can_capture?(payment)\n ['pending'].include?(payment.state)\n end", "def can_capture?(payment)\n ['checkout', 'pending'].include?(payment.state)\n end", "def test_successful_capture\n capt = OrderTransaction.capture(@amount, '123')\n assert capt.success\n assert_equal 'capture', capt.action\n assert_equal BogusGateway::SUCCESS_MESSAGE, capt.message\n end", "def test_successful_authorize_credit_card_metadata\n test_successful_purchase_credit_card_metadata(false, true, false)\n end", "def capture(money, authorization, options = {})\n txn_number, order_id = authorization.split(';')\n\n parameters = {\n :txn_number => txn_number,\n :order_id => order_id,\n :comp_amount => amount(money),\n :crypt_type => options[:crypt_type] || @options[:crypt_type]\n }\n\n commit('completion', parameters) \n end", "def can_capture?(payment)\n ['checkout', 'pending', 'processing'].include?(payment.state)\n end", "def authorize_credit_card\n main_body = {\n createTransactionRequest: {\n merchantAuthentication: merchant_authentication,\n transactionRequest: {\n transactionType: 'authOnlyTransaction',\n amount: '8.75',\n payment: {\n creditCard: {\n cardNumber: '5424000000000015',\n expirationDate: '1220',\n cardCode: '900'\n }\n }\n }\n }\n }\n\n response = self.class.post('', basic_auth: @auth, body: main_body.to_json,\n headers: { 'Content-Type' => 'application/json' })\n JSON.parse(response.body.delete(''))\n end", "def before_capturable_sign_in(capture_data, params)\n end", "def capture(money, authorization, options = {})\n post = { :gateid => authorization }\n commit('FORCE', money, post)\n end", "def test_successful_authorize_stored_card_metadata\n test_successful_purchase_credit_card_metadata(false, true, true)\n end", "def capture(money, authorization, options = {})\n commit(build_void_or_capture_request(FULFILL_TYPE, money, authorization, options))\n end", "def test_credit_card_authorize_and_void\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert void = @gateway.void(@amount, auth.authorization, @credit_card, @options)\n assert_success void\n assert_equal 'Approved', void.message\n end", "def test_subscription_payment_transaction\n capt = OrderTransaction.capture(@amount, '123')\n assert capt.success\n assert_equal 'capture', capt.action\n assert_equal BogusGateway::SUCCESS_MESSAGE, capt.message\n end", "def capture(money, authorization, options = {})\n post = {} \n add_authorization(post, reference_from(authorization))\n add_invoice(post, options)\n add_customer_data(post, options)\n add_money(post, money, options)\n commit('SAL', post)\n end", "def capture(money, authorization, options = {})\n request = build_void_or_capture_request(FULFILL_TYPE, money, authorization, options)\n\n commit(request)\n end", "def capture_funds\n \n resp = StdClass.new \n it = InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\" \n elsif self.total > it.amount\n resp.error = \"The invoice total exceeds the authorized amount.\"\n elsif it.nil?\n resp.error = \"This invoice doesn't seem to be authorized.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name\n \n #when 'authorize.net'\n # transaction = AuthorizeNet::AIM::Transaction.new(sc.authnet_api_login_id, sc.authnet_api_transaction_key)\n # response = transaction.prior_auth_capture(t.transaction_id, self.total)\n # \n # ot = Caboose::InvoiceTransaction.create(\n # :invoice_id => self.id,\n # :date_processed => DateTime.now.utc,\n # :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n # :payment_processor => sc.pp_name,\n # :amount => self.total, \n # :success => response.response_code && response.response_code == '1', \n # :transaction_id => response.transaction_id,\n # :auth_code => response.authorization_code,\n # :response_code => response.response_code\n # )\n # if ot.success\n # self.date_captured = DateTime.now.utc\n # self.save \n # end \n # self.update_attribute(:financial_status, Invoice::FINANCIAL_STATUS_CAPTURED)\n # resp.success = 'Captured funds successfully'\n \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n it = Caboose::InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n if it.nil?\n resp.error = \"Error capturing funds for invoice #{self.id}. No previous successful authorization for this invoice exists.\"\n return false\n else \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.retrieve(it.transaction_id)\n c = c.capture\n bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)\n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end\n \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => bt.id,\n :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n :payment_processor => sc.pp_name,\n :amount => bt.amount / 100, \n :date_processed => DateTime.strptime(bt.created.to_s, '%s'),\n :success => bt.status == 'succeeded' || bt.status == 'pending'\n )\n if bt.status == 'succeeded' || bt.status == 'pending'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n end\n \n end \n end \n return resp\n end", "def capture(_amount, response_code, _gateway_options)\n transaction = Cielo::Transaction.new\n ret = transaction.catch!(response_code)\n\n ActiveMerchant::Billing::Response.new(true, Spree.t('cielo.messages.capture_success'), {}, authorization: ret[:transacao][:tid])\n rescue\n verify_error 'capture', ret\n end", "def capture(money, authorization, options = {})\n options = options.merge(:transaction_type => \"COLLECTION\")\n options = options.merge(:xml_transaction_wrapper => 'CrossReferenceTransaction')\n options = options.merge(:soap_action => \"https://www.thepaymentgateway.net/CrossReferenceTransaction\")\n\n commit(build_capture_request(money, authorization, options), options)\n end", "def test_successful_authorize_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, false)\n end", "def capture_transaction(type)\n @gateway.capture test_transaction(type).transaction_id\n end", "def authorize(money, creditcard, options = {})\n post = {}\n add_invoice(post, options)\n add_creditcard(post, creditcard)\n add_address(post, options)\n add_customer_data(post, options)\n add_duplicate_window(post)\n\n commit('AUTH_ONLY', money, post)\n end", "def test_successful_authorize_stored_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, true)\n end", "def capture_transaction(location_id:,\n transaction_id:)\n warn 'Endpoint capture_transaction in TransactionsApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/locations/{location_id}/transactions/{transaction_id}/capture',\n 'default')\n .template_param(new_parameter(location_id, key: 'location_id')\n .should_encode(true))\n .template_param(new_parameter(transaction_id, key: 'transaction_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def test_pre_authorize_transaction\n customer = Stripe::Customer.create(email: 'johnny@appleseed.com', source: stripe_helper.generate_card_token)\n client_test = create(:client, stripe_customer_id: customer.id)\n amount = '1000'\n description = '123abc'\n client_id = client_test.id\n appointment_id = appointment.id\n\n pre_authorize_transaction(\n client_id,\n appointment_id,\n amount,\n description\n )\n end", "def auth_transaction\n data = full_params.merge(\n 'x_unique_id' => unique_id,\n 'x_invoice_num' => invoice_num,\n 'x_type' => \"AUTH_ONLY\"\n )\n\n astro_curl(@validator_url, data)\n end", "def test_recurring_with_initial_authorization\n response = @gateway.recurring(1000, @credit_card, \n :periodicity => :monthly,\n :initial_transaction => {\n :type => :purchase,\n :amount => 500\n }\n )\n \n return if user_authentication_failed?(response)\n \n assert_success response\n assert !response.params['profile_id'].blank?\n assert response.test?\n end", "def guard_process_payment_from_created; true; end", "def guard_process_payment_from_created; true; end", "def test_successful_authorize_encryption_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(true, true)\n end", "def test_successful_purchase_with_account_set_up_and_repeat_payments\n @params[:set_up_continuous_authority] = true\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert !response.authorization.to_s.split(';')[2].blank?\n assert response.test?\n\n #Make second payment on the continuous authorization that was set up in the first purchase\n second_order_params = { :order_id => generate_unique_id }\n purchase = @gateway.purchase(201, response.params['ca_reference'], second_order_params)\n assert_success purchase\n assert purchase.test?\n end", "def authorize(money, creditcard, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformAuthOnly(request, response)\r\n return create_response(response)\r\n end", "def test_recurring_with_initial_authorization\n response = @gateway.recurring(1000, @credit_card, \n :periodicity => :monthly,\n :initial_transaction => {\n :type => :authorization\n }\n )\n return if user_authentication_failed?(response)\n \n assert_success response\n assert !response.params['profile_id'].blank?\n assert response.test?\n end", "def authorize(record, query = nil)\n return record if Rails.env.test?\n super\n end", "def test_successful_authorize_encryption_credit_card_metadata\n test_successful_purchase_credit_card_metadata(true, true)\n end", "def test_successful_purchase_with_account_set_up_and_repeat_payments\n @params[:set_up_continuous_authority] = true\n response = @gateway.purchase(@amount, @mastercard, @params)\n assert_success response\n assert !response.authorization.to_s.split(';')[2].blank?\n assert response.test?\n\n # Make second payment on the continuous authorization that was set up in the first purchase\n second_order_params = { order_id: generate_unique_id }\n purchase = @gateway.purchase(201, response.authorization, second_order_params)\n assert_success purchase\n end", "def capture(money, authorization, options = {})\n\n body = credentials\n body[:ssl_transaction_type] = :cccomplete\n body[:ssl_description] = 'Keyed Sale API'\n body[:ssl_amount] = (money.to_money/100.0).to_s if money.present?\n body[:ssl_txn_id] = authorization\n\n names = [ :ssl_merchant_id,\n :ssl_user_id,\n :ssl_pin,\n :ssl_description,\n :ssl_transaction_type,\n :ssl_txn_id ]\n\n body_text = 'xmldata=<txn>' + xmlize2(body,names) + '</txn>'\n\n # for logging\n logger.error 'REQUEST: ' + body_text\n\n response = RestClient.post(url, body_text) {|response, request, result| response }\n logger.error 'RESPONSE: ' + response\n\n\n doc = JSON.parse(Hash.from_xml(response).to_json,:symbolize_names=>true)[:txn]\n\n return request_failed_response(doc) if request_failed?(doc)\n\n ActiveMerchant::Billing::Response.new(\n doc[:ssl_result] == '0',\n doc[:ssl_result_message], {},\n :authorization => doc[:ssl_txn_id],\n :request => body_text,\n :response => doc.to_json)\n end", "def purchase(money, creditcard, options = {})\n response = authorize(money, creditcard, options)\n return response if !response.success? || response.fraud_review?\n\n capture(money, response.authorization, options)\n end", "def purchase(money, billing_id)\n if (response = get_customer_profile(:customer_profile_id => billing_id)).success?\n create_customer_profile_transaction(:transaction => { :customer_profile_id => billing_id, :customer_payment_profile_id => response.params['profile']['payment_profiles']['customer_payment_profile_id'], :type => :auth_capture, :amount => amount(money) })\n else\n response\n end\n end", "def purchase(money, creditcard, options = {})\n requires!(options, :order_id)\n \n response = authorize(money, creditcard, options)\n # dove è finita l'etica del programmatore?\n # dove è finito l'incapsulamento dei dati\n if response.success? && response.fraud_review?[:fraud_result] == 'C'\n response.instance_variable_set('@success', false)\n response.instance_variable_set('@message', \"CAN'T CAPTURE, CHALLENGED AUTHORIZATION\")\n end\n \n return response unless response.success?\n\n commit(build_capture_request(money, options[:order_id], credit_card_type(creditcard)))\n end", "def test_successful_purchase_with_processing_mode_gateway\n response = @gateway.purchase(@amount, @credit_card, @options.merge(@processing_options))\n assert_success response\n assert_equal 'accredited', response.message\n end", "def capture(params)\n request(Resources::RESOURCE_CAPTURE, HTTP_METHOD_POST, params)\n end", "def capture(tx)\n pay_id = get_payment_id(tx.id)\n if !pay_id.nil?\n result = razorpay_api.payment_capture(community: tx.community_id, payment_id: pay_id, amount: order_total(tx).cents)\n RazorpayPayment.find_by(payment_id: pay_id).update_attribute(:payment_status, \"captured\") \n else \n raise \"Payment id not found\"\n end \n payment = {} \n Result::Success.new(payment)\n rescue => exception \n Result::Error.new(exception.message)\n end", "def process_billing!\n if payment.capture!\n next!(\"Captured #{formatted_total}\")\n else\n fail!(\"Could not capture payment due to a problem with the payment provider\")\n end\n end" ]
[ "0.6622601", "0.66165835", "0.66148984", "0.64050114", "0.6402435", "0.62876874", "0.6284776", "0.62716687", "0.6201491", "0.6200618", "0.61151105", "0.6092354", "0.606081", "0.6026894", "0.6023429", "0.601596", "0.5996501", "0.5947878", "0.59419584", "0.5903622", "0.5870499", "0.58447015", "0.5835913", "0.57892", "0.5742579", "0.5726837", "0.57035184", "0.56795263", "0.56758344", "0.56758344", "0.5673433", "0.56725097", "0.56501424", "0.56501424", "0.56501424", "0.56501424", "0.56501424", "0.56309617", "0.5610955", "0.56101006", "0.56024945", "0.55534995", "0.5536084", "0.5497847", "0.54606485", "0.5444258", "0.5420341", "0.5414771", "0.540977", "0.5403961", "0.53990597", "0.5393226", "0.5393226", "0.5392938", "0.5391536", "0.5383044", "0.53765655", "0.53735447", "0.53716475", "0.5344003", "0.53272337", "0.53182566", "0.53137994", "0.53119373", "0.5306443", "0.5290826", "0.5290603", "0.52871466", "0.5281153", "0.5280114", "0.52757543", "0.52033585", "0.51991713", "0.51975703", "0.5188334", "0.51818717", "0.51730585", "0.51708263", "0.51597685", "0.5150042", "0.51434785", "0.51294136", "0.5119871", "0.5098006", "0.5098006", "0.5082652", "0.50824976", "0.50609404", "0.5050682", "0.50504595", "0.5043891", "0.50166714", "0.49998122", "0.49973825", "0.49967483", "0.4994636", "0.49940977", "0.49936944", "0.49926004", "0.4980275" ]
0.6712602
0
USER MANAGEMENT GET api/v1/manage_users
def index @users = User.all render json: { messages: "Request Successfull!", is_success: true, data: { users: @users } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end", "def manage_users\n @agency_users = @agency.users\n @all_users = User.all\n # add_breadcrumb \"Users\", manage_users_agency_path(@agency)\n end", "def index\n @manage_users = Manage::User.all\n end", "def get_users_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_users ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_users, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_users, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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] || 'InlineResponse20037' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def user_management_get_all_users page: nil, per_page: nil\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"page\" => page,\n \"per_page\" => per_page,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 400\n raise APIException.new \"Bad request\", 400, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def index\n @manages = User.all\n end", "def set_manage\n @manage = User.find(params[:id])\n end", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def get_managed_users_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_managed_users ...'\n end\n # resource path\n local_var_path = '/v1/user/managed'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<ManagedUser>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['X-Api-Key']\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: UserApi#get_managed_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def _request_manage_user_info\r\n\t\t\t# Author\r\n\t\t\tauthorize! :manage, Project\r\n\r\n\t\t\tcase params[:user_type]\r\n\t\t\twhen 'user'\r\n\t\t\t\trender json: {\r\n\t\t\t\t\tstatus: 0,\r\n\t\t\t\t\tresult: render_to_string(partial: 'users/info_popup', locals: { user: User.find(params[:user_id]) })\r\n\t\t\t\t}\r\n\t\t\twhen 'contact_user'\r\n\t\t\t\trender json: {\r\n\t\t\t\t\tstatus: 0,\r\n\t\t\t\t\tresult: render_to_string(partial: 'contact_user_infos/info_popup', locals: { contact_user: ContactUserInfo.find(params[:user_id]) })\r\n\t\t\t\t}\r\n\t\t\telse\r\n\t\t\t\trender json: { status: 1 }\r\n\t\t\tend\r\n\t\tend", "def set_manage_user\n @manage_user = Manage::User.find(params[:id])\n end", "def set_manage_user\n @manage_user = Manage::User.find(params[:id])\n end", "def users!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/account/users'\n end.execute!\n\n json[:users].map do |user|\n GroupDocs::User.new(user)\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def _user_info_for_manage\n\t\t\tgroup = SystemGroup.find params[:id]\n\t\t\tuser = User.find params[:user_id]\n\n\t\t\tinfos = []\n\t\t\tcontrols = []\n\n\t\t\tif group.users.where(id: user.id).exists?\n\t\t\t\tinfos << {\n\t\t\t\t\tlabel: 'Tình trạng',\n\t\t\t\t\ttext: 'Đang trong nhóm'\n\t\t\t\t}\n\t\t\t\tcontrols << '<button class=\"btn btn-warning\" aria-click=\"remove\">Loại khỏi nhóm</button>'.html_safe\n\t\t\telse\n\t\t\t\tcontrols << '<button class=\"btn btn-primary\" aria-click=\"add\">Thêm vào nhóm</button>'.html_safe\n\t\t\tend\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: render_to_string(partial: '/users/info_popup', locals: { user: user, infos: infos, controls: controls })\n\t\t\t}\n\t\tend", "def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end", "def manageAllUsers\n @dAllUsers=User.all\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\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 index\n authorize! :manage, :multiple_users\n\n respond_with(users)\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def manage\n add_breadcrumb :manage\n authorize! :manage, @user, :message => 'You are not authorized to perform this operation.'\n respond_to do |format|\n format.html # manage.html.erb\n format.json { render json: UsersDatatable.new(view_context) }\n end\n end", "def list\n get('users')['users']\n end", "def set_users_management\n @users_management = Users::Management.find(params[:id])\n end", "def index\n @users_managements = Users::Management.all\n end", "def members\n raw_response = get_request('users/members')\n parse_response(raw_response, :users)\n end", "def user_management_get_single_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def index\n r = @api.get_users\n response = JSON.parse(r.body)\n if r.code == 200\n @users = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\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 set_user\n @users = User.find(params[:id])\n end", "def set_user\n @users = User.find(params[:id])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def _manager_list\n\t\t\t# Author\n\t\t\treturn render json: { status: 6 } if cannot? :manage, User\n\t\t\t\n\t\t\t# Check unless exists is_add, type\n\t\t\treturn render json: { status: 3 } unless params.has_key?(:is_add) && params.has_key?(:type)\n\n\t\t\tper = Rails.application.config.item_per_page\n\t\t\tpage = params.has_key?(:page) ? params[:page].to_i : 1\n\t\t\tis_add = params[:is_add] === 'true'\n\t\t\ttype = params[:type]\n\n\t\t\tusers = User.search_by_type params[:keyword], type, !is_add\n\n\t\t\tcount = users.count\n\n\t\t\treturn render json: { status: 1 } if count === 0\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tlist: render_to_string(partial: 'users/manager_list', locals: { users: users.page(page, per), is_add: is_add }),\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { total: count, per: per })\n\t\t\t\t}\n\t\t\t}\n\t\tend", "def list_users\n @users = User.find(:all)\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def get_users(request); end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def set_user\n @users = User.find(params[:id])\n end", "def create\n @manage_user = Manage::User.new(manage_user_params)\n\n respond_to do |format|\n if @manage_user.save\n format.html { redirect_to @manage_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @manage_user }\n else\n format.html { render :new }\n format.json { render json: @manage_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_users(options)\n @client.raw('get', '/config/users', options)\n end", "def get_data_for_manage\n\t\t\tgroup = SystemGroup.find(params[:id])\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: {\n\t\t\t\t\tusers: render_to_string(partial: 'user_items', locals: { users: group.users }),\n\t\t\t\t\tpermissions: group.permission_ids\n\t\t\t\t}\n\t\t\t}\n\t\tend", "def get_user_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_user ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling ManagementApi.get_user\"\n end\n # resource path\n local_var_path = '/v1/users/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end", "def manage_user_params\n params.fetch(:manage_user, {})\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 self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def users\n\n end", "def list_users(offset=0, limit=20)\n target = \"#{self.base_url}/user/\"\n options = {\n basic_auth: self.auth,\n query: {\n _limit: limit,\n _offset: offset\n }\n }\n self.class.get(target, options)\n end", "def me\n resource :get, 'api/v1/users/me'\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def _manage_user_info\n\t\t\tcase params[:user_type]\n\t\t\twhen 'user'\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 0,\n\t\t\t\t\tresult: render_to_string(partial: 'users/info_popup', locals: { user: User.find(params[:user_id]) })\n\t\t\t\t}\n\t\t\twhen 'contact_user'\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 0,\n\t\t\t\t\tresult: render_to_string(partial: 'contact_user_infos/info_popup', locals: { contact_user: ContactUserInfo.find(params[:user_id]) })\n\t\t\t\t}\n\t\t\telse\n\t\t\t\trender json: { status: 1 }\n\t\t\tend\n\t\tend", "def list_users\n BrickFTP::API::User.all\n end", "def list_users\n BrickFTP::API::User.all\n end", "def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend", "def user(options={})\n get('/user', options)\n end", "def users_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :users_list, options).each do |page|\n yield page\n end\n else\n get(\"users\", options)\n end\n end", "def users()\n return MicrosoftGraph::Users::Item::ManagedDevices::Item::Users::UsersRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @users = UserService.all_users\n end", "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 get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def users\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\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 all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def manage_users\n @stage = Stage.find(params[:id])\n @users = @stage.asset_users\n end", "def users\n\t\trespond_with User.all\n\tend", "def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end", "def mutes_users(optname, optarg)\n ret = nil\n\n begin\n self.client.new_auth(@account)\n mutes_users = self.client.mutes_ids()\n twUsers = self.client.users_lookup(mutes_users, is_use_cache: true)\n format = @options.format()\n\n if @options.save_as_json().nil? then\n self.renderer.display(twUsers, format, separator: \"\", current_user_id: self.client.current_user_id)\n else\n fs = FileSaver.create(@options.save_as_json(), \"w\", :json)\n fs.save(twUsers)\n end\n\n ret = 0\n rescue Tw::Error\n raise\n rescue SystemCallError\n raise\n rescue => e\n ret = self.show_rescue(__FILE__, __LINE__, __method__, e)\n end\n return ret\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 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 list_users\n response = @connection.dbreq(\"GET\", @lbmgmthost, \"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}/users\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n CloudDB.symbolize_keys(JSON.parse(response.body)[\"users\"])\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 user_get_me(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_me ...\"\n end\n\n # resource path\n path = \"/user\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:GET, 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 => 'User')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_me. Result: #{result.inspect}\"\n end\n return result\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\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 me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def get_users_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_users ...'\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_members(user, list)\n get(\"/#{user}/#{list}/members.json\")\n end", "def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end", "def user_list\n @user=User.all\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def list_all_users\n\n end", "def index\n if current_user && current_user.admin? \n @users = User.all\n respond_with users_path\n else\n flash[:notice] = 'You do not have rights to see the list of users.'\n redirect_to home_index_path\n end\n end", "def users\n \n end", "def get_users_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_users ...\"\n end\n \n # resource path\n path = \"/Users\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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<APIUser>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 authorize_admin_manage_users\n unless current_user.permission.manage_users\n redirect_back fallback_location: root_path\n end\n end", "def list_users_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserApi.list_users ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling UserApi.list_users, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling UserApi.list_users, must be smaller than or equal to 50.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling UserApi.list_users, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])\n fail ArgumentError, 'invalid value for \"order_direction\", must be one of asc, desc'\n end\n # resource path\n local_var_path = \"/users\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'role_id'] = opts[:'role_id'] if !opts[:'role_id'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['API Key']\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 => 'UserResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#list_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def users_get(opts = {})\n data, _status_code, _headers = users_get_with_http_info(opts)\n data\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def index\n\t\tif !admin?\n\t\t\thead 404\n\t\tend\n @users = User.all\n end", "def get_user_me_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UsersApi#get_user_me ...\"\n end\n \n # resource path\n path = \"/Users/Me\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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 => 'APIUser')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_user_me\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_ums_user\n @ums_user = Ums::User.find(params[:id])\n end", "def new_list_users\n\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 admin\n @userList = User.all\n end", "def get\n\t\t\t\tparams.required(:id)\t\n\n\t\t\t\t# Grab the service that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n\t\t\t\t@user = service.users.find params[:id]\n\t\t\tend" ]
[ "0.6842748", "0.6697969", "0.65239626", "0.6460605", "0.6460221", "0.64282465", "0.6415475", "0.63891375", "0.63671637", "0.63598704", "0.63145244", "0.62974435", "0.62907994", "0.6290356", "0.6220003", "0.6179132", "0.6170376", "0.61573213", "0.61503494", "0.6143398", "0.6143138", "0.61417305", "0.6108106", "0.6086216", "0.60717434", "0.60563433", "0.60404783", "0.60272735", "0.60114676", "0.60073954", "0.6006549", "0.5995606", "0.59761727", "0.5970113", "0.5970113", "0.5964659", "0.5941626", "0.5940888", "0.59407204", "0.59403515", "0.5928035", "0.58862364", "0.5882502", "0.5869941", "0.5868083", "0.5839589", "0.5836237", "0.5830186", "0.5825775", "0.5823063", "0.5792592", "0.57678175", "0.57404274", "0.57173604", "0.5705596", "0.57038987", "0.5699084", "0.5699084", "0.56974685", "0.5695194", "0.56942254", "0.5693422", "0.5693281", "0.569217", "0.568468", "0.5676594", "0.56765705", "0.5673038", "0.5671818", "0.5671022", "0.565661", "0.56398517", "0.5633456", "0.562928", "0.561844", "0.5617066", "0.5615936", "0.5614687", "0.5608593", "0.5607435", "0.5606676", "0.560564", "0.5602946", "0.55982786", "0.5595019", "0.55911124", "0.5590045", "0.55860525", "0.55807936", "0.5571756", "0.5568946", "0.55683845", "0.5567879", "0.55674845", "0.5557462", "0.5549825", "0.55491585", "0.55436254", "0.5538917", "0.5538567", "0.5530786" ]
0.0
-1
CHAT MANAGEMENT GET api/v1/manage_chats/[chat_id]
def show_chat @chat = Chat.find(params[:id]) render json: { messages: "Request Successfull!", is_success: true, data: { user: @chat } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_chat\n @chat = @application.chats.find_by!(number: params[:id])\n end", "def set_chat_messages\n @chat_messages = ChatMessage.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.get_one(params[:app_token], params[:number])\n end", "def chat\n @title = \"Conversacion\"\n @chats = GetChatsForPreviaGroup.call(@previa_group)\n @messages = GetMessagesForChat.call(Chat.find(params[:chat]))\n end", "def set_chat\n @chat_room = ChatRoom.find(params[:id])\n end", "def chats\n @chats ||= Chat.find_all_by_match_id(params[:match_id], :include => :player)\n end", "def chats()\n return MicrosoftGraph::Chats::ChatsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def show\r\n @chat = Chat.find(params[:id])\r\n if is_allowed?\r\n @chat_messages = @chat.chat_messages.order('created_at ASC')\r\n else\r\n redirect_to root_path, alert: \"Sorry, you're not allowed in that chat.\"\r\n end\r\n end", "def set_chat_room\n @chat_room = current_user.chat_rooms.find(params[:id])\n \n end", "def index\n list = current_user.chats.pluck :id\n\n options = filter_params\n options[:id] = filter_params[:id] == 'all' ? list : [filter_params[:id]]\n @messages = ChatMessage.filter options\n @messages = @messages.group_by(&:chat_id)\n end", "def set_chat_message\n @chat_message = ChatMessage.find(params[:id])\n end", "def chats(*args)\n @client.get \"#{@path}/chats\", Hash[*args]\n end", "def index\r\n @chats = Chat.all\r\n end", "def index\n @chats = Chat.all\n end", "def index\n @chats = Chat.all\n end", "def index\n @chats = Chat.all\n end", "def index\n @chats = Chat.all\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end", "def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end", "def index\n\t\tif !(defined? session[:chat_id]) || !session[:chat_id]\n\t\t\tif !(defined? session[:user_id]) || !session[:user_id]\n\t\t\t\t@chat = Chat.create\n\t\t\telse\n\t\t\t\tif Chat.exists?(user_id: session[:user_id])\n\t\t\t\t\t@chat = Chat.where('user_id' => session[:user_id]).first\n\t\t\t\telse\n\t\t\t\t\t@chat = Chat.create(user_id: session[:user_id])\n\t\t\t\tend\n\t\t\tend\n\t\t\tsession[:chat_id] = @chat.id\n\t\telse\n\t\t\tif defined? session[:user_id]\n\t\t\t\tif !Chat.exists?(user_id: session[:user_id])\n\t\t\t\t\tChat.where('id' => session[:chat_id]).update_all('user_id' => session[:user_id])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\t@messages = Message.joins(:chat).where('chat_id' => session[:chat_id])\t\n\tend", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n @chatroom = Chatroom.find_by( name: params[:id] )\n end", "def show\n @chat_thread = ChatThread.find(params[:id])\n # 既読つける\n readChat(@chat_thread.id, @chat_thread.chats.last.id) if @chat_thread.chats.size > 0\n render json: @chat_thread.chats, each_serializer: Rest::ChatSerializer\n end", "def set_customerchat\r\n @customerchat = Customerchat.find(params[:id])\r\n end", "def set_admin_chatting\n @admin_chatting = AdminChatting.find(params[:id])\n end", "def get_chat_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_chat ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TextMagicApi.get_chat\"\n end\n # resource path\n local_var_path = '/api/v2/chats/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Chat')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_chat\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_coffee_chat\n @coffee_chat = CoffeeChat.find(params[:id])\n end", "def set_chatroom\n\t\t@chatroom = Chatroom.find(params[:id])\n\tend", "def get_chat_messages\n # get chat messages\n chats = Message.includes(:user).where(receiver_id: @current_user.id, user_id: params[:user_id], request_id: params[:request_id]).or(Message.includes(:user).where(user_id: @current_user.id, receiver_id: params[:user_id], request_id: params[:request_id])).order(created_at: :asc)\n if chats.any?\n render json: chats, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n },\n },\n status: :ok\n else\n render json: {\n status: 'no-content',\n message: 'No chat on this request yet'\n },\n status: :no_content\n end\n end", "def index\n @chats = Chat.limit(100)\n end", "def set_merchant_chat_support\n @merchant_chat_support = MerchantChatSupport.find(params[:id])\n end", "def set_api_v1_chat\n @api_v1_chat = Api::V1::Chat.find(params[:id])\n end", "def index\n @chats = current_user.chats\n end", "def index\n @chats = Chat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chats }\n end\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:chatroom_id])\n end", "def chat_params\n params[:chat]\n end", "def index\n @chats = Chat.all\n render json: {\n messages: \"Request Successfull!\",\n is_success: true,\n data: { chats: @chats }\n }\n end", "def index\n @chats = Chat.where(\"reciever_id = ? OR user_id = ?\", current_user.id, current_user.id).order('created_at DESC')\n end", "def get_conversations_chats_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_chats ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/conversations/chats\".sub('{format}','json')\n\n # query parameters\n query_params = {}\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ChatConversationEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_chats\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @user_chats = Chatroom.where(friendship_id: friendship_chats)\n @messages = Message.where(chatroom_id: @user_chats)\n end", "def get_group_chat\n\t \tp\"------get_group_chat----#{params.inspect}-----------\"\n \t\t@sender = User.find_by(id: params[:sender_id])\n\t\t@group = Group.find_by(id: params[:assoc_id])\n\t\t@group_owner = @group.user_id\n\t\tgroup_member_ids = @group.group_memberships.pluck(:user_id) << @group_owner\n\t if @group.present?\n\t\t # @room = Room.where(\"(sender_id = ? and assoc_id = ? and is_group = ?) or (sender_id = ? and assoc_id = ? and is_group = ?) \", @sender.id,@group.id,true,@group.id,@sender.id,true).first\n\t\t\t@room = Room.where(\"(assoc_id = ? and is_group = ?) \", @group.id,true).first\n\t \tif @room.nil?\n\t\t\t @room = Room.create(:sender_id => params[:sender_id],:assoc_id => @group.id, :is_group => TRUE )\n\t\t\tend\n\t \t@chats = Message.where(\"(assoc_id = ? and is_group = ? )\",@group.id, true).order(:created_timestamp)\n\t\t array = Array.new\n\t\t @chats.each do |chat|\n\t\t read_by = chat.read_by\n\t\t\t read_by << params[:sender_id].to_s unless read_by.include?(params[:sender_id].to_s)\t\n\t\t\t chat.update(read_by: read_by)\n\t\t\t hash = {}\n\t\t\t hash[:id] = chat.id\n\t\t\t chat.body == nil ? hash[:body] = chat.image.url : hash[:body] = chat.body\n\t\t\t hash[:username] = User.find_by_id(chat.sender_id).username\n\t\t\t hash[:upload_type] = chat.upload_type\t\t \n\t\t \t\tp \"=============UPLOAD TYPE==========#{chat.upload_type.inspect}==================================\"\n\t\t\t hash[:is_user_sender] = (chat.sender_id == @sender.id )? true :false\n\t\t\t hash[:created_timestamp] = chat.tstamp\n\t\t\t array << hash\n\t\t\tend\n\t\t render :json => {:response_code => 200,\n\t :response_message => \"Chats fetched Successfuly.\",\n\t :room_id => @room.id,\n\t\t\t :group_member_ids => group_member_ids,\n\t\t\t :group_img => @group.group_image,\n\t :name => @group.group_name,\n\t :user_info => array\t\t\t\t\t \n\t }\n else\n \t\trender_message 500, \"Group does not exist.\"\n end\n end", "def get_chats\n \tp\"------get_group_chat----#{params.inspect}-----------\"\n\t\t@sender = User.find_by_id(params[:sender_id])\n\t\t@reciever = User.find_by_id(params[:assoc_id])\n @room = Room.where(\"(sender_id = ? and assoc_id = ? and is_group = ?) or (sender_id = ? and assoc_id = ? and is_group = ?) \", @sender.id,params[:assoc_id],false ,params[:assoc_id], @sender.id , false).first\n\t\t if @room.nil?\n\t\t @room = Room.create(:sender_id => params[:sender_id],:assoc_id => params[:assoc_id] )\n\t\t end\n @chats = Message.where(\"((sender_id = ? and assoc_id = ? ) or (sender_id = ? and assoc_id = ? ))\", @sender.id,params[:assoc_id],params[:assoc_id], @sender.id).order(:tstamp)\n\t\tarray = Array.new\n\t @chats.each do |chat|\n\t\t read_by = chat.read_by\n\t\t read_by << params[:sender_id].to_s unless read_by.include?(params[:sender_id].to_s)\t\n\t\t chat.update(read_by: read_by)\n\t\t hash = {}\n\t\t hash[:id] = chat.id\n\t chat.body == nil ? hash[:body] = chat.image.url : hash[:body] = chat.body\n\t\t hash[:read_status] = chat.read_status\n\t\t hash[:upload_type] = chat.upload_type\n\t hash[:created_timestamp] = chat.tstamp\n\t\t hash[:is_user_sender] = (chat.sender_id == @sender.id )? true :false\n\t\t \tarray << hash\n end\n if @reciever.show_online_status\n\t\t status = @reciever.status.current_status \n else\n status = false\n end\n\t\trender :json => {\n\t\t\t:response_code => 200,\n\t :response_message => \"Chats fetched Successfuly.\",\n\t :user_img => @sender.photo_link.nil? ? @sender.photo_url : @sender.photo_link ,\n\t :name => @sender.username,\n\t :room_id => @room.id,\n\t :current_status => status ,\n\t\t :user_info => array\n\t }\n end", "def chat_params\n params.require(:chat).permit(:user_id, :support_user_id)\n end", "def create\n room_id = params[:chat][:room_id]\n @chat = current_user.chats.build({message: params[:chat][:message],\n room_id: params[:chat][:room_id],\n receiver_id: params[:chat][:receiver_id]})\n\n if @chat.isSendToRoom?\n if current_user.rooms.find(room_id)\n response = \"ok\"\n\n else\n response = 'You have not join the room' + room_id\n end\n elsif @chat.isSendToPerson?\n response = 'Send to ' + @chat.to_user_id\n else # Broadcast to all users\n response = \"ok\"\n end\n\n chat_attrs = @chat.attributes\n chat_attrs['current_user'] = current_user\n chat_attrs['response'] = response\n if params[:chat][:room_id] == nil\n channel = \"server_channel\"\n else\n channel = room_id\n end\n\n self.broadcast_message_to_channel(channel, CHAT_EVENT_NAME, chat_attrs)\n render json: chat_attrs.to_json\n end", "def show\n @chat = Chat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chat }\n end\n end", "def show\n @meetup = Meetup.find(params[:id])\n data = 1\n if(@meetup.createdby.to_s != '')\n data = @meetup.createdby\n end\n @crby = User.find(data)\n @meetup.chats.build \n\n\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meetup }\n end\n end", "def create\n if current_user.id.nil?\n render json: { error: 'Not authed.' }, status: 401\n return\n end\n\n users = User.where(id: param_user_ids)\n @chat = Chat.find_or_create_private_chat(users)\n\n if @chat.errors[:user_ids].empty?\n render json: @chat, include: ['users'], status: :created\n else\n render json: @chat.errors, status: :unprocessable_entity\n end\n end", "def chat\n\t\t#TODO: this user\n\t\t@thisuser = session[:user_id]\n\n\t\t#TODO: get other users this user chats with\n\t\t@chat = Chat.where('user1 = ? OR user2 = ?', @thisuser, @thisuser)\n\n\t\t# @chat.each do |eachChat|\n\t\t@chatData = []\n\t\tfor eachChat in @chat\n\t\t\tuser1 = User.find(eachChat.user1)\n\t\t\tuser2 = User.find(eachChat.user2)\n\n\t\t\tchat_with = user1.username\n\t\t\tchat_user_id = user1.id\n\t\t\trole = user1.role == 1 ? \"trainer\" : \"user\"\n\t\t\tif eachChat.user1 == @thisuser\n\t\t\t\tchat_with = user2.username\n\t\t\t\tchat_user_id = user2.id\n\t\t\t\trole = user1.role == 1 ? \"trainer\" : \"user\"\n\t\t\tend\n\t\t\tthisChat = { \"chat_with\": chat_with, \"chat_user_id\": chat_user_id, \"role\": role }\n\t\t\t\n\t\t\t@chatData << thisChat\n\t\t\t\n\t\tend\n\tend", "def chat=(value)\n @chat = value\n end", "def group_chat_messages(group_id, params = {})\n get(\"/v1/groups/#{group_id}/chat/messages\", params)\n end", "def show\n\t\tchannel_sid = params[:channel_sid]\n\t\t@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])\n\t\t# Retrieve the member\n\t\tservice = @client.chat.v2.services(ENV['service_sid'])\n\t\tchannel = service.channels(channel_sid)\n\t\tmessage = channel.messages(params[:id]).fetch\n\t\tmessage_json = \"{\\n\\\"message_sid\\\": \\\"#{message.sid}\\\",\\n\\\"body\\\": \\\"#{message.body}\\\"\\n}\" \n\t\t# member_json = member_json+\" \\\"identity\\\": \\\"\"+member.identity+\"\\\",\\n\"\n\t\t# member_json = member_json+\" \\\"member_sid\\\": \\\"\"+member.sid+\"\\\"\\n\"\n\t\t# member_json = member_json+\"}\" \n\t\tputs \"#{message.sid} #{message.body}\"\n\t\tjson_response(message_json)\n\tend", "def index\n @chat_rooms = current_user.chat_rooms\n end", "def chat\n if params[:user] && params[:opp]\n @user = User.find_by_id(params[:user])\n if @user\n @opp = User.find_by_id(params[:opp])\n if @opp\n @messages = Message.all_messages(@user.id, @opp.id)\n @json = {:status => {:status => \"success\"}, :messages => @messages.as_json(:only => [:origin, :opponent, :created_at])}\n render json: @json\n else\n send_error_obj(\"opp not found\")\n end\n else\n send_error_obj(\"user not found\")\n end\n else\n send_error_obj(\"bad parameters\")\n end\n end", "def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end", "def get_chat_using_get(chat_id, opts = {})\n data, _status_code, _headers = get_chat_using_get_with_http_info(chat_id, opts)\n data\n end", "def send_new_chat(data)\n stream_from \"Chat:#{data['chat']['id']}\"\n recipient = User.find(data['chat']['recipient_id'])\n unless current_user.id == recipient.id\n ActionCable.server.broadcast \"user_#{recipient.id}_chats\", chat: data['chat'], type: 'new_chat'\n end\n end", "def index\n # @chat_messages = ChatMessage.all\n\n if params[:chat_room_id].present?\n @chat_room = ChatRoom.find(params[:chat_room_id])\n else\n if current_user.present?\n @user_chat_rooms = current_user.chat_rooms_as_sender + current_user.chat_rooms_as_reciever\n elsif current_super_admin.present?\n @user_chat_rooms = current_super_admin.chat_rooms_as_sender + current_super_admin.chat_rooms_as_reciever\n end \n @common_chat_rooms = @user_chat_rooms.select{ |cr| cr.senderable == @user || cr.recieverable == @user }\n if @common_chat_rooms.first.present?\n @chat_room = @common_chat_rooms.first\n else\n @chat_room = ChatRoom.create(senderable: current_user || current_super_admin, recieverable: @user )\n end\n end\n @chat_messages = @chat_room.chat_messages\n end", "def recent_chats\n r = Skype.send_command \"SEARCH RECENTCHATS\"\n chat_ids = parse_type(r.sub(/^CHATS\\s+/, \"\"), Array)\n chat_ids.map do |id|\n Chat.new(id)\n end\n end", "def chat_params\n params.require(:chat).permit(:room_id, :user_id, :message)\n end", "def get_chat_using_get_with_http_info(chat_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.get_chat_using_get ...'\n end\n # verify the required parameter 'chat_id' is set\n if @api_client.config.client_side_validation && chat_id.nil?\n fail ArgumentError, \"Missing the required parameter 'chat_id' when calling SupportApi.get_chat_using_get\"\n end\n # resource path\n local_var_path = '/chat/{chat_id}'.sub('{' + 'chat_id' + '}', chat_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ChatInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#get_chat_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\r\n @customerchats = Customerchat.all\r\n end", "def get_chat_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.get_chat_all_using_get ...'\n end\n # resource path\n local_var_path = '/chat'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageChatInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#get_chat_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @chat = Chat.find(params[:id])\n @receiver = interlocutor(@chat)\n @messages = @chat.messages\n @message = Message.new\n render json: $message\n end", "def chat_params\n params.require(:chat).permit(:user_id, :reciever_id, :message, :status, :last_msg_id)\n end", "def show\n # Try to find it and fail if it doesn't exist\n unless @chat_room = ChatRoom.find_by_id(params[:id])\n flash[:notice] = \"Chat room doesn't exist. Maybe the owner deleted it?\"\n return redirect_to(chat_rooms_url)\n end\n\n # If it's archived, redirect them to the transcript URL\n if @chat_room.archived?\n flash[:notice] = \"Chat room is archived, loading transcript\"\n return redirect_to(transcript_url(@chat_room))\n end\n\n # Check to see if the user is already a member of the room\n unless @chat_room.participants.include?(whoami)\n # If it's not locked, create a room membership\n unless @chat_room.locked?\n Membership.create(:participant => whoami, :chat_room => @chat_room)\n else\n # Notify that the room is locked and they can't get in\n flash[:notice] = \"Chat room is locked, you can't join\"\n return redirect_to(chat_rooms_url)\n end\n end\n\n # Mark the current membership as active and all others as inactive\n if @membership = Membership.joining(whoami, @chat_room).first\n @membership.active = true && !whoami.away?\n @membership.save!\n end\n\n # Get all the memberships for listing room members\n @memberships = @chat_room.memberships\n\n # Get messages from the last 3 days for the chat room\n @messages = @chat_room.messages.since(3.days.ago)\n\n # If there's no recent messages, get last 50\n @messages = @chat_room.messages.limit(50).reverse if @messages.blank?\n\n # Get the message ID of the last message in the list. This will be used in\n # the AJAX call to get more messages.\n @current_highest_message = @messages.blank? ? -1 : @messages.last.id\n\n # Get notifications\n @notifications = Notification.for(whoami)\n\n # Get current user's keywords\n @keywords = whoami.keywords\n\n # Get 5 rooms around the current one\n @my_memberships = whoami.rooms_around(@chat_room)\n\n # Get rooms that have notifications waiting\n @chat_rooms_with_notifications = @notifications.collect{|n| n.message.chat_room}.uniq\n\n # Get messages that have triggered notifications\n @messages_with_notifications = @notifications.collect(&:message)\n end", "def chat_params\n params.fetch(:chat, {})\n end", "def set_chatwork\n @chatwork = Chatwork.find(params[:id])\n end", "def show\n @other_user = (@chat.user == current_user) ? @chat.reciever : @chat.user\n\n Chat.where(reciever_id: current_user.id, user_id: @other_user.id, status: 'unread').each do |chat|\n chat.update_attribute(:status, 'read')\n end\n\n @chats = Chat.where(\"(reciever_id = ? AND user_id = ?) OR (reciever_id = ? AND user_id = ?)\", @other_user.id, current_user.id, current_user.id, @other_user.id).order('created_at DESC').limit(50).reverse\n @new_chat = Chat.new\n end", "def set_direct_chat\n @direct_chat = DirectChat.find(params[:id]) rescue nil\n return res_with_error(\"Chat not found\", :not_found) unless @direct_chat\n end", "def get_chat(id, opts = {})\n data, _status_code, _headers = get_chat_with_http_info(id, opts)\n data\n end", "def show\n render json: @chat\n end", "def index\n @chat_messages = DirectMessage.all\n end", "def index\n page = params[:page]\n @messages = chat_messages(@chat).paginate(page, 2)\n end", "def create\n filteredParams = params.require(:chat_message).permit(:message, :from_id, :direct_chat_id)\n #@chat = DirectChat.find(filteredParams[\"direct_chat_id\"])\n # Le \"by\" n'importe pas car c'est forcément un admin ou owner ou superAdmin qui l'a mute, et un tel mute vaut pour tout le monde\n # if RoomMute.where(room: @room, user: current_user).exists?\n # res_with_error(\"You're currently muted\", :bad_request)\n # return false\n # end \n user = User.find(filteredParams[\"from_id\"]) rescue nil\n dc = DirectChat.find(filteredParams[\"direct_chat_id\"]) rescue nil\n if !user || !dc\n res_with_error(\"Unknown DirectChat or User\", :bad_request)\n return (false)\n end\n if filteredParams[\"message\"] && filteredParams[\"message\"].length > 500\n res_with_error(\"Message too long\", :bad_request)\n return (false)\n end\n @chat_message = DirectMessage.create(message: filteredParams[\"message\"], from: user, direct_chat: dc)\n respond_to do |format|\n if @chat_message.save\n ActionCable.server.broadcast \"chat_channel\", type: \"chat_message\", description: \"create-message\", user: current_user\n format.html { redirect_to @chat_message, notice: 'Room message was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @chat_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @chat_room = ChatRoom.find(params[:chat_room_id])\n #@chat_messages = @chat_room.chat_messages\n @chat_messages = @chat_room.chat_messages.order(created_at: :desc).page(params[:page]).per(5)\n\n render json: @chat_messages, each_serializer: ChatMessageSerializer\n end", "def update\n @chat = Chat.find(params[:id])\n\n respond_to do |format|\n if @chat.update_attributes(params[:chat])\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @smpl_chats = SmplChat.all\n end", "def create\n @chat = current_user.chat_with(params[:user_id].to_i)\n if not @chat.blank?\n redirect_to @chat.first\n else\n \n @chat = Chat.new(chat_params)\n @chat.chat_subscribers.new(user_id: current_user.id)\n @chat.chat_subscribers.new(user_id: params[:user_id])\n \n respond_to do |format|\n if @chat.save\n format.html { redirect_to @chat, notice: 'Chat was successfully created.' }\n format.json { render :show, status: :created, location: @chat }\n else\n format.html { render :new }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n \n end\n end", "def set_achat\n @achat = Achat.find(params[:id])\n end", "def show\n messages = @chatroom.messages.order(created_at: :desc).limit(100).reverse\n @data = {}\n msgs = []\n if !current_user_view_permission\n @data['messages'] = msgs\n @data['chatUsers'] = []\n else\n messages.each do |msg|\n msgs << {message: msg, user: msg.user}\n end\n @data['messages'] = msgs\n @data['chatUsers'] = @chatroom.users.reject{ |user| user == current_user }\n end\n @data['viewPermission'] = current_user_view_permission\n @data['chatroom'] = @chatroom\n @data['currentUser'] = current_user\n end", "def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end", "def set_chat_room\n @chat_room_user = ChatRoomUser.find(chat_room_user_params)\n end", "def chat_info=(value)\n @chat_info = value\n end", "def index\n @users = User.all\n @chats = Chat.all\n end", "def chat_params\n params.require(:chat).permit(:message)\n end" ]
[ "0.7156667", "0.6678865", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.66185886", "0.65957135", "0.6489892", "0.64431465", "0.6411493", "0.63193405", "0.6253278", "0.6218891", "0.6186765", "0.6174666", "0.6165812", "0.61640465", "0.61193025", "0.6054724", "0.6054724", "0.6054724", "0.6054724", "0.6028484", "0.6028484", "0.60267127", "0.60267127", "0.6009729", "0.6007181", "0.6007181", "0.5998274", "0.599654", "0.5986924", "0.5973723", "0.5972871", "0.5923246", "0.59084725", "0.5899794", "0.5898899", "0.58885163", "0.5877808", "0.5856272", "0.58495146", "0.584835", "0.58433044", "0.58349", "0.58036244", "0.57936394", "0.5793394", "0.57883567", "0.5778086", "0.57301015", "0.57059395", "0.5701881", "0.5689959", "0.5684037", "0.5678998", "0.5675761", "0.56555825", "0.5652969", "0.56451017", "0.5638959", "0.5634209", "0.5633974", "0.563233", "0.56309956", "0.5622392", "0.5616469", "0.5591628", "0.55877286", "0.5584506", "0.558337", "0.55738425", "0.55700195", "0.55699986", "0.55653816", "0.55572325", "0.555452", "0.55479354", "0.5538278", "0.55368066", "0.5526351", "0.55196583", "0.55186826", "0.5518521", "0.55140895", "0.55075437", "0.5497177", "0.5493684", "0.5492834", "0.5492218", "0.54909086", "0.5489464", "0.5484506" ]
0.577841
56
MESSAGE MANAGEMENT PUT api/v1/manage_messages/[message_id]
def censor_message message_params = params.require(:message).permit(:body) @message = Message.find(params[:id]) respond_to do |format| if @message.update(censored: true) @censored_message = Censoredmessage.new(user_id: @current_user.id, message_id: @message.id, body: message_params["body"]) if @censored_message.save format.json { render json: { messages: "Request Successfull!", is_success: true, data: { message: @message, censored_message: @censored_message } } } else format.json { render json: { messages: "Message marked as censored but censored message not saved!", is_success: false, data: { } } } end else format.json { render json: { messages: "Bad Request!", is_success: false, data: { } } } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_message(display_id, message_id, opts = {})\n put \"commandcenter/displays/#{display_id}/messages/#{message_id}\", opts\n end", "def set_message\n @message = message.find(params[:id])\n end", "def set_message\n @message = Message.friendly.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\r\n @message = Message.find(params[:id])\r\n end", "def set_message\n message = Message.find(params[:id])\n end", "def update_message(message_key, message)\n self.messages[message_key.to_s] = message\n self.update_attribute :messages, self.messages\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = Message.find(params[:id])\n end", "def set_message\n @message = current_user.all_messages.find(params[:id]) # Can only access own msgs\n end", "def set_message\n if (params[:id].nil?)\n # @message = Message.find(params[:id])\n end\n end", "def set_message\n\t\t\t@message = Message.find(params[:id])\n\t\tend", "def set_message\n @message = Message.find(params[:id])\n authorize @message\n end", "def set_message\n @message = Message.find(params[:id])\n end" ]
[ "0.6924212", "0.6915829", "0.6903889", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.6890399", "0.68773514", "0.68663025", "0.68344796", "0.68323475", "0.6829546", "0.67856663", "0.67852604", "0.6775001", "0.6747594", "0.6738787" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def authenticate_and_load_user authentication_token = nil if request.headers["Authorization"] authentication_token = request.headers["Authorization"].split[1] end if authentication_token user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256') username = user[0]["nickname"] email = user[0]["name"] if user[0]['sub'].include? 'google-oauth2' email = username + '@gmail.com' end @current_user = User.find_by(email: email, username: username) if !@current_user.present? user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token) if user.save @current_user = user end end end return if @current_user.present? render json: { messages: "Can't authenticate user", is_success: false, data: {} }, status: :bad_request end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Get an strategy by its id
def get(id) self.class.strategies.select { |strategy| strategy.id == strategy.id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_strategy\n @strategy = Strategy.find(params[:id])\n end", "def set_strategy\n if params[:id]\n @strategy = Strategy.find(params[:id])\n else \n @strategy = Strategy.find_by(uuid: params[:uuid])\n end\n end", "def _fetch_strategy(name, scope)\n @strategies[scope][name] ||= if klass = Watchman::Strategies[name]\n klass.new(@env, scope)\n elsif @config.silence_missing_strategies?\n nil\n else\n raise \"Invalid strategy #{name}\"\n end\n end", "def sso_strategy_id\n @attributes[:sso_strategy_id]\n end", "def find id\n result = perform_request api_url \"champions/#{id}\"\n DynamicModel.new result\n end", "def find_strategy(type)\n \"Simple::OAuth2::Strategies::#{type.to_s.camelize}\".constantize\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end", "def [](label)\n _strategies[label]\n end", "def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end", "def set_b_strategy\n @b_strategy = BStrategy.find(params[:id])\n end", "def get_service_by_id(id)\n if params[:id]\n Service.find(params[:id])\n else\n nil #todo error handling.\n end\n end", "def service(id)\n ss = services\n ss.keep_if {|s| s.id == id}.first unless ss.nil?\n end", "def find_by_id(id)\n find(id)\n end", "def find(id)\n klass.find(id)\n end", "def [](label)\n strategies[label]\n end", "def lookup(id_or_slug)\n id_or_slug = id_or_slug.to_s\n\n # find plan by a specific objectid\n result = where(:_id => id_or_slug).first if BSON::ObjectId.legal?(id_or_slug)\n result ||= find_by_slug(id_or_slug) if id_or_slug.present?\n\n # make sure the plan exists\n result\n end", "def get(id, db = database)\n begin\n get!(id, db)\n rescue\n nil\n end\n end", "def find_by_id(id)\n @features.find { |feature| feature.id == id }\n end", "def find_driver(id)\n return find_by_id(@drivers, id)\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end", "def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end", "def get(id)\n @service.get(id)\n end", "def find_by(id:)\n storage_adapters.values.find do |storage_adapter|\n storage_adapter.handles?(id: id)\n end.find_by(id: id)\n end", "def find_by_id(clazz, id)\n clazz.find(id)\n end", "def find_service(id)\n self.class.get(\"/services/#{id}.json?apikey=#{apikey}\")\n end", "def show\n @strategy = Strategy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @strategy }\n end\n end", "def find(id, options = {})\n decorated = decorated_class.find(id)\n decorated ? resolve_associations([new(decorated)], options).first : nil\n end", "def get_from_id(id)\n @bucket_id_map[id]\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def find_by_id(goid)\n self[goid]\n end", "def by_id(id)\n raise NotImplementedError.new\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/stories/#{id}\", options: options)).first, client: client)\n end", "def find_by_id(id)\n configs.each do |config|\n if config.config_name.eql?(id)\n return config.new\n end\n end\n nil\n end", "def get id\n @services[id]\n end", "def find_by_id(id, options={})\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for(id: id)\n\n request = api_client.get(url, options)\n\n if request.success?\n self.class::INDIVIDUAL_MODEL.new(request.body)\n else\n nil\n end\n end", "def resource(id)\n CODES.select{|hash| hash.has_key?(id.to_s)}[0]\n end", "def find(id)\n end", "def get_from_id(id)\n @bucket_id_map[id]\n end", "def find_by_id(id)\n find_by(:id, id)\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def find_by_id(id)\n raise NotImplementedError.new\n end", "def find id\n model.find id\n end", "def strategy_name; end", "def set_product_strategy\n @product_strategy = ProductStrategy.find(params[:id])\n end", "def get_engine(id)\n conf = @registered_engine_confs[id.to_s]\n \n raise BentoSearch::NoSuchEngine.new(\"No registered engine for identifier '#{id}'\") unless conf\n \n # Figure out which SearchEngine class to instantiate\n klass = constantize(conf.engine)\n \n return klass.new( conf )\n end", "def call(strategy=\"youdao\", query)\n stra = instance_variable_get :\"@#{strategy}\"\n raise StrategyNotRegistered if stra.nil?\n stra.(query)\n end", "def find(id)\n raise NotImplementedError\n end", "def find_by_id(client, id, params = {})\n params = default_params.merge(params)\n\n client.get(\"#{resource_name}/#{id}\", params).data[resource_name_singular]\n end", "def get(id)\n emsg = \"The %s argument cannot be nil, empty, or a zero length string\"\n raise(ArgumentError, emsg % ['id']) if !id.kind_of?(Integer)\n account = @accounts.select{|a| a.id == id}\n account = account.nil? || account.empty? ? nil : account[0]\n return account\n end", "def show_behavior(id)\n BrickFTP::API::Behavior.find(id)\n end", "def show_behavior(id)\n BrickFTP::API::Behavior.find(id)\n end", "def get_provider(id, opts = {})\n # get all matching providers\n matching_provider_args = providers.find_all{|args| args.first == id}\n # sort providers on priority, form high to low\n matching_provider_args.sort! do |args_a, args_b|\n # we want to sort from high priority to low, but providers with the same priority level\n # should stay in the same order because among those, the last one added has the highest priority\n # (last added means first in the array, since they are pushed into the beginning of the array)\n (Provider.new(*args_b).priority || self.default_priority) <=> (Provider.new(*args_a).priority || self.default_priority)\n end\n # if no skip option is given, opts[:skip].to_i will result in zero, so it'll grab thefirst from the array\n # if the array is empty, args will always turn out nil\n args = matching_provider_args[opts[:skip].to_i]\n\n return args.nil? ? nil : Provider.new(*args)\n end", "def get(id)\n new(dataset.get(id))\n end", "def find(id); end", "def find(id); end", "def find id\n DynamicModel.new perform_request api_url \"summoners/#{id}\"\n end", "def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end", "def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end", "def get(id)\n return unless id\n with_redis { |redis| redis.get(redis_key_for(id)).try { |data| load(data) } }\n end", "def get(id)\n Ribs.with_handle(self.database) do |h|\n h.get(self.metadata.persistent_class.entity_name, id)\n end\n end", "def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end", "def find(id)\n find_by_index(id: id)\n end", "def find(id, options = {})\n if model = find_locally(id)\n model\n else\n adapter(model_class).find(id, options)\n end\n end", "def get_way(id)\n @ways[id.to_i]\n end", "def find(id, optional = {})\n find_all([id], optional).first\n end", "def get_resource(id)\n raise 'To be implemented in child classes'\n end", "def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end", "def lookup(id)\n id_num = id\n settings.data[id_num]\n end", "def find_by_id(id)\n court_slots[id]\n end", "def find_by_account_id account_id\n DynamicModel.new perform_request api_url \"summoners/by-account/#{account_id}\"\n end", "def get_deploy_strategy(service)\n strategy = Strategy.new\n\n case service.strategy\n when 'straight'\n strategy.extend(Straight)\n end\n\n return strategy\n end", "def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end", "def find(id)\n fetch([name, id]) do\n super\n end\n end", "def get_object_for_id(id, redis_pool = nil)\n redis_connection(redis_pool) do |conn|\n decode_object_from_redis(conn.get(key(id)))\n end\n end", "def get_by_id(class_name, id)\n @data = get_all()\n for item in @data[class_name]\n if item[\"id\"] == id\n return item\n end\n end\n raise \"#{class_name} id #{id} not found.\"\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def find_single(id, *args)\n data = get(id.to_s, *args)\n return nil unless data && !data.empty?\n instantiate(id, data)\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find_by_id(id, options = {})\n if item = Dynamoid::Adapter.read(self.table_name, id, options)\n obj = self.new(item)\n obj.new_record = false\n return obj\n else\n return nil\n end\n end", "def find_or_initialize(id_json:, json: {})\n return nil if json.blank?\n\n id = id_json[:identifier] if id_json.is_a?(Hash)\n schm = ::IdentifierScheme.find_by(name: id_json[:type].downcase) if id.present?\n\n if id.present?\n # If the identifier is a DOI/ARK or the api client's internal id for the DMP\n if Api::V2::DeserializationService.dmp_id?(value: id)\n # Find by the DOI or ARK\n plan = Api::V2::DeserializationService.object_from_identifier(\n class_name: 'Plan', json: id_json\n )\n elsif schm.present?\n value = id.start_with?(schm.identifier_prefix) ? id : \"#{schm.identifier_prefix}#{id}\"\n identifier = ::Identifier.find_by(\n identifiable_type: 'Plan', identifier_scheme: schm, value: value\n )\n plan = identifier.identifiable if identifier.present?\n else\n # For URL based identifiers\n begin\n plan = ::Plan.find_by(id: id.split('/').last.to_i) if id.start_with?('http')\n rescue StandardError => _e\n # Catches scenarios where the dmp_id is NOT one of our URLs\n plan = nil\n end\n end\n end\n return plan if plan.present?\n\n template = find_template(json: json)\n plan = ::Plan.new(title: json[:title], template: template)\n return plan unless id.present? && schm.present?\n\n # If the external system provided an identifier and they have an IdentifierScheme\n Api::V2::DeserializationService.attach_identifier(object: plan, json: id_json)\n end", "def load_by_id(name = nil)\n load_by(:id, name)\n end", "def find(id)\n begin\n @@grid.get(id)\n rescue\n nil\n end\n end", "def find(id)\n finder_or_run(:find, id)\n end", "def find(id)\n @data[id]\n end", "def get_way(id)\n get_object('way', id)\n end", "def get(id)\n dataset.get(id)\n end", "def show\n @ped_strategy = PedStrategy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped_strategy }\n end\n end", "def find(id)\n self.detect{|x| x.id == id.to_i}\n end", "def find_by_friendly_id(id)\n first_by_friendly_id(id) or raise_not_found_exception(id)\n end", "def get(id)\n record = @dao.read(id)\n record_to_vehicle(record)\n end", "def call(id)\n res = client.get(\"/api/rest/v1/behaviors/#{id}.json\")\n return nil if !res || res.empty?\n\n BrickFTP::Types::Behavior.new(**res.symbolize_keys)\n end", "def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end", "def get_by_fact_data_id(fact_data_id:)\n get(fact_id: FactData.find(fact_data_id).fact_id)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def get(entity_name, id) # :nodoc:\n chk_conn\n @hibernate_session.get(entity_name, java.lang.Integer.new(id))\n end", "def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend", "def find(id)\n response = client.get(endpoint(id))\n\n if response.success?\n new(response.body)\n else\n false\n end\n end", "def connectors_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_get\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end" ]
[ "0.687599", "0.6719225", "0.61248964", "0.60925907", "0.603201", "0.59219956", "0.58672255", "0.57997185", "0.5797541", "0.5793163", "0.57907176", "0.57891375", "0.57810223", "0.5767059", "0.5754778", "0.5749873", "0.5743043", "0.5742503", "0.5708508", "0.5689515", "0.5684819", "0.5668946", "0.56682014", "0.5664523", "0.56596684", "0.5641643", "0.56390446", "0.56352186", "0.56272787", "0.5621144", "0.56178826", "0.56144774", "0.56144106", "0.5614366", "0.5605393", "0.55990994", "0.5593952", "0.5591733", "0.55914605", "0.5587616", "0.5585592", "0.5560235", "0.5537825", "0.55337864", "0.55228996", "0.5515101", "0.5513766", "0.5513338", "0.551332", "0.549625", "0.54916555", "0.54916555", "0.5488116", "0.546335", "0.5463272", "0.5463272", "0.5455307", "0.5451248", "0.5445672", "0.5445233", "0.5434382", "0.5430259", "0.5420198", "0.5415088", "0.54114425", "0.54111856", "0.5408576", "0.5393019", "0.5385766", "0.53851223", "0.53823274", "0.5378715", "0.5371889", "0.5370638", "0.5369027", "0.53658575", "0.5357053", "0.53561604", "0.53508896", "0.53471357", "0.53383076", "0.5332366", "0.53285736", "0.5324659", "0.5322648", "0.5317137", "0.53148586", "0.5311684", "0.5308358", "0.5303698", "0.5292766", "0.5292737", "0.52908283", "0.52908134", "0.52900416", "0.528083", "0.52717406", "0.5261392", "0.52590734", "0.5258205" ]
0.854905
0
GET /connectors GET /connectors.json
def index @connectors = Connector.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "def connectors_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_get ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'display_name'] = opts[:'display_name'] if opts[:'display_name']\n query_params[:'image'] = opts[:'image'] if opts[:'image']\n query_params[:'get_it_url'] = opts[:'get_it_url'] if opts[:'get_it_url']\n query_params[:'short_description'] = opts[:'short_description'] if opts[:'short_description']\n query_params[:'long_description'] = opts[:'long_description'] if opts[:'long_description']\n query_params[:'enabled'] = opts[:'enabled'] if opts[:'enabled']\n query_params[:'oauth'] = opts[:'oauth'] if opts[:'oauth']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_7')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_get. Result: #{result.inspect}\"\n end\n return result\n end", "def connectors_get(opts = {})\n data, _status_code, _headers = connectors_get_with_http_info(opts)\n data\n end", "def connectors\n return @connectors\n end", "def connectors\n return @connectors\n end", "def get_connectors_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.get_connectors_list ...'\n end\n # resource path\n local_var_path = '/contentConnectors'\n\n # query parameters\n query_params = {}\n query_params[:'includeAdditionalInstanceInformation'] = opts[:'include_additional_instance_information'] if !opts[:'include_additional_instance_information'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectorListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#get_connectors_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api_connectors\n return @api_connectors\n end", "def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end", "def connectors_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_get ...'\n end\n # resource path\n local_var_path = '/connectors'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20017')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api_connectors=(value)\n @api_connectors = value\n end", "def connectors=(value)\n @connectors = value\n end", "def connectors=(value)\n @connectors = value\n end", "def get_connectors_list(opts = {})\n data, _status_code, _headers = get_connectors_list_with_http_info(opts)\n data\n end", "def connectors_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_get\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def new\n @url_connector = UrlConnector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url_connector }\n end\n end", "def connections\n\t\t# Find degree\n\t\tif params.has_key? 'degree'\n\t\t\tdegree = params['degree']\n\t\telse\n\t\t\tdegree = 1\n\t\tend\n\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\n\t\t# Get connections from graph\n\t\tconnections = { 1 => [{\"user\" => {id: 3}}] }\n\n\t\t# Get demos from couch\n\t\tdemographics = { 1 => 'asdljasd' }\n\n\t\t# Build JSON\n\t\trender json: connections_json(user_id, connections, demographics)\n\tend", "def connections\n return @connectors.keys\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def connector_types\n [connector_type_1, connector_type_2]\n end", "def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end", "def index\n @connector_types = ConnectorType.all\n end", "def connectors_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_post ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_post. Result: #{result.inspect}\"\n end\n return result\n end", "def connectors_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.connectors_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/connectors/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ise_connector_get\n nessus_rest_get('connectors/cisco-ise')\n end", "def associate_connector_dependencies!(connectors)\n connectors.each do |connector|\n source_names = [*connector.raw_config[\"source_connectors\"]].compact\n next if source_names.blank?\n \n source_connectors = source_names.map do |source_name|\n c = connectors.select{|connector2| connector2.name == source_name}.first\n raise InvalidConfig.new(\"Connector '#{connector.name}' references a source connector '#{source_name}' but no such connector name is defined.\") unless c\n raise InvalidConfig.new(\"Connector '#{connector.name}' cannot have itself as a source connector.\") if c == connector\n c\n end\n \n connector.send :source_connectors=, source_connectors\n end\n end", "def create\n @connector = Connector.new(connector_params)\n\n respond_to do |format|\n if @connector.save\n format.html { redirect_to @connector, notice: 'Connector was successfully created.' }\n format.json { render :show, status: :created, location: @connector }\n else\n format.html { render :new }\n format.json { render json: @connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end", "def set_connector\n @connector = Connector.find(params[:id])\n end", "def getChannelsList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/channels\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n channels_data = temp2[\"resource_response\"][\"resources\"]\n return channels_data\n \n end", "def banks_id_connector_connections_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_id_connector_connections_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.banks_id_connector_connections_get\"\n end\n # resource path\n local_var_path = '/banks/{id_connector}/connections'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'occurrences'] = opts[:'occurrences'] if !opts[:'occurrences'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2009')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_id_connector_connections_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n connection = connection_from_params\n if connection.nil?\n head 404\n else\n render jsonapi: connection_from_params, serializer: Connection::Serializer\n end\n end", "def providers_id_connector_connections_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_id_connector_connections_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.providers_id_connector_connections_get\"\n end\n # resource path\n local_var_path = '/providers/{id_connector}/connections'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2009')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_id_connector_connections_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def endpoints_list\n get \"endpoints\"\n end", "def callback\n connector_response_url(callback_options)\n end", "def index\n @restconnections = Restconnection.all\n end", "def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end", "def index\n render json: @links\n end", "def create\n @url_connector = UrlConnector.new(params[:url_connector])\n\n respond_to do |format|\n if @url_connector.save\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully created.' }\n format.json { render json: @url_connector, status: :created, location: @url_connector }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n clients = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients\"\n ).body\n end\n styled_header(\"OAuth Clients\")\n styled_array(clients.map { |client|\n [client[\"name\"], client[\"id\"], client[\"redirect_uri\"]]\n })\n end", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def show\n @lifestyle_cue_inference_clarification_connector = LifestyleCueInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_cue_inference_clarification_connector }\n end\n end", "def get_flows()\n\tputs \"Getting flows\"\n\tresponse = request_get('/api/partner/flow')\n\tputs response.body\nend", "def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end", "def description\n connectors.map do |connector|\n \"#{connector.device_name} (#{connector.connector_type_name})\"\n end.join(\" <-> \")\n end", "def api_connector_configuration\n return @api_connector_configuration\n end", "def update\n respond_to do |format|\n if @connector.update(connector_params)\n format.html { redirect_to @connector, notice: 'Connector was successfully updated.' }\n format.json { render :show, status: :ok, location: @connector }\n else\n format.html { render :edit }\n format.json { render json: @connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end", "def protocols\n get(\"/shodan/protocols\")\n end", "def connector_id\n return @connector_id\n end", "def providers_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.providers_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/providers/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def links\n response = Clever.request :get, url\n response[:links]\n end", "def index\n if params[:connectsearch]\n @connections = Teacher.search(params[:connectsearch]).paginate(:per_page => 25, :page => params[:page])\n else\n @connections = Teacher.paginate(:page=> params[:page], :per_page => 25)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end", "def create_connector_with_http_info(connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.create_connector ...'\n end\n # verify the required parameter 'connector' is set\n if connector.nil?\n fail ArgumentError, \"Missing the required parameter 'connector' when calling ContentConnectorsApi.create_connector\"\n end\n # resource path\n local_var_path = '/contentConnectors'\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(connector)\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StringResultSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#create_connector\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def banks_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.banks_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/banks/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_blueprint name\n connection.resource(:get, \"clusters/#{name}?format=blueprint\")\n end", "def index\n @cdn_configs = CdnConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cdn_configs }\n end\n end", "def get_all_rules\n @options = {\n headers: {\n \"User-Agent\": 'v2FilteredStreamRuby',\n \"Authorization\": \"Bearer #{@bearer_token}\"\n }\n }\n @response = Typhoeus.get(@rules_url, @options)\n raise \"An error occurred while retrieving active rules from your stream: #{@response.body}\" unless @response.success?\n\n @body = JSON.parse(@response.body)\nend", "def all\n render json: Url.all\n end", "def destroy\n @connector.destroy\n respond_to do |format|\n format.html { redirect_to connectors_url, notice: 'Connector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def connections(token)\n request(\n __method__,\n :get,\n \"#{api_base}/users/@me/connections\",\n Authorization: token\n )\n end", "def index\n @scene_connectors = SceneConnector.includes(:scene_from, :scene_to).all\n end", "def list\n @colors = Admin::Color.all\n\n render json: { colors: @colors }\n end", "def index\n @sales_channel = SalesChannel.find(params[:sales_channel_id])\n @sales_channel_apis = @sales_channel.apis\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sales_channel_apis }\n end\n end", "def index\n @external_credentials = ExternalCredential.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @external_credentials }\n end\n end", "def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end", "def connectors_post_with_http_info(name, login, password, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_post ...'\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling ConnectionsApi.connectors_post\"\n end\n # verify the required parameter 'login' is set\n if @api_client.config.client_side_validation && login.nil?\n fail ArgumentError, \"Missing the required parameter 'login' when calling ConnectionsApi.connectors_post\"\n end\n # verify the required parameter 'password' is set\n if @api_client.config.client_side_validation && password.nil?\n fail ArgumentError, \"Missing the required parameter 'password' when calling ConnectionsApi.connectors_post\"\n end\n # resource path\n local_var_path = '/connectors'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['name'] = name\n form_params['login'] = login\n form_params['password'] = password\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['email'] = opts[:'email'] if !opts[:'email'].nil?\n form_params['types'] = opts[:'types'] if !opts[:'types'].nil?\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['sendmail'] = opts[:'sendmail'] if !opts[:'sendmail'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Connector')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @schemas = Schema.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schemas }\n end\n end", "def all\r\n channels = Channel.all.order(:id)\r\n render json: channels\r\n end", "def all\n setup_file\n \n links_data = File.open('link_db.txt').read\n links = JSON.parse(links_data)\n \n return links\nend", "def providers_id_connector_connections_get(id_connector, opts = {})\n data, _status_code, _headers = providers_id_connector_connections_get_with_http_info(id_connector, opts)\n data\n end", "def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end", "def connectors_id_connector_sources_get(id_connector, opts = {})\n data, _status_code, _headers = connectors_id_connector_sources_get_with_http_info(id_connector, opts)\n data\n end", "def show\n @route_connection = RouteConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route_connection }\n end\n end", "def all\n setup_file\n \n links_data = File.open('link_db.txt').read\n links = JSON.parse(links_data)\n return links\nend", "def banks_id_connector_sources_get(id_connector, opts = {})\n data, _status_code, _headers = banks_id_connector_sources_get_with_http_info(id_connector, opts)\n data\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def add_connector(connector)\n @connectors[connector.name] = connector\n self\n end", "def connector_type\n cable.connector_types[self.end - 1]\n end", "def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection }\n end\n end", "def find(id)\n request(:get, \"/connections/#{id}\")\n end", "def index\n @connections = Connection.all\n end", "def index\n @connections = Connection.all\n end", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def banks_id_connector_connections_get(id_connector, opts = {})\n data, _status_code, _headers = banks_id_connector_connections_get_with_http_info(id_connector, opts)\n data\n end", "def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def show\n\t\tcolor = params[:color]\n\t\tusername = params[:username]\n\t\tcurrent_user = User.find_by(username: username)\n\n\t\t@user_connection = nil\n\t\tconnections = Connection.where(:color => color)\n\n\t\tfor connection in connections\n\t\t\tif connection.users.include? current_user\n\t\t\t\t@user_connection = connection\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif (@user_connection == nil)\n\t\t\trender json: { connection: nil }\n\n\t\telse\n\t\t\trender json: { connection: @user_connection.users }\n\t\tend\n\n\t\t# if @connection.users.length >= 2\n\t\t# \t@connection.destroy\n\t\t# end\n\tend", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def index\n @channels = Channel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @channels }\n end\n end", "def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end", "def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end", "def get_linked_resources(resource_type, filters = {})\n Util.convert_to_clever_object Clever.request(:get, get_uri(resource_type), filters)[:data]\n end", "def connections_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connections_get ...'\n end\n # resource path\n local_var_path = '/connections'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2009')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connections_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end", "def get_clients\n Client.get(:all).map{|c| c.to_ws}\n end", "def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end", "def index\n @clients = Client.all\n render json: @clients\n end", "def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end" ]
[ "0.7183864", "0.6952489", "0.6812904", "0.6781967", "0.6781967", "0.67060775", "0.6682356", "0.6656026", "0.6548709", "0.6500327", "0.6481767", "0.6481767", "0.6391897", "0.5988778", "0.59599704", "0.57967764", "0.5756998", "0.56902015", "0.5659863", "0.558622", "0.5573435", "0.5563784", "0.55470353", "0.5529343", "0.5509821", "0.550739", "0.544461", "0.5408156", "0.53771496", "0.5369757", "0.5366576", "0.5359873", "0.53430825", "0.514911", "0.5137218", "0.51185477", "0.51072115", "0.50881416", "0.5086923", "0.5063801", "0.50513273", "0.50469834", "0.50439644", "0.50134", "0.5012312", "0.50033104", "0.49897382", "0.49895963", "0.49786904", "0.4963627", "0.4961193", "0.49601236", "0.49530876", "0.49496594", "0.49477437", "0.4943907", "0.49392003", "0.49370196", "0.4928593", "0.49140725", "0.4913539", "0.49106058", "0.49102786", "0.48977107", "0.48911065", "0.4874869", "0.4868425", "0.4867314", "0.48631397", "0.48600858", "0.4857237", "0.48516524", "0.48498687", "0.4849802", "0.4842018", "0.48396522", "0.48308468", "0.48152015", "0.48107645", "0.48104522", "0.4801365", "0.4799916", "0.4799916", "0.47984865", "0.47982955", "0.47865182", "0.47729138", "0.47668526", "0.4754154", "0.4745636", "0.47451544", "0.47449282", "0.4744163", "0.47438118", "0.47432873", "0.47418872", "0.47239622", "0.47103363", "0.4704167", "0.4702471" ]
0.69453174
2
GET /connectors/1 GET /connectors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end", "def index\n @connectors = Connector.all\n end", "def connectors_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_get ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'display_name'] = opts[:'display_name'] if opts[:'display_name']\n query_params[:'image'] = opts[:'image'] if opts[:'image']\n query_params[:'get_it_url'] = opts[:'get_it_url'] if opts[:'get_it_url']\n query_params[:'short_description'] = opts[:'short_description'] if opts[:'short_description']\n query_params[:'long_description'] = opts[:'long_description'] if opts[:'long_description']\n query_params[:'enabled'] = opts[:'enabled'] if opts[:'enabled']\n query_params[:'oauth'] = opts[:'oauth'] if opts[:'oauth']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_7')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_get. Result: #{result.inspect}\"\n end\n return result\n end", "def connectors_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_get ...'\n end\n # resource path\n local_var_path = '/connectors'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20017')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connectors_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_get\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def get_connectors_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.get_connectors_list ...'\n end\n # resource path\n local_var_path = '/contentConnectors'\n\n # query parameters\n query_params = {}\n query_params[:'includeAdditionalInstanceInformation'] = opts[:'include_additional_instance_information'] if !opts[:'include_additional_instance_information'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectorListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#get_connectors_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api_connectors\n return @api_connectors\n end", "def api_connectors=(value)\n @api_connectors = value\n end", "def connectors_get(opts = {})\n data, _status_code, _headers = connectors_get_with_http_info(opts)\n data\n end", "def new\n @url_connector = UrlConnector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url_connector }\n end\n end", "def connectors\n return @connectors\n end", "def connectors\n return @connectors\n end", "def connectors=(value)\n @connectors = value\n end", "def connectors=(value)\n @connectors = value\n end", "def show\n connection = connection_from_params\n if connection.nil?\n head 404\n else\n render jsonapi: connection_from_params, serializer: Connection::Serializer\n end\n end", "def set_connector\n @connector = Connector.find(params[:id])\n end", "def connectors_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.connectors_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/connectors/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @connector = Connector.new(connector_params)\n\n respond_to do |format|\n if @connector.save\n format.html { redirect_to @connector, notice: 'Connector was successfully created.' }\n format.json { render :show, status: :created, location: @connector }\n else\n format.html { render :new }\n format.json { render json: @connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connections\n\t\t# Find degree\n\t\tif params.has_key? 'degree'\n\t\t\tdegree = params['degree']\n\t\telse\n\t\t\tdegree = 1\n\t\tend\n\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\n\t\t# Get connections from graph\n\t\tconnections = { 1 => [{\"user\" => {id: 3}}] }\n\n\t\t# Get demos from couch\n\t\tdemographics = { 1 => 'asdljasd' }\n\n\t\t# Build JSON\n\t\trender json: connections_json(user_id, connections, demographics)\n\tend", "def banks_id_connector_connections_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_id_connector_connections_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.banks_id_connector_connections_get\"\n end\n # resource path\n local_var_path = '/banks/{id_connector}/connections'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'occurrences'] = opts[:'occurrences'] if !opts[:'occurrences'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2009')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_id_connector_connections_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_connectors_list(opts = {})\n data, _status_code, _headers = get_connectors_list_with_http_info(opts)\n data\n end", "def providers_id_connector_connections_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_id_connector_connections_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.providers_id_connector_connections_get\"\n end\n # resource path\n local_var_path = '/providers/{id_connector}/connections'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'range'] = opts[:'range'] if !opts[:'range'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2009')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_id_connector_connections_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connector_types\n [connector_type_1, connector_type_2]\n end", "def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end", "def index\n @connector_types = ConnectorType.all\n end", "def connectors_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_post ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_post. Result: #{result.inspect}\"\n end\n return result\n end", "def find(id)\n request(:get, \"/connections/#{id}\")\n end", "def ise_connector_get\n nessus_rest_get('connectors/cisco-ise')\n end", "def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection }\n end\n end", "def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end", "def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end", "def connections\n return @connectors.keys\n end", "def show\n @lifestyle_cue_inference_clarification_connector = LifestyleCueInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_cue_inference_clarification_connector }\n end\n end", "def associate_connector_dependencies!(connectors)\n connectors.each do |connector|\n source_names = [*connector.raw_config[\"source_connectors\"]].compact\n next if source_names.blank?\n \n source_connectors = source_names.map do |source_name|\n c = connectors.select{|connector2| connector2.name == source_name}.first\n raise InvalidConfig.new(\"Connector '#{connector.name}' references a source connector '#{source_name}' but no such connector name is defined.\") unless c\n raise InvalidConfig.new(\"Connector '#{connector.name}' cannot have itself as a source connector.\") if c == connector\n c\n end\n \n connector.send :source_connectors=, source_connectors\n end\n end", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def create\n @url_connector = UrlConnector.new(params[:url_connector])\n\n respond_to do |format|\n if @url_connector.save\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully created.' }\n format.json { render json: @url_connector, status: :created, location: @url_connector }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_blueprint name\n connection.resource(:get, \"clusters/#{name}?format=blueprint\")\n end", "def show\n @route_connection = RouteConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route_connection }\n end\n end", "def update\n respond_to do |format|\n if @connector.update(connector_params)\n format.html { redirect_to @connector, notice: 'Connector was successfully updated.' }\n format.json { render :show, status: :ok, location: @connector }\n else\n format.html { render :edit }\n format.json { render json: @connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connector_id\n return @connector_id\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def getChannelsList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/channels\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n channels_data = temp2[\"resource_response\"][\"resources\"]\n return channels_data\n \n end", "def index\n @restconnections = Restconnection.all\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def providers_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.providers_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/providers/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @connector.destroy\n respond_to do |format|\n format.html { redirect_to connectors_url, notice: 'Connector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def connections_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_get\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_6')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end", "def index\n render json: @links\n end", "def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end", "def show\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conn }\n end\n end", "def banks_id_connector_sources_get_with_http_info(id_connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_id_connector_sources_get ...'\n end\n # verify the required parameter 'id_connector' is set\n if @api_client.config.client_side_validation && id_connector.nil?\n fail ArgumentError, \"Missing the required parameter 'id_connector' when calling ConnectionsApi.banks_id_connector_sources_get\"\n end\n # resource path\n local_var_path = '/banks/{id_connector}/sources'.sub('{' + 'id_connector' + '}', id_connector.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20011')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_id_connector_sources_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n\t\tcolor = params[:color]\n\t\tusername = params[:username]\n\t\tcurrent_user = User.find_by(username: username)\n\n\t\t@user_connection = nil\n\t\tconnections = Connection.where(:color => color)\n\n\t\tfor connection in connections\n\t\t\tif connection.users.include? current_user\n\t\t\t\t@user_connection = connection\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif (@user_connection == nil)\n\t\t\trender json: { connection: nil }\n\n\t\telse\n\t\t\trender json: { connection: @user_connection.users }\n\t\tend\n\n\t\t# if @connection.users.length >= 2\n\t\t# \t@connection.destroy\n\t\t# end\n\tend", "def show\r\n channel = Channel.where(service: channel_params[:service], channel: channel_params[:channel]).first\r\n render json: channel\r\n end", "def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end", "def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end", "def connector_type\n cable.connector_types[self.end - 1]\n end", "def for_user(user_id)\n request(:get, \"/users/#{user_id}/connections\")\n end", "def show\n respond_to do |format|\n begin\n @channel = Channel.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n format.json { render json: :not_found, status: :not_found }\n end\n format.json {render :info, status: :ok, location: @channel}\n end\n end", "def show\n channel = Channel.find(params[:id])\n json_response(channel)\n end", "def callback\n connector_response_url(callback_options)\n end", "def index\n @connections = Connection.all\n end", "def index\n @connections = Connection.all\n end", "def connector_id=(value)\n @connector_id = value\n end", "def index \n\t@skyrequest = Skyrequest::Connector.all.first\n end", "def set_connector_type\n @connector_type = ConnectorType.find(params[:id])\n end", "def show\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jetty }\n end\n end", "def connect\n result = send( { 'channel' => '/meta/connect', 'connectionType' => 'long-polling' } )\n connect_result = result.select { | message | message[ 'channel' ] == '/meta/connect' } \n \n raise RuntimeError, \"no response to connect request\" if connect_result.empty?\n raise RuntimeError, \"multiple responses to connect request: #{connect_result}\" unless connect_result.length == 1\n \n connect_result = connect_result.shift\n raise RuntimeError, \"connect error: #{connect_result}\" unless connect_result[ 'successful' ] == true\n \n result.reject { | message | message[ 'channel' ] == '/meta/connect' }\n end", "def endpoints_list\n get \"endpoints\"\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def all\r\n channels = Channel.all.order(:id)\r\n render json: channels\r\n end", "def get_flows()\n\tputs \"Getting flows\"\n\tresponse = request_get('/api/partner/flow')\n\tputs response.body\nend", "def create_connector_with_http_info(connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.create_connector ...'\n end\n # verify the required parameter 'connector' is set\n if connector.nil?\n fail ArgumentError, \"Missing the required parameter 'connector' when calling ContentConnectorsApi.create_connector\"\n end\n # resource path\n local_var_path = '/contentConnectors'\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(connector)\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StringResultSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#create_connector\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @sales_channel = SalesChannel.find(params[:sales_channel_id])\n @sales_channel_apis = @sales_channel.apis\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sales_channel_apis }\n end\n end", "def show\n @lifestyle_subgenre_inference_clarification_connector = LifestyleSubgenreInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lifestyle_subgenre_inference_clarification_connector }\n end\n end", "def index\n @cdn_configs = CdnConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cdn_configs }\n end\n end", "def connectors_post_with_http_info(name, login, password, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_post ...'\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling ConnectionsApi.connectors_post\"\n end\n # verify the required parameter 'login' is set\n if @api_client.config.client_side_validation && login.nil?\n fail ArgumentError, \"Missing the required parameter 'login' when calling ConnectionsApi.connectors_post\"\n end\n # verify the required parameter 'password' is set\n if @api_client.config.client_side_validation && password.nil?\n fail ArgumentError, \"Missing the required parameter 'password' when calling ConnectionsApi.connectors_post\"\n end\n # resource path\n local_var_path = '/connectors'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['name'] = name\n form_params['login'] = login\n form_params['password'] = password\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['email'] = opts[:'email'] if !opts[:'email'].nil?\n form_params['types'] = opts[:'types'] if !opts[:'types'].nil?\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['sendmail'] = opts[:'sendmail'] if !opts[:'sendmail'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Connector')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connectors_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_put\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n if @url_connector.update_attributes(params[:url_connector])\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end", "def connections_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connections_get ...'\n end\n # resource path\n local_var_path = '/connections'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2009')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connections_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @channels = Channel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @channels }\n end\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def show\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schema }\n end\n end", "def index\n @http_connections = HttpConnection.all\n end", "def fetch\n service = Diplomat::Service.get('resources')\n url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # if Rails.env.production?\n # service = Diplomat::Service.get('resources')\n # url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # else\n # url = 'http://localhost:3001/'\n # end\n conn = Faraday.new(url: url) do |faraday|\n faraday.response :logger, ::Logger.new(STDOUT), bodies: true\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n self.send(\"fetch_#{self.type}\", conn)\n end", "def index\n @external_credentials = ExternalCredential.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @external_credentials }\n end\n end", "def connectors_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_delete\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def index\n @schemas = Schema.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schemas }\n end\n end", "def all\n render json: Url.all\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def index\n render jsonapi: authorized_collection, each_serializer: Connection::Serializer\n end", "def get endpoint\n do_request :get, endpoint\n end", "def protocols\n get(\"/shodan/protocols\")\n end", "def show\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @schema }\n end\n end", "def show\n @external = External.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external }\n end\n end", "def show\n @network_connection = NetworkConnection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @network_connection }\n end\n end", "def connect\n @connector.connect\n @p.set_connection @connector\n end", "def get_connection(config, &connector)\n @connections ||= {}\n\n connection = @connections[config]\n\n return connection if connection\n\n begin\n @connections[config] = connector.call(config)\n rescue => e\n ::NewRelic::Agent.logger.error(\"Caught exception trying to get connection to DB for explain.\", e)\n nil\n end\n end" ]
[ "0.697967", "0.6883859", "0.67637634", "0.6751273", "0.6407257", "0.6312264", "0.62816614", "0.6275105", "0.6224756", "0.62198097", "0.6180519", "0.61611736", "0.61611736", "0.60824645", "0.60824645", "0.57934695", "0.5753963", "0.5657765", "0.5597659", "0.5579664", "0.55521405", "0.5540327", "0.55392784", "0.5530179", "0.5457942", "0.54346275", "0.54237986", "0.53901076", "0.53613776", "0.5354204", "0.5314778", "0.5287306", "0.52612835", "0.5249387", "0.52296335", "0.52239436", "0.52193445", "0.5213527", "0.5213417", "0.52014345", "0.5195897", "0.51876456", "0.51802176", "0.5174747", "0.5147045", "0.50918454", "0.50890034", "0.50867414", "0.50788057", "0.50776535", "0.5057464", "0.50503397", "0.50499153", "0.50341654", "0.5031102", "0.5014797", "0.49950284", "0.4987434", "0.49596828", "0.49579695", "0.4950251", "0.49500382", "0.49461573", "0.49461573", "0.49349943", "0.49261814", "0.4924175", "0.49208838", "0.49172476", "0.49171785", "0.4917083", "0.4898401", "0.48956856", "0.48907822", "0.48877013", "0.48841912", "0.4874273", "0.48730528", "0.4872436", "0.48718348", "0.48667443", "0.48659307", "0.4846778", "0.4840524", "0.48365295", "0.48257804", "0.48250416", "0.48188108", "0.48104638", "0.48090637", "0.48090386", "0.47978953", "0.47958657", "0.47904685", "0.4790004", "0.4784539", "0.47733048", "0.47688052", "0.47582453", "0.47566763", "0.4754264" ]
0.0
-1
POST /connectors POST /connectors.json
def create @connector = Connector.new(connector_params) respond_to do |format| if @connector.save format.html { redirect_to @connector, notice: 'Connector was successfully created.' } format.json { render :show, status: :created, location: @connector } else format.html { render :new } format.json { render json: @connector.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectors_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_post ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @url_connector = UrlConnector.new(params[:url_connector])\n\n respond_to do |format|\n if @url_connector.save\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully created.' }\n format.json { render json: @url_connector, status: :created, location: @url_connector }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connectors_post(name, login, password, opts = {})\n data, _status_code, _headers = connectors_post_with_http_info(name, login, password, opts)\n data\n end", "def connectors=(value)\n @connectors = value\n end", "def connectors=(value)\n @connectors = value\n end", "def api_connectors=(value)\n @api_connectors = value\n end", "def connectors_post_with_http_info(name, login, password, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_post ...'\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling ConnectionsApi.connectors_post\"\n end\n # verify the required parameter 'login' is set\n if @api_client.config.client_side_validation && login.nil?\n fail ArgumentError, \"Missing the required parameter 'login' when calling ConnectionsApi.connectors_post\"\n end\n # verify the required parameter 'password' is set\n if @api_client.config.client_side_validation && password.nil?\n fail ArgumentError, \"Missing the required parameter 'password' when calling ConnectionsApi.connectors_post\"\n end\n # resource path\n local_var_path = '/connectors'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['name'] = name\n form_params['login'] = login\n form_params['password'] = password\n form_params['url'] = opts[:'url'] if !opts[:'url'].nil?\n form_params['email'] = opts[:'email'] if !opts[:'email'].nil?\n form_params['types'] = opts[:'types'] if !opts[:'types'].nil?\n form_params['comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n form_params['sendmail'] = opts[:'sendmail'] if !opts[:'sendmail'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Connector')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connectors_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_get ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'display_name'] = opts[:'display_name'] if opts[:'display_name']\n query_params[:'image'] = opts[:'image'] if opts[:'image']\n query_params[:'get_it_url'] = opts[:'get_it_url'] if opts[:'get_it_url']\n query_params[:'short_description'] = opts[:'short_description'] if opts[:'short_description']\n query_params[:'long_description'] = opts[:'long_description'] if opts[:'long_description']\n query_params[:'enabled'] = opts[:'enabled'] if opts[:'enabled']\n query_params[:'oauth'] = opts[:'oauth'] if opts[:'oauth']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_7')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_get. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @connector_type = ConnectorType.new(connector_type_params)\n\n respond_to do |format|\n if @connector_type.save\n format.html { redirect_to @connector_type, notice: 'Connector type was successfully created.' }\n format.json { render :show, status: :created, location: @connector_type }\n else\n format.html { render :new }\n format.json { render json: @connector_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @url_connector = UrlConnector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url_connector }\n end\n end", "def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end", "def index\n @connectors = Connector.all\n end", "def create_connector_with_http_info(connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.create_connector ...'\n end\n # verify the required parameter 'connector' is set\n if connector.nil?\n fail ArgumentError, \"Missing the required parameter 'connector' when calling ContentConnectorsApi.create_connector\"\n end\n # resource path\n local_var_path = '/contentConnectors'\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(connector)\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StringResultSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#create_connector\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connector_params\n params.require(:connector).permit(:box_id, :aws_conn_id, :code, :url, :power, :voltage, :i_max, :price_per_kWh, :current_user, :frequency, :status, :tag_uid, :tag_token)\n end", "def create\n @lifestyle_cue_inference_clarification_connector = LifestyleCueInferenceClarificationConnector.new(params[:lifestyle_cue_inference_clarification_connector])\n\n respond_to do |format|\n if @lifestyle_cue_inference_clarification_connector.save\n format.html { redirect_to @lifestyle_cue_inference_clarification_connector, notice: 'Lifestyle cue inference clarification connector was successfully created.' }\n format.json { render json: @lifestyle_cue_inference_clarification_connector, status: :created, location: @lifestyle_cue_inference_clarification_connector }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lifestyle_cue_inference_clarification_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connectors_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_put\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def add_connector(connector)\n @connectors[connector.name] = connector\n self\n end", "def connections_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_post ...\"\n end\n \n # resource path\n path = \"/connections\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_6')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_post. Result: #{result.inspect}\"\n end\n return result\n end", "def associate_connector_dependencies!(connectors)\n connectors.each do |connector|\n source_names = [*connector.raw_config[\"source_connectors\"]].compact\n next if source_names.blank?\n \n source_connectors = source_names.map do |source_name|\n c = connectors.select{|connector2| connector2.name == source_name}.first\n raise InvalidConfig.new(\"Connector '#{connector.name}' references a source connector '#{source_name}' but no such connector name is defined.\") unless c\n raise InvalidConfig.new(\"Connector '#{connector.name}' cannot have itself as a source connector.\") if c == connector\n c\n end\n \n connector.send :source_connectors=, source_connectors\n end\n end", "def create_connector(connector, opts = {})\n data, _status_code, _headers = create_connector_with_http_info(connector, opts)\n data\n end", "def set_connector\n @connector = Connector.find(params[:id])\n end", "def connector_type_params\n params.require(:connector_type).permit(:name)\n end", "def create\n @scene_connector = SceneConnector.new(scene_connector_params)\n\n respond_to do |format|\n if @scene_connector.save\n format.html { redirect_to @scene_connector, notice: 'Scene connector was successfully created.' }\n format.json { render :show, status: :created, location: @scene_connector }\n else\n format.html { render :new }\n format.json { render json: @scene_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connect!\n payload = {}\n user.options.active.each do |option|\n hook = option.hook(@user)\n payload[option.code] = hook ? hook.connect : {}\n end\n user.connects.create!(server_id: server.id, option_attributes: payload)\n end", "def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @lifestyle_subgenre_inference_clarification_connector = LifestyleSubgenreInferenceClarificationConnector.new(params[:lifestyle_subgenre_inference_clarification_connector])\n\n respond_to do |format|\n if @lifestyle_subgenre_inference_clarification_connector.save\n format.html { redirect_to @lifestyle_subgenre_inference_clarification_connector, notice: 'Lifestyle subgenre inference clarification connector was successfully created.' }\n format.json { render json: @lifestyle_subgenre_inference_clarification_connector, status: :created, location: @lifestyle_subgenre_inference_clarification_connector }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lifestyle_subgenre_inference_clarification_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connector_types\n [connector_type_1, connector_type_2]\n end", "def destroy\n @connector.destroy\n respond_to do |format|\n format.html { redirect_to connectors_url, notice: 'Connector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def connectors\n return @connectors\n end", "def connectors\n return @connectors\n end", "def update\n respond_to do |format|\n if @connector.update(connector_params)\n format.html { redirect_to @connector, notice: 'Connector was successfully updated.' }\n format.json { render :show, status: :ok, location: @connector }\n else\n format.html { render :edit }\n format.json { render json: @connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_connectors\n return @api_connectors\n end", "def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end", "def get_connectors_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.get_connectors_list ...'\n end\n # resource path\n local_var_path = '/contentConnectors'\n\n # query parameters\n query_params = {}\n query_params[:'includeAdditionalInstanceInformation'] = opts[:'include_additional_instance_information'] if !opts[:'include_additional_instance_information'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ConnectorListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#get_connectors_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def add_connections_to_journey(json, user, poi_ids)\n journey = create_journey(json, user)\n connections = create_connections(json)\n connections.each do |connection|\n connection.journey = journey\n connection.save\n # check params for the ids of POI to creat PoiBookings\n if poi_ids.keys.include? connection.start_time\n ids = poi_ids[connection.start_time].split(\",\")\n ids.each do |id|\n poi = Poi.find(id.to_i)\n poi_booking = PoiBooking.new\n poi_booking.poi = poi\n poi_booking.connection = connection\n poi_booking.save\n end\n end\n end\n journey\n end", "def connect\n @connector.connect\n @p.set_connection @connector\n end", "def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n @response = { url: \"#{request.protocol}#{request.host_with_port}/#{Link.encode(@link.id)}\" }\n format.json { render json: @response, status: :created, location: @link }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n service= params[:connector][:service]\n\n case service\n when 'Scanner'\n Scanner.connect(params[:connector])\n when 'Converter'\n Converter.connect(params[:connector])\n sleep(0.5) ##just to avoid to much going on in parallel, should not be needed, just better\n Converter.run_conversion(Page.for_batch_conversion)\n when 'Hardware'\n Hardware.connect(params[:connector])\n sleep(0.5)\n Hardware.blink_ok_status_led\n Hardware.watch_scanner_button_on\n when 'TouchSwitch'\n TouchSwitch.connect(params[:connector])\n else\n raise \"Create Connection with unkown service: #{service}\"\n end\n\n push_app_status\n head :ok\n end", "def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def connector_id=(value)\n @connector_id = value\n end", "def post_connect(uri, response, body_io); end", "def connect!\n request! :connect\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def create_connection(body)\n raise Auth0::InvalidParameter, 'Must specify a body to create a connection' if body.to_s.empty?\n request_params = body\n post(connections_path, request_params)\n end", "def create\n @color_scheme = ColorScheme.new(color_scheme_params)\n\n respond_to do |format|\n if @color_scheme.save\n format.html { redirect_to [:admin, @color_scheme], notice: 'Color scheme was successfully created.' }\n format.json { render action: 'show', status: :created, location: @color_scheme }\n else\n format.html { render action: 'new' }\n format.json { render json: @color_scheme.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @connection = Connection.new(params[:connection])\n @connection.user = current_user\n @connection.database_type = 'mysql'\n\n if @connection.port.nil?\n @connection.port = '3306'\n end\n\n respond_to do |format|\n if @connection.save\n redirect_path = param(:redirect, connections_path)\n\n format.html { redirect_to redirect_path, notice: 'Connection was successfully created.' }\n format.json { render json: @connection, status: :created, location: @connection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n source_ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:map_from_bioportal_ontology_id]).first\n target_ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:map_to_bioportal_ontology_id]).first\n source = source_ontology.explore.single_class(params[:map_from_bioportal_full_id])\n target = target_ontology.explore.single_class(params[:map_to_bioportal_full_id])\n values = {\n classes: {\n source.id => source_ontology.id,\n target.id => target_ontology.id\n },\n creator: session[:user].id,\n relation: params[:mapping_relation],\n comment: params[:mapping_comment]\n }\n @mapping = LinkedData::Client::Models::Mapping.new(values: values)\n @mapping_saved = @mapping.save\n if @mapping_saved.errors\n raise Exception, @mapping_saved.errors\n else\n @delete_mapping_permission = check_delete_mapping_permission(@mapping_saved)\n render json: @mapping_saved\n end\n end", "def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end", "def set_connector_type\n @connector_type = ConnectorType.find(params[:id])\n end", "def connectors_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.connectors_get ...'\n end\n # resource path\n local_var_path = '/connectors'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20017')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#connectors_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_connectors_list(opts = {})\n data, _status_code, _headers = get_connectors_list_with_http_info(opts)\n data\n end", "def update\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n if @url_connector.update_attributes(params[:url_connector])\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def init_jaxb_json_hash(_o)\n @pattern = String.from_json(_o['pattern']) unless _o['pattern'].nil?\n @proxyConnectorRuleType = String.from_json(_o['proxyConnectorRuleType']) unless _o['proxyConnectorRuleType'].nil?\n if !_o['proxyConnectors'].nil?\n @proxyConnectors = Array.new\n _oa = _o['proxyConnectors']\n _oa.each { | _item | @proxyConnectors.push Org::Apache::Archiva::Admin::Model::Beans::ProxyConnector.from_json(_item) }\n end\n end", "def connectors_id_get(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_get ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_get\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_get. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @link_resource = LinkResource.new(link_resource_params)\n\n respond_to do |format|\n if @link_resource.save\n format.html { redirect_to @lab, notice: 'Link resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @connector_type.destroy\n respond_to do |format|\n format.html { redirect_to connector_types_url, notice: 'Connector type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @connector_types = ConnectorType.all\n end", "def create_or_update_connection\n form(:action => R(CreateOrUpdateConnection, @connection.id), :method => :post) {\n ul {\n li {\n label {\n \"name\"\n }\n input(:type => :text, :name => :name, :value => @connection.name)\n }\n li {\n label {\n \"host\"\n }\n input(:type => :text, :name => :host, :value => @connection.host)\n }\n li {\n label {\n \"secret\"\n }\n input(:type => :text, :name => :secret, :value => @connection.secret)\n }\n }\n }\n end", "def create\n @schema = Schema.new(params[:schema])\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, :notice => 'Schema was successfully created.' }\n format.json { render :json => @schema, :status => :created, :location => @schema }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @schema.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @url_mapper = UrlMapper.new(url_mapper_params)\n\n respond_to do |format|\n if @url_mapper.save\n format.html { redirect_to @url_mapper, notice: 'Url mapper was successfully created.' }\n format.json { render :show, status: :created, location: @url_mapper }\n else\n format.html { render :new }\n format.json { render json: @url_mapper.errors, status: :unprocessable_entity }\n end\n end\n end", "def callback\n connector_response_url(callback_options)\n end", "def create\n @datasource = Datasource.new(form_params)\n\n respond_to do |format|\n if @datasource.save\n format.json { render json: { datasources: @datasource }, status: :created }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @social_networking = Admin::SocialNetworking.new(social_networking_params)\n\n if @social_networking.save\n render json: @social_networking, status: :created\n else\n render json: @social_networking.errors, status: :unprocessable_entity\n end\n end", "def create\n @schema = Schema.new(params[:schema])\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render json: @schema, status: :created, location: @schema }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end", "def new\n @site = Site.new \n puts \"Got here\"\n #2.times { @site.connections.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def connectors_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_delete\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @connection = Connection.new(params[:connection])\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: 'Your Connection Request was successfully sent.' }\n format.json { render json: @connection, status: :created, location: @connection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jetty = Jetty.new(params[:jetty])\n\n respond_to do |format|\n if @jetty.save\n format.html { redirect_to @jetty, notice: 'Jetty was successfully created.' }\n format.json { render json: @jetty, status: :created, location: @jetty }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @route_connection = RouteConnection.new(params[:route_connection])\n\n respond_to do |format|\n if @route_connection.save\n format.html { redirect_to @route_connection, notice: 'Route connection was successfully created.' }\n format.json { render json: @route_connection, status: :created, location: @route_connection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route_connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "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 post_init\n @connector = Aeon::Connector.new(self)\n end", "def post_init\n @connector = Aeon::Connector.new(self)\n end", "def post(url, resource_name, options = {})\n build_response(resource_name) do\n connection.post do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def create\n @connection = Connection.new(connection_params)\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: 'Connection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @connection }\n else\n format.html { render action: 'new' }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jakeslink = Jakeslink.new(params[:jakeslink])\n\n respond_to do |format|\n if @jakeslink.save\n format.html { redirect_to @jakeslink, notice: 'Jakeslink was successfully created.' }\n format.json { render json: @jakeslink, status: :created, location: @jakeslink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jakeslink.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def create\n @scheme = Scheme.new(params[:scheme])\n\n respond_to do |format|\n if @scheme.save\n if @scheme.from_file == true\n #TODO: Get this working right depending on file extension\n if @scheme.json_scaffold.content_type == \"application/octet-stream\"\n\t\t\t@file = File.read(@scheme.json_scaffold.path)\n\t\t\t@json_scaffold = JSON.parse(@file)\n\t\t\tputs @json_scaffold.inspect\n\t\t\t@scheme.collectionname = @json_scaffold[\"collectionname\"]\n\t\t\t@json_scaffold[\"columns\"].each do |col|\n\t\t\t puts col.to_hash.with_indifferent_access\n\t\t\t begin\n\t\t\t @scheme.schemer_columns.create!(col.to_hash.symbolize_keys)\n\t\t\t rescue Exception => e\n\t\t\t\tputs e.to_s\n\t\t\t end\n\t\t\tend\n\t\t\t@scheme.save\n\t\t elsif @scheme.json_scaffold.content_type == \"text/csv\"\n\t\t @file = File.read(@scheme.json_scaffold.path)\n\t\t begin\n\t\t csv = CSV.parse(@file, :headers => true)\n\t\t rescue Exception => e\n\t\t puts e.to_s\n\t\t end\n\t\t unless csv.nil?\n\t\t\t csv.each do |row|\n\t\t\t row = row.to_hash.with_indifferent_access\n\t\t\t @row_hash = row.to_hash.symbolize_keys\n\t\t\t puts @row_hash\n\t\t\t @scheme.collectionname = @row_hash[\"dataset\"]\n\t\t\t begin\n\t\t\t\t @scheme.schemer_columns.create!(row.to_hash.symbolize_keys)\n\t\t\t rescue Exception => e\n\t\t\t\t puts e.to_s\n\t\t\t end\n\t\t\t end\n\t\t end\n\t\t @scheme.save\n\t\t else\n\t\t #TODO: Txt/CSV, XML\n\t\t end\n\t\tend\n format.html { redirect_to @scheme, notice: 'Scheme was successfully created.' }\n format.json { render json: @scheme, status: :created, location: @scheme }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheme.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trips_connect = TripsConnect.new(params[:trips_connect])\n\n respond_to do |format|\n if @trips_connect.save\n format.html { redirect_to @trips_connect, notice: 'Trips connect was successfully created.' }\n format.json { render json: @trips_connect, status: :created, location: @trips_connect }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trips_connect.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @connection = Connection.new(connection_params)\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: \"Connection was successfully created.\" }\n format.json { render :show, status: :created, location: @connection }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@url = Url.build(params[:link],request.base_url) \t\n \trender json: @url.to_json\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @resources_and_link = ResourcesAndLink.new(params[:resources_and_link])\n\n respond_to do |format|\n if @resources_and_link.save\n format.html { redirect_to @resources_and_link, notice: 'Resources and link was successfully created.' }\n format.json { render json: @resources_and_link, status: :created, location: @resources_and_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resources_and_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_connector(connector)\n old_weight = @total_weight\n @total_weight += connector.weight\n @ranges << {:connector => connector, :range =>(old_weight..@total_weight)}\n @active_connectors << connector\n end", "def post_connect_hooks; end", "def post_connect_hooks; end", "def create\n @schema = Schema.new(schema_params)\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render :show, status: :created, location: @schema }\n else\n format.html { render :new }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schema = Schema.new(schema_params)\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render :show, status: :created, location: @schema }\n else\n format.html { render :new }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_links\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal(\n ['list', 'info', 'identify_resource', 'create', 'submit', 'update', 'delete'],\n schema.resource('resource').links.map { |link| link.name })\n end", "def connect!; end", "def connect!; end", "def update\n respond_to do |format|\n if @connector_type.update(connector_type_params)\n format.html { redirect_to @connector_type, notice: 'Connector type was successfully updated.' }\n format.json { render :show, status: :ok, location: @connector_type }\n else\n format.html { render :edit }\n format.json { render json: @connector_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restconnection = Restconnection.new(restconnection_params)\n\n respond_to do |format|\n if @restconnection.save\n format.html { redirect_to @restconnection, notice: 'Restconnection was successfully created.' }\n format.json { render :show, status: :created, location: @restconnection }\n else\n format.html { render :new }\n format.json { render json: @restconnection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n name = shift_argument\n url = shift_argument\n\n unless name && url\n raise(Heroku::Command::CommandFailed, \"Usage: clients:register [NAME] [CALLBACK_URL]\")\n end\n\n validate!(url)\n client = request do\n api.request(\n :body => encode_json(\n { :name => name, :redirect_uri => url }),\n :expects => 201,\n :headers => headers,\n :method => :post,\n :path => \"/oauth/clients\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Registered client \"#{name}\".})\n styled_hash(client)\n end\n end", "def create\n @test_link = TestLink.new(test_link_params)\n\n if @test_link.save\n render :show, status: :created, location: @test_link\n else\n render json: @test_link.errors, status: :unprocessable_entity\n end\n end", "def add(params)\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(intranet(:koha_rest_api) + \"patrons\")\n res = http.post(uri, params.to_json, headers)\n expect(res.code).to eq(\"201\"), \"got unexpected #{res.code} when adding patron.\\nResponse body: #{res.body}\"\n res.body\n end", "def create\n @conn = current_user.conns.build(params[:conn])\n\n respond_to do |format|\n if @conn.save\n format.html { redirect_to @conn, notice: 'Conn was successfully created.' }\n format.json { render json: @conn, status: :created, location: @conn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conn.errors, status: :unprocessable_entity }\n end\n end\n end", "def connections\n\t\t# Find degree\n\t\tif params.has_key? 'degree'\n\t\t\tdegree = params['degree']\n\t\telse\n\t\t\tdegree = 1\n\t\tend\n\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\n\t\t# Get connections from graph\n\t\tconnections = { 1 => [{\"user\" => {id: 3}}] }\n\n\t\t# Get demos from couch\n\t\tdemographics = { 1 => 'asdljasd' }\n\n\t\t# Build JSON\n\t\trender json: connections_json(user_id, connections, demographics)\n\tend" ]
[ "0.72071993", "0.6536202", "0.64566696", "0.6264675", "0.6264675", "0.6186751", "0.6156597", "0.5947391", "0.5875985", "0.5864708", "0.57912225", "0.5660581", "0.5622291", "0.551319", "0.544815", "0.544497", "0.54416513", "0.54387206", "0.5408554", "0.5313349", "0.5309515", "0.5254841", "0.5254429", "0.5228799", "0.52263933", "0.51638997", "0.5084396", "0.5083992", "0.5064319", "0.5064319", "0.5044595", "0.5026895", "0.501227", "0.49871182", "0.49503264", "0.4950209", "0.49334076", "0.4922781", "0.48476183", "0.48458308", "0.48336065", "0.48100734", "0.4809054", "0.47808203", "0.47681263", "0.47637856", "0.4748095", "0.4732142", "0.47162277", "0.47079036", "0.46956408", "0.46918276", "0.46872208", "0.46829662", "0.46713126", "0.465226", "0.46398678", "0.46287325", "0.46221742", "0.46216992", "0.4615863", "0.4612149", "0.46118", "0.46065265", "0.45984584", "0.45792204", "0.45633915", "0.45592222", "0.45557296", "0.45485312", "0.45484704", "0.4539805", "0.4536784", "0.45270005", "0.45270005", "0.45266953", "0.4526034", "0.4522888", "0.4515864", "0.45082748", "0.44917417", "0.44915617", "0.44890338", "0.447295", "0.44609863", "0.44580215", "0.44449377", "0.44449377", "0.44401437", "0.44401437", "0.44349852", "0.4434551", "0.4434551", "0.4433548", "0.44304132", "0.44300753", "0.44290614", "0.44270906", "0.4426003", "0.44245523" ]
0.6866876
1
PATCH/PUT /connectors/1 PATCH/PUT /connectors/1.json
def update respond_to do |format| if @connector.update(connector_params) format.html { redirect_to @connector, notice: 'Connector was successfully updated.' } format.json { render :show, status: :ok, location: @connector } else format.html { render :edit } format.json { render json: @connector.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n if @url_connector.update_attributes(params[:url_connector])\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def connectors_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_put\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update!(**args)\n @connector_type = args[:connector_type] if args.key?(:connector_type)\n end", "def update\n respond_to do |format|\n if @connector_type.update(connector_type_params)\n format.html { redirect_to @connector_type, notice: 'Connector type was successfully updated.' }\n format.json { render :show, status: :ok, location: @connector_type }\n else\n format.html { render :edit }\n format.json { render json: @connector_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update_connector_with_http_info(connector_id, connector, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.update_connector ...'\n end\n # verify the required parameter 'connector_id' is set\n if connector_id.nil?\n fail ArgumentError, \"Missing the required parameter 'connector_id' when calling ContentConnectorsApi.update_connector\"\n end\n # verify the required parameter 'connector' is set\n if connector.nil?\n fail ArgumentError, \"Missing the required parameter 'connector' when calling ContentConnectorsApi.update_connector\"\n end\n # resource path\n local_var_path = '/contentConnectors/{connectorId}'.sub('{' + 'connectorId' + '}', connector_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(connector)\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#update_connector\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n end", "def api_connectors=(value)\n @api_connectors = value\n end", "def update\n @lifestyle_cue_inference_clarification_connector = LifestyleCueInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n if @lifestyle_cue_inference_clarification_connector.update_attributes(params[:lifestyle_cue_inference_clarification_connector])\n format.html { redirect_to @lifestyle_cue_inference_clarification_connector, notice: 'Lifestyle cue inference clarification connector was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lifestyle_cue_inference_clarification_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update!(**args)\n @json_schemas = args[:json_schemas] if args.key?(:json_schemas)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @queue = args[:queue] if args.key?(:queue)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @queue = args[:queue] if args.key?(:queue)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @queue = args[:queue] if args.key?(:queue)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @queue = args[:queue] if args.key?(:queue)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n if @schema.update_attributes(params[:schema])\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @schema = Schema.find(params[:id])\n\n respond_to do |format|\n if @schema.update_attributes(params[:schema])\n format.html { redirect_to @schema, :notice => 'Schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @schema.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n if @scheme.update_attributes(params[:scheme])\n format.html { redirect_to @scheme, notice: 'Scheme was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheme.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @protocol = Protocol.find(params[:id])\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n format.html { redirect_to @protocol, notice: 'Protocol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def test_client_from_schema_with_url_prefix\n uuid = '1ab1c589-df46-40aa-b786-60e83b1efb10'\n body = {'Hello' => 'World!'}\n result = {'Goodbye' => 'Universe!'}\n Excon.stub(method: :patch) do |request|\n assert_equal(\"/api/resource/#{uuid}\", request[:path])\n assert_equal('application/json', request[:headers]['Content-Type'])\n assert_equal(body, MultiJson.load(request[:body]))\n Excon.stubs.pop\n {status: 200, headers: {'Content-Type' => 'application/json'},\n body: MultiJson.dump(result)}\n end\n\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n output = StringIO.new\n cli = Heroics.cli_from_schema('cli', output, schema,\n 'https://example.com/api')\n cli.run('resource:update', uuid, body)\n assert_equal(MultiJson.dump(result, pretty: true) + \"\\n\", output.string)\n end", "def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def update\n @lifestyle_subgenre_inference_clarification_connector = LifestyleSubgenreInferenceClarificationConnector.find(params[:id])\n\n respond_to do |format|\n if @lifestyle_subgenre_inference_clarification_connector.update_attributes(params[:lifestyle_subgenre_inference_clarification_connector])\n format.html { redirect_to @lifestyle_subgenre_inference_clarification_connector, notice: 'Lifestyle subgenre inference clarification connector was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lifestyle_subgenre_inference_clarification_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end", "def set_connector\n @connector = Connector.find(params[:id])\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @item = args[:item] if args.key?(:item)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @item = args[:item] if args.key?(:item)\n end", "def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def connections_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_put\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @schema.update(schema_params)\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema }\n else\n format.html { render :edit }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schema.update(schema_params)\n format.html { redirect_to @schema, notice: 'Schema was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema }\n else\n format.html { render :edit }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(uri, options = T.unsafe(nil)); end", "def connectors_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_post ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_8')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_post. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def patch\n end", "def update\n put :update\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def patch\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.patch do |req|\n req.headers['Content-Type'] = \"application/json\"\n req.url resource_uri\n req.body = raw.to_json\n end\n if res.success?\n data = JSON.parse(res.body)\n self.class.new(data, @client)\n else\n nil\n end\n end", "def update!(**args)\n @scheme = args[:scheme] if args.key?(:scheme)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @index_item_options = args[:index_item_options] if args.key?(:index_item_options)\n @item = args[:item] if args.key?(:item)\n @mode = args[:mode] if args.key?(:mode)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @index_item_options = args[:index_item_options] if args.key?(:index_item_options)\n @item = args[:item] if args.key?(:item)\n @mode = args[:mode] if args.key?(:mode)\n end", "def update\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:update [ID] [options]\")\n\n if options.empty?\n raise(Heroku::Command::CommandFailed, \"Missing options\")\n end\n\n validate!(options[:url]) if options[:url]\n shell = options.delete(:shell)\n options[:redirect_uri] = options.delete(:url)\n\n client = request do\n api.request(\n :body => encode_json(options),\n :expects => 200,\n :headers => headers,\n :method => :patch,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if shell\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Updated client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n respond_to do |format|\n if @scene_connector.update(scene_connector_params)\n format.html { redirect_to @scene_connector, notice: 'Scene connector was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene_connector }\n else\n format.html { render :edit }\n format.json { render json: @scene_connector.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end", "def connectors=(value)\n @connectors = value\n end", "def connectors=(value)\n @connectors = value\n end", "def update\n @external = External.find(params[:id])\n\n respond_to do |format|\n if @external.update_attributes(params[:external])\n format.html { redirect_to @external, notice: 'External was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @external.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n respond_to do |format|\n if @endpoint.update(endpoint_params)\n format.html { redirect_to root_url, notice: 'Endpoint was successfully updated.' }\n format.json { head :ok }\n else\n format.html { head :unprocessable_entity }\n format.json { render json: @endpoint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @protocol.update(protocol_params)\n format.html { redirect_to protocols_url, notice: 'Protocolo actualizado.' }\n format.json { head :no_content }\n else\n format.html { render :show }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end", "def connectors_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_get ...\"\n end\n \n # resource path\n path = \"/connectors\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'display_name'] = opts[:'display_name'] if opts[:'display_name']\n query_params[:'image'] = opts[:'image'] if opts[:'image']\n query_params[:'get_it_url'] = opts[:'get_it_url'] if opts[:'get_it_url']\n query_params[:'short_description'] = opts[:'short_description'] if opts[:'short_description']\n query_params[:'long_description'] = opts[:'long_description'] if opts[:'long_description']\n query_params[:'enabled'] = opts[:'enabled'] if opts[:'enabled']\n query_params[:'oauth'] = opts[:'oauth'] if opts[:'oauth']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_7')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_get. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @link_resource.update(link_resource_params)\n format.html { redirect_to @lab, notice: 'Link resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @price_schema.update(price_schema_params)\n format.html { redirect_to @price_schema, notice: 'Price schema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @price_schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @limit = args[:limit] if args.key?(:limit)\n @queue = args[:queue] if args.key?(:queue)\n @status_codes = args[:status_codes] if args.key?(:status_codes)\n end", "def update!(**args)\n @connector_name = args[:connector_name] if args.key?(:connector_name)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @limit = args[:limit] if args.key?(:limit)\n @queue = args[:queue] if args.key?(:queue)\n @status_codes = args[:status_codes] if args.key?(:status_codes)\n end", "def update\n url = single_url\n payload = attributes_to_payload\n payload[:reset_data] = true\n to_server url, payload\n end", "def update\n respond_to do |format|\n if @protocol_relationship.update(protocol_relationship_params)\n format.html { redirect_to @protocol_relationship, notice: 'Protocol relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @protocol_relationship }\n else\n format.html { render :edit }\n format.json { render json: @protocol_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n if @connection.update_attributes(params[:connection])\n redirect_path = param(:redirect, edit_connection_path(@connection))\n\n format.html { redirect_to redirect_path, notice: 'Connection was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @connection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @protocol = Protocol.find(params[:id])\n @title = \"Protocol\"\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n format.html { redirect_to(@protocol, :notice => 'Protocol was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end", "def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end", "def update!(**args)\n @json_schema = args[:json_schema] if args.key?(:json_schema)\n @name = args[:name] if args.key?(:name)\n @struct_schema = args[:struct_schema] if args.key?(:struct_schema)\n end", "def update\n respond_to do |format|\n if @color_scheme.update(color_scheme_params)\n format.html { redirect_to [:admin, @color_scheme], notice: 'Color scheme was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @color_scheme.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allows = args[:allows] if args.key?(:allows)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def update\n @protocol = Protocol.find(params[:id])\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n flash[:notice] = 'Protocol was successfully updated.'\n format.html { redirect_to(@protocol) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @application_endpoint = args[:application_endpoint] if args.key?(:application_endpoint)\n @connectors = args[:connectors] if args.key?(:connectors)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @gateway = args[:gateway] if args.key?(:gateway)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update\n respond_to do |format|\n if @schema_table.update(schema_table_params)\n format.html { redirect_to @schema_table, notice: 'Schema table was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_table }\n else\n format.html { render :edit }\n format.json { render json: @schema_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def configure(**params)\n client.post(\"/api/live/#{read_attribute(:id)}/edit\", params)\n end", "def patch(path, **args); end", "def update\n @client.update(client_params)\n render json: @client\n end", "def update!(**args)\n @data_schema = args[:data_schema] if args.key?(:data_schema)\n @input_uris = args[:input_uris] if args.key?(:input_uris)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end", "def update\n head :ok\n end" ]
[ "0.64440304", "0.6419161", "0.6087523", "0.5842914", "0.5832763", "0.5822447", "0.58125496", "0.57372296", "0.57372296", "0.573005", "0.5663236", "0.56514657", "0.56498235", "0.5607775", "0.55426246", "0.55426246", "0.55426246", "0.55426246", "0.55341756", "0.55136704", "0.5497625", "0.5497155", "0.54954904", "0.5462987", "0.5457291", "0.54505396", "0.5433347", "0.54238415", "0.54061395", "0.5405073", "0.5398932", "0.5393056", "0.53798395", "0.53716666", "0.53634757", "0.5361422", "0.5361422", "0.53554714", "0.5342046", "0.53401595", "0.53330517", "0.53330517", "0.5305186", "0.5305186", "0.5305021", "0.5284417", "0.52720994", "0.5270632", "0.52668816", "0.52664113", "0.52624416", "0.52605575", "0.52605575", "0.52593213", "0.5255963", "0.5246562", "0.52329075", "0.52282196", "0.52282196", "0.5215559", "0.52108717", "0.5207991", "0.5205019", "0.518951", "0.5185632", "0.5185632", "0.51852083", "0.5184114", "0.5182807", "0.5182626", "0.51802254", "0.51778287", "0.51748747", "0.517234", "0.51647234", "0.5153316", "0.5151773", "0.5151773", "0.5140747", "0.5137722", "0.5133008", "0.5119644", "0.5105939", "0.5104268", "0.5102334", "0.5100125", "0.5100125", "0.50767314", "0.50746936", "0.507454", "0.5072718", "0.5072041", "0.5069775", "0.5068315", "0.50665206", "0.5064956", "0.5064087", "0.5063007", "0.505946", "0.505725" ]
0.6629357
0
DELETE /connectors/1 DELETE /connectors/1.json
def destroy @connector.destroy respond_to do |format| format.html { redirect_to connectors_url, notice: 'Connector was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @url_connector = UrlConnector.find(params[:id])\n @url_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to url_connectors_url }\n format.json { head :no_content }\n end\n end", "def connectors_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectorApi#connectors_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connectors_id_delete\" if id.nil?\n \n # resource path\n path = \"/connectors/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectorApi#connectors_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def destroy\n @connector = Connector.find(params[:id])\n @connector.destroy unless @connector.nil?\n\n respond_to do |format|\n format.html { render 'status/index'}\n format.json { render nothing: true }\n end\n\n push_app_status\n\n end", "def destroy\n @connector_type.destroy\n respond_to do |format|\n format.html { redirect_to connector_types_url, notice: 'Connector type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n @connection.destroy\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @scene_connector.destroy\n respond_to do |format|\n format.html { redirect_to scene_connectors_url, notice: 'Scene connector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lifestyle_cue_inference_clarification_connector = LifestyleCueInferenceClarificationConnector.find(params[:id])\n @lifestyle_cue_inference_clarification_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to lifestyle_cue_inference_clarification_connectors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @route_connection = RouteConnection.find(params[:id])\n @route_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to route_connections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @restconnection.destroy\n respond_to do |format|\n format.html { redirect_to restconnections_url, notice: 'Restconnection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @connection.destroy\n respond_to do |format|\n format.html { redirect_to connections_url, notice: \"Connection was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @lifestyle_subgenre_inference_clarification_connector = LifestyleSubgenreInferenceClarificationConnector.find(params[:id])\n @lifestyle_subgenre_inference_clarification_connector.destroy\n\n respond_to do |format|\n format.html { redirect_to lifestyle_subgenre_inference_clarification_connectors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bitbucket2_asana_connection.destroy\n respond_to do |format|\n format.html { redirect_to new_bitbucket2_asana_connection_path, notice: 'Bitbucket2 asana connection was successfully destroyed.' }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @conn = current_user.conns.find(params[:id])\n @conn.destroy\n\n respond_to do |format|\n format.html { redirect_to conns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scheme = Scheme.find(params[:id])\n @scheme.destroy\n\n respond_to do |format|\n format.html { redirect_to schemes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\r\n\r\n @connection_request = ConnectionRequest.find(params[:id])\r\n @connection_request.destroy\r\n\r\n render json: {:status => :success, :data => @connection_request}\r\n end", "def destroy\n @jetty = Jetty.find(params[:id])\n @jetty.destroy\n\n respond_to do |format|\n format.html { redirect_to jetties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @http_connection.destroy\n respond_to do |format|\n format.html { redirect_to http_connections_url, notice: \"Http connection was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def connections_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: ConnectionApi#connections_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling connections_id_delete\" if id.nil?\n \n # resource path\n path = \"/connections/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: ConnectionApi#connections_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @protocol = Protocol.find(params[:id])\n @protocol.destroy\n\n respond_to do |format|\n format.html { redirect_to(protocols_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def delete\n request(:delete)\n end", "def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @argument_connection = ArgumentConnection.find(params[:id])\n @argument_connection.destroy\n\n respond_to do |format|\n format.html { redirect_to argument_connections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def destroy\n @http_backend = Http::Backend.find(params[:id])\n @http_backend.destroy\n\n respond_to do |format|\n format.html { redirect_to http_backends_url }\n format.json { head :ok }\n end\n\n Http::Backend.send_to_redis\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @oauth_client = OauthClient.find(params[:id])\n @oauth_client.destroy\n\n respond_to do |format|\n format.html { redirect_to oauth_clients_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def delete\n conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n @api_v1_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_graphs_url, notice: 'Graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'api'\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def destroy\n @external = External.find(params[:id])\n @external.destroy\n\n respond_to do |format|\n format.html { redirect_to externals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bot_server.destroy\n respond_to do |format|\n format.html { redirect_to bot_servers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ps_connection_information.destroy\n respond_to do |format|\n format.html { redirect_to ps_connection_informations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @broker.destroy\n respond_to do |format|\n format.html { redirect_to admin_brokers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @externalformlink.destroy\n respond_to do |format|\n format.html { redirect_to externalformlinks_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @url_mapper.destroy\n respond_to do |format|\n format.html { redirect_to url_mappers_url, notice: 'Url mapper was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def destroy\n @sales_channel_api = SalesChannelApi.find(params[:id])\n @sales_channel_api.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_channel_apis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(request)\n @connection.delete request.path do |req|\n req.body = request.params\n end\n end", "def destroy\n @client.delete( name )\n end", "def delete_connector_with_http_info(connector_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContentConnectorsApi.delete_connector ...'\n end\n # verify the required parameter 'connector_id' is set\n if connector_id.nil?\n fail ArgumentError, \"Missing the required parameter 'connector_id' when calling ContentConnectorsApi.delete_connector\"\n end\n # resource path\n local_var_path = '/contentConnectors/{connectorId}'.sub('{' + 'connectorId' + '}', connector_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['APP_NORMAL', 'OAUTH']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContentConnectorsApi#delete_connector\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @cfg.destroy\n respond_to do |format|\n format.html { redirect_to cfgs_url, notice: 'Cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jakeslink = Jakeslink.find(params[:id])\n @jakeslink.destroy\n\n respond_to do |format|\n format.html { redirect_to jakeslinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backend.destroy\n respond_to do |format|\n format.html { redirect_to backends_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @social_networking.destroy\n\n render json: @social_networking, status: :ok\n end", "def destroy\n @hub.destroy\n\n respond_to do |format|\n format.html { redirect_to hubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # if authorise(request)\n operation = params[:operation]\n case operation\n when 'remove_vertex'\n delete_vertex(params[:id])\n when 'disconnect_vertex'\n delete_connection(params[:from_vertex_id], params[:to_vertex_id])\n else\n render json: { status: 'FAILED', message: 'Operation does not exist' }, status: :bad_request\n end\n # else\n # render json: { status: 'FAILED', message: 'Unauthorized' }, status: 401\n # end\n end", "def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @endpoint.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Endpoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @edge_type = EdgeType.find(params[:id])\n @edge_type.destroy\n\n respond_to do |format|\n format.html { redirect_to edge_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @edge = Edge.find(params[:id])\n @edge.destroy\n\n respond_to do |format|\n format.html { redirect_to edges_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.74248743", "0.6949447", "0.6913631", "0.67478865", "0.6603385", "0.65876436", "0.65615493", "0.6534312", "0.65047103", "0.6491685", "0.64342993", "0.6429", "0.63927054", "0.63927054", "0.63890564", "0.63669485", "0.63462245", "0.632686", "0.632686", "0.6267603", "0.6237204", "0.6224785", "0.6219968", "0.6215453", "0.6210929", "0.6210015", "0.62070286", "0.62063575", "0.62063575", "0.62063575", "0.62063575", "0.6205093", "0.6187059", "0.61790955", "0.6167039", "0.6164998", "0.6154499", "0.61518717", "0.6138253", "0.6136512", "0.6132144", "0.6126161", "0.61221635", "0.61150146", "0.6109843", "0.6107666", "0.6104412", "0.6097749", "0.6095598", "0.608578", "0.6082991", "0.607501", "0.607501", "0.6073871", "0.6072065", "0.60704726", "0.6069286", "0.60682", "0.6067492", "0.60661525", "0.60549897", "0.6049413", "0.6048422", "0.60465026", "0.60390264", "0.60383373", "0.60348076", "0.6033392", "0.6029297", "0.60261714", "0.602481", "0.6022003", "0.60168105", "0.60168105", "0.6014163", "0.6011215", "0.5996021", "0.5995667", "0.59915715", "0.5987012", "0.59845495", "0.59807444", "0.59807444", "0.59807444", "0.59793836", "0.59755975", "0.59732604", "0.59712094", "0.5969515", "0.5969354", "0.5965168", "0.59604347", "0.5957837", "0.5956647", "0.59549385", "0.5950326", "0.59489655", "0.5948318", "0.5948067", "0.5947973" ]
0.73246616
1
Use callbacks to share common setup or constraints between actions.
def set_connector @connector = Connector.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 connector_params params.require(:connector).permit(:box_id, :aws_conn_id, :code, :url, :power, :voltage, :i_max, :price_per_kWh, :current_user, :frequency, :status, :tag_uid, :tag_token) 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 filtering_params\n params.permit(:email)\n end", "def active_code_params\n params[:active_code].permit\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 url_whitelist; 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 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 permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\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 unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "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 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289145", "0.62875307", "0.6280997", "0.62420976", "0.62388235", "0.6216686", "0.62122375", "0.6208949", "0.619173", "0.6176307", "0.6173907", "0.6170346", "0.616111", "0.6150513", "0.6150023", "0.61446756", "0.6120429", "0.6112975", "0.6104845", "0.6102966", "0.6087884", "0.6079323", "0.60699135", "0.60602236", "0.60191786", "0.60170597", "0.60100305", "0.6009527", "0.60052776", "0.60052776", "0.600042", "0.5999317", "0.59933805", "0.5991528", "0.5991221", "0.5990094", "0.5979497", "0.5966058", "0.5958738", "0.59579456", "0.5957759", "0.5956938", "0.5951788", "0.59511644", "0.59423065", "0.59373474", "0.59361076", "0.59361076", "0.59331447", "0.5928005", "0.5924882", "0.5924011", "0.59169155", "0.5908037", "0.5907541", "0.59061426", "0.59056246", "0.5897408", "0.58960444", "0.58951247", "0.5893136", "0.5892312", "0.5890385", "0.58853275", "0.58801144", "0.58784765", "0.5872648", "0.58682626", "0.5867028", "0.58661693", "0.586578", "0.58643955", "0.5863193", "0.58609086", "0.5859997", "0.5858935", "0.5858632", "0.5853379", "0.5852741", "0.584806", "0.5847703" ]
0.0
-1
this could be optimized a tiny bit by only calling superclass.build_kiln but i am le tired
def build_kiln @build_kiln ||= begin retval = Hash.new { |hash,key| hash[key] = {} } klasses = [] klass = self while klass && klass <= UIView klasses.unshift(klass) klass = klass.superclass end klasses.each do |klass| kiln_props = klass.kiln kiln_props && kiln_props.each do |key,values| values.keys.each do |check_unique| retval.each do |section, editors| editors.delete(check_unique) end end retval[key].merge!(values) end end # clean out nil-editors and empty sections retval.each do |section, editors| editors.each do |property, editor| editors.delete(property) unless editor end retval.delete(section) if editors.length == 0 end retval end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build; end", "def build\r\n raise \"Not implemented\"\r\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 build\r\n end", "def build\r\n end", "def kid_generator; end", "def kid_generator; end", "def kid_generator; end", "def build_request\n b = builder\n build_authentication(b)\n b.instruct!\n \n b.LabelRecoveryRequest do\n b.Request do\n b.RequestAction \"LabelRecovery\"\n end\n \n b.LabelSpecification do\n b.LabelImageFormat do\n b.Code \"GIF\"\n end\n end\n \n b.Translate do\n b.LanguageCode \"eng\"\n b.DialectCode \"US\"\n b.Code \"01\"\n end\n \n b.TrackingNumber tracking_number\n end\n end", "def build!\n end", "def build=(_arg0); end", "def build\n end", "def ancestor_builder; end", "def ancestor_builder; end", "def my_buildings\n \n end", "def build\n end", "def builder; end", "def builder; end", "def builder; end", "def build(floor, overrides)\n @instance || super\n end", "def initialize\n # kosong\n end", "def build_arel(*)\n arel = super\n arel.only if self.itself_only_value === true\n build_inheritances(arel)\n arel\n end", "def private; end", "def blg; end", "def build(**)\n raise NotImplementedError\n end", "def internal; end", "def initialize\n # @all_bikes_in_van = [] \n @broken_bikes_for_garage = []\n @fixed_bikes_to_distribute = []\n end", "def build_xml(builder)\n super(builder)\n builder.ValidNetwork { |b| valid_network.build_xml(b) } if valid_network\n builder.Model { |b| model.build_xml(b) } if model\n builder.Manufacturer { |b| manufacturer.build_xml(b) } if manufacturer\n end", "def method_731(base); end", "def initialize b\n @build = b\n end", "def kid_generator=(_arg0); end", "def kid_generator=(_arg0); end", "def build(floor, overrides)\n produce_instance.tap { |i| \n apply_attributes(i, :none, floor, overrides) }\n end", "def ismn; end", "def object_nl()\n #This is a stub, used for indexing\n end", "def initialize\n\t \t# loading or not loading should be the key here.\n end", "def iseuc;\tKconv.iseuc(self) end", "def king_richard_iii; end", "def nn\n end", "def refined_super_digit(n, k)\n \nend", "def refined_super_digit(n, k)\n \nend", "def label; end", "def label; end", "def nebula; end", "def build(params); end", "def init(model, rec, pckg, baseName); @model = model; @rec = rec; @pckg = pckg; @baseName = baseName; self end", "def intensifier; end", "def refined_super_digit(n, k)\n \nend", "def build(attrs)\n # Implement #build \n end", "def method_missing(name , *args)\n return super if args.length != 0\n name = name.to_s\n return @names[name] if @names.has_key?(name)\n if name == \"message\"\n return Risc.message_reg.set_builder(self)\n end\n if name.index(\"label\")\n reg = Risc.label( @source , \"#{name}_#{object_id}\")\n @source_used = true\n else\n last_char = name[-1]\n name = name[0 ... -1]\n if last_char == \"!\" or last_char == \"?\"\n if @names.has_key?(name)\n return @names[name] if last_char == \"?\"\n raise \"Name exists (#{@names.keys})before creating it #{name}#{last_char}\"\n end\n else\n raise \"Must create (with ! or ?) before using #{name}#{last_char}\"\n end\n type = infer_type(name )\n reg = @compiler.use_reg( type.object_class.name ).set_builder(self)\n end\n @names[name] = reg\n reg\n end", "def labels; end", "def build_hidden(type, value); end", "def initialize **values\n # Just to do the type check...\n self.class.level_for! **values\n super **values\n end", "def berlioz; end", "def build_ingest_form\n super\n @form.association_class = OregonDigital::Metadata::CloneableAssociation if @cloneable\n end", "def initialize\n en_be_gp_i\n @bestiary_known_data = {}\n @bestiary_known_data[:ene] = {}\n @bestiary_known_data[:dro] = {}\n @bestiary_known_data[:ele] = {}\n @bestiary_known_data[:sta] = {}\n @bestiary_known_data[:ski] = {}\n end", "def group_builder; end", "def _zeichnen(n,kl)\n\n end", "def refined_super_digit(n, k)\n new_n = (n.to_s * k).to_i\n return super_digit(new_n) \nend", "def generate_model(ngram_count)\n raise \"#{self.class} should be subclassed\"\n ngram_count # never called, supresses unused variable warning\n end", "def formation; end", "def initialize(parent); end", "def genCurrentLayer\n end", "def lsi; end", "def under_construction\n end", "def generate\n throw \"override me before innocent kittens are hurt!\"\n end", "def kex; end", "def initialize(tinkit_class_name, user_id)#, data_field_defs = {})\n #key_field = data_field_defs[:key_field] || :id #maybe my_category?\n #parents_field = data_field_defs[:parents_field] || :parents\n @key_field = :id\n @parents_field = :parents\n @attachments_field = :attachments\n @user_data_field = :user_data\n #TODO, need to fix formatter to accept custom field ops\n joha_env = TinkitNodeFactory.env_formatter(\"couchrest\",\n tinkit_class_name,\n user_id,\n CouchDB.uri,\n CouchDB.host)\n\n #hack until formatter is fixed\n joha_env[:data_model][:field_op_set] = JohaDataDefn\n\n @tinkit_class = TinkitNodeFactory.make(joha_env)\n \n #TODO Figure out approach to deal with subsets of records\n #to handle huge data repositories\n all_joha_tinkits = @tinkit_class.all\n\n #I've given up on native tinkit class into burp for now\n all_joha_node_data = all_joha_tinkits.map{|node| node._user_data}\n \n #transforms an array of hashes to a hash with key field\n #pointing to hashed data of node\n burped_tinkits = Burp.new(all_joha_node_data, @key_field)\n\n #finds relationships between nodes\n tinkit_kins = Kinkit.new(burped_tinkits, @parents_field)\n\n @node_list = tinkit_kins\n\n @digraphs = tinkit_kins.uniq_digraphs\n #@orphans = tinkit_kins.orphans\n \n @current_digraph = nil\n #parent child relationship data #adds field :children\n joha_relationships = tinkit_kins.parent_child_maps\n @joha_data = joha_relationships\n\n joha_relationship_structure = {:id => @key_field, \n :name_key => :label,\n :children =>:children }\n\n #p full_data.methods\n\n @jsgrapher = JsivtGrapher.new(joha_relationships, joha_relationship_structure)\n end", "def initialize\n\t\t\n\tend", "def greibach_normal_form\n raise NotImplementedError\n end", "def tril(k=0)\n dup.tril!(k)\n end", "def refined_super_digit(n, k)\n\n n = n.digits.sum * k\n super_digit(n)\n\nend", "def droid; end", "def initialize_copy( other )\n\t\tsuper\n\t\tself.apply_applicable_mixins( @dn, @entry )\n\t\tself.after_initialize\n\tend", "def initialize(k=5, data=nil)\n super(data)\n \n @k = k || 5\n end", "def refined_super_digit(n, k)\n number = (n.to_s * k).to_i\n super_digit(number)\nend", "def build_up(&blk)\n klass = granularity.succ\n iter = if klass.nil?\n []\n else\n # #each calls break_down\n klass.new(start)\n end\n iter.each(&blk)\n end", "def kids_musical; end", "def initialize\n \n end", "def krr_short()\n\tputs 'KRR_short'\n\n\twidth=0.8; tau=1e-6\n# *** \tkrr=KernelRidgeRegression(tau, GaussianKernel(0, width), RegressionLabels(label_train))\n\tkrr=Modshogun::KernelRidgeRegression.new(tau, GaussianKernel(0, width), RegressionLabels(label_train))\n\t#krr.set_features(tau, GaussianKernel(0, width), RegressionLabels(label_train))\n\tkrr.train(RealFeatures(fm_train))\n\tout = Modshogun::RegressionLabels.obtain_from_generic(krr.apply(RealFeatures(fm_test)).get_labels())\n\n\treturn krr,out\n\nend", "def begingraphics(*)\n super\n end", "def initialize(building_name, building_address, owner_name) # if super is called, must pass required arguments for superclass inialization in addition to those required for subclass\n super(building_name, building_address) # must have same number of arguments as initialized in superclass\n @owner_name = owner_name\n @num_chairs = 0\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[label]\n end", "def bellini; end", "def initialize(pallet,is_repack = nil)\n @pallet = pallet\n @puc_groups = Hash.new\n build_groups \n calc_ratios if is_repack \n \n end", "def build_everything\n @defs.keys.each { |k| self[k] }\n end", "def build_tree\n index = 0\n @ignore_list.each do |attribute|\n #puts \"Attribute: #{attribute}\"\n #puts \"Result: #{@max_result_array[index]}\"\n #puts \"Count: #{@max_class_count_array[index]}\"\n\n @max_class_count_array[index].each do |label, count|\n isLeaf = false\n result = nil\n #puts \"Label: #{label}, Count: #{count}\"\n c1_count = count['<=50K.']\n c2_count = count['>50K.']\n ratio_a = c1_count.to_f / c2_count.to_f\n ratio_b = c2_count.to_f / c1_count.to_f\n #puts \"ratio_a: #{ratio_a} || ratio_b: #{ratio_b} || c1: #{c1_count} || c2: #{c2_count}\"\n if ratio_a >= 30 or ratio_b >= 30 then\n # Have a high ratio, thus we can declare a class\n if c1_count > c2_count\n # declare class 1\n #puts \"Ratio is HIGH, #{ratio_a}, declare any #{attribute} with a #{label} to be class <=50K.\"\n isLeaf = true\n result = '<=50k'\n else\n #puts \"Ratio B is HIGH, #{ratio_b}, declare any #{attribute} with a #{label} to be class >50K.\"\n isLeaf = true\n result = '>50k'\n end\n else\n #puts \"Ratio is too LOW for #{attribute} with label #{label}.\"\n end\n\n if index == 0 then parent = nil else parent = @ignore_list[index-1] end\n\n if isLeaf then\n @tree[label] = Hash['attribute' => attribute, 'label' => label, 'isLeaf' => isLeaf, 'result' => result, 'child' => nil, 'parent' => parent]\n else\n @tree[label] = Hash['attribute' => attribute, 'label' => label, 'isLeaf' => isLeaf, 'result' => result, 'child' => @ignore_list[index+1], 'parent' => parent]\n end\n\n end\n index += 1\n end\n\n @tree.each { |node| puts node }\n end", "def manufacture; end", "def refined_super_digit(n, k)\n n = (n.to_s * k).to_i\n super_digit(n)\nend", "def initialize() end", "def membergroups_koolkid_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/parent-group-title/\").innerText(\"/Kool Kid Crusade/\"), __method__)\n end", "def build(*args)\n raise \"Method 'build' not implemented for #{self.class.name}\"\n end", "def refined_super_digit(n, k)\n super_digit(n*k)\nend", "def refined_super_digit(n, k)\n return super_digit((n.to_s * k).to_i)\nend", "def build_singleton0(type_name); end", "def build_xml(builder)\n super(builder)\n object_data.each do |d|\n builder.Attribute do |b|\n d.build_xml(b)\n end\n end\n builder.DefaultUnitType { |b| default_eng_unit_type.build_xml(b) }\n end", "def init; end", "def init; end", "def init; end", "def init; end" ]
[ "0.574302", "0.5575132", "0.55477244", "0.5443314", "0.5443314", "0.54090065", "0.54090065", "0.54090065", "0.540197", "0.53540945", "0.5332637", "0.53148705", "0.5303159", "0.5303159", "0.5293818", "0.52841735", "0.5257594", "0.5257594", "0.5257594", "0.523665", "0.5226283", "0.5200276", "0.51759756", "0.51683426", "0.5161348", "0.5130459", "0.5129996", "0.51286054", "0.5114284", "0.51123756", "0.5098701", "0.5098701", "0.5067602", "0.50647444", "0.50642383", "0.5056664", "0.50535893", "0.5047531", "0.5045908", "0.50364935", "0.50364935", "0.5033187", "0.5033187", "0.5028303", "0.50265193", "0.50186634", "0.50169456", "0.5000967", "0.4997082", "0.49759433", "0.49743566", "0.49727637", "0.4955857", "0.4935049", "0.49240157", "0.4920352", "0.4897051", "0.48966795", "0.4889861", "0.48896495", "0.4878009", "0.48765507", "0.4871902", "0.48711956", "0.4863205", "0.48612085", "0.485997", "0.48583958", "0.4848911", "0.48457035", "0.48421553", "0.4833517", "0.48286173", "0.48278707", "0.48267913", "0.48227316", "0.48195556", "0.48195365", "0.48114613", "0.48081243", "0.4806324", "0.48046306", "0.47976345", "0.4784156", "0.47820273", "0.4771598", "0.47698677", "0.47595432", "0.47575077", "0.4755312", "0.47549987", "0.4754726", "0.47503304", "0.4745902", "0.47451591", "0.4745083", "0.47444972", "0.47444972", "0.47444972", "0.47444972" ]
0.68418276
0
factory method to create game instances for testing
def make_game(board=nil) # create a game and connect it to two DummyPlayerInterfaces g = Game.new(DummyPlayerInterface.new, DummyPlayerInterface.new) # initialize the game's board to the given state board ||= boards[:empty] (0..2).each do |y| (0..2).each do |x| g.set_cell(x, y, board[y][x]) if board[y][x] =~ /[XO]/ end end # keep the tests tidy by suppressing output to the terminal g.send_output_to_terminal = false return g end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_game\n player1 = @players[0]\n player2 = @players[1]\n @game = Game.new(player1, player2, best_of, rules)\n game.play\n end", "def generate_new_game\n Game.new(Array.new(10, 'X'), 0, rand())\nend", "def start_new_game\n x = create_player_x\n o = create_player_o\n \n @game = Game.start_game(x, o)\n end", "def new # the input\n @game = Game.new\n @game.new_game\n end", "def new_game \n Game.new.play_game\n end", "def init\n\t\t@state = NewGame.new(self)\n\t\t# Deck.create({:game => self})\n\tend", "def run\n game = Game.new\n game.game_start\nend", "def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend", "def player\n player1 = Player.new('luke')\n player2 = Player.new('sam')\n game = Game.new(player1,player2)\n end", "def test_init_game()\n # Test Game has Track\n assert_equal(true, @game.track().is_a?(Track))\n # Test Game has 2 players\n assert_equal(2, @game.get_num_players())\n # Test game has 1 die\n assert_equal(true, @game.dice().is_a?(Dice))\n # Test game has selected first player to play\n assert_equal(true, @game.first_player().is_a?(Player))\n # Test game has current player\n assert_equal(true, @game.current_player().is_a?(Player))\nend", "def create_game(window, game_over_callable, *players)\n\t\tplay_state = PlayState.new(game_over_callable)\n\n\t\t@pos_idx = 0\n\n\t\tcreate_player_entities(play_state, players)\n\t\tassign_z_values(players)\n\n\t\tplay_state.width = BOARD_WIDTH\n\t\tplay_state.height = BOARD_HEIGHT \n\n\t\tplay_state.window = window\n\n\t\tplay_state.controller = @controller_factory.create_controller(*players)\n\t\tplay_state.judge = Judge.new(*players)\n\n\t\tplay_state\n\tend", "def initialize\n @game = Game.new\n @machine = Machine.new(game)\n end", "def new\n \t@admingame = Game.new\n end", "def create_game_objects\n rm_extender_create_game_objects\n $game_self_vars = Hash.new\n $game_labels = Hash.new\n $game_self_labels = Hash.new\n end", "def create_game(num_players)\n # - Ask the user for who should go first and be \"X\". [√]\n # - Use the input to correctly initialize a Game with [√]\n # the appropriate player types and token values. \n \n human_X = Players::Human.new(\"X\")\n human_O = Players::Human.new(\"O\")\n computer_X = Players::Computer.new(\"X\")\n computer_O = Players::Computer.new(\"O\")\n\n case num_players\n when 0\n Game.new(computer_X, computer_O)\n when 1\n puts \"Who will go first? (ME or CPU)\"\n first_player = gets.chomp\n \n case first_player.downcase\n \n when \"me\"\n Game.new(human_X, computer_O)\n \n when \"cpu\"\n Game.new(computer_X, human_O)\n end\n when 2\n Game.new\n when 100\n 99.times{ Game.new(computer_X, computer_O).start}\n Game.new(computer_X, computer_O)\n end\n end", "def start_game\n Board.new 10, 10\n end", "def test_create_rectangle\n game=GameOfLife.new(4,6)\n measure_universe game.state,4,6\n\n game.populate(7,5)\n measure_universe game.state,7,5\n end", "def new_game(game)\n @game = game\n\t@p1 = game.getP1\n\t@p2 = game.getP2\n\t@flag = game.getFlag\n\t@map = @game.get_map\n\tupdate_background\n\tdraw_all_objects\n end", "def start_game(game_config)\n # start a new game\nend", "def new\n @game = Game.new\n end", "def new\n @game = Game.new\n end", "def startNewGame ()\n #could have you enter your name\n newGame = Beyond_the_vale.new #this calls the new game class, whose init method calls the first card\nend", "def create_new_game\n create_new_party\n $pokemon_party.expand_global_var\n $trainer.redefine_var\n $scene = Scene_Map.new\n Yuki::TJN.force_update_tone\n @running = false\n end", "def game_setup\n end", "def initialize\n @game = Board.new\n end", "def main\n rounds = Game.start\n game = Game.new(rounds)\n roshambo = Roshambo.new(game)\n Roshambo.play(roshambo)\nend", "def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end", "def new_game\n\t\tclear\n\t\tget_username\n\t\tselect_level\n\t\tget_deck\n\t\tshuffle\n\t\tget_hand\n\t\tcontinue_game\n\tend", "def start_game\n start_game_with create_pair(:person)\n end", "def initialize_game\n setup_boards\n end", "def create_instance_core() \r\n @log.debug(\"Create core scopetta\")\r\n return CoreGameScopetta.new\r\n end", "def initialize(game, player = nil)\n @game = game\n @player = player\n end", "def init(name, difficulty)\n case difficulty\n when 'easy'\n health = 100\n hunger = 100\n sanity = 100\n when 'medium'\n health = 50\n hunger = 50\n sanity = 50\n when 'hard'\n health = 25\n hunger = 25\n sanity = 25\n when 'arm fighter'\n health = 1\n hunger = 2\n sanity = 3\n end\n player = Player.new(name, health, hunger, sanity)\n game(player)\nend", "def test_class_test\n players = [\"player1\", \"player2\", \"player3\"]\n team = Team.new(\"Scotland\", players, \"Alex Ferguson\")\nend", "def set_game_instance\n @game_instance = GameInstance.find(params[:id])\n end", "def check_game\n self.game ||= begin\n #TODO get player from last game\n # TODO write test where \"Player 3\" already exits\n player = Player.find_or_create_by(:name => \"Player #{self.slot}\")\n Game.create!(:player => player, :slot => self.slot)\n end\n end", "def instantiate!; end", "def create_game(user1, game_id, players, type)\n game_factory = ConnectGameFactory.new(players.to_i, type.to_sym)\n @game_list[game_id] = GameInfo.new(game_factory.connect_game, game_factory.game_state, nil, user1, nil)\n ''\n end", "def initiate_game(user)\n $game_session = GameSession.create(\n user_id: user.id,\n total_score: 0,\n fifty_fifty: 1,\n phone_a_friend: 1\n )\nend", "def initialize\n @loot = createLoot\n @suppliesPackage = createSuppliesPackage\n @weapon = createWeapon\n @shieldBooster = createShieldBooster\n @dice = Dice.new\n @hangar = createHangar\n @damageNumeric = createDamageNumeric\n @damageSpecific = createDamageSpecific\n @enemyStarShip = createEnemyStarShip\n @spaceStation = createSpaceStation\n @spaceCity = createSpaceCity\n @betaPowerEfficient = createBetaPowerEfficient\n @powerEfficient = createPowerEfficient\n @gameUniverse = GameUniverse.new\n end", "def commandnewgame_gamedata\r\n # Reset frame count for measuring play time\r\n Graphics.frame_count = 0\r\n # Make each type of game object\r\n $game_temp = Game_Temp.new\r\n $game_system = Game_System.new\r\n $game_switches = Game_Switches.new\r\n $game_variables = Game_Variables.new\r\n $game_self_switches = Game_SelfSwitches.new\r\n $game_screen = Game_Screen.new\r\n $game_actors = Game_Actors.new\r\n $game_party = Game_Party.new\r\n $game_troop = Game_Troop.new\r\n $game_map = Game_Map.new\r\n $game_player = Game_Player.new\r\n end", "def initialize(name1)\r\n @player1=Player1.new(name1)\r\n @grid=Grid.new()\r\n @grid.pretty_print\r\n puts \"\\nYour game is ready!!!\\n\\n\"\r\n game \r\nend", "def initialize(config, game)\n @config = config\n @game = game\n auto_test_esp = \"#{@game.path}/Data/AutoTest.esp\"\n # Ordered list of available in-game test suites\n # Array<Symbol>\n @available_tests_suites =\n if File.exist?(auto_test_esp)\n Base64.decode64(\n ElderScrollsPlugin.new(auto_test_esp).\n to_json[:sub_chunks].\n find { |chunk| chunk[:decoded_header][:label] == 'QUST' }[:sub_chunks].\n find do |chunk|\n chunk[:sub_chunks].any? { |sub_chunk| sub_chunk[:name] == 'EDID' && sub_chunk[:data] =~ /AutoTest_ScriptsQuest/ }\n end[:sub_chunks].\n find { |chunk| chunk[:name] == 'VMAD' }[:data]\n ).scan(/AutoTest_Suite_(\\w+)/).flatten.map { |tests_suite| tests_suite.downcase.to_sym }\n else\n log \"[ In-game testing #{@game.name} ] - Missing file #{auto_test_esp}. In-game tests will be disabled. Please install the AutoTest mod.\"\n []\n end\n log \"[ In-game testing #{@game.name} ] - #{@available_tests_suites.size} available in-game tests suites: #{@available_tests_suites.join(', ')}\"\n end", "def initialize()\n original_dir = Dir.pwd\n Dir.chdir(__dir__)\n\n classes_before = ObjectSpace.each_object(Class).to_a\n Dir[\"../model/game/*\"].each {|file|\n require_relative file\n }\n Dir.chdir(original_dir)\n\n classes_after = ObjectSpace.each_object(Class).to_a\n @modes_loaded = classes_after - classes_before\n\n @game_started = false\n @observer_views = []\n @players = []\n @clients_players = Hash.new\n @board = nil\n @clients_board = nil\n @player_playing = nil\n @clients_player_playing_index = nil\n @AI_players = 0\n # http://docs.ruby-lang.org/en/2.0.0/Hash.html\n @game_history = Hash.new(-1)\n @turn = 1\n @online_mode = false\n @player_name = nil\n @player_id = 1\n @save_requests_received = Hash.new(0)\n @turn_which_save_was_requested = -1\n @continuing_game = false\n end", "def define(game_mode:, difficulty:, order_to_attack:)\n if order_to_attack.negative? || order_to_attack > 1\n raise ArgumentError, '0 is first, 1 is second'\n end\n\n @board = Board.new(board_size: 3)\n @stat = GameState.new(order_to_attack)\n @order_to_attack = order_to_attack\n @difficulty = difficulty\n @judge = GameRule.new(game_board: @board.board)\n @game_mode = game_mode\n create_game_with_game_mode(game_mode)\nend", "def start_game\n p \"What's your name, player one?\"\n input = gets.chomp.to_s\n me = HumanPlayer.new(input)\n comp = ComputerPlayer.new('Jessica')\n new_game = Game.new(me, comp)\n new_game.play\nend", "def create_player_o\n p = Player.new()\n p.title = \"application\"\n p.session_string = \"application\"\n \n return p \n end", "def setup_game(guess_total, pegs, user)\n new_screen\n @game_board = GameBoard.new(guess_total, pegs)\n @code_maker = CodeMaker.new(pegs, user)\n @game_board.secret_code = @code_maker.maker_code\n @code_breaker = user == 'human' ? Human.new(pegs) : Computer.new(pegs)\n end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def instantiate( game )\n t = RBA::Trans::new_u( RBA::Point::new_xy( @x*1000, @y*1000 ) )\n inst = RBA::CellInstArray::new_inst( @cell_index, t )\n game.topcell.insert( inst )\n end", "def initialize( game, type, x, y )\n @game, @type, @x, @y = game, type, x, y\n end", "def players_factory(player1, player2, player1_marker_x=true)\n players = []\n\n\t# Cases of initializing the players\n\tif player1_marker_x\n\n\t\t# Case 1\n\t\tif player1 == \"human\"\n\t\t\tplayers << Player.new(\"X\", \"Player1\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"X\", \"Player1\", true)\n\t\tend\n\n\t\tif player2 == \"human\"\n\t\t\tplayers << Player.new(\"O\", \"Player2\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"O\", \"Player2\", true)\n\t\tend\n\n\telse\n\t\t# Case2\n\t\tif player1 == \"human\"\n\t\t\tplayers << Player.new(\"O\", \"Player1\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"O\", \"Player1\", true)\n\t\tend\n\n\t\tif player2 == \"human\"\n\t\t\tplayers << Player.new(\"X\", \"Player2\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"X\", \"Player2\", true)\n\t\tend\n\tend\n\n\tplayers\nend", "def new_game\n @board = Board.new\n player_select\n turn\n play_again\n end", "def initialize(options = {})\n options = default_options.merge(options)\n require_keys!(options, [:engine_path, :movetime])\n @movetime = options[:movetime]\n\n set_debug(options)\n reset_board!\n set_startpos!\n\n check_engine(options)\n set_engine_name(options)\n open_engine_connection(options[:engine_path])\n set_engine_options(options[:options]) if !options[:options].nil?\n new_game!\n end", "def initialize_player\n\n Player.new\n\nend", "def test_creates_a_new_guess\n card = Card.new(question: \"What is the capital of Alaska?\", answer: \"Juneau\")\n guess = Guess.new(\"Juneau\", card)\n assert_instance_of(guess)\n end", "def start_game(players, type)\n game_factory = ConnectGameFactory.new(players.to_i, type)\n\n GameView.new(game_factory.connect_game, game_factory.game_state) unless $DEBUG\n\n CommandView.new(game_factory) if $DEBUG\n end", "def initialize( generator = Generators::Universe::Basic, options = { :universe => { :size => 32 } } )\n\t\t\n\t\t@generator = generator\n\t\t@options = options\n\t\t@players = []\n\t\t@runner = create_simulation\n\t\t@instance = Instance.new\n\tend", "def setup_game\n begin\n @game = @cache.fetch(@key, expires_in: 24.hours) do\n get_random_user_list \n get_prizes\n set_prizes\n end\n rescue => e\n puts \"e: #{e.inspect}\"\n @failed = true\n end \n end", "def create_game type\n @game = Game.create(user_id:@user.id, game_type:type)\n new_deck_for @game.id \n end", "def test_for_guess_instance\n card = Card.new(\"10\", \"Hearts\")\n guess = Guess.new(\"10 of Hearts\", card)\n\n\n assert_instance_of Guess, guess\n end", "def start(every_player, width, height)\n Board.new(every_player, width, height)\nend", "def initialize_current_gfx(nome_game)\n @log.debug \"**** bot: initialize current gfx #{nome_game}\"\n #p self.app_settings\n select_engine(nome_game)\n #@current_game_gfx = eval(@game_to_play[:class_name]).new()\n # override @game_bot_name only to use a test robot. For a game GameBasebot is enought\n # simply add the new game to @all_games_bots\n \n @current_game_gfx = eval( @game_bot_name ).new #GameBasebot.new\n @current_game_gfx.set_game_info(@game_to_play[:core_name],\n @game_to_play[:alg_name], @game_to_play[:key],\n @game_to_play[:nalgfx_name],\n @login_name)\n @current_game_gfx.net_controller = @control_net_conn\n @current_game_gfx.join_game = @join_game\n #p self.app_settings\n end", "def build_game_instance\n @roulette_wheel = (0..36).to_a # Establishes array of possible numbers\n @roulette_wheel.push(\"00\") # Adds 00\n @roulette_wheel.each_with_index do |number,index|\n @roulette_wheel[index] = number.to_s # converts each number to a string\n end\n\n @bet_options = [\"Any Single Number\",\"00\",\"red\",\"black\",\"odd\",\"even\",\"1-18\",\n \"19-36\",\"1-12\",\"13-24\",\"25-36\"]\n\n # Combines all options into one array, and flattens this array \n @bet_options.push((0..36).to_a)\n @bet_options.flatten!\n \n # Makes sure everything is a string\n @bet_options.each_with_index do |number,index|\n @bet_options[index] = number.to_s\n end\n \n # Builds arrays for red and black colors on the roulette table\n @red = [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36]\n @black = [2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,32,33,35]\n end", "def setup_game\n name_player = set_name_player\n number_columns = set_number_columns\n number_rabbits = set_number_rabbits(number_columns)\n number_foxs = set_number_foxs(number_columns)\n\n board = build_board(number_columns)\n rabbit_collection = build_rabbit_collection(number_columns, number_rabbits)\n fox_collection = build_fox_collection(number_columns, number_foxs)\n\n\n [ board, name_player, number_columns, rabbit_collection, fox_collection ]\nend", "def initialize\n @mode = game_set_mode\n @turn_obj = Turn.new\n @solution_obj = Solution.new\n @human_solution_obj = HumanSolution.new\n @computer_solve_obj = ComputerSolver.new\n end", "def initialize(game, x, y, state)\n @game = game\n @x = x\n @y = y\n @living = state\n end", "def init_bots\r\n p1 = Player.new(\"José\")\r\n p2 = Player.new(\"Josiane\")\r\nend", "def game_starter\n if path == \"/start_game\"\n @game = Game.new\n end\n end", "def init_opponent\n Opponent.new(connect_game, game_state)\n end", "def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end", "def initialize(config, game_info)\n @config = config\n # Set default values here\n @game_info = {\n 'min_launch_time_secs' => 10,\n 'tests_poll_secs' => 5,\n 'timeout_frozen_tests_secs' => 300,\n 'timeout_interrupt_tests_secs' => 10\n }.merge(game_info)\n @name = name\n @pid = nil\n init if respond_to?(:init)\n end", "def load_icu_players\n @icu_players_cache ||= YAML.load(File.read(File.expand_path('../factories/icu_players.yml', __FILE__)))\n @icu_players_cache.inject({}) do |h, (id, data)|\n h[id] = FactoryGirl.create(:icu_player, data.merge(id: id))\n h\n end\nend", "def initialize(config, game)\n @config = config\n @game = game\n # Parse tests suites\n @tests_suites = Dir.glob(\"#{__dir__}/tests_suites/*.rb\").map do |tests_suite_file|\n tests_suite = File.basename(tests_suite_file, '.rb').to_sym\n require \"#{__dir__}/tests_suites/#{tests_suite}.rb\"\n [\n tests_suite,\n TestsSuites.const_get(tests_suite.to_s.split('_').collect(&:capitalize).join.to_sym).new(tests_suite, @game)\n ]\n end.to_h\n @tests_info_file = \"#{@game.path}/Data/Modsvaskr/Tests/TestsInfo.json\"\n end", "def create_game\n if game.nil? || game.concluded?\n p = playerships.build(:owner => true)\n p.game = Game.new(:name => \"#{login}'s Game\")\n \n p.save && self.game(true) # load the new game\n else\n false\n end\n end", "def new_game\n @players = [@p1, @p2]\n\n round_gameplay\n until self.winner?\n next_round\n end\n\n end", "def set_game\n if Game.where(id: params[:id]).exists?\n @game = Game.find(params[:id])\n else\n @game = Game.new\n end\n end", "def create_players\n\t\t\t\tnum_players.times do |i|\n\t\t\t\t\tplayer_class = Merlion::Player\n\t\t\t\t\tself.players[i] = create_player({ seat: i, class: player_class })\n\t\t\t\tend\n\t\t\tend", "def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end", "def game_init\r\n state(0)\r\n @game_deck.create_new_deck\r\n @player_deck = {}\r\n @dealer_deck = {}\r\n @player.points = 0\r\n @dealer.points = 0\r\n end", "def initStrategy\n if @game == GAME_C4 \n @strategy = C4Strategy.new self\n elsif @game == GAME_OTTO\n @strategy = OttoStrategy.new self\n end\n end", "def start\n # start a new game using @config\n end", "def initialize(game) \n @game= game\n @items=[]\n fill_items([])\n end", "def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end", "def create_new_player\n @player = Player.new(self, nil, ServerConfig.start_room, @new_name, [], \"a typical person\", \"This is a normal, everyday kind of person.\", \"person\", @sex)\n @player.word_wrap = nil\n\n # TODO remove following lines\n require 'aethyr/extensions/objects/clothing_items' #why not\n require 'aethyr/extensions/objects/sword'\n shirt = Shirt.new\n pants = Pants.new\n undies = Underwear.new\n sword = Sword.new\n\n $manager.add_object(shirt)\n $manager.add_object(undies)\n $manager.add_object(pants)\n $manager.add_object(sword)\n\n @player.inventory << shirt\n @player.inventory << pants\n @player.inventory << undies\n @player.inventory << sword\n\n @player.wear(undies)\n @player.wear(pants)\n @player.wear(shirt)\n\n if @player.name.downcase == ServerConfig.admin.downcase\n @player.instance_variable_set(:@admin, true)\n end\n\n $manager.add_player(@player, @new_password)\n\n File.open(\"logs/player.log\", \"a\") { |f| f.puts \"#{Time.now} - #{@player.name} logged in.\" }\n\n @state = nil\n\n output(\"Type HELP HELP for help.\")\n end", "def create_players\n players = []\n players << create_player('player_1')\n players << create_player('player_2')\n players\n end", "def new_game(dictionary)\n\t\t@dictionary = dictionary\n\t\t@frequency_hash = frequency_hash\n\t\t@vowels = vowels\n\t\t@letters = letters\n end", "def create #players are in an array\n @players = [\n Player.new('Contestant 1')\n Player.new('Contestant 2')\n ]\n end", "def test_partial_game_1\n \t@game = Bowling::Game.new '10,10'\n \tassert_equal(30, @game.scores)\n end", "def create\n game = Game.new(game_attributes)\n if game.save\n game.randomize_list(10)\n flash[:notice] = \"Let's get started!\"\n redirect_to edit_game_url(game)\n else\n render :new, error: \"failed to start the game\"\n end\n end", "def create\n p = game_params\n\n home_team_name = p.delete(:home_team_name)\n away_team_name = p.delete(:away_team_name)\n p[:home_team_id] = find_or_create_team(home_team_name).try(:id)\n p[:away_team_id] = find_or_create_team(away_team_name).try(:id)\n\n @game = Game.new(p)\n @game.user = current_user\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new, notice: 'Game was successfully created.' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_object\n sut.send(:new)\n end", "def create_game\n if can_create_game?\n new_game = Game.create(state: \"lobby\")\n Player.create(user: self, game: new_game, role: \"player\", host: true)\n return new_game\n else\n return false\n end\n end", "def initialize\n puts 'Welcome to the Casino'.colorize(:blue)\n @player = Player.new #seeing new here so it means its going to the class listed and runs the initi method\n puts \"what game do you want to play #{player.name}?\"\n #show a casino game menu\n #let the player choose a game\n # initialize the new game, passing the player as a parameter\n end" ]
[ "0.720984", "0.7127582", "0.67822444", "0.6775214", "0.674209", "0.6692038", "0.6667009", "0.65911585", "0.6582407", "0.6580021", "0.6536516", "0.6522807", "0.64648324", "0.6392518", "0.63782775", "0.63707006", "0.6350667", "0.63463604", "0.6343919", "0.63395053", "0.63395053", "0.626905", "0.6238622", "0.62336797", "0.62200224", "0.6205928", "0.61831594", "0.61805815", "0.6148126", "0.61387783", "0.61370903", "0.6135736", "0.61247367", "0.61121756", "0.60968834", "0.6073752", "0.60687286", "0.6064492", "0.6034387", "0.6023913", "0.6014171", "0.6013455", "0.5986663", "0.59849226", "0.5983384", "0.5980844", "0.59626645", "0.59619296", "0.59462374", "0.59462374", "0.5946164", "0.5946164", "0.5946164", "0.5946164", "0.5946164", "0.5944713", "0.59276795", "0.59242153", "0.59073114", "0.590647", "0.59027845", "0.59002244", "0.5884324", "0.5879113", "0.58740723", "0.5874041", "0.5873339", "0.5873212", "0.58525395", "0.58436555", "0.58361083", "0.58337665", "0.583228", "0.58231246", "0.5817076", "0.58160913", "0.5812598", "0.5811127", "0.580511", "0.5802796", "0.58019906", "0.5799411", "0.57962006", "0.5787299", "0.5783647", "0.57797384", "0.5779322", "0.57651436", "0.57553065", "0.57469726", "0.5739021", "0.57309884", "0.57306457", "0.57303905", "0.572566", "0.572328", "0.57228124", "0.5720772", "0.5713832", "0.56995875" ]
0.70379865
2
helper: run a block and ignore any errors it raises
def suppress_errors begin yield rescue end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore &block\n begin; block.call; rescue; end\n end", "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end", "def regardless(&block)\n yield\nrescue\nend", "def may_fail # block\n begin\n yield\n rescue\n end\nend", "def run_with_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend", "def __run_block\n # This may not catch concurrent calls (unless surrounded by a mutex), but\n # it's not worth trying to protect against that. It's enough to just check for\n # multiple non-concurrent calls.\n ::Kernel.raise Error, \"Cannot run async block multiple times\" unless block = @block\n\n @block = nil\n\n begin\n block.call\n rescue ::Exception => e\n WrappedException.new(e)\n end\n end", "def execute_and_rescue\n begin\n yield if block_given?\n rescue SystemExit\n end\nend", "def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end", "def one\n too { yield }\nendbegin;1;rescue => e1;e1;end", "def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end", "def _perform(&block)\n\n begin\n\n r = validate\n return r unless r.success?\n\n yield if block_given?\n\n mark_contract_event_as_processed\n\n success\n\n rescue StandardError => se\n\n mark_contract_event_as_failed\n\n return exception_with_data(\n se,\n 'cem_b_1',\n 'exception in contract event management: ' + se.message,\n 'Something went wrong.',\n GlobalConstant::ErrorAction.default,\n {contract_event_obj_id: @contract_event_obj.id}\n )\n\n end\n\n end", "def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end", "def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end", "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprocess_snippet_error(e)\n\t\t\t\n\t\t\tunload(kill:true)\n\t\t\t# ^ stop further execution of the bound @wrapped_object\n\t\tend\n\tend", "def never_raise_yield\n yield\n rescue Exception => e\n Thread.main.raise(e) if !!$DEBUG\n end", "def ignore_raise\n yield\nrescue StandardError\n :raised\nend", "def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend", "def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend", "def execute_with_rescue\n yield if block_given?\n rescue Interrupt\n rescue_interrupt\n rescue => error\n log_error(error)\n end", "def execute_with_rescue(&block)\n begin\n yield block\n rescue Flickr::Error => ex\n self.error_messages ||= []\n self.error_messages << {:date => Time.now, :msg => ex.message}\n if ex.message.match(/(User not found|Invalid auth token)/)\n self.status = 'inactive'\n end\n self.save\n return\n end\n end", "def ensure(&block)\n raise \"catch or each must be called before ensure\" unless @used\n block.call\n raise_if_failures\n end", "def run_and_raise_on_failure\n # TODO ?\n end", "def for_broke(ci)\n begin\n ci.run\n\n rescue HaltState\n # nop\n rescue err\n puts err.message\n puts 'should not have got this'\n end\nend", "def call_block(block,stdout,stderr,exitstatus)\n # blocks that take no arguments have arity -1. Or 0. Ugh.\n if block.arity > 0\n case block.arity\n when 1 \n block.call(stdout)\n when 2\n block.call(stdout,stderr)\n else\n # Let it fail for lambdas\n block.call(stdout,stderr,exitstatus)\n end\n else\n block.call\n end\n end", "def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend", "def run_action(&_block)\n yield\n rescue ::Zanzibar::Error => e\n @ui.error e\n abort \"Fatal error: #{e.message}\"\n end", "def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend", "def safe_call(&block)\n begin\n block.call\n rescue NoMethodError => e\n nil\n end\n end", "def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = true\n raise e\n rescue => e\n @failed = true\n logger.trace(\"Plugin #{name} threw #{e.inspect}\")\n e.backtrace.each { |line| logger.trace( line ) }\n end", "def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end", "def run_and_convert_exceptions(&block)\n block.call\n rescue *self.class.expected_errors => e\n raise self.class.horza_error_from_orm_error(e.class).new(e.message)\n end", "def error(&block)\n @runner.set_error(@current_platform, block)\n end", "def on_bad_exit(&block)\n @bad_exit_block = block\n end", "def raises_upon_errored_playbook\n expect(Ansible::Runner).to receive(:run).and_return(response_bad)\n expect { yield }.to raise_error(MiqException::Error)\nend", "def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend", "def execute(&block)\n executed = locksmith.execute(&block)\n\n reflect(:execution_failed, item) unless executed\n end", "def run_nonblock(&block)\n @timeout = 0\n run &block\n end", "def crawl_block(block, site)\n block.call(site)\n rescue Capybara::Poltergeist::BrowserError, Capybara::Poltergeist::DeadClient,\n Capybara::Poltergeist::JavascriptError, Capybara::Poltergeist::StatusFailError,\n Capybara::Poltergeist::TimeoutError, Errno::ECONNRESET, URI::InvalidURIError => e\n site.unavailable_page(404, e)\n end", "def safely\n yield\n rescue Exception\n nil\n end", "def block?; end", "def assert\n\traise \"Error! Error!\" unless yield\nend", "def on_error(&block)\n @@error_block = block\n end", "def __execute__\n @result = @block[*@args]\n rescue Exception => e\n @result = e\n ensure\n # Prevent multiple executions\n def self.__execute__; nil; end\n end", "def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end", "def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end", "def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end", "def assert\n raise \"Found an error!\" unless yield\nend", "def run(&block)\n end", "def __force__\n @mutex.synchronize do\n if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n begin\n @result = @block.call\n rescue ::Exception => e\n @error = e\n end\n end\n end if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n # BasicObject won't send raise to Kernel\n @error.equal?(NOT_SET) ? @result : ::Kernel.raise(@error)\n end", "def errback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def raise_if_block(obj, name, has_block, type)\n return unless has_block\n\n puts \"Type passed in: #{type}\"\n puts \"#{obj.class}##{name} does not accept blocks\"\n\n raise Appom::UnsupportedBlockError\n end", "def run\n catch(:skip) { call }\n finish!\n rescue => e\n fail!\n raise e\n end", "def run\n return yield if turned_off?\n\n with_connection do\n if open?\n callback&.call CircuitOpen.new\n raise CircuitOpen\n end\n\n begin\n result = yield\n rescue Exception => error\n if exceptions.any? { |watched| error.is_a?(watched) }\n increment_counter!\n callback&.call error\n else\n reset_counter!\n end\n\n raise error\n end\n\n reset_counter!\n result\n end\n ensure\n reset_record\n end", "def run\n run!\n rescue Failure => e\n if context.object_id != e.context.object_id\n raise\n end\n end", "def refute_exception\n yield\n rescue StandardError => e\n flunk e.message\n end", "def test_check_bad_block\n assert_raises SystemExit do\n assert_output \"Line 1: Invalid block, missing or extra element(s)\\nBLOCKCHAIN INVALID\" do\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d', '']\n line_num = 1\n @verify.check_block(line, line_num)\n end\n end\n end", "def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end", "def abort_on_exception=(*) end", "def refute_nothing_raised(msg=nil, &block)\n RescueAssay.assert!(Exception, :message=>msg, :backtrace=>caller, &block)\n end", "def assert\n raise \"Alert Fail!\" unless yield\nend", "def try &bk\n yield\n rescue Exception => ex\n ex\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def call_explicit_block(&block)\n # block.call another wat of saying yield\n return \"There's no block\" unless block_given?\n yield\n # block.call\nend", "def safe_call# (&block)\n yield\n rescue Sunra::Utils::Recording::DBProxy::DBProxyError,\n Sunra::Recording::RecorderManager::RecorderError,\n APIError => e\n _error e\n end", "def run(&block); end", "def assert \n raise \"Error! your code sucks!\" unless yield\nend", "def require_block(block_given)\n raise ArgumentError, \"Must provide a block\" unless block_given\n end", "def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end", "def safe_loop &block\n begin\n loop &block\n rescue => ex\n $log.debug( \"APP.rb rescue reached \")\n $log.debug( ex) if ex\n $log.debug(ex.backtrace.join(\"\\n\")) if ex\n ensure\n close\n # putting it here allows it to be printed on screen, otherwise it was not showing at all.\n if ex\n puts \"========== EXCEPTION ==========\"\n p ex \n puts \"===============================\"\n puts(ex.backtrace.join(\"\\n\")) \n end\n end\n end", "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# switch states first, in case extra messages need to be printed to contexualize the actual exception\n\t\t\tself.runtime_error()\n\t\t\t\n\t\t\t\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprint_wrapped_error(e)\n\t\t\t\n\t\t\t\n\t\tend\n\tend", "def state_run_block(channel)\n debug :run_block\n channel[:state] = nil\n blk = channel[:block]\n channel[:block] = nil\n begin\n instance_eval &blk\n rescue => ex\n channel[:exception] = ex\n end\n channel[:state] = :exit\n end", "def run_block_proc\n yield\nend", "def f\n # This calls the block:\n yield == 2 or raise\n yield == 2 or raise\n end", "def _catch_warden(&block); end", "def warning(&block)\n begin\n update_status(:warning) if instance_eval(&block)\n rescue Exception\n update_status(:warning)\n end\n end", "def run_block\n yield\nend", "def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Opbeat errors\n rescue Exception => e\n self.captureException(e)\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n self.capture_exception($!)\n end\n end\n end\n end" ]
[ "0.731524", "0.7236683", "0.71931976", "0.7156799", "0.70394874", "0.6993102", "0.69054455", "0.6795646", "0.67560405", "0.667052", "0.66597193", "0.66359603", "0.6604494", "0.6596517", "0.6593758", "0.65557575", "0.6550964", "0.6534305", "0.6511649", "0.650602", "0.64880806", "0.6429428", "0.63450575", "0.633231", "0.63076615", "0.6287443", "0.6255595", "0.62497103", "0.62463963", "0.6246343", "0.62264717", "0.6220741", "0.6214537", "0.6212337", "0.620418", "0.6201873", "0.61886644", "0.61728495", "0.616458", "0.61605364", "0.61600065", "0.61081386", "0.61037236", "0.60958576", "0.60919464", "0.608392", "0.6082014", "0.60699636", "0.6059222", "0.6055344", "0.60528207", "0.60528207", "0.60528207", "0.603618", "0.60358965", "0.60349303", "0.60302526", "0.60264957", "0.60247713", "0.6021013", "0.6016951", "0.60164917", "0.60074353", "0.6004077", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60034597", "0.60007083", "0.5991759", "0.5980078", "0.59769154", "0.59687793", "0.5963559", "0.59577936", "0.5954652", "0.59529847", "0.59491026", "0.59466887", "0.59434295", "0.5942991", "0.5937153", "0.59266704", "0.592461" ]
0.65282816
18
GET /companies GET /companies.json
def index @companies = Company.search(params[:search]) @companies = @companies.where(suscription: params[:suscription]) if params[:suscription] && %w[0 1].include?(params[:suscription]) @companies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n respond_to do |format|\n format.html {}\n format.json {render json: {message: @companies}, status: 200}\n end\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end", "def show\n render json: [*@company]\n end", "def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n end", "def show\n render json: @company\n end", "def index\n @companies = NasdaqCompany.all_companies\n respond_with(@companies)\n end", "def index\n @companies = ClientCompany.all\n end", "def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end", "def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def index\n\t\tif current_user.user_role.code == 'admin'\n\t\t\t@companies = Company.all\n\t\telse\n\t\t\t@companies = current_user.created_companies\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @companies }\n\t\tend\n\tend", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @companies = current_user.account.companies || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end", "def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end", "def index\r\n # Get all companies alphabetized\r\n #@companies = Company.order(\"LOWER(name)\")\r\n @companies = Company.order(\"LOWER(name)\").paginate(:page =>params[:page], :per_page =>10)\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @companies }\r\n end\r\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end", "def index\n if request.format.to_sym == :html\n @companies = Company.page(params[:page]).order(\"LOWER(name)\")\n else\n @companies = Company.all\n end\n respond_with(@companies)\n end", "def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end", "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def index\n @companies = Company.all\n\n end", "def show\n @companies = Company.all\n end", "def index\n\t\t@companies = Company.all\n\tend", "def index\n\t\t@companies = Company.all\n\tend", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def companies\n signed_get(COMPANIES_PATH)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companions = Companion.all\n end", "def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end", "def new\n @company.name = params[:name]\n @companies = []\n @linkedin_companies = []\n \n if (!@company.name.blank?)\n @companies = Company.find_all_by_name(params[:name])\n @linkedin_companies = current_user.linkedin_client.search({:keywords => params[:name]}, \"company\").companies.all\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def companies\n companies = Driver.find(params[:id]).company\n if companies.size == 0\n companies = Array.new\n end\n respond_with companies\n rescue ActiveRecord::RecordNotFound\n respond_with ActiveRecord::RecordNotFound\n end", "def index\n @business_companies = Business::Company.all\n end", "def company\n response = JSON.parse(@client.get(\"users/#{send(:id)}/companies\").body)\n Promisepay::Company.new(@client, response['companies'])\n rescue Promisepay::NotFound\n nil\n end", "def show\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biz_company }\n end\n end", "def show\n @company = Company.find(params[:id])\n employees_and_bio_signals\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company =Company.find_by(user_id: params[:user_id])\n render json:\n @company\n \n end", "def show\n\t begin\n\t\t if params[:id].to_i != 0\n\t\t\t # id given\n\t\t @company = Company.find(params[:id])\n\t\t else\n\t\t\t # name given\n\t\t\t @company = Company.find_by_name(params[:id])\n\t\t end\n\t rescue Exception => e\n\t\t @company = nil\n\t\tend\n\n\t if @company.nil?\n\t\t redirect_to root_path, alert: \"This company does not exist.\"\n\t\t return\n\t end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end", "def show\n\t\t@company = Company.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @company }\n\t\tend\n\tend", "def index\n @companies = current_user.companies.all\n flash[:notice] = t('flash.actions.index.notice') if @companies.empty?\n respond_with(@companies)\n end", "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies_info = Company.display_information\n end", "def show\n response_hash = @company.get_company_detail\n respond_to do |format|\n format.html {}\n format.json {render json: {message: response_hash}, status: 200}\n end\n end", "def show\n @crunch_company = CrunchCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crunch_company }\n end\n end", "def index\n @contact_companies = ContactCompany.all\n end", "def index\n @hiring_companies = HiringCompany.all\n end", "def show\n @breadcrumb = 'read'\n @company = Company.find(params[:id])\n @offices = @company.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @company.company_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n @accounts = @company.company_bank_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_companies.to_ext_json(:class => :company, :count => Company.count) }\n end\n end", "def index\n @account_companies = Account::Company.all\n end", "def show\n render json: @company_authority\n end", "def index\n @production_companies = ProductionCompany.all\n end", "def find_company\n @company = Company.exists?(params[:id])\n if @company\n @company = Company.find(params[:id])\n else\n render json: { description: \"Company not found\", code: 404 }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @customer_companies = CustomerCompany.all\n end", "def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if !@parts.nil?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end", "def index\n\t\t@companies = []\n if params[:query].nil?\n @products = []\n else\n @products = Product.search params[:query]\n @products.each do |product|\n product.companies.each do |company|\n if !@companies.include? company\n @companies << company\n end\n end\n end\n end\n\tend", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def show\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ins_company }\n end\n end", "def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end", "def index\n if current_user.is_student?\n @companies = Company.where(:reg_status => [2,3])\n respond_with @companies.as_json({:student_id => current_user.id})\n elsif\n respond_with Company.all\n end\n end", "def company_information(params)\n get('company-information',params)\n end", "def companies\n\t\tEmpresa.all\n\tend", "def index\n @compania = Companium.all\n end", "def show\n @company = Company.find(params[:id])\n respond_with @company\n end", "def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end", "def show\n @company = current_user.companies.find(params[:company_id])\n @report = @company.labors.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def index\n @companies = NewCompany.where(user: current_user)\n end", "def index\n @companies = Company.all\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all.page params[:page]\n end", "def index\n @invoced_companies = InvocedCompany.all\n end", "def index\n @incomes = current_company.incomes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @incomes }\n end\n end", "def index\n @companies = Company.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n end", "def index\n @company = Company.all\n end", "def index\n @companies = Company.alphabetical.all\n end", "def show\n @company_account = CompanyAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @company_account }\n end\n end" ]
[ "0.7902303", "0.7858561", "0.7774042", "0.7774042", "0.7774042", "0.7774042", "0.7595257", "0.75136745", "0.7443538", "0.7433297", "0.7311967", "0.7278466", "0.7264634", "0.72469735", "0.724456", "0.72012216", "0.7155448", "0.7151627", "0.71487916", "0.7133825", "0.71279407", "0.7126435", "0.7124335", "0.7066993", "0.7051971", "0.7051971", "0.7051971", "0.7051971", "0.7051971", "0.7051971", "0.70319235", "0.70319235", "0.70319235", "0.70319235", "0.70319235", "0.70319235", "0.7018108", "0.70142066", "0.7009021", "0.69896555", "0.69769686", "0.69655377", "0.6965365", "0.6965365", "0.6896826", "0.6894545", "0.68778974", "0.6856462", "0.6856266", "0.68086773", "0.67906415", "0.67648864", "0.6745797", "0.67446876", "0.67414397", "0.67303187", "0.67277956", "0.6723565", "0.66872174", "0.66860545", "0.66797394", "0.66660047", "0.66507983", "0.6643559", "0.66379243", "0.6632865", "0.6619069", "0.6615509", "0.66148555", "0.6597279", "0.6591295", "0.65895915", "0.6582577", "0.6560164", "0.65431666", "0.65431666", "0.65431666", "0.65431666", "0.65412414", "0.6519994", "0.65152776", "0.64800066", "0.6479329", "0.6476584", "0.64703685", "0.6461919", "0.64547753", "0.64260864", "0.64251864", "0.64248455", "0.64225477", "0.6422256", "0.64200747", "0.6418588", "0.6408176", "0.6404664", "0.64022803", "0.63977236", "0.63940334", "0.6390367", "0.63705754" ]
0.0
-1
GET /companies/1 GET /companies/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def show\n render json: @company\n end", "def show\n render json: [*@company]\n end", "def index\n @companies = Company.all\n respond_to do |format|\n format.html {}\n format.json {render json: {message: @companies}, status: 200}\n end\n end", "def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end", "def show\n @crunch_company = CrunchCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crunch_company }\n end\n end", "def index\n @companies = ClientCompany.all\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def show\n\t begin\n\t\t if params[:id].to_i != 0\n\t\t\t # id given\n\t\t @company = Company.find(params[:id])\n\t\t else\n\t\t\t # name given\n\t\t\t @company = Company.find_by_name(params[:id])\n\t\t end\n\t rescue Exception => e\n\t\t @company = nil\n\t\tend\n\n\t if @company.nil?\n\t\t redirect_to root_path, alert: \"This company does not exist.\"\n\t\t return\n\t end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biz_company }\n end\n end", "def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end", "def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end", "def find_company\n @company = Company.exists?(params[:id])\n if @company\n @company = Company.find(params[:id])\n else\n render json: { description: \"Company not found\", code: 404 }\n end\n end", "def index\n @companies = NasdaqCompany.all_companies\n respond_with(@companies)\n end", "def show\n\t\t@company = Company.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @company }\n\t\tend\n\tend", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @companies = current_user.account.companies || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end", "def show\n @companies = Company.all\n end", "def index\n @companies = Company.all\n\n end", "def index\r\n # Get all companies alphabetized\r\n #@companies = Company.order(\"LOWER(name)\")\r\n @companies = Company.order(\"LOWER(name)\").paginate(:page =>params[:page], :per_page =>10)\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @companies }\r\n end\r\n end", "def new\n @company.name = params[:name]\n @companies = []\n @linkedin_companies = []\n \n if (!@company.name.blank?)\n @companies = Company.find_all_by_name(params[:name])\n @linkedin_companies = current_user.linkedin_client.search({:keywords => params[:name]}, \"company\").companies.all\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = Company.all\n @cities = City.all\n #render json: @companies\n render json: { :companies => @companies, :cities => @cities }\n end", "def show\n @company = Company.find(params[:id])\n employees_and_bio_signals\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end", "def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end", "def index\n\t\t@companies = Company.all\n\tend", "def index\n\t\t@companies = Company.all\n\tend", "def get_company\n @company = Company.find(params[:company_id])\n end", "def show\n @company =Company.find_by(user_id: params[:user_id])\n render json:\n @company\n \n end", "def show\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ins_company }\n end\n end", "def show\n @company = Company.find(params[:id])\n respond_with @company\n end", "def index\n if request.format.to_sym == :html\n @companies = Company.page(params[:page]).order(\"LOWER(name)\")\n else\n @companies = Company.all\n end\n respond_with(@companies)\n end", "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @company = Company.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def company\n response = JSON.parse(@client.get(\"users/#{send(:id)}/companies\").body)\n Promisepay::Company.new(@client, response['companies'])\n rescue Promisepay::NotFound\n nil\n end", "def show\n @breadcrumb = 'read'\n @company = Company.find(params[:id])\n @offices = @company.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @company.company_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n @accounts = @company.company_bank_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def show\n\n \tbegin\n \t@company = Company.find(COMPANY_ID)\n rescue ActiveRecord::RecordNotFound\n \t@company = Company.create({:description => ''})\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end \n end", "def show\n response_hash = @company.get_company_detail\n respond_to do |format|\n format.html {}\n format.json {render json: {message: response_hash}, status: 200}\n end\n end", "def show\n @company_account = CompanyAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @company_account }\n end\n end", "def index\n @companions = Companion.all\n end", "def index\n\t\tif current_user.user_role.code == 'admin'\n\t\t\t@companies = Company.all\n\t\telse\n\t\t\t@companies = current_user.created_companies\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @companies }\n\t\tend\n\tend", "def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end", "def companies\n companies = Driver.find(params[:id]).company\n if companies.size == 0\n companies = Array.new\n end\n respond_with companies\n rescue ActiveRecord::RecordNotFound\n respond_with ActiveRecord::RecordNotFound\n end", "def show\n @company = current_user.companies.find(params[:company_id])\n @report = @company.labors.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n render json: @company_authority\n end", "def index\n @companies_info = Company.display_information\n end", "def show\n @company = Company.find(params[:id])\n @status_updates = @company.status_updates\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_companies.to_ext_json(:class => :company, :count => Company.count) }\n end\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n @companies = Company.all\n\n if current_user.account.companies.empty?\n @company = @companies.first\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @companies }\n end\n else\n @company = current_user.account.companies.last\n respond_to do |format|\n format.html { redirect_to edit_dashboard_company_path(@company), notice: 'Please update your company listing' }\n format.json { render json: current_user.accounts.companies.last }\n end\n end\n end", "def index\n @business_companies = Business::Company.all\n end", "def show\n render json: @company_type\n end", "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def new\n\n @crunch_company = CrunchCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crunch_company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end", "def index\n @companies = Company.all.first(50000)\n end", "def new\r\n @company = Company.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @company }\r\n end\r\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end", "def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if !@parts.nil?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend", "def set_api_v1_company\n @api_v1_company = Api::V1::Company.find(params[:id])\n end", "def index\n @contact_companies = ContactCompany.all\n end", "def find_company(company_id)\n company = Company.find_by_id(company_id)\n halt 404 unless company\n\n company\n end", "def show\n @company = Company.find(params[:company_id])\n end" ]
[ "0.7808709", "0.76832056", "0.76499087", "0.76414454", "0.76414454", "0.76414454", "0.76414454", "0.75729924", "0.75324935", "0.74126863", "0.74126863", "0.74126863", "0.74126863", "0.74126863", "0.74126863", "0.73355657", "0.7306839", "0.73025626", "0.7289219", "0.7240604", "0.7117647", "0.7109449", "0.7094742", "0.70859903", "0.70796025", "0.7065032", "0.70507896", "0.6999829", "0.6960964", "0.6958902", "0.6956714", "0.6952383", "0.6926072", "0.69260633", "0.69260633", "0.69260633", "0.69260633", "0.69260633", "0.69260633", "0.690197", "0.689622", "0.68864995", "0.6878242", "0.68766445", "0.6875235", "0.6866866", "0.6854994", "0.68364775", "0.6827214", "0.6827214", "0.6814774", "0.6807632", "0.67918414", "0.6779518", "0.67780185", "0.6776291", "0.67668587", "0.67591864", "0.67567", "0.6753601", "0.67532694", "0.6738435", "0.67369735", "0.67017287", "0.6694612", "0.66646796", "0.6660005", "0.6637083", "0.663263", "0.6623725", "0.66212654", "0.65964866", "0.6581732", "0.657223", "0.6569899", "0.6569895", "0.6551937", "0.6542113", "0.654164", "0.654164", "0.654164", "0.654164", "0.654164", "0.654164", "0.654164", "0.654164", "0.654164", "0.654164", "0.6539981", "0.653889", "0.6538654", "0.6525427", "0.6525427", "0.6525427", "0.6525427", "0.6489834", "0.64839625", "0.64830756", "0.64753187", "0.6474092", "0.64728475" ]
0.0
-1
POST /companies POST /companies.json
def create @company = Company.new(company_params) respond_to do |format| if @company.save @company.visit.each do |visit| @visit = Visit.new(visit.attributes) @visit.companyId=@company.id daysFromNow = Frecuency.find(visit.frecuencyTypeId).days nextVisitDate = visit.visitDate + daysFromNow.day while nextVisitDate < (Date.today + 365.day) @nextVisit = Visit.new(visit.attributes) @nextVisit.visitDate = nextVisitDate @nextVisit.id = nil @nextVisit.companyId=@company.id @nextVisit.save nextVisitDate = nextVisitDate + daysFromNow.day end end if @company.save @company.expiration.each do |expiration| @expiration = Expiration.new(expiration.attributes) @expiration.companyId=@company.id end end format.html { redirect_to @company, notice: 'Cliente creado con exito' } format.json { render :show, status: :created, location: @company } else format.html { render :new } format.json { render json: @company.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Company.create(params[\"company\"])\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, :notice => 'Company was successfully created.' }\n format.json { render :json => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html {\n redirect_to @company, notice: 'Company was successfully created.'\n }\n format.json {\n render json: @company, status: :created, location: @company\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @company = Company.new(params[:company])\n \n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Empresa foi criada com sucesso.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @company = Company.new(params[:company])\r\n respond_to do |format|\r\n if @company.save\r\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\r\n format.json { render json: @company, status: :created, location: @company }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @company }\n else\n format.html { render action: 'new' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = @community.companies.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params[:company])\n @companyAuthority = @company.company_authority.new(company_params[:company_authority])\n\n if (!company_params[:lobs].blank?)\n company_params[:lobs].each do |lob|\n @companyAuthority.lob.new(lob)\n end\n end\n\n if @company.save\n render json: @company, status: :created, location: @company\n else\n render json: ErrorSerializer.serialize(@company.errors), status: :unprocessable_entity\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n #format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n #format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(nested_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n company = Company.create(company_params)\n if company\n render json:{\n status: :created,\n company: company\n }\n else\n render json: { status: 500 }\n end\n\n \n \n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html {redirect_to @company, notice: 'Company was successfully created.'}\n format.json {render :show, status: :created, location: @company}\n else\n format.html {render :new}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html {redirect_to @company, notice: 'Company was successfully created.'}\n format.json {render :show, status: :created, location: @company}\n else\n format.html {render :new}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @intelcompany = IntelCompany.new(intelcompany_params)\n\n if @intelcompany.save\n render json: @intelcompany, status: :created, location: @intelcompany\n else\n render json: @intelcompany.errors, status: :unprocessable_entity\n end\n\n end", "def create\n begin\n \n detail = @@data_util.hash_data_to_upper_case( params[:company], ['description'])\n\n detail[:mypclient_id] = session[:client_id]\n detail[:createdby] = session[:username]\n detail[:isactive] = 1\n\n @company = Company.new(detail)\n if @company.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'New company successfully created.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def create\n @account_company = Account::Company.new(account_company_params)\n\n respond_to do |format|\n if @account_company.save\n format.html { redirect_to @account_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @account_company }\n else\n format.html { render :new }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n if @company.save\n respond_with @company, status: :created, location: @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def create\n Rails.logger.info \"\\n*****\\nParams Company: #{params[:company]} ********\\n\"\n\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.js\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tyc_company = Tyc::Company.new(tyc_company_params)\n\n respond_to do |format|\n if @tyc_company.save\n format.html { redirect_to @tyc_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @tyc_company }\n else\n format.html { render :new }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@company = Company.new(params[:company].merge({:by_user_id => current_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @company.save\n\t\t\t\tformat.html { redirect_to @company, notice: t('app.companies.created') }\n\t\t\t\tformat.json { render json: @company, status: :created, location: @company }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create_new_companies\n params[:new_companies].each do |name|\n c = Company.new\n c.name = CGI.unescape(name)\n c.save\n @movie.production_companies << ProductionCompany.new( :company => c )\n end\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def create\n @company = Company.create!(company_params)\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Bar criado com sucesso.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.json { render :show, status: :created, location: @company }\n SignUpNotifier.registrated(@company).deliver\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n company = Company.new(company_params)\n if company.save \n render json: CompanySerializer.new(company)\n else\n render json: {error: \"Couldnt be saved\"}\n end\nend", "def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end", "def create\n @project = Project.new(project_params)\n @companies = Array.new\n @project.name = @project.name.upcase\n Company.all.each do |comp|\n @companies << [comp.name, comp.id]\n end\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Proyecto registrado exitosamente.' }\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 @company = Company.new(company_params)\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.save\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n if @company.save\n redirect_to @company, notice: \"Company was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end", "def create\n @company = Company.new(company_params)\n @company.tipo = '01'\n if @company.save \n render json: { status: :created }\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n # result = self.add()\n # # @company = result[:company]\n # format.html { redirect_to result[:company], notice: 'Company was successfully created.' }\n # format.json { render :show, status: :created, location: result[:company] }\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @listed_company = ListedCompany.new(listed_company_params)\n\n respond_to do |format|\n if @listed_company.save\n format.html { redirect_to listed_companies_path, notice: 'Listed company was successfully created.' }\n format.json { render :show, status: :created, location: @listed_company }\n else\n format.html { render :new }\n format.json { render json: @listed_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:company][:founded_on] = params[:company][:founded_on].blank? ? Date.today : params[:company][:founded_on].to_date\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n response_hash = @company.get_company_detail\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json {render json: {message: response_hash}, status: 200}\n else\n format.html { render :new }\n error = @company.errors.keys[0].to_s.capitalize+\" \"+@company.errors.values[0][0].to_s\n format.json { render json: {message: error}, status: 400 }\n end\n end\n end", "def new\n @company.name = params[:name]\n @companies = []\n @linkedin_companies = []\n \n if (!@company.name.blank?)\n @companies = Company.find_all_by_name(params[:name])\n @linkedin_companies = current_user.linkedin_client.search({:keywords => params[:name]}, \"company\").companies.all\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def create\n @company = Company.new(company_params)\n if current_user\n current_user.companies << @company\n end\n @company.save\n flash[:safe] = %Q[#{t(\"company_created\")} #{view_context.link_to(t(\"create_new_open_jobs\"), administration_company_path(@company))}.]\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :internal_server_error }\n end\n end\n end", "def create\n @company_authority = CompanyAuthority.new(company_authority_params)\n\n if @company_authority.save\n render json: @company_authority, status: :created, location: @company_authority\n else\n render json: @company_authority.errors, status: :unprocessable_entity\n end\n end", "def create\n @ins_company = InsCompany.new(params[:ins_company])\n\n respond_to do |format|\n if @ins_company.save\n format.html { redirect_to @ins_company, notice: 'Ins company was successfully created.' }\n format.json { render json: @ins_company, status: :created, location: @ins_company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ins_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_account = CompanyAccount.new(params[:company_account])\n\n respond_to do |format|\n if @company_account.save\n format.html { redirect_to @company_account, :notice => 'Company account was successfully created.' }\n format.json { render :json => {:data => @company_account , :success => true }, :status => :created, :location => @company_account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => {:msg => @company_account.errors, :status => :unprocessable_entity} }\n end\n end\n end", "def create\n @company = current_user.companies.build(params[:company])\n flash[:notice] = t('flash.actions.create.notice', :resource_name => Company.model_name.human) if @company.save\n respond_with(@company, :location => companies_path)\n end", "def create\n @company = Company.new(company_params)\n\n render status: \\\n current_user.save_company(@company) ? :created : :unprocessable_entity\n end", "def create\n @contact_company = ContactCompany.new(contact_company_params)\n\n respond_to do |format|\n if @contact_company.save\n format.html { redirect_to @contact_company, notice: 'Contact company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact_company }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n @company.owner = User.find(session[:user_id])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @company = current_profile.companies.build(company_params)\n\n @company.companytype_id = params[:company_id]\n\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @global_company = GlobalCompany.new(params[:global_company])\n\n respond_to do |format|\n if @global_company.save\n format.html { redirect_to @global_company, notice: 'Global company was successfully created.' }\n format.json { render json: @global_company, status: :created, location: @global_company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @global_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def createWithStaff\n created_location = Company.create(params[\"company\"])\n if params[\"id\"]\n updated_person = Person.setCompany(params[\"id\"], created_location)\n end\n render json: created_location\n end", "def create\n @production_company = ProductionCompany.new(production_company_params)\n\n respond_to do |format|\n if @production_company.save\n format.html { redirect_to @production_company, notice: 'Production company was successfully created.' }\n format.json { render :show, status: :created, location: @production_company }\n else\n format.html { render :new }\n format.json { render json: @production_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def create\n @new_company = NewCompany.new(new_company_params)\n @new_company.user = current_user\n\n respond_to do |format|\n if @new_company.save\n format.html { redirect_to new_requesit_path, notice: 'Вы успешно добавили компанию!' }\n format.json { render :show, status: :created, location: @new_company }\n else\n format.html { render :new }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n \n if @company.save\n redirect_to companies_path, notice: 'Company was successfully created.' \n else\n format.html { render :new }\n end\n end", "def create\n @company = Company.new(company_params)\n @company.user = current_user\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to companies_path, notice: 'Компания успешно создана' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n company = Company.find_by_id(params[:company_id])\n company_logo = company.image_logo\n company_name = company.name \n\n \n @company_order = CompanyOrder.new(company_order_params)\n\n if @company_order.save\n render json: @company_order, status: :created, location: @company_order\n else\n render json: @company_order.errors, status: :unprocessable_entity\n end\n end", "def create\n @company = Company.new(params[:company])\n @company.create_default_infos\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @visit_company = VisitCompany.new(visit_company_params)\n\n respond_to do |format|\n if @visit_company.save\n format.html { redirect_to @visit_company, notice: 'Visit company was successfully created.' }\n format.json { render :show, status: :created, location: @visit_company }\n else\n format.html { render :new }\n format.json { render json: @visit_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_company = CustomerCompany.new(customer_company_params)\n @customer_company.created_user_id = current_user.id\n respond_to do |format|\n if @customer_company.save\n format.html { redirect_to @customer_company, notice: t(\"controllers.create_success\") }\n format.json { render :show, status: :created, location: @customer_company }\n else\n @customer_companies_options = CustomerCompany.where(active: true, consortium: true).map{|m| [ m.company_customer , m.id ] }\n format.html { render :new }\n format.json { render json: @customer_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @companyreg = Companyreg.new(companyreg_params)\n\n respond_to do |format|\n if @companyreg.save\n format.html { redirect_to @companyreg, notice: 'Companyreg was successfully created.' }\n format.json { render :show, status: :created, location: @companyreg }\n else\n format.html { render :new }\n format.json { render json: @companyreg.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\r\n @company = Company.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @company }\r\n end\r\n end", "def create\n\t the_params = company_params\n\t the_params[:rating] = 0\n\t the_params[:number_of_votes] = 0\n @company = Company.new(the_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company_name = CompanyName.new(company_name_params)\n\n respond_to do |format|\n if @company_name.save\n format.html { redirect_to @company_name, notice: 'Company name was successfully created.' }\n format.json { render :show, status: :created, location: @company_name }\n else\n format.html { render :new }\n format.json { render json: @company_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n if @company_business.save\n format.html { redirect_to @company_business, notice: 'Company business was successfully created.' }\n format.json { render json: @company_business, status: :created, location: @company_business }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company_business.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoced_company = InvocedCompany.new(invoced_company_params)\n\n respond_to do |format|\n if @invoced_company.save\n format.html { redirect_to @invoced_company, notice: t(:successfully_updated_invoced_company) }\n format.json { render action: 'show', status: :created, location: @invoced_company }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoced_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = current_user.companies.build(company_params)\n\n if @company.save\n flash[:success] = \"Saved!\"\n redirect_to companies_path\n else\n render 'new'\n end\n end", "def update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].nil?\n create_new_companies unless params[:new_companies].nil?\n end", "def create\n @rail_company = RailCompany.new(rail_company_params)\n\n respond_to do |format|\n if @rail_company.save\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rail_company }\n else\n format.html { render action: 'new' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hiring_company = HiringCompany.new(hiring_company_params)\n\n respond_to do |format|\n if @hiring_company.save\n format.html { redirect_to @hiring_company, notice: 'Hiring company was successfully created.' }\n format.json { render :show, status: :created, location: @hiring_company }\n else\n format.html { render :new }\n format.json { render json: @hiring_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @credit_company = CreditCompany.new(credit_company_params)\n\n respond_to do |format|\n if @credit_company.save\n format.html { redirect_to @credit_company, notice: t('credit_company.created') }\n format.json { render :show, status: :created, location: @credit_company }\n else\n format.html { render :new }\n format.json { render json: @credit_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = companies_scope.new(company_params)\n\n respond_to do |format|\n if @company.save\n CompanyRegisterMailer.send_request(@company.id).deliver\n\n flash.now[:notice] = I18n.t('commons.successfully_created')\n format.html { render action: \"show\" }\n format.json { render json: @company, status: :created, location: @company.location }\n format.js #\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n format.js #\n end\n end\n end", "def create\n @type_company = TypeCompany.new(type_company_params)\n\n respond_to do |format|\n if @type_company.save\n format.html { redirect_to @type_company, notice: 'Type company was successfully created.' }\n format.json { render :show, status: :created, location: @type_company }\n else\n format.html { render :new }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n if @company.save\n flash[:success] = \"Company was successfully created.\"\n redirect_to companies_url\n else\n flash[:error] = @company.errors.full_messages.join(\" and \")\n redirect_to new_company_url(@company)\n end\n end", "def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end", "def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def create\n @client_company = ClientCompany.new(company_params)\n @client_company.poc_country = @client_company.country_name\n respond_to do |format|\n if @client_company.save\n format.html {redirect_to client_companies_url, notice: 'Company is successfully created.'}\n format.json {render :show, status: :created, location: @client_company}\n else\n format.html {render :new}\n format.json {render json: @client_company.errors, status: :unprocessable_entity}\n end\n end\n end" ]
[ "0.75086176", "0.7454409", "0.7148216", "0.7067736", "0.69924504", "0.6992177", "0.6991816", "0.6991816", "0.6991816", "0.6991816", "0.692276", "0.69189334", "0.69189334", "0.69189334", "0.69189334", "0.69189334", "0.69163394", "0.690428", "0.6899169", "0.68933874", "0.68476266", "0.6843674", "0.6816974", "0.680992", "0.6766317", "0.67590636", "0.67399466", "0.67399466", "0.67340183", "0.67319125", "0.6682637", "0.66712207", "0.66020507", "0.65840894", "0.653913", "0.6523938", "0.65214026", "0.6506829", "0.64884746", "0.64878446", "0.6484541", "0.6479742", "0.64617956", "0.6461615", "0.6441333", "0.6414747", "0.63979465", "0.6391498", "0.6389729", "0.6383826", "0.63828164", "0.6380915", "0.6373825", "0.6361652", "0.6359336", "0.63522136", "0.6341897", "0.63354236", "0.63145095", "0.63130844", "0.63078475", "0.63063234", "0.6296106", "0.6277097", "0.6277097", "0.6277097", "0.6277097", "0.62514484", "0.62510884", "0.62496394", "0.6249196", "0.62437177", "0.62345177", "0.62340087", "0.622988", "0.622188", "0.622188", "0.622188", "0.622188", "0.622188", "0.622188", "0.622188", "0.622188", "0.622188", "0.622188", "0.6211162", "0.61999255", "0.61908126", "0.61877143", "0.61806846", "0.61720884", "0.61657625", "0.616334", "0.6153597", "0.61462766", "0.61452097", "0.61353976", "0.6134431", "0.6123663", "0.61188495", "0.6117755" ]
0.0
-1
PATCH/PUT /companies/1 PATCH/PUT /companies/1.json
def update respond_to do |format| if @company.update(company_params) format.html { redirect_to @company, notice: 'Cliente actualizado con exito' } format.json { render :show, status: :ok, location: @company } else format.html { render :edit } format.json { render json: @company.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n Rails.logger.info \"******\\n\\n\\nCompany: #{params[:company]}***********\\n\\n\\n\"\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @company = Company.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @company.update_attributes(params[:company])\r\n format.html { redirect_to @company, notice: 'Company 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: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to companies_url, notice: @company.name + ' was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def update\n @company = Company.find(COMPANY_ID)\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to administration_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @company }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n #format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n #format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html {redirect_to action: :index, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @company}\n else\n format.html {render :edit}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html {redirect_to @company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @company}\n else\n format.html {render :edit}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n\t\t@company = Company.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @company.update_attributes(params[:company])\n\t\t\t\tformat.html { redirect_to @company, notice: t('app.companies.updated') }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @client_company.update(company_params)\n format.html {redirect_to @client_company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @client_company}\n else\n format.html {render :edit}\n format.json {render json: @client_company.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Empresa foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: t(\"updated\") }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @company = Company.find(params[:id])\n detail = @@data_util.hash_data_to_upper_case(params[:company], ['description'])\n detail[:lastupdateby] = session[:username]\n\n @@request_result[:data] = detail \n @@request_result[:type] = params[:company].class \n if @company.update_attributes(detail)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Company successfully updated.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update!(nested_params)\n format.html { redirect_to @company, notice: \"#{@company.name} Company has been updated.\" }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # authorize @company\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Общая информация о компании успешно отредактирована' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Configurações da empresa alteradas com sucesso!' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].nil?\n create_new_companies unless params[:new_companies].nil?\n end", "def edit\n respond_with(@company)\n end", "def update\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.update(company_params)\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.js do\n if params[:update_formats]\n render 'update_formats'\n else\n render 'update'\n end\n end\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render action: \"edit\" }\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = companies_scope.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.html { redirect_to @company, notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n format.js #\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = current_user.companies.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n @company.infos.each do |i|\n\t i.value = params[i.key]\n\t i.save\n end\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n\n respond_to do |format|\n if @admin_company_detail.update_attributes(params[:admin_company_detail])\n format.html { redirect_to @admin_company_detail, :notice => 'Company detail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admin_company_detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n @company.email_format = nil if @company.allow_email_regex == false\n @company.save\n @company.track_company_activity(\" updated the company \")\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n response_hash = @company.get_company_detail\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json {render json: {message: response_hash}, status: 200}\n else\n format.html { render :edit }\n error = @company.errors.keys[0].to_s.capitalize+\" \"+@company.errors.values[0][0].to_s\n format.json { render json: {message: error}, status: 422 }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Bar atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contact_company.update(contact_company_params)\n format.html { redirect_to @contact_company, notice: 'Contact company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title = \"Update Company\"\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @invoced_company.update(invoced_company_params)\n format.html { redirect_to @invoced_company, notice: t(:successfully_updated_invoced_company) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoced_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = \"#{@company.name} was successfully updated.\"\n format.html { redirect_to @person }\n format.xml { head :ok }\n format.js { @company.reload and render :layout => false }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end", "def update\n @crunch_company = CrunchCompany.find(params[:id])\n @fetch_crunch = Crunchbase::Company.get(@crunch_company.company_name)\n @fetch_crunch_posts = @fetch_crunch.ipo\n\n respond_to do |format|\n if @crunch_company.update_attributes(params[:crunch_company])\n @crunch_company.update_attribute(:posts, @fetch_crunch_posts)\n format.html { redirect_to @crunch_company, notice: 'Crunch company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crunch_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n add_to_log(t('Company updated log') + @company.name,\"companies\",\"update\")\n flash[:notice] = t('Company updated')\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if params[:person][:company_name]\n params[:person][:company] = Company.find_or_create_by_name(params[:person][:company_name])\n params[:person].delete(:company_name)\n end\n @person = Person.find(params[:id])\n\n authorize! :edit, @person\n \n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end", "def update\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n if @ins_company.update_attributes(params[:ins_company])\n format.html { redirect_to @ins_company, notice: 'Ins company was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ins_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @companies = Array.new\n Company.all.each do |comp|\n @companies << [comp.name, comp.id]\n end\n @project.name = @project.name.upcase\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Proyecto actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @global_company = GlobalCompany.find(params[:id])\n\n respond_to do |format|\n if @global_company.update_attributes(params[:global_company])\n format.html { redirect_to @global_company, notice: 'Global company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @global_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end", "def update\n @company_account = CompanyAccount.find(params[:id])\n\n respond_to do |format|\n if @company_account.update_attributes(params[:company_account])\n format.html { redirect_to @company_account, :notice => 'Company account was successfully updated.' }\n # format.json { head :ok }\n format.json {render :json => {:data => @company_account , :success => true } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company_account.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(id_from_params)\n\n respond_to do |format|\n if @company.accounts.exists? current_user.account.id\n @company.accounts.delete(current_user.account)\n @company.accounts << current_user.account\n\n format.html { redirect_to root_path, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n @company.accounts << current_user.account\n format.html { redirect_to root_path, notice: 'Company was successfully updated.' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listed_company.update(listed_company_params)\n format.html { redirect_to listed_companies_path, notice: 'Listed company was successfully updated.' }\n format.json { render :show, status: :ok, location: @listed_company }\n else\n format.html { render :edit }\n format.json { render json: listed_companies_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @company_business.update_attributes(params[:company_business])\n format.html { redirect_to @company_business, notice: 'Company business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company_business.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hiring_company.update(hiring_company_params)\n format.html { redirect_to @hiring_company, notice: 'Hiring company was successfully updated.' }\n format.json { render :show, status: :ok, location: @hiring_company }\n else\n format.html { render :edit }\n format.json { render json: @hiring_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n params[:company][:projects_attributes][\"0\"].merge!(:user_id => current_user.id)\n respond_to do |format|\n if @company.update_attributes(params[:company])\n\tformat.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n\tformat.xml { head :ok }\n else\n\tformat.html { render :action => \"edit\" }\n\tformat.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_name.update(company_name_params)\n format.html { redirect_to @company_name, notice: 'Company name was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_name }\n else\n format.html { render :edit }\n format.json { render json: @company_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tyc_company.update(tyc_company_params)\n format.html { redirect_to @tyc_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @tyc_company }\n else\n format.html { render :edit }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @new_company.update(new_company_params)\n format.html { redirect_to @new_company, notice: 'Вы успешно отредактировали компанию' }\n format.json { render :show, status: :ok, location: @new_company }\n else\n format.html { render :edit }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @account_company.update(account_company_params)\n format.html { redirect_to @account_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_company }\n else\n format.html { render :edit }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n params[:company][:category_ids] ||= []\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.update(company_params)\n # $redis.publish('companies.update', @company.to_json)\n # render :action => 'show'\n end", "def update\n\n @company = Company.find(1)\n @puntos = @company.get_puntos()\n @employees = @company.get_employees2() \n@trucks = @company.get_trucks\n\n respond_to do |format|\n if @cout.update(cout_params)\n format.html { redirect_to @cout, notice: 'Cout was successfully updated.' }\n format.json { render :show, status: :ok, location: @cout }\n else\n format.html { render :edit }\n format.json { render json: @cout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_owner.update(company_owner_params)\n format.html { redirect_to @company_owner, notice: 'Company owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n if @sp_company_info.update_attributes(sp_company_info_params)\n format.html { redirect_to \"/sp_company_infos\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp_company_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:company_id])\n @employee = @company.employees.find(params[:id]) \n respond_to do |format|\n if @employee.update(employee_params)\n format.html { redirect_to company_employees_url(@company), notice: 'Employee was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee }\n else\n format.html { render :edit }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "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 @events_company = EventsCompany.find(params[:id])\n\n respond_to do |format|\n if @events_company.update_attributes(params[:events_company])\n format.html { redirect_to @events_company, :notice => 'Events company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @events_company.errors, :event => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rail_company.update(rail_company_params)\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @companies = Company.all\n respond_to do |format|\n if @house.update(house_params)\n format.html { redirect_to @house, notice: 'House was successfully updated.' }\n format.json { render :show, status: :ok, location: @house }\n else\n format.html { render :edit }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @part_company = PartCompany.find(params[:id])\n\n respond_to do |format|\n if @part_company.update_attributes(params[:part_company])\n format.html { redirect_to @part_company, notice: 'Part company was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @part_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_field.update(company_field_params)\n format.html { redirect_to @company_field, notice: 'Company field was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_field }\n else\n format.html { render :edit }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n @battalion = Battalion.find(params[:battalion_id])\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to battalion_company_path(@battalion, @company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @guarantee_company.update(guarantee_company_params)\n format.html { redirect_to @guarantee_company, notice: 'Guarantee company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @guarantee_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @company.update(company_params)\n redirect_to @company, notice: \"Company was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end" ]
[ "0.7636508", "0.7152674", "0.7055599", "0.7044559", "0.7037746", "0.7037746", "0.7037746", "0.7037746", "0.7037746", "0.7037746", "0.7032013", "0.7018044", "0.70124805", "0.6974244", "0.6946986", "0.6919841", "0.6919841", "0.6879891", "0.6875187", "0.6837392", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.68369305", "0.6801564", "0.6795398", "0.6794092", "0.6788173", "0.6773205", "0.6768756", "0.6760083", "0.6757447", "0.67484707", "0.6726122", "0.67177236", "0.67164105", "0.66773534", "0.6583323", "0.6572606", "0.6571927", "0.6540096", "0.6539763", "0.65302175", "0.65274173", "0.6512498", "0.6512498", "0.6498335", "0.6494971", "0.6489876", "0.6476511", "0.6475477", "0.6473841", "0.6464583", "0.64640296", "0.6457861", "0.64577353", "0.6457692", "0.64518636", "0.6445961", "0.6439817", "0.643084", "0.6428963", "0.64152473", "0.64150196", "0.64145947", "0.6401742", "0.6392766", "0.63811433", "0.63744754", "0.6369677", "0.63678175", "0.6360152", "0.6356482", "0.6351711", "0.6345173", "0.6341026", "0.63360715", "0.6329728", "0.6322519", "0.63129455", "0.63120615", "0.6309746", "0.6297462", "0.62968993", "0.6287218", "0.6273654", "0.62644714", "0.62578243", "0.62464577", "0.6242683", "0.62382317", "0.62341255" ]
0.6475512
58
DELETE /companies/1 DELETE /companies/1.json
def destroy @company.destroy respond_to do |format| format.html { redirect_to companies_url, notice: 'Cliente eliminado con exito' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to companies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |format|\n format.html { redirect_to crunch_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = set_company\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: \"#{@company.name} has been deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @biz_company = BizCompany.find(params[:id])\n @biz_company.destroy\n\n respond_to do |format|\n format.html { redirect_to biz_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ins_company = InsCompany.find(params[:id])\n @ins_company.destroy\n\n respond_to do |format|\n format.html { redirect_to ins_companies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @company.destroy\n @companies = Company.all\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json {render json: {message: @companies}, status: 200}\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: t(\"company_destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n #format.html { redirect_to companys_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n\n head :no_content\n end", "def destroy\n #@company = Company.find_by_slug(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(id_from_params)\n @company.accounts.delete(current_user.account)\n #current_user.companies.delete(@company)\n #@company.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html {redirect_to companies_url, notice: 'Company was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @global_company = GlobalCompany.find(params[:id])\n @global_company.destroy\n\n respond_to do |format|\n format.html { redirect_to global_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html {redirect_to companies_url, notice: 'Company was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @contact_company.destroy\n respond_to do |format|\n format.html { redirect_to contact_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n flash[:notice] = \"company deleted\" \n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@company = Company.find(params[:id])\n\t\t@company.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to companies_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @guarantee_company.destroy\n respond_to do |format|\n format.html { redirect_to guarantee_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_company.destroy\n respond_to do |format|\n format.html { redirect_to visit_companies_url, notice: 'Visit company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @new_company.destroy\n respond_to do |format|\n format.html { redirect_to new_companies_url, notice: 'New company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Bar Deletado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @title = \"Destroy Company\"\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_company_details_url }\n format.json { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.destroy\n format.html { redirect_to companies_url,\n notice: (crud_notice('destroyed', @company) + \"#{undo_link(@company)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to companies_url, alert: \"#{@company.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @company = current_user.companies.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n add_to_log(t('Company destroy log') + @company.name,\"companies\",\"destroy\")\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @business_company.destroy\n respond_to do |format|\n format.html { redirect_to business_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_company.destroy\n respond_to do |format|\n format.html { redirect_to customer_companies_url, notice: t(\"controllers.destroy_success\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @account_company.destroy\n respond_to do |format|\n format.html { redirect_to account_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Company.transaction do\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @tyc_company.destroy\n respond_to do |format|\n format.html { redirect_to tyc_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_account = CompanyAccount.find(params[:id])\n @company_account.destroy\n\n respond_to do |format|\n format.html { redirect_to company_accounts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @hiring_company.destroy\n respond_to do |format|\n format.html { redirect_to hiring_companies_url, notice: 'Hiring company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @credit_company.destroy\n respond_to do |format|\n format.html { redirect_to credit_companies_url, notice: t('credit_company.destroyed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n redirect_to(companies_url)\n end", "def destroy\n @companium.destroy\n respond_to do |format|\n format.html { redirect_to compania_url, notice: 'Companium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.js\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n flash[:success] = \"Company was successfully deleted.\"\n redirect_to crm_path\n end", "def destroy\n @production_company.destroy\n respond_to do |format|\n format.html { redirect_to production_companies_url, notice: 'Production company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Компания успешно удалена' }\n format.json { head :no_content }\n end\n end", "def destroy\n company = @moot.company\n @moot.destroy\n respond_to do |format|\n format.html { redirect_to [company], notice: 'Moot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @company.destroy()\n render json: { :message => \"Success!\" }\n else\n render json: { :message => \"La zona no pudo ser eliminada\" }\n end\n end", "def destroy\n @events_company = EventsCompany.find(params[:id])\n @events_company.destroy\n\n respond_to do |format|\n format.html { redirect_to events_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n @company = Company.find(params[:id])\n if @company.destroy\n @@request_result[:success] = true\n @@request_result[:notice] = 'Operation ended successfully.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n @@request_result[:errorcode] = e.code\n end\n render json: @@request_result\n end", "def destroy\n @listed_company.destroy\n respond_to do |format|\n format.html { redirect_to listed_companies_url, notice: 'Listed company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_vacancy.destroy\n respond_to do |format|\n format.html { redirect_to company_vacancies_url, notice: 'Company vacancy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @part_company = PartCompany.find(params[:id])\n @part_company.destroy\n\n respond_to do |format|\n format.html { redirect_to part_companies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @company_name.destroy\n respond_to do |format|\n format.html { redirect_to company_names_url, notice: 'Company name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sp_company_info = SpCompanyInfo.find(params[:id])\n @sp_company_info.destroy\n\n respond_to do |format|\n format.html { redirect_to sp_company_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n respond_to do |format|\r\n format.html { redirect_to(admincompany_manage_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @companyreg.destroy\n respond_to do |format|\n format.html { redirect_to companyregs_url, notice: 'Companyreg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @main_company.destroy\n respond_to do |format|\n format.html { redirect_to main_companies_url, notice: 'Main company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_type.destroy\n\n head :no_content\n end", "def destroy\n @companycreation.destroy\n respond_to do |format|\n format.html { redirect_to companycreations_url, notice: 'Companycreation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_investor.destroy\n respond_to do |format|\n format.html { redirect_to company_investors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_owner.destroy\n respond_to do |format|\n format.html { redirect_to company_owners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n respond_to do |format|\n if @invoced_company.destroy\n format.html { redirect_to invoced_companies_url}\n format.json { head :no_content }\n else\n format.html { redirect_to invoced_companies_url, :alert => t(:error_destroy_invoiced_company) }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @type_company.destroy\n respond_to do |format|\n format.html { redirect_to type_companies_url, notice: 'Type company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gas_company.destroy\n respond_to do |format|\n format.html { redirect_to admins_gas_companies_url, notice: 'Gas company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @news_company = NewsCompany.find(params[:id])\n @news_company.destroy\n\n respond_to do |format|\n format.html { redirect_to news_companies_url }\n format.json { head :ok }\n end\n end" ]
[ "0.8019891", "0.7862878", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76938766", "0.76433545", "0.76246405", "0.76226014", "0.76226014", "0.76226014", "0.75703335", "0.7548862", "0.75414675", "0.7440054", "0.7434501", "0.7424373", "0.74203396", "0.7415283", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74098516", "0.74089134", "0.7405203", "0.7404894", "0.740289", "0.7364365", "0.7364339", "0.7364084", "0.7343882", "0.73379016", "0.7334877", "0.73324513", "0.73306674", "0.73306674", "0.73306674", "0.73306674", "0.73306674", "0.73306674", "0.73306674", "0.7316724", "0.73113", "0.730626", "0.728801", "0.72717124", "0.72504634", "0.725011", "0.72476834", "0.72448534", "0.7241762", "0.7238619", "0.7237398", "0.7237291", "0.7230114", "0.7171306", "0.7169148", "0.71334475", "0.71255416", "0.7121896", "0.71035177", "0.7095917", "0.70907015", "0.7090499", "0.7083244", "0.70670235", "0.7058671", "0.7050647", "0.7047641", "0.70346045", "0.702666", "0.70190907", "0.7015799", "0.7002634", "0.69967985", "0.6993609", "0.6974273", "0.69738585", "0.697319", "0.69727886", "0.69727", "0.69723004", "0.6971726", "0.6967662", "0.694888" ]
0.73295957
56
Use callbacks to share common setup or constraints between actions.
def set_company @company = Company.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 set_actions\n actions :all\n end", "def define_action_helpers?; 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 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 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 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 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 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 default_action; end", "def setup(&blk)\n @setup_block = blk\n 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 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 _handle_action_missing(*args); end", "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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def company_params params.require(:company).permit(:id, :industryTypeId, :industryTypeId2, :employeeId, :name, :email, :localidad, :partido, :addressDirection, :addressNumber, :cuit, :comment, :suscription, :fantasy_name, :postal_code, :companyType, :tlf, :cellphone, :internal_tlf, :contact, :floor, :departament, :search, :visitqty_min, :visitqty_max, :visit_attributes => [:id, :companyId, :visitTypeId, :frecuencyTypeId, :employeeId, :nextVisit, :visitDate, :aproved, :aprovalDate, :_destroy, :_update, :_save, :_create] ) 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
false O(N + N) = O(N)
def unique_a?(string) # O(N) string = string.split('') # O(N) string == string.uniq 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 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 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)\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 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 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 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 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 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 naive(a, target)\n\ta.each do |ie, i|\n\t\ta.each do |je, j|\n\t\t\tnext if i == j # cant be the same, i assume\n\t\t\treturn true if ie + je == target\n\t\tend\n\tend\n\treturn false\nend", "def sum_to_n? arr, n\n if arr.size>=2\n for x in arr\n target = n-x\n tmp = arr.dup\n tmp.delete_at(tmp.index(x))\n return true if tmp.include?(target)\n end\n end\n false\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 hit_itself?\n # list.uniq removes all repeated elements from a list\n @positions.uniq.length != @positions.length\n end", "def bad_two_sum?(arr, target_sum) #O(n^2)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend", "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 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 two_sum_to_zero?(array)\n # len = array.length - 1\n # len.times do |i|\n # (i + 1).upto(len) do |j|\n # return true if array[i] + array[j] == 0\n # end\n # end\n # false\n nums_hash = {}\n array.each do |el|\n return true if nums_hash[-(el)]\n nums_hash[el] = true\n end\n false\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 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 if arr.length > 1\n for i in arr do\n ndx = arr.find_index(i)\n x = arr.delete_at(ndx)\n if arr.include?(n - x)\n return true\n end\n arr.insert(ndx, x)\n end\n end\n return false\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 solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\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 true_two_sum(arr, targ)\n\n arr_hash = Hash.new\n\n arr.each { |el| arr_hash[n] = true }\n\n arr.each { |el| return arr_hash[targ - el] if arr_hash[targ - el] }\n false \nend", "def okay_two_sum?(arr, target)\n\n arr.each do |ele1| # O(n)\n # debugger\n found = arr.bsearch do |ele2|\n # debugger\n (target - ele1) == ele2\n end\n return true unless found.nil? || arr.index(found) == arr.index(ele1)\n end\n false\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 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 okay_two_sum?(arr, target)\r\n arr = arr.sort #n log n\r\n i, j = 0, arr.length - 1 #2\r\n\r\n while j > i #n\r\n curr_sum = arr[i] + arr[j]\r\n if curr_sum > target\r\n j -= 1\r\n elsif curr_sum < target\r\n i += 1\r\n else\r\n return true\r\n end\r\n end\r\n false\r\nend", "def magic?(arr)\n n = arr.size / 2\n (0...n).map { |i| (arr[i] + arr[i + 1 < n ? i + 1 : 0] + arr[n + i]) }.reduce { |s, memo| s == memo ? memo : false }\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 sum_to_n? arr, n\n if arr.size>=2\n for a in arr\n if arr.include?(n-a) and (a != n-a or arr.count(a) > 1)\n return true\n end\n end\n end\n false\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_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 hardcore_two_sum?(arr, target)\n nums = {}\n arr.each{ |n| nums[n] = n }\n\n nums.each do |n,_|\n needed = target - n\n return true if !nums[needed].nil? && nums[needed] != n\n end\n\n false\nend", "def sum_to_n? arr, n\n hash = Hash.new\n arr.each do |val|\n if hash.key? val\n return true\n else\n hash[n-val] = val\n end\n end\n return false\nend", "def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\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 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 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 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 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 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 better_sum?(arr, target)\n pair_set = Set.new\n\n arr.each do |ele|\n if pair_set.include?(ele)\n return true\n else\n pair_set << target - ele\n end\n end\n\n false\n\nend", "def okay_two_sum(arr, target)\n #O(n)\n arr.sort!\n i = 0\n j = arr.length - 1\n while i < j\n sum = arr[i] + arr[j]\n return true if sum == target\n if sum < target\n i += 1\n else\n j -= 1\n end\n end\n false\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 no_consecutive_repeats?(arr)\n return true if arr.length == 1\n arr.inject do |acc, el| \n if acc == el\n return false\n else\n el \n end \n end\n true\nend", "def faster_cont_sum(arr)\n # debugger\n sum = arr[0]\n bool = true\n run_tot = arr[0]\n arr[1..-1].each do |e|\n if bool == false && e > sum\n sum = e\n bool = true\n run_tot = e\n elsif bool == true && e + sum > sum\n sum += e\n run_tot += e\n elsif bool == true && e > sum\n sum = e\n else \n bool = false\n run_tot += e\n end \n end \n sum >= run_tot ? sum : run_tot\nend", "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end", "def okay_two_sum?(arr, target)\n small = arr.select {|el| el < target}\n small.each_with_index do |e, i|\n sub_el = target - e \n # arr.delete(sub_el)\n return true if small.include?(sub_el) && small[i] != sub_el\n \n end\n false \n \n \nend", "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 two_sum?(arr, num) # n\n hsh = {}\n arr.each do |el|\n return true if hsh.key? { el }\n\n hsh[num - el] = true\n end\n false\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 two_sum_to_zero?(arr)\r\n\r\n #\r\n arr.each_index {|index|\r\n index_out = arr.slice(0, index) +arr.slice(index +1, arr.length)\r\n\r\n return true if index_out.include?(-arr[index])\r\n }\r\n false\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 best_two_sum?(arr, target)\n fastest = {}\n arr.each_with_index {|ele, i| fastest[ele] = i }\n arr.each_with_index do |ele, i|\n return true if fastest.has_key?(target - ele) && fastest[target - ele] != i\n end\n false\nend", "def okay_two_sum?(arr,target)\n ans = arr.sort #O(nlogn)\n\n ans.each do |ele|\n temp = ans.shift\n dif = target-temp\n return true if bsearch(arr,dif) == true\n end\n false\nend", "def hash_two_sum(arr,sum)\n arr_hash = Hash.new(0)\n arr.each do |el|\n arr_hash[el] += 1\n end\n\n arr.each do |el|\n return true if arr_hash[sum - el] > 0 &&\n (sum - el != el || arr_hash[sum - el] > 1)\n end\n false\nend", "def c v1, v2, o\n m = false\n d = []\n (0...v2.size).each{ |j|\n if !v1.include? v2[j] + o\n d << v2[j]\n m = true\n end\n }\n for x in d\n v2.delete x\n end\n m\nend", "def sum_to_n? arr, n\n \n if arr.size>=2\n for x in arr\n if arr.include?(n-x) and x != n-x or arr.count(x) > 1\n return true\n end\n end\n end\n \n false\nend", "def reduce_to_all_true(source_array) \n i = 0\n while i < source_array do\n return false if !source_array[i]\n i += 1\n end\nend", "def okay_two_sum?(arr, target_sum)\n array = arr.sort #n log n\n i1 = 0\n i2 = array.length-1\n while i1 < i2\n case array[i1] + array[i2] <=> target_sum\n when 0\n return true\n when -1\n i1 += 1\n when 1\n i2 -= 1\n end\n end\n false\nend", "def okay_two_sum?(arr, target_sum)\n sorted_arr = merge_sort(arr) # O(n * log(n))\n\n sorted_arr.each.with_index do |ele, i| # O(n * log(n))\n diff = target_sum - ele\n next if diff == ele\n return true if !sorted_arr.my_bsearch(diff).nil?\n end\n\n false\nend", "def can_be_summed_by_two_abunds?(n, arr)\n i = 0\n while i < arr.length-1\n j = i+1\n while j < arr.length\n if arr[i] + arr[j] == n\n return true\n end\n j+=1\n end\n i+=1\n end\n return false\nend", "def two_sum(array, target_sum)\n hash = {}\n array.each do |ele|\n hash[target_sum - ele] = ele\n end \n array.each do |ele|\n # debugger\n return true if !(hash[ele].nil? || hash[ele] == ele) \n end \n false \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 solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n return true\n end\n end\n end\n end\n end\n false\nend", "def sum_to_n? arr, n\n if arr.nil? || arr.empty? || arr.size == 1\n return false\n else \n arr.each {|x| arr.each {|y| return true if x + y == n && x != y}}\n end\n return false\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def good_two_sum?(arr, target_sum)\r\n elements = {}\r\n\r\n arr.each do |ele|\r\n return true if elements[target_sum - ele]\r\n elements[ele] = true\r\n end\r\n false\r\nend", "def sum_to_n?(array, num)\n return false if array.length < 2\n hash = Hash.new\n array.each do |val|\n if hash.key? val\n return true\n else \n hash[num-val] = val\n end\n end\n return false\nend", "def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\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 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 missing(ordered)\n first_index = 0\n missings = []\n while first_index < ordered.size - 1\n second_index = first_index + 1\n\n first_missing = ordered[first_index] + 1\n\n until first_missing == ordered[second_index]\n missings << first_missing\n\n first_missing += 1\n end\n\n first_index += 1\n end\n missings\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 not_included(arr) \n hash = Hash.new(0)\n arr.each { |el| hash[el] = 0 }\n i = 1\n # hash[5] == 0\n while true\n return i unless hash.has_key?(i)\n i += 1\n end\nend", "def okay_two_sum?(arr, target_sum) #bsearch = log n => n * log n\n sorted_arr = arr.sort #.sort => n * log n\n sorted_arr.each_index do |i|\n j = sorted_arr.bsearch_index { |n| n + sorted_arr[i] == target_sum }\n return true if !j.nil? && j != i\n end\n false\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 awesome(arr, target)\n hash = Hash.new(0)\n i = 0\n j = i + 1\n while i < arr.size\n hash[arr[i] + arr[j]] += 1 \n if j < arr.size\n j += 1\n else\n i += 1\n if j = i + 1 > arr.length\n j = i \n else\n j = i + 1\n \n end\n\n end\n \n end\n return true if hash[target] >= 1\n false\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 okay_two_sum?(arr, target_sum) # worst case O(N^2), average case O(n log n)\n sorted = arr.sort\n\n arr2 = []\n sorted.each do |num|\n arr2 << target_sum - num\n end\n\n arr2.each_with_index do |num, i| # O(n log n)\n result = sorted.bsearch { |x| x == num }\n if sorted.index(num) == i\n next\n end\n return true if result\n end\n\n false\nend", "def hash_two_sum?(arr, target)\n hash_count = {}\n\n arr.each { |el| hash_count[el] = true }\n\n hash_count.each_key do |key|\n return true unless hash_count[target - key].nil?\n end\n\n false\n \nend", "def two_sum_to_zero?(arr)\n arr.each_with_index do |n1, idx1|\n arr.each_with_index do |n2, idx2|\n next if idx1 == idx2\n return true if (n1 + n2).zero?\n end\n end\n false\nend", "def sum_eq_n?(arr, n)\n if arr == [] && n == 0\n return true\n end\n for i in 0..arr.length-2\n for j in i+1..arr.length-1\n if arr[i] + arr[j] == n\n return true\n end\n end\n end\n return false\nend", "def bf_inversions arr\n count = 0\n (0...arr.size).each do |i|\n ((i+1)...arr.size).each do |j|\n count+=1 if arr[i] > arr[j]\n end\n end\n count\nend", "def sum_to_n?(arr, n)\n for x in arr\n if arr.include?(n - x)\n return true\n end\n end\n return n==0 && arr.empty?\nend", "def has_duplicate_value_linear(array)\n existing_numbers = []\n (array.length - 1).times do |i|\n if existing_numbers[array[i]] == nil\n existing_numbers[array[i]] = 1\n else\n return true\n end\n end\n false\nend", "def naive(set)\n solutions = []\n indexes = (0..set.size-1).to_a\n\n Backtracker.generate do\n candidates { |a| indexes - a }\n solution? { |a| a.size == set.size }\n found_solution do |a| \n solution = a.map { |i| set[i] } \n solutions << solution unless solutions.include? solution\n end\n end\n\n return solutions\nend", "def sum_to_n? arr, n\n return false if arr.empty?#empty to 0\n i=0\n while i < arr.length do#goes throgh all elements\n e = arr.shift#returns the 1st element to e and removes it from array\n arr.each{ |x| return true if x + e == n }#add e and all the remaining elements to see if they add up to n\n i += 1\n end\n false\nend", "def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end", "def second_anagram?(word1, word2)\n p \"Running second_anagram?...\" \n\n start = Time.now\n word2 = word2.split(\"\") #O(n)\n word1.each_char do |char| #O(n)\n char_index = word2.index(char) #O(n)\n if char_index.nil? #O(1)\n return false #O(1)\n else\n word2.delete_at(char_index) #O(1)\n end\n end\n word2.empty? #O(1)\n p \"Took #{Time.now - start} seconds\"\nend", "def sum_to_n?(array, n)\n\n array_size = array.size\n\n i = 0\n\n while i < array_size do\n argument = array.slice!(0)\n array.each{|x| return true if x + argument == n}\n i += 1\n end\n return false\nend", "def checkSum(array, sum)\n if array.nil? or array.empty?\n return false\n else\n sortedArray = []\n sortedArray = array.sort # n*log(n)\n length = sortedArray.count\n rightPointer = length - 1\n leftPointer = 0\n result = false\n\n while leftPointer < rightPointer\n if sortedArray[leftPointer] == rightPointer\n result = false;\n break;\n elsif sortedArray[leftPointer] + sortedArray[rightPointer] > sum\n rightPointer -= 1\n elsif sortedArray[leftPointer] + sortedArray[rightPointer] < sum\n leftPointer += 1\n else\n result = true\n break;\n end\n end \n return result;\n\n # return checkHeadAndRear(sortedArray, sum, length) # n\n end\n\nend", "def amazzzzzzing_two_sum?(arr, target)\n hash = Hash.new\n\n arr.each do |el|\n return true if hash[target - el]\n hash[el] = true\n end\n\n false\nend", "def in_order? (array)\n\tif array[i] < array[i+1] \n\t\trun = 0\n\t\trun += 1\n\t\tn +=1\n\tend\nend", "def two_sums?(arr, target)\n # number_count = Hash.new(0)\n #\n # arr.each do |num|\n # number_count[num] += 1\n # end\n #\n # arr.each do |num|\n # other_num = target - num\n # number_count[num] -= 1\n # return true if number_count.include?(other_num) && number_count[other_num] > 0\n # end\n #\n # false\n set = Set.new(arr)\n arr.each do |num|\n set.delete(num)\n return true if set.include?(target - num)\n end\n false\nend", "def visit_all_rooms?(array) \n visited = {}\n queue = [] \n\n first = array.shift \n\n \n first.each do |key|\n queue << key //3, 0\n end\n\n\n # O(n) * o(m) => O(nm)\n while queue.length > 0 //O(n)\n current_key = queue.shift\n visited[current_key] = true\n array[current_key].each do |key| \n queue << key unless visited[key] == false // 3,0,1 \n end\n end\n\n visited.keys.length == array.length\n\nend", "def fast_two_sum?(arr, tar)\n lookup = {}\n\n arr.each_with_index do |num, idx|\n return true if lookup[tar - num]\n lookup[num] = idx\n end\n\n false\nend", "def two_sum?(arr, target_sum)\n debugger\n complements = {}\n\n arr.each do |el|\n return true if complements[target_sum - el]\n complements[el] = true\n end\n\n false\nend", "def sum_to_n?( arr, n )\n return false if arr.nil? or arr.empty? or arr.length == 1\n arr.each do |first|\n arr.each do |second|\n return true if (first + second == n) and first != second\n end\n end\n false\nend", "def okay_two_sum?(array, target_sum)\n sorted = array.sort #O(logn) (But isn't worst case here O(n^2)?)\n i, j = 0, array.length - 1\n\n while i < j #O(n)\n case (array[i] + array[j]) <=> target_sum\n when 0\n return true\n when -1\n i += 1\n when 1\n j -= 1\n end\n end\n false\nend" ]
[ "0.67565906", "0.6702543", "0.6613357", "0.6567477", "0.64635956", "0.64581907", "0.64401364", "0.6365695", "0.616527", "0.6042195", "0.6039725", "0.6036338", "0.6022691", "0.60194224", "0.60131353", "0.6003689", "0.60026765", "0.59930795", "0.5990014", "0.5977022", "0.5954356", "0.5923286", "0.59216404", "0.5900844", "0.5898558", "0.5895249", "0.5880383", "0.5866953", "0.5854554", "0.5818648", "0.5807551", "0.5804619", "0.5802844", "0.57981193", "0.57978916", "0.5796633", "0.5786547", "0.57831794", "0.5776571", "0.5767004", "0.57643336", "0.5756288", "0.5742731", "0.574213", "0.5739588", "0.57325673", "0.57325345", "0.57314485", "0.57186955", "0.57181793", "0.5711851", "0.57023853", "0.5695977", "0.5694847", "0.56932634", "0.5690193", "0.5688852", "0.56882477", "0.5687655", "0.56848174", "0.5682303", "0.56817424", "0.56811094", "0.5680162", "0.5670141", "0.56664324", "0.5664549", "0.56634855", "0.56630176", "0.5660515", "0.5659638", "0.56576157", "0.565759", "0.56526405", "0.5646915", "0.56428534", "0.56411093", "0.5639174", "0.5636963", "0.5633846", "0.5632695", "0.5624385", "0.5619694", "0.56156594", "0.5614486", "0.56135917", "0.56088424", "0.56061", "0.5600885", "0.5598447", "0.559721", "0.5596486", "0.55946267", "0.55930185", "0.5592281", "0.55909413", "0.5589336", "0.5587902", "0.55872387", "0.5582715", "0.5582183" ]
0.0
-1
without uniq O(N + N) = O(N)
def unique_b?(string) # O(N) string = string.split('') characters = {} # O(N) string.each do |character| return false if characters[character] characters[character] = true end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniq() end", "def uniq!() end", "def using_uniq(array)\n\n \nend", "def uniq\n end", "def uniq\n end", "def uniq(array)\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq()\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def using_uniq(array)\n array.uniq\nend", "def my_uniq(arr)\nend", "def using_uniq(array)\n \n array.uniq\n \nend", "def using_uniq(arr)\n arr.uniq\nend", "def using_uniq(arr)\n arr.uniq\nend", "def my_uniq\n unique = []\n each_index { |i| unique << self[i] unless unique.include?(self[i]) }\n unique\n end", "def using_uniq (array)\n return array.uniq!\nend", "def using_uniq(array)\n array.uniq\n end", "def uniq\n distinct\n end", "def custom_uniq(array)\n final = []\n array.each do |element|\n final << element if !final.include?(element)\n end \n final\nend", "def my_uniq(arr)\n uniques = []\n arr.each do |el|\n uniques << el unless uniques.include?(el)\n end\n uniques\nend", "def uniq(array)\n counts = Hash.new(0)\n result = []\n array.each do |element|\n counts[element] += 1\n result << element unless counts[element] > 1\n end\n result\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 uniq(array)\n finalArray = []\n array.each do |element|\n if !finalArray.include?(element)\n finalArray.push(element)\n end\n end\n return finalArray\nend", "def my_uniq\n unique = []\n self.each do |ele|\n unique << ele if !unique.include?(ele)\n end\n unique\n end", "def my_uniq(arr)\n \n output = []\n hash = Hash.new(false)\n \n arr.each do |x|\n output << x if !hash[x]\n hash[x] = true\n end\n output\n end", "def my_uniq(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] = 1} #value doesnt matter this case\n hash.keys\nend", "def uniq\n dup.uniq! or dup\n end", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def my_uniq(arr)\n hash = {}\n arr.each {|elem| hash[elem] = true}\n hash.keys\nend", "def no_mutter(arr)\n arr.uniq\nend", "def my_uniq(arr)\n hash = {}\n arr.each { |obj| hash[obj] = true }\n hash.keys\nend", "def uniqify(array)\n encountered = Hash.new { |hash, key| hash[key] = false }\n uniqified_array = []\n array.each do |element|\n uniqified_array.push(element) unless encountered[element]\n encountered[element] = true\n end\n uniqified_array\nend", "def find_uniq(arr)\n\tarr.uniq\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def my_uniq(arr)\n unique_set = arr.reduce({}) do |acc, el|\n acc[el] = true\n acc\n end\n unique_set.keys\nend", "def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend", "def my_uniq(array)\n result = []\n array.each { |ele| result << ele unless result.include?(ele) }\n result\nend", "def find_unique_elements(arr)\n \nend", "def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend", "def my_unique(arr)\n res = []\n arr.each do |item|\n res << item unless res.include?(item)\n end\n \n res\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\nend", "def num_uniq\n Set[*self].size\n end", "def uniq!\n im = Rubinius::IdentityMap.from self\n return if im.size == size\n\n Rubinius.check_frozen\n\n array = im.to_array\n @tuple = array.tuple\n @start = array.start\n @total = array.total\n\n self\n end", "def some_methods(obj)\n # obj.uniq\n obj.uniq!\nend", "def my_uniq(arr)\n answer = Hash.new\n arr.each_with_index do |el, i|\n answer[el] = 1\n end\n answer.keys\nend", "def uniq(array)\n\t\n\tcount = Hash.new 0\n\n array.each do |num|\n count[num] += 1\n end\n \n uniqueness = count.select { |k,v| v == 1 }\n uniqueness.select { |k,v| puts k }\n \nend", "def find_dups2\n uniq.select{ |e| (self-[e]).size < self.size - 1 }\n end", "def find_dups2\n uniq.select{ |e| (self-[e]).size < self.size - 1 }\n end", "def unique(array)\n unique_array = []\n\n array.each do |original_element|\n found = false\n\n unique_array.each do |unique_element|\n if original_element == unique_element\n found = true\n break\n end\n end\n\n if !found\n unique_array << original_element\n end\n end\n\n unique_array\nend", "def find_unique_elements(arr)\n# Count how many times each element appears in the array, if an element appears\n# more than once, delete that element and any elements that are equal to it.\n \n arr.each do |i|\n\tif arr.count(i) > 1\n\t\tarr.delete(i)\n\tend\n end\n return arr\nend", "def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend", "def unique(arr)\n uniq = Hash.new(0)\n arr.each { |x| uniq[x] += 1 }\n uniq.select { |k, v| v == 1 }.keys\nend", "def remove_duplicates(array)\nend", "def uniq(arr)\n new_array = []\n arr = arr.sort\n arr.each_with_index do |num, idx|\n new_array << num if num != arr[idx + 1]\n end\n new_array\nend", "def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend", "def my_unique\n dict = Hash.new(false)\n self.each_with_index do |el, idx|\n self[idx] = nil if dict[el]\n dict[el] = true\n end\n self.compact!\n end", "def uniq(arr)\n result = []\n\n hash_of_uniqs = {}\n arr.each do |el|\n hash_of_uniqs[el] = el\n end\n\n hash_of_uniqs.each do |k, v|\n result << v\n end\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 uniq_by\n clean = []\n self.collect{|x| yield(x)}.uniq.each do |x|\n clean << self.select{|y| yield(y) == x}.last\n end\n clean\n end", "def uniques(array)\n test_array=[]\n array.each do |i|\n if test_array.include?(i)==false\n test_array.push(i)\n else \n end\n end\n return test_array\nend", "def unique_in_order(sequence)\n\ta = 0\n\tfinal_arr = []\n\twhile a < sequence.length\n\t\tfinal_arr << sequence[a]\n\t\tduplicate = sequence[a]\n\t\twhile duplicate == sequence[a]\n\t\t\tif sequence[a] == duplicate\n\t\t\t\ta += 1\n\t\t\tend\n\t\tend\n\tend\n\treturn final_arr\nend", "def some_method(array)\n array.uniq\nend", "def my_method(arr)\n arr.uniq!\nend", "def unique_elements(arr)\n\thash = {}\n arr.each { |ele| hash[ele] = true }\n return hash.keys \t\nend", "def min_unique(arr)\n arr.sort! #[1,2,2,3,7]\n uniq = []\n dups = []\n (arr.length ).times do |i|\n if arr[i] == arr[i+1]\n dups << arr[i]\n else \n uniq << arr[i]\n end \n end \n\n dups.each do |el|\n while uniq.include?(el)\n el+=1\n end \n uniq << el\n p uniq\n end \n p uniq.reduce(:+)\nend", "def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\nend", "def unique\n lambda do |rec, acc|\n acc.uniq!\n end\n end", "def uniq(array)\n unique_values = []\n array.each do |el|\n unless unique_values.include?(el)\n unique_values << el\n end\n end\n unique_values\n end", "def unique(integers)\n integers.to_set.to_a\nend", "def unique_elements(arr)\n hash = {}\n arr.each { |ele| hash[ele] = true }\n return hash.keys\nend", "def solution(a)\n a.uniq.count\nend", "def uniques(array)\n hash = Hash[array.map {|x| [x, nil]}]\n print hash.keys\nend", "def find_unique_elements(arr)\n arr_unique = []\n arr.each do |elem1|\n var1 = 0\n arr.each do |elem2|\n if elem1 == elem2\n var1 = var1 + 1\n end\n end\n if var1 <= 1\n arr_unique.push(elem1)\n end\n end\nend", "def duplicate(array)\n array.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each do |item|\n count[item] += 1\n end\n count.keys\n # or could do these_keys = {} arr.each {|item| these_keys[item] = true} these_keys.keys\nend", "def uniq\n :identity\n end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend", "def my_method(arr)\n arr.uniq\nend", "def my_method(arr)\n arr.uniq\nend", "def ruby_unique(original_array)\n array.uniq\nend", "def unique_elements(arr)\n unique = {}\n\n arr.each { |ele| unique[ele] = true }\n\n return unique.keys\nend", "def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end", "def non_duplicated_values(values)\n # Write your code here\n values.uniq!\nend", "def unique_items(ary)\r\n ary.select {|x| ary.count(x) == 1}\r\nend", "def uniq(input, property = T.unsafe(nil)); end", "def set(arr)\n\treturn arr.uniq\nend", "def remove_dups(arr)\n\treturn arr.uniq()\nend", "def remove_duplicates(array)\n uniq_array = []\n array.each {|value| uniq_array << value unless uniq_array.include?(value) }\n return uniq_array\nend", "def array_uniq!(a)\n a.uniq!\n end" ]
[ "0.8110045", "0.78938305", "0.77674484", "0.7644031", "0.7644031", "0.7542324", "0.74677557", "0.74677557", "0.74163395", "0.7414721", "0.7414721", "0.7414721", "0.7414721", "0.7414721", "0.7414721", "0.7387269", "0.73717135", "0.73663557", "0.73663557", "0.7299427", "0.7296251", "0.7237242", "0.72322947", "0.7189898", "0.71819335", "0.71406645", "0.7117755", "0.7106312", "0.71057224", "0.70835155", "0.7065695", "0.7065187", "0.70611984", "0.70611984", "0.70611984", "0.7055862", "0.7053158", "0.7027069", "0.7011823", "0.701151", "0.6946696", "0.6946696", "0.6945163", "0.69386965", "0.6902473", "0.6896516", "0.689258", "0.6890195", "0.686073", "0.6827197", "0.6811202", "0.6808676", "0.6804155", "0.6794702", "0.67898643", "0.67898643", "0.6785621", "0.6783845", "0.6782901", "0.6776107", "0.67638934", "0.6761426", "0.6741919", "0.67089003", "0.6708762", "0.6703693", "0.6689622", "0.6685347", "0.66840607", "0.6682025", "0.66798145", "0.66726065", "0.66642237", "0.6651946", "0.66444254", "0.66391456", "0.66385365", "0.66346836", "0.6632943", "0.66247946", "0.66191447", "0.661755", "0.6616901", "0.6605995", "0.6605995", "0.6605995", "0.66004705", "0.6595814", "0.6593392", "0.6591085", "0.6591085", "0.658413", "0.6578439", "0.65737396", "0.65557957", "0.6531109", "0.65196735", "0.65143055", "0.651226", "0.65074396", "0.6507057" ]
0.0
-1
without a hash O(N)
def unique_d?(string) # assums all characters are letters alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] count = 0 # O(N) while count < string.length character = string[count] # O(1) because alphabet is a constant size return false if !alphabet.include?(character) # O(1) because alphabet is a constant size alphabet.delete(character) count += 1 end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "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 rehash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash()\n #This is a stub, used for indexing\nend", "def uniq() end", "def hash()\n #This is a stub, used for indexing\n end", "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 find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend", "def 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 uniq!() end", "def hash(*) end", "def o1\n hasher = {}\n (0...@n).each do |n|\n sym = n.to_s.to_sym\n hasher[sym] = n\n end\n\n print_header('O(1) examples')\n\n hash_count = hasher.count\n do_benchmark(\"O(1) - Hash with #{hash_count} items\") do\n hasher[hash_count.to_s.to_sym]\n end\n\n self\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n self.begin.hash ^ self.end.hash\n end", "def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end", "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 hash_code; end", "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 uniq\n end", "def uniq\n end", "def my_uniq(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] = 1} #value doesnt matter this case\n hash.keys\nend", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend", "def check_rehash!\n return if @size.to_f/@cardinality < LOAD_FACTOR_THRESHOLD\n\n @cardinality *= 2\n old_arr = @arr.dup\n @arr = []\n old_arr.each do |r|\n next unless r\n\n self.add(r.number, r.name)\n el = r\n while (el = el.next_rec)\n self.add(el.number, el.name)\n end\n end\n end", "def cache_intersection2(nums1, nums2)\n outer_cache = {}\n nums1.each do |n|\n next if outer_cache[n]\n outer_cache[n] = true\n end\n array = []\n inner_cache = {}\n nums2.each do |n|\n next if inner_cache[n]\n array << n if outer_cache[n]\n inner_cache[n] = true\n end\n array\nend", "def hash(key); end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend", "def geohash(key, member); end", "def find_it(seq)\n # hash = Hash.new\n \n # seq.each do |num|\n # if hash[num].nil?\n # hash[num] = 1\n # else\n # hash[num] += 1\n # end\n # end\n \n hash = Hash.new(0)\n seq.each { |num| hash[num] += 1 }\n \n hash.each { |k, v| return k if v.odd? }\nend", "def using_uniq(array)\n\n \nend", "def compute_element_occurrence(values)\n uniq_elements = Hash.new(0)\n values.map { |x| uniq_elements[x] += 1 }\n uniq_elements\nend", "def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend", "def map(hash); end", "def cache_intersection(nums1, nums2)\n array = []\n outer_cache = {}\n inner_cache = {}\n nums1.each do |outer|\n next if outer_cache[outer]\n outer_cache[outer] = true\n nums2.each do |inner| \n next if inner_cache[inner]\n if outer == inner \n array << inner\n inner_cache[inner] = true\n end\n end\n end\n array\nend", "def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend", "def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\nend", "def my_uniq(arr)\n hash = {}\n arr.each { |obj| hash[obj] = true }\n hash.keys\nend", "def index_of(item)\n hash_value = 0\n item.each_byte { |byte| hash_value += byte }\n hash_value % @table.size\n end", "def solution(a)\n # write your code in Ruby 2.2 \n frecuencies = a.each_with_object(Hash.new(0)) { |key, value| value[key] += 1 } \n \n frecuencies.each do |key, value|\n if value.odd? then return key end\n end\nend", "def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end", "def inject!(hash); end", "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 my_uniq(arr)\n hash = {}\n arr.each {|elem| hash[elem] = true}\n hash.keys\nend", "def find_it(seq)\r\n counts = seq.each_with_object({}) { |n, hash| hash[n] = seq.count(n) }\r\n counts.key(counts.values.find(&:odd?))\r\nend", "def hash\n size.hash ^ rank.hash\n end", "def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend", "def hash\n @vector\n end", "def redundancy(array, sensitive=true)\n if sensitive == false\n array = lower(array)\n end\n base = array.to_a.sort! { |x, y| x.to_s <=> y.to_s }.uniq\n occurence = {}\n n, b = 0, 0\n base.each do |x|\n while x == array[n]\n n += 1\n end\n occurence[x] = n - b\n b = n\n end\n puts occurence\nend", "def collate!\n @buckets = @buckets.sort { |a,b| b.time <=> a.time }\n @ordered = {}\n @buckets.map { |o| o.identity }.uniq.each do |identity|\n @ordered[identity] = @buckets.select { |o| o.identity == identity }\n end\n return @buckets\n end", "def test_array_hash\r\n # a = %w(brendan baird billy)\r\n # assert_equal(1047868961, a.hash)\r\n end", "def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def unoptimized_find_unique_integer(id_array)\n histogram = Hash.new(0)\n id_array.each do |id|\n histogram[id] += 1\n end\n histogram.keys.each do |key|\n return key if histogram[key] == 1\n end\n return nil\nend", "def find_hash(possible_words, known_anagram, known_md5s, start, n = 3)\n cpus = Parallel.processor_count\n puts \"Total number of iteration: #{possible_words.length**n}\"\n puts \"You got #{cpus} cores\"\n\n hash_table = get_hash_table(known_anagram)\n known_hash = get_hash(known_anagram, hash_table)\n\n Parallel.map(possible_words, in_processes: cpus) do |w1|\n possible_words.each do |w2|\n possible_words.each do |w3|\n # Print every ten million iteration\n phrase = \"#{w1} #{w2} #{w3}\"\n\n # Allow only equal size phrases\n next unless phrase.length == known_anagram.length\n\n # Allow only equal hash phrases\n hash = get_hash(phrase, hash_table)\n next unless hash == known_hash\n\n # All only equal md5 phrases\n md5 = Digest::MD5.hexdigest phrase\n next unless known_md5s.include?(md5)\n\n puts \"#{phrase} #{md5} (#{Time.now - start}s)\"\n end\n end\n end\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 bigSorting(unsorted)\n\nend", "def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\nend", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def intersect nums1, nums2\n result = []\n return result if nums1.size == 0 or nums2.size == 0\n\n counter_cache = {}\n counter_cache = nums1.inject({}) { |result, n|\n result[n] ||= 0\n result[n] += 1\n result\n }\n\n nums2.each do |n|\n if counter_cache[n] and counter_cache[n] > 0\n result << n\n counter_cache[n] -= 1\n end\n end\n result\nend", "def hash() source.hash ^ target.hash; end", "def unique_elements(arr)\n\thash = {}\n arr.each { |ele| hash[ele] = true }\n return hash.keys \t\nend", "def uniq(array)\nend", "def unique_in_order(iterable) \n# create an empty array\ncontent = []\n\n # check each letter/number of `iterable` \n for e in (0..iterable.length()-1) \n\n# compare current element to previous element\n# if array is empty\n if e == 0 or \n# \n# if current element is not the same with previous element, push current index to content array\n iterable[e] != iterable[e-1] \n content.push(iterable[e])\n end\n end\n# return new content array\n return content\nend", "def memo; end", "def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\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 find_unique_elements(arr)\n \nend", "def solution(arr)\n temp_hash_odd_balls = {}\n\n arr.each { |el| temp_hash_odd_balls[el] ? temp_hash_odd_balls.delete(el) : temp_hash_odd_balls[el] = 0 }\n\n temp_hash_odd_balls.keys.first\nend", "def find_it(seq)\n uniqueInts=seq.uniq\n\n uniqueInts.each do |value|\n k=0\n seq.each do |mainSeq|\n k+=1 if mainSeq==value\n end\n return value if k%2==1\n end\nend", "def two_sum_hash(numbers, target)\n n_index = {} \n (0...numbers.length).each do |i2|\n i1 = n_index[target - numbers[i2]] \n\n # We know that n[i2] > n[i1] because input array is sorted.\n return [i1 + 1, i2 + 1] if i1 && i1 != i2\n n_index[numbers[i2]] = i2\n end\nend", "def find_unique_elements(arr)\n collect = Hash.new 0\n \n arr.each do |elt|\n collect[elt] += 1\n end\n\n unique_hash = Hash(collect.select {|k,v| v == 1})\n \n unique_hash.keys\nend", "def my_uniq(arr)\n \n output = []\n hash = Hash.new(false)\n \n arr.each do |x|\n output << x if !hash[x]\n hash[x] = true\n end\n output\n end", "def uniques(array)\n hash = Hash[array.map {|x| [x, nil]}]\n print hash.keys\nend", "def hash_to_id(h,i)\n\tif h[i] == 0\n\t\th[i] = h.size+1\n\tend\n\th[i]\nend", "def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend", "def my_unique\n dict = Hash.new(false)\n self.each_with_index do |el, idx|\n self[idx] = nil if dict[el]\n dict[el] = true\n end\n self.compact!\n end", "def first_duplicate2(a)\n found = {}\n a.each do |x|\n return x if found[x]\n found[x] = true\n end\n -1\nend", "def dupe_indices(array)\n #ht = Hash.new {|h,k| h[k]=[]}\n #ht[\"cats\"] << \"Jellicle\"\n #ht[\"cats\"] << \"Mr. Mistoffelees\"\n hash = Hash.new { |h,k| h[k]=[] }\n array.each_with_index do |char, i|\n hash[char] << i\n end\n \n # puts \"Hash b select form : #{b.select{|key, value| value < 200}}\\n\\n\n hash.select{ |k,v| v.length > 1}\n\n\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 find_fast(u)\n u += 0xe91aaa35\n u ^= u >> 16\n u += (u << 8) & 0xFFFFFFFF\n u &= 0xFFFFFFFF\n u ^= u >> 4\n b = (u >> 8) & 0x1ff\n a = ((u + ((u << 2) & 0xFFFFFFFF)) & 0xFFFFFFFF) >> 19\n a ^ Arrays::HASH_ADJUST[b]\n end", "def find_pair(array,sum)\n indices = []\n hash = Hash.new\n array.each_with_index do |element,i|\n if hash[sum - element] != nil then\n indices.push(\"#{hash[sum - element]},#{i}\")\n end\n hash[element] = i\n end\n indices\nend" ]
[ "0.6504625", "0.64225435", "0.63155615", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.62428355", "0.61674774", "0.61622703", "0.61504877", "0.6127353", "0.6115558", "0.6080133", "0.60714984", "0.60689265", "0.60091203", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.5999503", "0.59494054", "0.5943563", "0.59405255", "0.58483845", "0.5839172", "0.58241475", "0.58241475", "0.5822693", "0.58177584", "0.58123696", "0.58108944", "0.5810118", "0.58037615", "0.57798624", "0.57798624", "0.5755324", "0.5727881", "0.56990004", "0.569385", "0.5693024", "0.5689191", "0.56850225", "0.5664702", "0.5664095", "0.5644784", "0.56351846", "0.56331176", "0.5629521", "0.56245995", "0.56073594", "0.5603113", "0.55957824", "0.55927974", "0.55863935", "0.55766624", "0.5574667", "0.55421007", "0.553276", "0.552347", "0.55226487", "0.5522241", "0.55221367", "0.55165726", "0.55127", "0.55108064", "0.55078673", "0.5506112", "0.55044895", "0.5501102", "0.5499652", "0.5496441", "0.54962635", "0.54948896", "0.54923266", "0.5485928", "0.54827595", "0.5478343", "0.54760915", "0.547296", "0.54682976", "0.5466638", "0.54656976", "0.54633", "0.54623294", "0.5459276", "0.5458421", "0.54563475", "0.545578", "0.54556274", "0.54506284", "0.54498583", "0.54446477" ]
0.0
-1
Creates a new array
def square self.map {|x| x ** 2} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_array_new(size)\n Array.new(size) { Array.new(size) { '0' } }\nend", "def instantiate_new_array\n<<<<<<< HEAD\n Array.new\nend", "def array_array(rn, cn, iv = 1)\n Array.new(rn) { Array.new(cn, iv) }\nend", "def create_new_players_moves_array\n player_moves = Array.new(2) { Array.new }\n player_moves[0] = @data[0].dup\n player_moves[1] = @data[1].dup\n return player_moves\n end", "def make_array\n <<-CODE\n next_int;\n t1 = array_new(state, _int);\n j = _int - 1;\n for(; j >= 0; j--) {\n t2 = stack_pop();\n array_set(state, t1, j, t2);\n }\n\n cpu_perform_hook(state, c, BASIC_CLASS(array),\n global->sym_from_literal, t1);\n stack_push(t1);\n CODE\n end", "def make_array(n)\n if n.class != Array\n x = []\n x << n\n array = x\n return array\n else\n return n\n end\n end", "def create_array(one, two, three)\n\treturn [one, two, three]\nend", "def array(before: Pass.instance, each: Pass.instance, after: Pass.instance)\n ArrayV.new before: before, each: each, after: after\n end", "def create_array(base_type, element_count, size = 0)\n if base_type.respond_to?(:name)\n base_type = base_type.name\n end\n return build(\"#{base_type}[#{element_count}]\", size)\n end", "def create_an_array\n [\"a\", \"b\", \"c\", \"d\"]\nend", "def Array(p0) end", "def createArray(size)\n\treturn Array.new(size) {rand(1..1000)};\nend", "def build_array\n arr = []\n yield(arr)\n arr \n end", "def array_with_two_elements\n ary = Array.new\n Array.new(2)\nend", "def array_with_two_elements\n @my_two_array = Array.new(2)\nend", "def array_init(size, value)\n arr = Array.new(size) { value }\nend", "def create_an_array\n [\"oranges\",\"apples\",\"kiwis\",\"mangos\"]\nend", "def create_empty_array\n @outcome_array = Array.new(find_number_of_rows+1) { Array.new(find_number_of_columns+1) }\nend", "def make_array(item1, item2, item3)\n\tarray = [item1, item2, item3]\n\n\tarray\nend", "def copy_array(arr)\n a = Array.new(arr.length)\n a.each_with_index do |v,i|\n a[i] = arr[i]\n end\n a\nend", "def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend", "def converted_arrays; end", "def to_a; [Array]; end", "def array_copy(a)\n n = []\n a.each do |i|\n n.push(i)\n end\n n\nend", "def build_array(it1, it2, it3)\n\tnew_array = [it1, it2, it3]\n\tp new_array\nend", "def two_array_copy(a)\n new_a = Array.new(a.length)\n new_a.each.dup\n return new_a\n end", "def beer(arr, x, y)\n build = Array.new \n arr << x << y \nend", "def as_array\n @fm.dup\n end", "def build_array(x, y, z)\n array = []\n array.push(x, y, z)\nend", "def to_a; Array(force) end", "def new_with_progenitor array\n iter_ary = IterableArray.new array\n iter_ary.take_progenitor @progenitor\n iter_ary\n end", "def initialize array\n @array = array\n end", "def create_array\n array = []\n rand_size = rand(10) + 1\n (0..rand_size).each do\n array.push(rand(1000))\n end\n return array\nend", "def to_a\n Array.wrap(self)\n end", "def build_array(a, b, c)\n\tx = []\n\treturn x.push(a, b, c)\nend", "def to_a\n @arr\n end", "def make_array(startArrayValue, endArrayValue)\n\tresultArray = []\n\tfor i in startArrayValue..endArrayValue\n\t\tresultArray.push(i)\n\tend\n\treturn resultArray\nend", "def to_array\n array = []\n self.each { |x| array.push x }\n return array\n end", "def to_a\n result = []\n size.times { |i| result << self[i] }\n result\n end", "def array(*args)\n args_ = (args.size == 1) && (args[0].is_a? ::Array) ? args[0] : args\n args_.each_with_object(newObject('Array')) do |val, obj|\n obj.add val\n end\n end", "def ary(n); Array.new(n){rand}; end", "def to_a\n array\n end", "def initialize\n @more_array = Array.new\n end", "def array_clone\n new_map = @map.inject([]) do |result,rows|\n result << rows.collect { |e| e}\n end\n \n \n end", "def array\n raise \"Not implemented\"\n end", "def to_a\n a = Array.new(stop)\n self.each { |i,v| a[i] = v }\n return a\n end", "def create_copy(arr)\n copy = []\n arr.each { |e| copy.unshift(e) }\n copy\nend", "def mda(width, height) \n return Array.new(width){ Array.new(height) }\nend", "def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend", "def [](length)\n self::Array.new(length)\n end", "def make_array\n [@name, @author, @deviation_url, @views, @favs, @comments]\n end", "def to_flex_array\n self\n end", "def beer(arr, x, y)\n\tbuild = Array.new\n\tarr << x << y \nend", "def square_array(array)\n new_array =[]\n\n counter = 0\n\nend", "def airports_normal\n return Array.new\n end", "def push_to_array_jeff(original_array, new_item)\n # I think this is my best\n\n # make new_array that's one item longer than original\n original_length = original_array.length\n new_array = [nil] * (original_length + 1)\n # add all original items to new_array\n original_array.each_with_index do |val, idx|\n new_array[idx] = val\n end \n # make new_item the last element of new_array\n new_array[original_length] = new_item\n return new_array\nend", "def to_array\n return [@filename,\n @timestamp,\n @source,\n @rmr_number,\n @series_description,\n @gender,\n @slice_thickness,\n @slice_spacing,\n @reconstruction_diameter, \n @acquisition_matrix_x,\n @acquisition_matrix_y]\n end", "def set_array!(values)\n @objects = []\n @memory = FFI::MemoryPointer.new(MsgObject,values.length)\n\n values.each_with_index do |value,index|\n @objects << MsgObject.new_object(value,@memory[index])\n end\n\n self[:type] = :array\n\n array = self[:values][:array]\n array[:size] = values.length\n array[:ptr] = @memory\n end", "def to_array(array=nil)\n if array\n array.start = 0\n array.total = @size\n else\n array = Array.new @size\n end\n\n i = 0\n while i < @capacity\n array[@table[i+2]] = @table[i+1] if @table[i]\n i += 4\n end\n\n unless @spill.empty?\n i = @spill.to_iter 3\n while i.next\n array[i.at(2)] = i.at(1) if i.item\n end\n end\n\n array\n end", "def my_array_splitting_method(source)\n new_array=[[], []]\n \n source.each do |x|\n if x.is_a?(Integer)\n new_array[0]<<x\n else \n new_array[1]<<x\n end\n end\nnew_array\n\nend", "def __array__; self; end", "def build_array(param1, param2, param3)\n\t[param1, param2, param3]\nend", "def initialize; @ary = []; end", "def array(input_array)\n output = input_array + [100] # Creates a new array by adding '[]' to the string \"100\",\n # then combines \"input_array\" and \"[\"100\"]\" arrays by '+'\n return output\nend", "def to_array_of(type, base_ptr, num)\n base_ptr = base_ptr.to_ptr\n\n (0...num).map { |i| type.new(base_ptr + i*type.size) }\n end", "def build_array(length)\n return_array = []\n length.times do\n return_array << rand(100)\n end\n return return_array\nend", "def array(op, len, work) # DK:P297\n\t\t\t\twarn \"array is not implemented\"\n\t\t\tend", "def assignation_array() \n array = []\n \n count = self.assignation_count()\n #puts \"COUNT: #{count}\".yellow.on_black\n for i in 0..(count-1)\n #puts \"ADD element\".yellow.on_black\n array << self.assignation(i)\n end\n \n array\n end", "def to_a ; data.dup ;end", "def create_array_tc(length, element_type)\n return CORBA::TypeCode::Array.new(element_type, length)\n end", "def extend_array(size)\n return Array.new(size) do |x|\n @coeffs[x] || 0.0\n end\n # return @coeffs + Array.new(size - @coeffs.size, 0.0)\n end", "def to_a; []; end", "def to_ary; []; end", "def initialize\n @array = []\n end", "def to_flat_array\n ary = Array.new(self.size)\n self.each.with_index { |v,i| ary[i] = v }\n ary\n end", "def copy array\n array.map(&:clone)\nend", "def copy_tg(tg)\n result = [Array.new(tg[0].size),Array.new(tg[1].size)]\n tg[0].each_index do |n|\n result[0][n] = Array.new(tg[0][n])\n end\n tg[1].each_index do |e|\n result[1][e] = Array.new(tg[1][e])\n end\n result\nend", "def to_a\n @array ||= [name, depth]\n end", "def get_oneDArray(shape,twoDArray)\n oneDArray = Java::double[shape[0]*shape[1]].new\n index = 0\n (0...shape[0]).each do |i|\n (0...shape[1]).each do |j|\n oneDArray[index] = twoDArray[i][j]\n index+=1\n end\n end\n oneDArray\n end", "def to_a\n to_ary.dup\n end", "def initialize\n @a = Array.new(3){Array.new(3){Array.new(3)}}\n end", "def cast_array\n <<-CODE\n t1 = stack_pop();\n if(REFERENCE_P(t1) && object_kind_of_p(state, t1, global->tuple)) {\n t1 = array_from_tuple(state, t1);\n } else if(!REFERENCE_P(t1) || !object_kind_of_p(state, t1, global->array)) {\n t2 = array_new(state, 1);\n array_set(state, t2, 0, t1);\n t1 = t2;\n }\n stack_push(t1);\n CODE\n end", "def yale_nd_row_as_array i\n yale_nd_row(i, :array)\n end", "def create_sample_array\n sample_array = []\n\n\n # add songs to sample-array in correct ratios\n @spins_per_week.each do |k,v|\n v.times { sample_array.push(PL::db.get_song(k)) }\n end\n\n sample_array\n end", "def to_a\n to_ary.dup\n end", "def create_empty(rows, columns)\n @rch = Array.new(rows)\n @gch = Array.new(rows)\n @bch = Array.new(rows)\n \n 0.upto rows-1 do |r|\n @rch[r] = Array.new(columns, 0)\n @gch[r] = Array.new(columns, 0)\n @bch[r] = Array.new(columns, 0)\n end \n end", "def constructor\n\t\t\tarray_of_arrays = []\n\t\t\t6.times do |i|\n\t\t\t\tarray_of_arrays[i] = []\n\t\t\t\t7.times do \n\t\t\t\t\tarray_of_arrays[i] << Token.new \n\t\t\t\tend\n\t\t\tend\n\t\t\tarray_of_arrays\n\t\tend", "def initialize arr = []\n super arr\n end", "def to_a; [w, x, y, z] end", "def initialize\n @size = 10\n @array = Array.new(@size) { [] }\n @count = 0\n end", "def initialize(val, nombre)\n @value = Array.new(nombre, val)\nend", "def mutliplied(array)\nend", "def double_array(array)\n array + array\nend", "def to_a\n a = Array.new(size).fill(0)\n @elements.each_pair { |k,v| a[k] = v }\n a\n end", "def arraycreate(filename)\n\tarray = IO.readlines(filename)\n\tselector(array, filename)\nend", "def arraycreate(filename)\n\tarray = IO.readlines(filename)\n\tselector(array, filename)\nend", "def [](index)\n Array.new([index])\n end", "def double_array(array)\n array.concat(array)\nend", "def create_hash_from_array(array, hash)\n result = array << hash\n return result\nend", "def create_arr\n k = []\n n = self.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k.append(n.value.create_arr)\n else\n k.append(n.value)\n end\n n = n.next\n end\n return k\n end", "def create_game_field_array\r\n\t\r\n\t\ti=0\r\n\t\twhile i < 8 do\r\n\t\t\tj=0\r\n\t\t\t\r\n\t\t\twhile j < 8 do\r\n\t\t\t #Copy the \".\" object in the actual Position of the 2 dimensional Array \r\n\t \t @nha[i][j] =\".\"\t\t\r\n\t\t\t\tj+=1\t\t\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\treturn true\r\n\tend" ]
[ "0.74652296", "0.6970988", "0.69395626", "0.69199824", "0.69199246", "0.68641895", "0.67733884", "0.67700714", "0.67660755", "0.6763177", "0.6754282", "0.6748965", "0.6645105", "0.6630614", "0.6614212", "0.6545823", "0.6503649", "0.6487088", "0.64827317", "0.6474626", "0.6406046", "0.6352382", "0.63053495", "0.6267785", "0.6262806", "0.624902", "0.6230199", "0.6217693", "0.6215701", "0.62040377", "0.6182444", "0.6153626", "0.61455494", "0.6131585", "0.6123209", "0.6118935", "0.6114409", "0.60804105", "0.60545343", "0.6046031", "0.6040216", "0.60389876", "0.60349226", "0.60279506", "0.60230404", "0.6008544", "0.6008491", "0.60031724", "0.5998224", "0.5996341", "0.5960627", "0.5955058", "0.5954427", "0.59463364", "0.59428453", "0.5936855", "0.59139055", "0.5897904", "0.5892036", "0.58875656", "0.588551", "0.5880358", "0.58747524", "0.5867892", "0.5864247", "0.5860666", "0.58488476", "0.58480674", "0.58472615", "0.58452195", "0.58402604", "0.58269036", "0.58205813", "0.581061", "0.58005357", "0.5787993", "0.57875097", "0.5775529", "0.577304", "0.57468593", "0.57448936", "0.5741644", "0.5738621", "0.57322973", "0.57321036", "0.5730653", "0.572581", "0.57227665", "0.57057244", "0.57016283", "0.569626", "0.5684284", "0.56832033", "0.5682721", "0.5682085", "0.5682085", "0.5667273", "0.56634605", "0.56562895", "0.56557614", "0.5651384" ]
0.0
-1
Replaces existing array because of !
def square! self.map! {|x| x ** 2} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_to_no_change(array)\n return array\nend", "def update_arr2(var)\n\tvar.uniq!\nend", "def replace_without_hooks( other_array )\n \n @without_hooks = true\n\n replace( other_array )\n \n @without_hooks = false\n \n return self\n \n end", "def add_bang(array)\n\tarray.map {|string| string + \"!\"}\nend", "def replace_array(match_array, replace_arry)\n array = []\n match_array\n self.each_index{|i|\n if self[i].eql?(match_array.first) and self.slice(i, match_array.count).eql?(match_array)\n array.concat self.first(i)\n array.concat replace_arry\n array.concat self.drop(i + match_array.count)\n break\n end\n }\n array = self if array.empty?\n array\n end", "def map_to_no_change(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array << source_array[i]\n \n i += 1\n end\n \n new_array\nend", "def replace(other_ary)\n other_ary = _ensure_array_is_valid other_ary\n super\n end", "def mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def map_to_no_change(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index])\n index += 1 \n end\n return array\nend", "def setNotSeen\n\t\t@suspects.length.times{ |i| @suspectsNotSeen[i] = @suspects[i] }\n\t\t@locations.length.times{ |i| @locationsNotSeen[i] = @locations[i] }\n\t\t@weapons.length.times{ |i| @weaponsNotSeen[i] = @weapons[i] }\n\tend", "def mutliplied(array)\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def no_mutate(arr)\n arr.uniq!\nend", "def remove_evens!(arr)\n cloned_arr = arr.dup\n arr.each do |num|\n if num % 2 == 0\n cloned_arr.delete(num)\n end\n end\n cloned_arr\nend", "def fix_the_meerkat(arr)\n arr.reverse!\nend", "def remove_evens!(arr)\n cloned_arr = arr.dup\n cloned_arr.each do |num|\n if num % 2 == 0\n arr.delete(num)\n end\n end\n arr\nend", "def add_bang(array)\n array.map {|string| string+\"!\"}\nend", "def my_array_modification_method!(source, thing_to_modify)\r\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\r\nend", "def calculate_doubles!(arr)\n arr.map!{|a|a=a*2}\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.map! do |e|\n if e.class == Fixnum\n e = e + thing_to_modify\n elsif e.class == String\n e = e\n end\n end\n return source\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def no_mutate(array)\n array.last #returns array with last item removed, no mutation of array\nend", "def ele_replace!(array, hash)\n array.map! do |ele| #go through the array\n if hash.has_key?(ele) #hash contains a key thats also in the array arr = [4,2,0,2] vs hash = {2=>two, 0 => zero} \n hash[ele] #convert array values with corresponding hash values -> [ ... ,two,zero,two]\n else\n ele #if array value doesnt correspond with hash key, place array index back to original position -> [ 4,...,...,...]\n end\n end\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.map! do |element|\n if element.class == Fixnum\n element += thing_to_modify\n else\n element = element\n end\n end\nend", "def my_array_modification_method(source, thing_to_modify)\n source.map!{ |x| (x==/\\d/ ? x+thing_to_modify : x) }\nend", "def replace_index!(arr, i,array)\n arr.replace( (arr[0, i] || []) + array + arr[i + 1 .. -1] )\n end", "def clean_up_arrays\n self.likes.reject! {|l| l.empty? } if self.likes\n self.outdoor_activities.reject! {|l| l.empty? } if self.outdoor_activities\n self.nightlife.reject! {|l| l.empty? } if self.nightlife\n end", "def mutate(arr)\n arr.pop # (no bang! here) mutates\nend", "def no_correction(teams)\n\tteams.each do |team|\n\t\ti = 0\n\t\tj = RC_AP.num_cols\n\t\twhile i < RC_AP.num_rows\n\t\t\tif RC_AP.rows[i][5] == team\n\t\t\t\ttmp = RC_AP[(i + 1), j] + 'x'\n\t\t\t\tRC_AP[(i + 1), j] = tmp\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\tend\n\tRC_AP.save \nend", "def light_switcher(array, inc)\n counter = 0\n\n while counter < array.length\n array[counter] = !array[counter] if (counter + 1) % inc == 0\n counter += 1\n end\n\n array\nend", "def my_array_deletion_method(source, thing_to_delete)\n p source.delete_if {|thing_to_modify| thing_to_modify.to_s.include? (thing_to_delete)}\nend", "def remove_nils_and_false_from_array(arr)\n reformed_array = []\n index = 0\n arr.each do |entry|\n if entry != nil && entry != false\n reformed_array.insert(index, entry)\n index += 1\n end\n end \n return reformed_array\nend", "def my_array_modification_method!(source, thing_to_modify)\n\n source.map! do |x|\n\n if x.class == Fixnum\n\n x + thing_to_modify\n else\n x\n end\n\n end\n\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.map! { |word| word.is_a?(Integer) ? word + thing_to_modify : word }\nend", "def array_times_two!(arr) #note the ! to indicate what it does\n arr.each_with_index { |num, idx| arr[idx] = num*2 }\nend", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\nend", "def element_replace(arr, hash)\n elements = []\n arr.each do |value|\n if hash[value] != nil\n elements << hash[value]\n else\n elements << value\n end\n end\n return elements\nend", "def replace_nil_with_nan\n hydrate_array\n @outcome_array.each { |row| row[row.index(nil)] = \"nan\" if row.include?(nil) } \n print \"#{@outcome_array} \\n\"\nend", "def array_uniq!(a)\n a.uniq!\n end", "def my_array_deletion_method!(source, thing_to_delete)\n source.select! {|el| el.to_s.include?(thing_to_delete) == false}\nend", "def element_replace(arr, hash)\n new_arr = []\n\n arr.each { |element| hash.key?(element) ? new_arr << hash[element] : new_arr << element }\n\n new_arr\nend", "def fixed_array\n reformated_array.map! do |element|\n element.join(\", \").split(\", \")\n end \nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def no_mutate(arr)\n arr.uniq\nend", "def my_array_modification_method!(i_want_pets, thing_to_modify)\n i_want_pets.map! {|element| element.is_a?(Integer)? (element + thing_to_modify) : element}\nend", "def inject_evil_symbols(array)\n array.insert(\n rand(0..array.length),\n [rand(9999), 9999]\n ).flatten!\nend", "def my_array_modification_method(array, number)\n\tarray = array.map! do |x|\n\t\tif x.is_a?(Integer)\n\t\t\tx + number\n\t\telse\n\t \tx\n\t end\nend\nend", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if do |item| \n item.to_s.include? thing_to_delete\n end\n source\nend", "def no_mutate(array)\n\tarray.last\nend", "def my_array_deletion_method!(source, thing_to_delete)\n\n var_to_delete = thing_to_delete\n\n source.map! {|str| str.to_s}\n p source.delete_if {|str| str.include?(var_to_delete)}\n\nend", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete)}\nend", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete)}\nend", "def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend", "def my_array_modification_method(source, thing_to_modify)\n len = source.length; # find the number of elements in the array\n # for each element in the array see if it is a string\n 0.upto(len - 1) do |loc|\n # if the element is NOT a string, add thing_to_modify to it\n if source[loc].is_a?(String) === false\n source[loc] += thing_to_modify\n end\n end\n return source\nend", "def add_bang(array)\n # TODO: Take an array of strings and return a new array with \"!\" appended to each string.\n # You should use Enumerable#map\n array.map do |element|\n element+\"!\"\n end\nend", "def replace(other_array)\n other_array.each { |val| raise_on_type_mismatch!(val) }\n original_target = skip_strict_loading { load_target }.dup\n\n if owner.new_record?\n replace_records(other_array, original_target)\n else\n replace_common_records_in_memory(other_array, original_target)\n if other_array != original_target\n transaction { replace_records(other_array, original_target) }\n else\n other_array\n end\n end\n end", "def my_array_deletion_method!(source, thing_to_delete)\n source.each do |thing|\n if thing.to_s.downcase.include?(thing_to_delete)\n source.delete(thing)\n end\n end\n source\nend", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include? thing_to_delete}\nend", "def my_array_modification_method!(array, num)\n array[2] = array[2] + num\n array[-1] = array[-1] + num\n array\nend", "def mutate(arr)\n arr.pop\n end", "def no_mutate(array)\n array.last #returns the last element of the array but does not actually permanently modify the array in any way\nend", "def my_array_modification_method(source, thing_to_modify)\n new_array = []\n source.each { |a|\n if a.is_a? Integer\n new_array << a + thing_to_modify\n else\n new_array << a\n end\n }\n source.replace(new_array)\nend", "def my_array_modification_method!(sentence_array, increment)\n sentence_array.map! do |word|\n if word.is_a?(Integer)\n word += increment\n else\n word # no change, but needs to be specified or word goes to nil\n end\n end\n return sentence_array\nend", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |x| x.to_s.include?(thing_to_delete)}\nend", "def remove_evens!(arr)\n arr.each do |num|\n if num % 2 == 0\n arr.delete(num)\n end\n end\n arr\nend", "def overwrite(new_array)\n redis.with do |conn|\n conn.pipelined do\n conn.del(key)\n conn.rpush(key, new_array)\n end\n end\n end", "def my_array_modification_method!(source, thing_to_modify)\n\nreturn source.collect! { |item| item.is_a?(Fixnum) ? item + thing_to_modify : item}\nend", "def not_x\n x = @x.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = (x[i] == 1) ? 0 : 1 } \n\n @z.content = z\n end", "def replace_with_flat_array(array)\n begin\n array = vash_validate_flat_array(array)\n rescue Puppet::Util::PTomulik::Vash::VashArgumentError => err\n raise err.class, err.to_s\n end\n hash = Hash[*array]\n # On 1.8 using 'super' breaks rspec tests :(.\n self.class.superclass.instance_method(:replace).bind(self).call(hash)\n self\n end", "def replace!( *entries )\n _modify( *entries ) { |a,b| b }\n end", "def update_array_at_with(array, index)\n board[index] = \"X\"\nend", "def arrayReplaceAt(src, pos, newElements)\n src[pos] = newElements\n src.flatten!(1)\n return src\n end", "def my_array_modification_method(source, thing_to_modify)\n return source.map! {|i| i.is_a?(Integer) ? (i + thing_to_modify) : i}\nend", "def super_fizzbuzz(array)\n newarray = []\n array.each do |x|\n \tif x % 15 == 0\n \t\t newarray << \"Fizzbuzz\"\n \telsif x % 5 == 0\n \t newarray << \"Buzz\"\n\telsif x % 3 == 0\n\t\tnewarray << \"Fizz\"\n\telse\n\tnewarray << x\n\tend\nend\nputs newarray\nputs array\narray.replace(newarray)\nputs array\nend", "def ensure_non_null_array_entry(hash, key)\n hash[key] = [] unless hash.key?(key)\n end", "def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |word| word.to_s.include? thing_to_delete }\nend", "def my_array_deletion_method(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete) == true}\nend", "def my_array_modification_method!(source, thing_to_modify)\n source.map! { |i| i.is_a?(Integer)? (i + thing_to_modify) : i }\nend" ]
[ "0.65128976", "0.6384678", "0.62718666", "0.62189436", "0.61562175", "0.6131723", "0.6110143", "0.59053826", "0.5897488", "0.5897488", "0.5897488", "0.58891726", "0.5811728", "0.58056056", "0.58044577", "0.58044577", "0.5753077", "0.57413214", "0.57382417", "0.572978", "0.5711932", "0.5672719", "0.5660748", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.5645522", "0.56437385", "0.56265396", "0.5619833", "0.5608673", "0.55592746", "0.55415255", "0.5540807", "0.5538547", "0.55351484", "0.5527661", "0.5525872", "0.5518699", "0.5514301", "0.5499703", "0.54863596", "0.5485672", "0.54783165", "0.547699", "0.5465448", "0.546337", "0.5463293", "0.5461103", "0.5461103", "0.5461103", "0.54600084", "0.545502", "0.5451146", "0.54398847", "0.54325765", "0.5432329", "0.54321253", "0.54321253", "0.5419568", "0.54156363", "0.5414808", "0.5411724", "0.5408822", "0.5398949", "0.5398879", "0.53920215", "0.539106", "0.5385672", "0.53804064", "0.53702515", "0.53597397", "0.53597105", "0.5351437", "0.5346413", "0.5336606", "0.5336543", "0.53318274", "0.53316593", "0.5328325", "0.5327965", "0.5317009", "0.5314227", "0.5312667", "0.53066313" ]
0.0
-1
Contstructor method Parameters String name_player1 Name for player 1 String name_player2 Name for player 2
def initialize(name_player1, name_player2) @current_player = :player1 @player1 = Player.new(name_player1, PLAYER_MARKS[:player1], 1) @player2 = Player.new(name_player2, PLAYER_MARKS[:player2], 2) @game_array = [[nil, nil, nil], [nil, nil, nil], [nil, nil, nil]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @player1 = get_player_name('1')\n @player2 = get_player_name('2')\n @current_player = @player1\n end", "def initialize(player_1=nil, player_2=nil)\n @player_1 = player_1\n @player_2 = player_2\n end", "def second_player_name(player)\n player == 1 ? @player_2_name : @player_1_name\nend", "def get_name(player_number, name)\n if player_number == 1\n then @player1 = Player.new(name)\n else\n @player2 = Player.new(name)\n end\n end", "def player_names\n puts \"What name do you want to use, Player 1?\"\n @player_1_name = gets.chomp\n puts \"What name do you want to use, Player 2?\"\n @player_2_name = gets.chomp\n end", "def add_players(names)\n @me.name = names[1]\n @opponent.name = names[2]\n p @me, @opponent\n run\n end", "def player_name(player)\n player == 1 ? @player_1_name : @player_2_name\nend", "def wargames(player_1 = Players::Computer.new(\"X\"), player_2 = Players::Computer.new(\"O\"),board = Board.new)\n game = Game.new(player_1, player_2, board)\n game.play\n end", "def set_players(player1, player2)\n @p1, @p2 = player1, player2\n (@p1.starts) ? @current_player = @p1 : @current_player = @p2\n end", "def create_players\n puts \"Enter player1 name: \"\n player1_name = gets.chomp\n @player1 = Player.new(player1_name, \"X\")\n puts \"Enter player2 name: \"\n player2_name = gets.chomp\n @player2 = Player.new(player2_name, \"O\")\n puts \"#{@player1.name} will play with '#{@player1.symbol}' and #{@player2.name} will play with '#{@player2.symbol}' \\n\\n\"\n end", "def human_and_human_player(size)\n\t@player1 = \"player\"\n @player2 = \"player\"\nend", "def setup_player_2\n name = ask_for_name(\"Player 2\")\n if self.player_1.token.downcase == \"x\"\n token = \"O\"\n else\n token = \"X\"\n end\n \n self.player_2 = Player.new(name, token)\n end", "def start_game(player1, player2)\n player1=\"Rocky\"\n player2=\"Bullwinkle\"\n p \"Hello #{player1} & #{player2}\"\nend", "def setplayer1\r\n\t\t\t@player1 = \"O\"\r\n\t\tend", "def switch_players\n if @current_player.name == @player1.name\n @current_player = @player2\n @other_player = @player1\n else \n @current_player = @player1\n @other_player = @player2\n end\n return\n end", "def ask_name\n puts \"Quel est le nom du joueur 1 ?\"\n print \"> \"\n name_player0 = gets.chomp\n tok0 = \"X\"\n player0 =Player.new(name_player0,tok0)\n @player0 = player0\n puts \"OK , #{player0.name} jouera avec les #{player0.token} \"\n puts \" \"\n puts \"Quel est le nom du joueur 2 ?\"\n print \"> \"\n name_player1 = gets.chomp\n tok1 = \"O\"\n player1 = Player.new(name_player1,tok1)\n @player1 = player1\n puts \"OK , #{player1.name} jouera avec les #{player1.token} \"\n end", "def get_names\n puts \"Player 1: Enter your name.\"\n input = gets.strip\n @player1[:name] = input\n puts \"Player 2: Enter your name.\"\n input = gets.strip\n @player2[:name] = input\nend", "def display_player_scores(player1,player2)\n puts \"#{player1.name}'s score: #{player1.score}\"\n puts \"#{player2.name}'s score: #{player2.score}\"\nend", "def players_factory(player1, player2, player1_marker_x=true)\n players = []\n\n\t# Cases of initializing the players\n\tif player1_marker_x\n\n\t\t# Case 1\n\t\tif player1 == \"human\"\n\t\t\tplayers << Player.new(\"X\", \"Player1\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"X\", \"Player1\", true)\n\t\tend\n\n\t\tif player2 == \"human\"\n\t\t\tplayers << Player.new(\"O\", \"Player2\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"O\", \"Player2\", true)\n\t\tend\n\n\telse\n\t\t# Case2\n\t\tif player1 == \"human\"\n\t\t\tplayers << Player.new(\"O\", \"Player1\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"O\", \"Player1\", true)\n\t\tend\n\n\t\tif player2 == \"human\"\n\t\t\tplayers << Player.new(\"X\", \"Player2\", false)\n\t\telse\n\t\t\tplayers << Player.new(\"X\", \"Player2\", true)\n\t\tend\n\tend\n\n\tplayers\nend", "def roster player_1, player_2, player_3\n puts player_1\n puts player_2\n puts player_3\nend", "def second_player\n singles_player_of_team second_team\n end", "def initialize(player_name1, player_name2)\n\t\t@player1 = Player.new(player_name1)\n\t\t@player2 = Player.new(player_name2)\n\t\t@player = @player1\n\t\t@other_player = @player2\n\t\t@rooms = []\n\t\t@items = []\n\t\t@maze = Maze.new\n\t\t\n\t\t@pills_taken = false\n\t\t@box_taken = false\n\t\t@crystal_taken = 0\n\t\t@beans_taken = false\n\t\t@notes_taken = false\n\t\t\n\t\t@escape_artists = 'escape artists'\n\t\t@pica = 'pica'\n\t\t@generous = 'generous'\n\t\t@ghostbuster = 'ghostbuster'\n\t\t@stinky = 'stinky'\n\t\t@double_stink = 'double stink'\n\t\t@overdose = 'overdose'\n\t\t@dead_and_free = 'dead and free'\n\t\t\n\t\t@eaten = 0\n\t\t@given = 0\n\t\t@game = true\n\tend", "def name_all_players()\n set_name()\n set_other_name()\n end", "def initialize(p1, p2)\n @players = [p1, p2]\n @current_player = @players[0]\n \n end", "def roster(player_1, player_2, player_3)\n puts player_1\n puts player_2\n puts player_3\nend", "def setplayer2\r\n\t\t\t@player2 = \"X\"\r\n\t\tend", "def played_by?(username)\n @first_player.name == username || @second_player.name == username\n end", "def player\n player1 = Player.new('luke')\n player2 = Player.new('sam')\n game = Game.new(player1,player2)\n end", "def two_players\n\n if go_first? == true\n game = Game.new(Players::Human.new(\"X\"), Players::Human.new(\"O\"))\n game.play\n\n else\n game = Game.new(Players::Human.new(\"O\"), Players::Human.new(\"X\"))\n game.play\n end # inner if\n end", "def players_choose\n @p1_game_move = @player1.p1_moves\n @p2_game_move = @player2.p2_moves\n puts \"#{@player1.name} chooses: #{@p1_game_move}\\n\" + \"#{@player2.name} chooses: #{@p2_game_move}\"\n end", "def player_setup(player1, player2, names, symbols)\n player1[:player_type] == \"Human\" ? player1 = Human.find(player1[:id]) : player1 = Computer.find(player1[:id])\n player2[:player_type] == \"Human\" ? player2 = Human.find(player2[:id]) : player2 = Computer.find(player2[:id])\n player1.game_id = self.id\n player2.game_id = self.id\n player1.symbol = symbols[0]\n player2.symbol = symbols[1]\n player1.name = names[0]\n player2.name = names[1]\n player1.save\n player2.save\n self.player1_id = player1.id\n self.player2_id = player2.id\n self.save\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def ask_name\n\n puts ''\n puts \"Bienvenue sur TIC-TAC-TOE\"\n puts \"Veuillez écrire vos noms :\"\n\n puts \"Joueur 1 : \"\n print \"> \"\n\n @player_one = Player.new(gets.chomp)\n\n puts \"Joueur 2 : \"\n print \"> \"\n\n @player_two = Player.new(gets.chomp)\n\n end", "def initialize\n @player1 = Player.new(\"Player 1\")\n @player2 = Player.new(\"Player 2\")\n @player1_turn = true; # true -> player1's turn, false -> player2's turn\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def initialize(player_one:, player_two:)\n @player_one = player_one\n @player_two = player_two\n @acceptable_choices = ['rock', 'paper', 'scissors']\n end", "def choose_player\n case @name\n when 'R2D2' then rtwodtwo\n when 'Hal' then hal\n when 'Chappie' then chappie\n end\n end", "def initialize(player_1 = Player::Human.new(\"X\"), player_2 = Player::Human.new(\"O\"),board = Board.new)\n @board = board\n @player_1 = player_1\n @player_2 = player_2\n end", "def initialize(player1, player2)\n @player1 = player1\n @player2 = player2\n @p1_score = 0\n @p2_score = 0\n end", "def switch_players(player_one, player_two)\n self.current_player = current_player == player_one ? player_two : player_one\n\n end", "def getplayer1\r\n\t\t\treturn @player1\r\n\t\tend", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @player_1 = player_1;\n @player_2 = player_2;\n @board = board;\n end", "def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end", "def ask_name\n\n puts \"Bienvenue sur TIC-TAC-TOE\"\n puts \"Veuillez écrire vos noms :\"\n\n puts \"Joueur 1 :\"\n print \">\"\n\n @player_one = Player.new(\"Emeran\")\n\n puts \"Joueur 2 : \"\n\n @player_two = Player.new(\"Martin\")\n @player_array = [@player_one, @player_two]\n end", "def initialize(player_1=Players::Human.new(\"X\"), player_2=Players::Human.new(\"O\"), board=Board.new)\n @board = board\n @player_1 = player_1\n @player_2 = player_2\n end", "def play\n case [@player1,@player2].join(';')\n when 'rock;paper' then puts 'Gracz 2 wygrał'\n when 'rock;scissors' then puts 'Gracz 1 wygrał'\n when 'scissors;rock' then puts 'Gracz 2 wygrał'\n when 'scissors;paper' then puts 'Gracz 1 wygrał'\n when 'paper;scissors' then puts 'Gracz 2 wygrał'\n when 'paper;rock' then puts 'Gracz 1 wygrał'\n when 'paper;paper' then puts 'Remis'\n when 'rock;rock' then puts 'Remis'\n when 'scissors;scissors' then puts 'Remis'\n else\n puts 'Błędne informacje'\n end\n end", "def initialize(player_1 = nil, player_2 = nil, board = nil)\n if player_1 == nil && player_2 == nil && board == nil\n @player_1 = Players::Human.new(\"X\")\n @player_2 = Players::Human.new(\"O\")\n @board = Board.new\n else\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end\n end", "def start\n puts \"We have new challengers! Welcome #{@player_1.name} and #{@player_2.name}!\"\n turn\n end", "def set_other_name(other_name)\n @other_player_name = other_name\n end", "def get_names\n print \"Player 1, what is your name? \"\n @player_1_name = gets.chomp\n print \"Player 2, what is your name? \"\n @player_2_name = gets.chomp\nend", "def switch_players\n \n if @current_asker == @player1\n @current_asker = @player2\n @current_responder = @player1\n else\n @current_asker = @player1\n @current_responder = @player2\n end\n\n end", "def ask_name\n puts \"Nom du player 1 ?\"\n print \"> \"\n @players << Player.new(gets.chomp.to_s, \"o\")\n\n puts \"Nom du player 2 ?\"\n print \"> \"\n @players << Player.new(gets.chomp.to_s, \"x\")\n end", "def confirmed_by(username)\n self.confirm1 if @first_player.name == username\n self.confirm2 if @second_player.name == username\n end", "def assign_names()\n\t\tparams.each { |number, name| session[:player][number.to_i].name = name }\n\tend", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @board = board\n @player_1 = player_1\n @player_2 = player_2\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @board = board\n @player_1 = player_1\n @player_2 = player_2\n end", "def name_all_players\n (0..num_players - 1).each { |i| @players[i].name_player('Player' + i.to_s)}\n end", "def switch_player\n\t\tputs \"\\n\"\n\t\tif @player == @player1\n\t\t\t@player = @player2\n\t\t\t@other_player = @player1\n\t\telse\n\t\t\t@player = @player1\n\t\t\t@other_player = @player2\n\t\tend\n\t\t\n\t\t#Matt easter egg\n\t\tif @player.name.downcase == 'matt'\n\t\t\tdescriptors = [' the Amazing', ' the Hero', ' the Incroyable', \n\t\t\t\t\t\t ' the Handsome', ' the Clever', ' the Wonderful', ' the Indominable']\n\t\t\t@player.name = @player.name + descriptors.sample\n\t\tend\n\n\t\t@player.stench -= 1\n\t\t@player.stench = 4 if @player.location == :Rubbisher\n\t\t@player.beans -= 1\n\t\t@player.pills += 1 if @player.pills > 0\n\t\tif @player.location == :free && @other_player.location == :free\n\t\t\t@escape_artists = @escape_artists.upcase\n\t\t\tif @player.stench > 0 || @player.beans > 0 || @other_player.stench > 0 || @other_player.beans > 0\n\t\t\t\t@stinky = @stinky.upcase\n\t\t\tend\n\t\t\tif (@player.stench > 0 && @other_player.beans > 0) || (@player.beans > 0 && @other_player.stench > 0)\n\t\t\t\t@double_stink = @double_stink.upcase\n\t\t\tend\n\t\t\tputs \"\\nYou've both escaped! Congratulations!\"\n\t\t\tif @player.dead\n\t\t\t\tputs @player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0 && @player.location != :Rubbisher\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\t\tif @other_player.dead\n\t\t\t\tputs @other_player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @other_player.beans > 0\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @other_player.stench > 0\n\t\t\tshow_achievements\n\t\t\t@game = false\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\tputs \"\\nYou've escaped, but you've left your friend behind to rot.\\n\"\\\n\t\t\t\t \"Way to go, hero.\"\n\t\t\t@game = false\n\t\tend\n\t\tif @player.location == :free\n\t\t\tputs \"\\n\" + @player.name + \" is free!\"\n\t\tend\n\t\tif @player.dead\n\t\t\tputs \"\\n\" + @player.name + \" is dead.\"\n\t\tend\n\t\tshow_current_description unless @player.location == :free\n\t\tputs \"\\nThe world swims before your eyes.\" if @player.pills == 2\n\t\tputs \"\\nIn the corners of your vision, colorful phantasms\\nflicker in and out of being.\" if @player.pills == 3\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour stomach hurts.\" if @player.pills == 4\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour entire body is starting to hurt.\" if @player.pills == 5\n\t\tif [4, 5].include?(@player.pills) && @player.location == :Lair && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature's image in the spirit world is far stronger than\\n\"\\\n\t\t\t\t \"in the real. In the spirit world, you can see the ideas holding\\n\"\\\n\t\t\t\t \"the creature together... you reach out your hand and you can\\n\"\\\n\t\t\t\t \"feel them, too. You twist your fingers and those ideas shift.\\n\"\\\n\t\t\t\t \"The creature blurs and disappears. In it's place, a mouse falls\\n\"\\\n\t\t\t\t \"to the floor and scampers away. Without the creature there, you\\n\"\\\n\t\t\t\t \"can see an exit to the north.\" \n\t\t\twin_door(:Lair, :north)\n\t\tend\t\n\t\tif @player.pills == 6\n\t\t\tputs \"\\nYour entire body feels like tiny rats are eating you from inside your veins,\\n\"\\\n\t\t\t\"and the rats are on fire. You can't do anything but lie on the floor and moan.\"\n\t\t\t@player.dead = true\n\t\t\t@overdose = @overdose.upcase\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0\n\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\tif @player.location == :Lair && (@player.stench > 0 || @player.beans > 0) && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature takes a step back, and wrinkles its already wrinkly nose. As it\\n\"\\\n\t\t\t\"glides to the side and disappears through the wall, you think you hear it\\n\"\\\n\t\t\t\"mutter something about the disadvantages of an enhanced sense of smell.\\n\"\\\n\t\t\t\"Without the creature there, you can see an exit to the north.\"\n\t\t\twin_door(:Lair, :north)\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tif @player.dead\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\n\t\t#Matt easter egg\n\t\tif ['matt the amazing', 'matt the hero', 'matt the incroyable', \n\t\t\t'matt the handsome', 'matt the clever', 'matt the wonderful', \n\t\t\t'matt the indominable'].include?(@player.name.downcase)\n\t\t\t@player.name = @player.name.slice(0, 4)\n\t\tend\n\t\n\tend", "def change_player\n\n end", "def make_player\n\t\tputs \"\\nIf I may, master, what is your government name?\"\n\t\tname_input = gets.chomp\n#\t\t@name_1 = name_input.split.map {|i| i.capitalize}.join(\" \")\n#\t\t@user_name_1= new_name[0][(0..3)]+new_name[2][(0..3)]\n\t\tsign = @signs_array[0]\n\t\tPlayer.new(name_input,sign)\n\t\t$current_players[0] << @order[1]\n\t\t$current_players[0] << @signs_array[0]\n\t\t@signs_array = @signs_array.delete_at(0)\n\t\tputs \"\\nThank you!\\tNow I just need the next person.\"\n\t\t\n\t\tputs \"Other master, when ready, please type your government name.\"\n\t\tname_input = gets.chomp\n\t\tsign = @signs_array[-1]\n\t\tPlayer.new(name_input,sign)\n\t\t$current_players[1] << @order[0]\n\t\t$current_players[1] << @signs_array[-1]\n\t\tend", "def set_players\n print \"Enter name of Player 1 (white): \"\n player1 = create_player(gets.chomp, 1)\n assign_pieces(player1)\n\n print \"Enter name of Player 2 (black): \"\n player2 = create_player(gets.chomp, 2)\n assign_pieces(player2)\n\n [player1, player2]\n end", "def getplayer2\r\n\t\t\treturn @player2\r\n\t\tend", "def human_player_and_ai(size)\n\tif first?()\n @player1 = \"player\"\n @player2 = difficulty(size,\"o\")\n else\n @player1 = difficulty(size,\"x\")\n @player2 = \"player\"\n end\nend", "def update_players(input)\n # If name is the same as the player's name (@me.name?), then update_player is\n # called on @me and its return value is returned\n return update_player(@me, input) if @me.name?(input.shift)\n # If name is not the same as the player's name, then update_player is called\n # on @opponent and its return value is returned\n update_player(@opponent, input)\n end", "def join_player\r\n @players_joined += 1\r\n \r\n puts \"\\nPlayer #{@players_joined}, what is your name?\\n\"\r\n player_name = gets.chomp.to_s\r\n\r\n player_name\r\n end", "def initialize(player_1 = Players::Human.new(\"X\"), player_2 = Players::Human.new(\"O\"), board = Board.new)\n @board = board\n @player_1 = player_1\n @player_2 = player_2\n end", "def show_start_game(game)\n puts \"#{game.player1.name} is: #{game.player1.identity}\"\n puts \"#{game.player2.name} is: #{game.player2.identity}\"\n puts 'TIC TAC TOE.. start!'\nend", "def init_bots\r\n p1 = Player.new(\"José\")\r\n p2 = Player.new(\"Josiane\")\r\nend", "def new_players\n puts \"Welcome to the Tic Tac Toe Game X-O-X-O\"\n puts \"Player 1 name:\"\n name1 = gets.chomp\n @player1 = Player.new(name1, \"X\") #creates player 2 with X symbol\n @player1.say_hello # prints out welcome message for player 1\n puts \"Player 2 name:\"\n name2 = gets.chomp\n @player2 = Player.new(name2, \"O\") #creates player 2 with O symbol\n @player2.say_hello # prints out welcome message for player 2\n end", "def initialize(player_1 = Human.new(\"X\"), player_2 = Human.new(\"O\"), board = Board.new)\n @player_1 = player_1\n @player_2 = player_2\n @board = board\n end", "def get_players\n\n end", "def initialize\n @player1 = Player.new\n @player2 = Player.new\n\n @player1.opponent = @player2\n @player2.opponent = @player1\n end", "def initialize_players\n\n end", "def set_name(player_name)\n @player_name = player_name\n end", "def name_checker(player_name)\n\tputs \"hi #{player_name}\"\nend", "def initialize(user_id1, user_id2)\n super() # NOTE: This *must* be called, otherwise states won't get initialized\n @first_player, @second_player = Player.new(user_id1), Player.new(user_id2)\n end", "def initialize name\n @player = name\n @@player_count+=1\n end", "def start(location1, location2)\n\t\t@player.location = location1\n\t\t@other_player.location = location2\n\tend", "def initialize\n @current_player = 1\n @player_1 = Player.new\n @player_2 = Player.new\n @num_1 = rand(1..20)\n @num_2 = rand(1..20)\n end", "def initialize(player_1=Players::Human.new(\"X\"), player_2=Players::Human.new(\"O\"), board=Board.new ) #Game initialize defaults to two human players, X and O, with an empty board\n @board = board #Game initialize accepts 2 players and a board\n @player_1 = player_1\n @player_2 = player_2\n end", "def set_player(input) \n print \"Please enter your name : \"\n @name[0] = input.gets\n print \"Please enter your name : \"\n @name[1] = input.gets \n end", "def gui_new_match(players)\n end", "def initialize(player_name)\n @name = player_name.to_s\n @life_points = 10\n end", "def initialize(player1, player2)\n\t\t@player_array = Array.new #create an array with 2 players inside (usefull to change easaly the current player)\n\t\t@player_array << player1\n\t\t@player_array << player2\n\t\t@current_player = player1\n\t\t@new_board = Board.new\n\tend", "def player_name\n player.name\n end", "def initialize(name, players,coach, points)\n @name = name\n @players = players\n @coach = coach\n @points = points\n end", "def player(player_name)\n players.find{|player| player.name == player_name}\n end", "def initialize \n\t@first_player = Player.new(\"joueur 1\")\n\t@second_player = Player.new(\"joueur 2\")\n\t self.create_board\n\t self.play_until_victory\n end", "def play_for_trick \n if @player1.deal == true && @player2.deal == false && !@player1.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player1.lead_card\n @player1.remove_card_from_hand(leading_card)\n puts @player1.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player2.respond(leading_card)\n @player2.remove_card_from_hand(response_card)\n puts @player1.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player2.name + \" plays the \" + response_card.card_to_string\n \n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n if winning_card == leading_card \n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n else\n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n\n if @player1.deal == false && @player2.deal == true && !@player2.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player2.lead_card\n @player2.remove_card_from_hand(leading_card)\n puts @player2.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player1.respond(leading_card)\n @player1.remove_card_from_hand(response_card)\n puts @player2.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player1.name + \" plays the \" + response_card.card_to_string\n\n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n\n if winning_card == leading_card \n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n else\n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n end", "def get_player\n\t @name\n\tend", "def init_players(names)\n \n \n @dealer = CardDealer.instance\n \n #Inicializamos el array de jugadores\n @players = Array.new\n \n #Recorremos los nombres pasados y creamos tantos jugadores como nombres\n names.each do |s|\n\n players << Player.new(s)\n\n end\n end", "def initialize(name_player)\n @life_points = 10\n @name = name_player\n end", "def players\n puts \"Player 1, would you like to be X or O? \"\n $player1 = gets.chomp\n\n if $player1 == \"X\"\n $player2 = \"O\"\n else\n $player2 = \"X\"\n end\n\n puts \"Great! Player 1 is #{$player1} and Player 2 is #{$player2}\"\n puts \"\"\n \nend", "def set_player\n\n end", "def create_player\n name=gets.chomp\n @name=name\n end", "def intro \n @player1 = Player.new(\"Josiane\")\n puts \"à ma droite Josiane\"\n @player2 = Player.new(\"José\")\n puts \"à ma gauche José\"\nend" ]
[ "0.7432191", "0.7303798", "0.7163091", "0.7133529", "0.709381", "0.70699525", "0.7061218", "0.70389044", "0.69731706", "0.69149226", "0.6907445", "0.6729348", "0.66706604", "0.66637665", "0.66632074", "0.6650754", "0.664396", "0.6643723", "0.6638365", "0.66375405", "0.6637297", "0.66312003", "0.6626731", "0.6596754", "0.6570761", "0.6569196", "0.6551769", "0.6532844", "0.6531717", "0.6525981", "0.6518633", "0.65053165", "0.6498283", "0.6466114", "0.64659035", "0.6460331", "0.64503294", "0.64502823", "0.644979", "0.6440695", "0.6438409", "0.6428971", "0.6428971", "0.6428971", "0.6428971", "0.64278156", "0.64185196", "0.6414336", "0.6393746", "0.6392754", "0.63879347", "0.6383207", "0.6382165", "0.63730663", "0.6364096", "0.63478327", "0.6342599", "0.63411295", "0.63377684", "0.63377684", "0.6325733", "0.6323054", "0.63218063", "0.6319483", "0.6313409", "0.6312732", "0.6298503", "0.6291673", "0.6273657", "0.62599975", "0.62580305", "0.6242123", "0.62389714", "0.6230368", "0.6218957", "0.6214006", "0.6212205", "0.62088734", "0.620852", "0.62033445", "0.6188737", "0.618471", "0.6172217", "0.6167531", "0.6155093", "0.61544675", "0.6151185", "0.6140591", "0.61398846", "0.6136226", "0.6111571", "0.6103477", "0.6101931", "0.6095352", "0.60881025", "0.6085421", "0.60847133", "0.6084134", "0.60793906", "0.6078642" ]
0.68276936
11
Represents the pick of some user and chosen coordinates String player Player picking a coordinate Integer x X coordinate Integer y Y coordinate Exceptions Throws InvalidPickException if player is not valid or if coordinate is out of boundaries
def pick(player, x, y) fail InvalidPickException.new('Invalid pick') unless valid_pick?(x, y) && valid_player?(player) @game_array[x][y] = PLAYER_MARKS[player.to_sym] @current_player = if @current_player == :player1 :player2 else :player1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_pick?(x, y)\n @game_array[x][y] == nil\n rescue\n fail InvalidPickException.new\n end", "def player_select_coordinates\n parse_response(get_a_valid_destination)\n end", "def invalid_user_shot\n \"Please enter a valid coordinate:\\n> \"\n end", "def player_select_valid_piece_destination\n puts \"Where would you like to move this piece?\"\n response = player_select_coordinates\n end", "def invalid_inputs\n puts \"Invalid input! Your positions must have x and y coordinates \"\\\n \"between 0 and 7.\"\n end", "def set_player_positions\n self.print_grid\n\n xy = self.ask_for_x_y do\n \"Player 1: Where would you like to place your flag?\"\n end\n\n @player1_x = xy[0]\n @player1_y = xy[1]\n \n xy = self.ask_for_x_y do\n \"Player 2: Where would you like to place your flag?\"\n end\n\n @player2_x = xy[0]\n @player2_y = xy[1]\n end", "def x_player_turn\n print \"Player X:\"\n @x_player_choice = gets.chomp\n #Make sure that the player inputs a correct input\n if check_coord_marked?(@x_player_choice)\n print \"Already marked please try again\\n\"\n self.x_player_turn\n elsif @coordinates.any?{|i| i==@x_player_choice}\n self.place_mark(@x_player_choice, \"x\")\n else\n print \"Not a valid Coordinate try again \\n\"\n self.x_player_turn\n end\n end", "def collect_coords\n if $new_game.lives == 0\n self.game_over\n elsif $new_game.targets == 0\n self.win\n else\n $new_game.print_grid\n self.info\n row = \"z\"\n while $abc.index(row) == nil\n puts \"Enter row coordinate (A - J):\"\n row = gets.chomp.downcase.to_s\n row_num = $abc.index(row)\n end\n col = \"\"\n while (\"0\"..\"9\").to_a.index(col) == nil\n puts \"Enter column coordinate (0 - 9):\"\n col = gets.chomp\n end\n self.check_coords([row_num,col.to_i])\n end\n end", "def get_new_coordinates(choice)\n selected_move = moveset[possible_moves[choice]]\n return x + selected_move[0], y + selected_move[1]\n end", "def select_ship_positions(player, ship_size)\n valid_selection = false\n while valid_selection == false\n puts \"---- #{player.name} ---- please choose positions for the #{ship_size}x1 ship: \\n\"\n puts \"must be separated by a space like: a0 a1 a3 \\n\"\n prompt = '> '\n positions = Readline.readline(prompt, true)\n positions_simbolized = positions.split(' ').map(&:to_sym)\n\n valid_selection = $current_game.create_ship(player.board, positions_simbolized, ship_size)\n message = valid_selection == true ? \"👍 Good Choice \\n\" : \"👎 wrong positions , please try again \\n\"\n puts message\n end\n end", "def o_player_turn\n print \"Player O:\"\n @o_player_choice = gets.chomp\n #Make sure that the player inputs a correct input\n if check_coord_marked?(@o_player_choice)\n print \"Already marked please try again\\n\"\n self.o_player_turn\n elsif @coordinates.any?{|i| i==@o_player_choice}\n self.place_mark(@o_player_choice, \"o\")\n else\n print \"Not a valid Coordinate try again \\n\"\n self.o_player_turn\n end\n end", "def coordinates_valid?(@coordinates)\n #still need to set conditions for validation to be true.\n\n #for 2-unit shit\n if true\n @user_ship_1.set_coordinates(@coordinates)\n else\n #need to kick back to BoardGame with out Board knowing about BoardGame\n @Messages.error_ship_location_is_invalid\n coordinates_match\n end\n\n #for 3-unit ship\n if true\n @user_ship_2.set_coordinates(@coordinates)\n else\n #need to kick back to BoardGame with out Board knowing about BoardGame\n @Messages.error_ship_location_is_invalid\n coordinates_match\n #place_your_3_unit_ship\n end\n end", "def validation\n self.nation ||= region.nation\n unless !@x || !@y || @x == '' || @y == ''\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def user_shot_selection_text\n \"Enter the coordinate for your shot:\\n> \"\n end", "def test_can_start_game\n battleship = Battleship.new\n battleship.input_player_coordinates(\"A1 A2\", 1)\n assert_equal ({ \"A1\" => \"H\", \"A2\"=>\"H\", \"A3\"=>\"-\", \"A4\"=> \"-\",\n \"B1\" => \"-\", \"B2\"=>\"-\", \"B3\"=>\"-\", \"B4\"=> \"-\",\n \"C1\" => \"-\", \"C2\"=>\"-\", \"C3\"=>\"-\", \"C4\"=> \"-\",\n \"D1\" => \"-\", \"D2\"=>\"-\", \"D3\"=>\"-\", \"D4\"=> \"-\"}),\n battleship.player_grid\n\n battleship.input_player_coordinates(\"D2 D3 D4\", 2)\n assert_equal ({ \"A1\" => \"H\", \"A2\"=>\"H\", \"A3\"=>\"-\", \"A4\"=> \"-\",\n \"B1\" => \"-\", \"B2\"=>\"-\", \"B3\"=>\"-\", \"B4\"=> \"-\",\n \"C1\" => \"-\", \"C2\"=>\"-\", \"C3\"=>\"-\", \"C4\"=> \"-\",\n \"D1\" => \"-\", \"D2\"=>\"H\", \"D3\"=>\"H\", \"D4\"=> \"H\"}),\n battleship.player_grid\n end", "def validation\n self.country ||= province.country\n unless !@x || !@y || @x == \"\" || @y == \"\"\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def coordinates\n \"Xmin:%s Ymin:%s Xmax:%s Ymax:%s\" % [x_min, y_min, x_max, y_max]\n end", "def get_player_selection(board)\n begin # check if the selection is valid\n player_choice = gets.chomp.to_i\n is_valid = get_empty_positions(board).include? player_choice\n if !is_valid\n puts \"Invalid selection! Please select empty squares that are displayed by numeric values only! \"\n end\n end until is_valid\n board[player_choice] = 'X'\nend", "def player_select_move_piece(player)\n puts \"#{player.name}, select which piece you would like to move, in the form of a1, b3 etc\"\n response_coords = player_select_coordinates\n move_piece = board.get_board_coord(response_coords[0], response_coords[1])\n if !move_piece.respond_to?(:color) || move_piece.color != player.color\n puts \"#{player.name}, that's not a piece of yours. Please select another\"\n response_coords = player_select_move_piece(player)\n end\n response_coords\n end", "def get_plateau_coordinates\n @input = STDIN.gets.chomp.split\n\n #Prompt the user for input until valid coordinates are entered.\n while !valid_coordinates\n puts \"Incorrect upper right coordinates entered. Enter upper right coordinates:\"\n @input = STDIN.gets.chomp.split\n end\n\n @plateau = Plateau.new(input[0], input[1])\n end", "def validate_coordinate(x, y, msg)\n\t\twhile !numbers.include?(y) || !letters.include?(x.upcase)\n\t\t\tputs msg\n\t\t\tinput = gets.chomp.chars\n\t\t\tif input.count == 2\n\t\t\t\tx, y = input[0], input[1]\n\t\t\telsif input.count == 3 && input[1] == '1' && input[2] == '0'\n\t\t\t\tx, y = input[0], '10'\n\t\t\telse\n\t\t\t\tx, y = \"X\", \"X\"\n\t\t\tend\n\t\t\tmsg = \"That's not a valid coordinate, try again... (eg A1-J10)\"\n\t\tend\n\t\treturn x, y\n\tend", "def make_decision\n\t\tputs \"What row?\"\n\t\ty_coordinate = gets.to_i - 1\n\n\t\tputs \"What column?\"\n\t\tx_coordinate = gets.to_i - 1\n\n\t\t[@letter, x_coordinate, y_coordinate]\n\tend", "def place(args)\n x, y, orientation = args\n validate_orientation(orientation)\n validate_coordinates({ 'x' => x.to_i, 'y' => y.to_i })\n self.x_coordinate = x.to_i\n self.y_coordinate = y.to_i\n self.orientation = orientation\n end", "def get_move\n\t\tputs \"Enter where you would like to mark in the form (X, Y): \"\n\t\tmove = gets.chomp\n\t\tpositions = move.split(\", \")\n\t\t[positions[0].to_i, positions[1].to_i]\n\tend", "def player_instructions\n puts \"I have laid out my ships on the grid.\n \"\n puts \"You now need to lay out your two ships.\"\n puts \"The Cruiser is three units long and the Submarine is two units long.\n \"\n @board_computer.render\n puts \"Enter the squares for the Cruiser (3 spaces):\n \"\n cruiser_squares = gets.chomp\n cruiser_location = cruiser_squares.split()\n @board_player.valid_placement?(@cruiser_player, cruiser_location)\n while @board_player.valid_placement?(@cruiser_player, cruiser_location) == false\n puts \"Those are invalid coordinates. Please try again:\n \"\n cruiser_squares = gets.chomp\n cruiser_location = cruiser_squares.split()\n end\n @board_player.place(@cruiser_player, cruiser_location)\n @board_player.render(true)\n puts \"Enter the squares for the Submarine (2 spaces):\n \"\n submarine_squares = gets.chomp\n sub_location = submarine_squares.split()\n @board_player.valid_placement?(@submarine_player, sub_location)\n while @board_player.valid_placement?(@submarine_player, sub_location) == false\n puts \"Those are invalid coordinates. Please try again:\n \"\n submarine_squares = gets.chomp\n sub_location = submarine_squares.split()\n end\n @board_player.place(@submarine_player, sub_location)\n @board_player.render(true)\n end", "def user_pick_params\n params.require(:user_pick).permit(:picks, :pick_points, :current_points, :user_id)\n end", "def choose_move\n puts \"#{current_player}, select a cell to place your #{whose_turn}. Select a number between 1 - 9.\"\n move = gets.chomp.to_i\n puts\n\n # If move is valid and is not taken, then create a key-value pair in @taken: number => X or O.\n if valid_move?(move) && !taken?(move)\n @taken[move] = whose_turn\n update_board(move)\n # When it is not a valid move and the cell is not taken\n elsif !valid_move?(move) && !taken?(move)\n puts \"That is not a valid choice. Please select a number between 1 and 9.\"\n \t# When it is a valid move and the cell is taken \n elsif valid_move?(move) && taken?(move)\n puts \"That one has already been taken. Please select another cell.\"\n end\n end", "def select_piece(coord)\n begin\n @game.select_piece_at(coord)\n rescue\n raise\n end\n end", "def pick_piece(test = false, pick = nil) # test, pick parameters for unit testing\n begin\n # TODO: Need to show only rooms not taken yet.\n puts \"Choose your playing piece.\"\n puts Suspects.list\n print \"> \"\n \n if test == false\n pick = gets.chomp\n else\n puts pick\n end\n \n already_taken = Suspects.picked?(pick)\n case already_taken # Originally had these messages in suspects.picked? but wanted to separate UI from logic\n when false\n puts response = \"Got it.\"\n @piece = pick\n when true\n puts response = \"Already taken.\"\n when nil\n puts response = \"There is no suspect with that name. Come on man!\"\n else\n puts \"Error in Player.pick_piece.\"\n Process.exit(0)\n end\n end while (already_taken == true or already_taken == nil) and test == false\n return response # For unit testing only\n end", "def test_player_coord_input\n # true if finalize_ship_coords == true\n @ship.valid_coords = finalize_ship_coords(@player_orientation,\n @player_base_coords)\n end", "def validate_coords\n (0..1).each do |index|\n if params.try(:[], index).try(:to_i) > 5 || params.try(:[], index).try(:to_i) < 0\n errors[:params] << \"[PLACE] #{index+1} param should be more than -1 and less than 6\"\n end\n end\n end", "def computer_chooses_coordinate\n\n all_possible_coordinates = @human.board.cells.keys\n coordinate = all_possible_coordinates.sample\n\n loop do\n\n if @already_fired_upon_coordinates_computer.include?(coordinate) == false\n @human.board.cells[coordinate].fire_upon\n @already_fired_upon_coordinates_computer.push(coordinate)\n break\n end\n coordinate = all_possible_coordinates.sample\n end #end of loop\n\n status = @human.board.cells[coordinate].render\n\n case status\n when 'H'\n puts \"My shot on #{coordinate} was a hit.\"\n when 'M'\n puts \"My shot on #{coordinate} was a miss.\"\n when 'X'\n puts \"My shot on #{coordinate} sunk a ship.\"\n end #ends case\n end", "def select_x\r\n print \" Please select the X player: \"\r\n p1 = gets.chomp\r\n case p1\r\n when \"1\" then @p1_type = \"human\"\r\n when \"2\" then @p1_type = \"perfect\"\r\n when \"3\" then @p1_type = \"random\"\r\n when \"4\" then @p1_type = \"sequential\"\r\n else @p1_type = \"invalid_p1\"\r\n end\r\n invalid_player?(@p1_type)\r\n end", "def get_position(legal_positions)\n pos = nil\n\n until legal_positions.include?(pos)\n puts \"Player #{mark.to_s}, enter two numbers representing a position in the format `row col`\"\n pos = gets.chomp.split(' ').map(&:to_i)\n puts \"#{pos} is not a legal position\" if !legal_positions.include?(pos)\n raise 'sorry, that was invalid :(' if pos.length != 2\n end\n\n pos\n end", "def coordinate_params\n params.require(:coordinate).permit(:colour, :x, :y, :user_id)\n end", "def prompt_place\n place_command ={}\n puts \"Position X and Y Selection:\".colorize(:green)\n puts \"Inputs must be a positive number between 0 and your pre-selected board width and height parameters\".colorize(:green)\n puts \"Example -- If board width and height are 30,30, inputs must be between 0 and 30\".colorize(:green)\n puts \"Select position X\".colorize(:green)\n user_position_x = gets.chomp\n place_command[:position_x] = user_position_x\n puts \"Select position Y\".colorize(:green)\n user_position_y = gets.chomp\n place_command[:position_y] = user_position_y\n puts \"Select Direction between one of the following:\".colorize(:green)\n puts \"NORTH, SOUTH, EAST, WEST\".colorize(:green)\n user_position_direction = gets.chomp.upcase\n place_command[:position_f] = user_position_direction\n return place_command\nend", "def coords; {:x => @x, :y => @y} end", "def choose_b_position\n puts \"What number on the board do you choose?\"\n @choice = gets.chomp.to_i\n # if human #set up X or O for player here?\n # spaces.index(human.choice) = \"X\"\n # else\n # spaces.index(computer.choice etc etc) = \"O\"\n # end\n end", "def selectPiece(x, y)\n if x.instance_of?(Integer) && y.instance_of?(Integer)\n if x.between?(0,6) && y.between?(0,6) && @locations[x][y] != nil\n return @locations[x][y].piece\n end\n end\n return nil\n end", "def validate_x_y_coords(x, y)\n validate_x_coords(x)\n validate_y_coords(y)\n end", "def place_ships\n create_ships\n @computer_details[:ship_location] << COORDINATES.sample(5)\n p @computer_details[:ship_location]\n loop do\n i = 0\n loop do\n puts \"Enter the no. #{i + 1} attack coordinate.\"\n input = gets.chomp\n if COORDINATES.include?(input)\n unless @computer_details[:attack_coordinates].include?(input)\n @your_details[:attack_coordinates] << input\n x1 = input[0]\n y1 = input[1]\n x = 250 + X[x1]\n y = 10 + Y[y1]\n @screen.draw_line [x,y], [x + 20,y + 20], 'red'\n @screen.draw_line [x + 20,y], [x,y + 20], 'red'\n @screen.flip\n i +=1\n @computer_details[:ships_alive] -= 1 if @computer_details[:ship_location].include?(input)\n break if i >= @your_details[:ships_alive]\n else\n puts \"Already choosed this Coordinate\"\n end\n else\n puts \"This is not a valid Coordinate\"\n end\n end\n\n puts \"Now Computer Playing.....\" \n inputs = (COORDINATES - @computer_details[:attack_coordinates]).sample(@computer_details[:ships_alive])\n inputs.each do |input| \n @your_details[:attack_coordinates] << input\n x1 = input[0]\n y1 = input[1]\n x = 250 + X[x1]\n y = 250 + Y[y1]\n @screen.draw_line [x,y], [x + 20,y + 20], 'white'\n @screen.draw_line [x + 20,y], [x,y + 20], 'white'\n @your_details[:ships_alive] -= 1 if @your_details[:ship_location].include?(input)\n @screen.flip\n end\n p @computer_details[:ships_alive]\n if @computer_details[:ships_alive] == 0\n puts \"YOU WON !!!!!\"\n break\n elsif @your_details[:ships_alive] == 0\n puts \"COMPUTER WON !!!!!\"\n x1 = input[0]\n y1 = input[1]\n x = 10 + X[x1]\n y = 10 + Y[y1]\n 10.times do\n @screen.draw_line [x, y +=2], [ x + 20,y], 'white'\n end\n @screen.flip\n break\n end\n end\n p @your_details\n gets\n #@ship = Ship.new( @screen.w/2, @screen.h/2 , 'red')\n \n # Make event hook to pass all events to @ship#handle().\n #make_magic_hooks_for( @ship, { YesTrigger.new() => :handle } )\n end", "def check_coords(coord)\n target = $new_game.grid[coord[0]][coord[1]]\n if target[:ship] == true\n $new_game.hits += 1\n $new_game.targets -= 1\n target[:display] = \"XX\"\n self.hit\n else\n # Miss\n target[:display] = \"OO\"\n $new_game.lives -= 1\n self.miss\n end\n $prompt.collect_coords\n end", "def choose_marker_position(options)\r\n available_spaces = options.map { |space| @game.index_to_placeholder(space) }\r\n @output.puts \"Available Options: #{available_spaces}\"\r\n\r\n @game.placeholder_to_index(get_valid_input(available_spaces))\r\n end", "def taken?(input_position)\n self.position(input_position) == \"X\" || self.position(input_position) == \"O\"\n end", "def validate_current_position_boundaries\n if (@initial_position.nil? || row_pos_invalid? || col_pos_invalid?) \n puts \"\\nPlease enter valid chess piece position. Eg: -position a1\"\n puts \"Please type one of these positions\"\n puts valid_boundaries\n @is_valid = false\n end\n end", "def user_input_params\n params.require(:user_input).permit(:input_x, :input_y)\n end", "def check_valid?(coordinates)\n valid = false\n x = coordinates[0]\n y = coordinates[1]\n if (x > 0 && x <= @size) && (y > 0 && y <= @size)\n if @game_board[coord_to_array(coordinates)] == \" \"\n valid = true\n else\n puts \"\\nLocation already taken! Please try again.\"\n end\n else\n puts \"\\nInput does not fit parameters of the board. Please try again.\"\n end\n return valid\n end", "def map_position(position)\n coords = position.split(\"\")\n col, row = coords\n\n unless coords.length == 2 && ChessGame::LETTER_MAP[col] && row.to_i.between?(1,8)\n raise RuntimeError.new \"Invalid Input - Please use A-H and 1-8\"\n end\n\n [ChessGame::LETTER_MAP[col], (row.to_i)-1]\n end", "def display_selection\n if possible_moves.any?\n puts \"=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=X=\"\n puts \"Current position of Pawn.\"\n puts \"#{x}, #{y}\"\n puts 'Please select from possible moves:'\n possible_moves.each_with_index { |v, k| puts \"#{k}) #{v}\" }\n else\n puts \"No possible moves found; Re-run the code\"\n puts \"You have visited following coordinates\"\n visited_coordinates.each { |v| puts \"#{v[0]}, #{v[1]}\" }\n exit!\n end\n end", "def validate_place(x,y,direction,placed,place_position)\n params=place_position.split(',')\n if is_integer(params[0]) && is_integer(params[1]) # Checking invalid inputs\n temp_x=params[0].to_i\n temp_y=params[1].to_i\n else\n return x,y,direction,placed # Place invalid, return\n end \n if validate(temp_x) && validate(temp_y) # Checking board boundaries\n if ['NORTH','EAST','WEST','SOUTH'].include?(params[2]) # Checking valid Directions\n x=temp_x\n y=temp_y\n direction=params[2]\n return x,y,direction,true #place is valid return updated coordinates and placed_state\n end\n end\n return x,y,direction,placed # Place invalid, return\n end", "def validate_placement(input)\n begin\n coordinates = input[6..-1].split(',')\n x_input = coordinates[0].to_i\n y_input = coordinates[1].to_i\n direction_input = coordinates[2]\n rescue\n return false\n end\n if input[0..5] == 'PLACE ' && (Robot::VALID_XY_COORDS.include? x_input) && (Robot::VALID_XY_COORDS.include? y_input) && (Robot::VALID_DIRECTIONS.include? direction_input)\n update_position(x_input, y_input, direction_input)\n else\n false\n end\n end", "def get_input(board)\n\tbegin\n\t\tprint \"Coordinates (x,y): \"\n\t\tinput_string = gets.chomp.delete(\" \") # Get a new string of user input, remove newline and spaces\n\t\tcoordinate_strings = input_string.split(\",\") # Split input into x and y values by comma separation\n\t\t\n\t\t# If the string length is zero, skip the rest of the code block and try again\n\t\tif coordinate_strings.length == 0\n\t\t\tnext\n\t\tend\n\n\t\tcoordinates = Array.new\n\t\tcoordinates[0] = coordinate_strings[0].to_i\n\t\tcoordinates[1] = coordinate_strings[1].to_i\n\t\t\n\t\tvalid_coords = check_valid_position(coordinates[0], coordinates[1])\n\t\t\n\t\t# See if string could be converted to integer or not\n\t\tif coordinate_strings[0] == nil || coordinate_strings[1] == nil\n\t\t\tnull_string = true\n\t\telse\n\t\t\tnull_string = false\n\t\tend\n\t\t\n\t\thit_already = false\n\t\tif valid_coords && ! null_string\n\t\t\thit_already = board.get_square_known_status(coordinates)\n\t\tend\n\t\t\n\t\tif hit_already\n\t\t\tputs \"You already shot at that square\"\n\t\tend\n\t\t# Keep looping until the user enters valid input - the function's job is to only \n\t\t# return coordinates that are valid\n\tend until valid_coords && ! null_string && ! hit_already\n\t\n\treturn coordinates\nend", "def pick_editable_points( x, y, view )\r\n tr = view.model.edit_transform\r\n ph = view.pick_helper\r\n ph.init( x, y, VERTEX_SIZE )\r\n picked = []\r\n for vertex in vertices\r\n picked << vertex if ph.test_point( vertex.position.transform( tr ) )\r\n end\r\n for point in manual_interior_points\r\n picked << point if ph.test_point( point.position.transform( tr ) )\r\n end\r\n picked.uniq\r\n end", "def place(x, y)\n self.robot_position = {\n x: x,\n y: y\n } if valid_coordinates?(x, y)\n end", "def player_places_piece!(brd)\n square = ''\n loop do\n prompt \"Choose a square (#{empty_squares(brd).join(', ')}):\"\n square = gets.chomp.to_i\n break if empty_squares(brd).include?(square)\n prompt \"Sorry, that's not a valid choice\"\n end\n\n brd.position_values[square] = Board::PLAYER_MARKER\n end", "def position_taken?(input)\n @board[input] == \"X\" || @board[input] == \"O\"\n end", "def validate(x_coordinate, y_coordinate)\n if x_coordinate >= 0 && x_coordinate < maze.length && y_coordinate >= 0 && y_coordinate < maze[0].length\n [x_coordinate, y_coordinate]\n else\n nil\n end\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 set_player(choice=nil)\n\n\t\t# until choice == 1 || choice == 2\n\n\t\t\tchoice = gets.chomp.to_i if !choice\n\t\t\tcase\n\n\t\t\t\twhen choice == 1\n\n\t\t\t\t\t @player_one = \"X\"\n\t\t\t\t\t @player_two = \"O\"\n\n\t\t\t\twhen choice == 2\n\n\t\t\t\t\t @player_one = \"O\"\n\t\t\t\t\t @player_two = \"X\"\n\n\t\t\t\twhen choice != 1 || choice != 2\n\n\t\t\t\t\tputs '-------- Invalid Choice! -------'\n\t\t\t\t\tputs '---------- Pick Again! ---------'\t\n\t\t\t\t\tputs '--------------------------------'\n\t\t\tend\n\t\t# end\n\n\t\tputs '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'\n\t\tputs \"$$$$$$$ Player One #{@player_one} $$$$$$$\"\n\t\tputs \"$$$$$$$ Player Two #{@player_two} $$$$$$$\"\n\n\t\treturn @player_one\n\n\tend", "def valid_place?(x_position, y_position)\n x_position.between?(0, @dimension) &&\n y_position.between?(0, @dimension)\n end", "def valid_coordinates?(x_coord, y_coord)\n (0..width).include?(x_coord) && (0..height).include?(y_coord)\n end", "def player_choice(row,col)\n row = row.to_i\n col = col.to_i\n row = row - 1 \n col = col - 1\n if @known_empty.include? ((row.to_s)+(col.to_s))\n puts 'That spot is already known.'\n elsif @flag_pair.include? ((row.to_s)+(col.to_s))\n puts \"You can't guess where you have a flag.\"\n \n elsif @grid[row][col] == 0\n open_up(row,col)\n elsif @grid[row][col] == :B\n puts 'YOU LOSE, SORRY'\n @game_over = false\n else\n @known_empty << (row.to_s + col.to_s)\n end\n end", "def get_rover_position\n valid_rover_position = false\n\n while !valid_rover_position\n if valid_position\n valid_rover_position = plateau.rover_in_bounds?(input[0].to_i, input[1].to_i)\n unless valid_rover_position\n puts \"Rover position out of plateau bounds. Enter rover position:\"\n @input = STDIN.gets.chomp.split\n end\n else\n puts \"Incorrect position entered. Enter rover position:\"\n @input = STDIN.gets.chomp.split\n end\n end\n\n @rover = Rover.new(input[0], input[1], input[2])\n end", "def initialize options\r\n super\r\n @x = options[:x]\r\n @y = options[:y]\r\n end", "def validate_user_input\n validate_chess_piece_type\n validate_current_position_boundaries\n @is_valid\n end", "def get_input_for_attack (player, opponent, opponent_board)\n\t\tputs \"\"\n\t\tputs \"#{player.name}: Ready to attack #{opponent.name}'s board?\"\n\t\tprint(opponent_board.read)\n\t\tx, y = get_coordinate\n\t\treturn x, y\n\tend", "def player_render_and_report(player_select_coordinate)\n if @computer_board.cells[player_select_coordinate].render == \"X\"\n puts \"You shot at #{selected_coord} GET SUNK.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"H\"\n puts \"I shot at #{selected_coord} and it's a hit. I'm gonna win.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"M\"\n puts \"You missed but I'm not throwing away my SHOT.\"\n end\n end", "def play choice, player\n puts \"#{player}'s turn\"\n print \"Enter the input: \"\n input = gets.chomp.split(\",\")\n valid_input_arr = input.filter { |item| item.to_i <= 3 && item.to_i > 0 }\n while input.length != valid_input_arr.length\n puts \"wrong format! Insert the entries in the form: x, y. (where x => row, y => column)\"\n print \"Enter the input: \"\n input = gets.chomp.split(\",\")\n valid_input_arr = input.filter { |item| item.to_i <= 3 && item.to_i > 0 }\n end\n @board[(input[0].to_i) - 1][(input[1].to_i) - 1] = choice\n display_board\n end", "def convert_user_coord(input)\n input.split\n end", "def player_move\n puts \"ENTER YOUR SHOSEN LOCATION BETWEEN 1..9\"\n @position = gets.chomp.to_i\n end", "def playerone\n\tputs \"#{@player1.name}, please make your selection. Remember, numbers 1-9 for it to be valid.\"\n\tmove = gets.chomp\n\twhile @used_numbers.include?(move)\n\t\tputs \"That's already taken!\"\n\t\tputs \"Please select another location\"\n\t\tmove = gets.chomp.to_s\n\tend\n\tif move == (1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9)\n\t\tmake_move(@player1, move)\n\t\t@game.display\n\t\t$turn += 1\n\t\twinner(@player1, \"X\")\n\telse\n\t\tmake_move(@player1, move)\n\t\t@game.display\n\t\t$turn += 1\n\t\twinner(@player1, \"X\")\n\tend\nend", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def valid_position?(x, y)\n !!(x && y && x > 0 && y > 0 && x <= 8 && y <= 8)\n end", "def move_to(piece)\r\n cols = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\r\n rows = [1, 2, 3, 4, 5, 6, 7, 8]\r\n counter = 0; x = ''; y = ''\r\n until counter == 1\r\n print \"Enter destination coordinates: \"\r\n coordinate = STDIN.gets.chomp\r\n x = coordinate[0]; y = coordinate[1].to_i\r\n counter+=1 if ((cols.include? x) && (rows.include? y))\r\n end\r\n puts ''\r\n puts \"#{piece.class} to #{x}#{y}.\"\r\n stop = []\r\n stop[0] = cols.index(x)\r\n stop[1] = rows.index(y)\r\n stop \r\n end", "def choose_sides\n if ask(\"Choose a side\", \"x\", \"o\") == \"o\"\n $piece[:player] = O\n $piece[:computer] = X\n end\nend", "def coordinate\n x = ((position-1) / area.x_max) + 1\n y = position - (x-1) * area.x_max\n \"(#{x}, #{y})\"\n end", "def selectLocation(x, y)\n if x.instance_of?(Integer) && y.instance_of?(Integer)\n if x.between?(0,6) && y.between?(0,6)\n return @locations[x][y]\n end\n end\n return nil\n end", "def valid_piece_movement?(coordinates)\n row = coordinates[:row]\n column = coordinates[:column]\n @active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])\n end", "def check_place_params *args\n if args.length != 3\n throw_error \"wrong number of arguments for place: (#{args.length} for 3)\"\n return false\n end\n # params number is 3 ...\n x = args[0].to_i if is_integer args[0]\n y = args[1].to_i if is_integer args[1]\n face = args[2]\n faces = Constants::FACES\n\n case\n when !is_integer(args[0])\n throw_error \"x should be an integer\"\n when !is_integer(args[1])\n throw_error \"y should be and integer\"\n when face.class != String\n throw_error \"face should be string type\"\n when x > @xmax || x < 0\n throw_error \"x exceed the limitation\"\n when y > @ymax || y < 0\n throw_error \"y exceed the limitation\"\n when faces.index(face.downcase).nil?\n throw_error \"face value should be one of the #{faces}\"\n else\n return true\n end \n end", "def position\n [x, y]\n end", "def set_piece(player,location) #takes the arguments player and location\n\t\t@piece=player.piece #defines piece as the player's number (either 1 or 2)\n\t\trow=(location-1)/4 #takes the value of location (1-16) and converts it into a row coordinate 0, 1, 2, or 3\n\t\tcolumn=(location+3)%4 #takes the value of location (1-16) and converts it into a column coordinate 0, 1, 2, or 3\n\t\t@board[row][column]=@piece #defines the cell that the player has just selected as the player's number (1 or 2)\n\t\t@size+=1 #we count each move after its been made which is used in the function below, check_full?\n\tend", "def attempt(x,y) \n if x >@height or y> @height\n abort(\"Invalid coordinates!\")\n end\n\n if not isMine(x,y)\t\t\n #puts \"LOOSE\"\n @status = \"LOOSE\\nYou Loose!\"\t\n else\n #puts \"BOOOOOM\"\n @status = \"BOOOOOM\\nYou Won!\"\t\n end \n end", "def validate_user_position(position)\n if $grid_hash[position] == ' '\n \t$confirmed_piece = position\n return true\n elsif $grid_hash[position] == nil\n \tputs \"That is not a valid entry.\"\n \tplay\n else\n puts \"That spot is already taken.\"\n play\n end\nend", "def test_the_coordinates_are_valid\n assert_equal true, @board.valid_coordinate?(\"A1\")\n assert_equal false, @board.valid_coordinate?(\"ZZ\")\n end", "def path_requesting_parameters(x, y)\n # if target is a character\n if x.is_a?(Map_Battler)\n # get pixel movement coordinates\n y = x.y\n x = x.x\n else\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if target is a normal character\n if x.is_a?(Game_Character)\n # create pixel movement coordinates from actual coordinates\n y = x.y * pix\n x = x.x * pix\n # if actual coordinates\n elsif x.is_a?(Numeric) && y.is_a?(Numeric)\n # create pixel movement coordinates from actual coordinates\n y *= pix\n x *= pix\n end\n end\n # return coordinates\n return [x, y]\n end", "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 valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end", "def safe_position?(x, y)\n x >= 0 &&\n x <= @max_x &&\n y >= 0 &&\n y <= @max_y &&\n !@registered_positions.include?([x, y])\n end", "def valid_coordinate?(coord)\n if coord.size == 2 && coord[0].between?(0, 7) && coord[1].between?(0, 7)\n true\n else\n false\n end\n end", "def invalid_player?(player_type)\r\n unless player_type =~ /invalid/\r\n if player_type == @p1_type\r\n puts \"\\n\"\r\n tab(12, \"Great!!!\")\r\n tab(5, \"X is a #{@p1_type} player.\", \"-\" * 31)\r\n elsif player_type == @p2_type\r\n puts \"\\n\"\r\n tab(10, \"Excellent!!!\")\r\n tab(5, \"O is a #{@p2_type} player.\", \"-\" * 31)\r\n end\r\n else\r\n puts \"\\n\"\r\n puts \" Invalid selection - try again!\"\r\n player_type == \"invalid_p1\" ? select_x : select_o\r\n end\r\n end", "def test_it_can_pick_random_coord\n assert_equal true, @board.cells.keys.include?(@board.random_coord)\n end", "def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end", "def test_cell_then_place(ship, attempt_x, attempt_y, starts_at)\n alpha, numb = starts_at.split(\"\")\n coordinates = \"#{get_alpha(get_index(alpha) + attempt_y)}#{numb.to_i + attempt_x}\"\n cells[coordinates].accept ship\n end", "def pick_player\n \n puts \"Let's play Tic Tac Toe!\"\n puts \"But first, let's get acquainted. I am your computer #{Socket.gethostname}\"\n puts \"What's your name?\n \"\n\n # if you don't pick a name we'll pick a greeting for you\n @player = gets.chomp\n if @player == ''\n @player = 'Human friend'\n end\n \n # getting cracking already\n clr \n puts \"A pleaure to see you, #{@player}.\"\n puts \"Please choose if you want to play as X or O\"\n puts \"by pressing the corresponding key on your keyboard.\n \"\n input = ''\n until input == \"x\" || input ==\"o\" do\n input = gets.chomp.upcase\n if input == \"X\" || input == \"O\"\n @marker = input\n puts \"Thanks #{@player}, you picked #{@marker}, what's your move?\\n\"\n new_board\n make_move\n else\n puts \"that's not an X or an O. Try again\"\n end\n end\n end", "def match_pick_params\n params.require(:match_pick).permit(:userID, :matchID, :userPick, :result, :points, :closed)\n end", "def get_start_coordinates\n start_coord = []\n until start_coord_valid?(start_coord)\n puts \"START COORDINATES\"\n start_coord = @current_player.get_user_input\n start_coord = [] if [\"reset\", \"save\", []].include?(do_special_input_stuff(start_coord)) #hackhackhack\n end\n print_board(start_coord)\n puts \"Move #{@board[start_coord[0]][start_coord[1]].class.to_s.upcase} where?\"\n return start_coord\n end", "def position(player_input)\n cells[move_to_index(player_input)]\n end", "def taken?(user_input)\n position(user_input) == \"X\" || position(user_input) == \"O\" ? true : false\n end", "def populate\n self.start_coordinate_x = rand(11)\n self.start_coordinate_y = rand(11)\n if ship_position == 'vertical'\n self.end_coordinate_x = self.start_coordinate_x\n self.end_coordinate_y = (self.start_coordinate_y + SHIP_SIZE) > MAX_SIZE_BOARD ? (self.start_coordinate_y - SHIP_SIZE) : (self.start_coordinate_y + SHIP_SIZE)\n else\n self.end_coordinate_y = self.start_coordinate_y\n self.end_coordinate_x = (self.start_coordinate_x + SHIP_SIZE) > MAX_SIZE_BOARD ? (self.start_coordinate_x - SHIP_SIZE) : (self.start_coordinate_x + SHIP_SIZE)\n end\n end" ]
[ "0.6357382", "0.6326895", "0.59886116", "0.59806776", "0.5870088", "0.5845969", "0.58289963", "0.5804468", "0.5748903", "0.57455456", "0.5734839", "0.55847925", "0.55539936", "0.55123425", "0.55029684", "0.5471036", "0.54590845", "0.5450844", "0.54354054", "0.5429965", "0.53925556", "0.537174", "0.53196037", "0.5307496", "0.53019685", "0.52977717", "0.5295262", "0.52940094", "0.526967", "0.52613276", "0.5247341", "0.52275497", "0.5223151", "0.5208341", "0.5198175", "0.51743513", "0.5173831", "0.51636434", "0.5160391", "0.5160074", "0.51589626", "0.5150947", "0.51380175", "0.51240563", "0.51162905", "0.51111954", "0.5108436", "0.5106976", "0.50968206", "0.509122", "0.50785244", "0.5063983", "0.5062126", "0.50507146", "0.50370723", "0.5033715", "0.5012415", "0.5010876", "0.500549", "0.50004095", "0.49980098", "0.4997827", "0.49937087", "0.49918458", "0.4988715", "0.4984231", "0.49782476", "0.4937225", "0.49353758", "0.4932113", "0.4925835", "0.4925584", "0.4925584", "0.4923776", "0.49225643", "0.4921536", "0.49181572", "0.4915346", "0.49124295", "0.48998797", "0.4895861", "0.48949048", "0.4893194", "0.48860434", "0.48852485", "0.4881729", "0.4876747", "0.48737532", "0.4871231", "0.4868081", "0.48666215", "0.4851766", "0.4850647", "0.4846494", "0.48457044", "0.48453823", "0.483893", "0.4836398", "0.4832176", "0.48295188" ]
0.6759482
0
Returns a hash containing the current state of the game, the current user able to do the next pick. If the last pick resulted in a winner the player is returned.
def current_state result = { current_state: @game_array, current_player: @current_player } mark = winner_mark if mark result.merge!(winner: player_by_mark(mark).name) end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n store_person = winner_function\n store_combo = won?\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\n end", "def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end", "def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end", "def winner\n return @winner\n end", "def winner\n if winning_combo = won?\n @board[winning_combo.first]\n end\n end", "def winner\n if finished?\n @players.each do|key,score|\n if score.sum >=@length\n return key\n end\n end\n else\n nil\n end\n end", "def winner\r\n self.results_hash[:winner]\r\n end", "def winner\n if combo = won?\n winner = board.position(combo.first + 1)\n end\n winner\n end", "def who_won? game\n if game.winner_id == nil\n \"In Progress\"\n elsif game.winner_id == current_user.id\n \"You\"\n else\n \"CPU\"\n end\n end", "def getFinalState()\r\n dealer_score = @dealer.hand.score\r\n case @dealer.state\r\n when \"bust\"\r\n #every player that didnt bust wins\r\n @players.each do |player|\r\n if(player.state != \"bust\")\r\n player.state = \"won\"\r\n else\r\n player.state = \"lose\"\r\n end\r\n end\r\n when \"fine\"\r\n #everyone with a lower score than the dealer loses, everyone with a higher score that didnt bust wins\r\n @players.each do |player|\r\n if(player.state == \"bust\")\r\n player.state = \"lose\"\r\n elsif(player.hand.score < dealer_score)\r\n player.state = \"lose\"\r\n elsif(player.hand.score > dealer_score)\r\n player.state = \"won\"\r\n else\r\n player.state = \"push\"\r\n end\r\n end\r\n when \"blackjack\"\r\n #everyone lower score loses, everyone equal score pushes\r\n @players.each do |player|\r\n if(player.hand.score == dealer_score)\r\n player.state = \"push\"\r\n else\r\n player.state = \"lose\"\r\n end\r\n end\r\n end\r\n end", "def winner\n if winning_combo = won?\n @winner = @board.cells[winning_combo.first]\n end\n end", "def winner\n if finished?\n if fold = @hand_history.all_actions.find(&:fold?)\n winner = (fold.player == small_blind) ? big_blind : small_blind\n else\n winner = if PokerHand.new( small_blind.hole_cards + @community_cards ) > PokerHand.new( big_blind.hole_cards + @community_cards )\n small_blind\n else\n big_blind\n end\n end\n else\n nil\n end\n end", "def winner\n @hash.key(@hash.values.max)\n end", "def choose_winner; end", "def check_last_winner\n if @player1.player_victory\n @player2\n elsif @player2.player_victory\n @player1\n else\n @player1\n end\n end", "def winner\n if won?\n win_combination = won?\n token = @board[win_combination[0]]\n return token\n end\n end", "def winner()\n if won?()\n return @board[won?()[0]]\n end\n return nil\n end", "def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end", "def winner\n if finished?\n if @player_1[@length] = \"x\"\n return @players[0]\n elsif @player_2[@length] = \"x\"\n return @players[1]\n end\n end\n\n end", "def winner\r\n win_combination = won?\r\n if win_combination\r\n win_index = win_combination[0]\r\n @board[win_index]\r\n end\r\n end", "def winner(board)\n if winning_combo = won?(board)\n board[winning_combo.first]\n end\nend", "def winner\n return @board[won?[0]] if won?\n end", "def determine_winner(comp_choice, player_choice)\n rock = 0\n paper = 1\n scissors = 2\n\n player_won = 0\n comp_won = 1\n tie = 2\n\n if comp_choice == rock\n if player_choice = rock\n return tie\n elsif player_choice = paper\n return player_won\n else\n return comp_won\n end\n elsif comp_choice == paper\n if player_choice = rock\n return comp_won\n elsif player_choice = paper\n return tie\n else\n return player_won\n end\n else \n if player_choice = rock\n return player_won\n elsif player_choice = paper\n return comp_won\n else\n return tie\n end\n end\nend", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def staying_pick_wins?(pick)\n\t\twon?(pick)\n\tend", "def winner(board)\n if combination = won?(board)\n board[combination.first]\n end\nend", "def winning_player_id\n return nil if draw?\n player_score.value > opponent_score.value ? player_id : opponent_id\n end", "def result # :nodoc:\n winning_strategy && winning_strategy.result\n end", "def winner\n\t\tbest_for_1 = best_hand(@hand1)\n\t\tbest_for_2 = best_hand(@hand2)\n\t\tcase best_for_1[:rank] <=> best_for_2[:rank]\n\t\t\twhen -1 then 2\n\t\t\twhen 1 then 1\n\t\t\twhen 0 then check_kicker(best_for_1, best_for_2)\n\t\tend\n\tend", "def winner\n if won?\n winner = won?\n return @board[winner[0]]\n else\n return nil\n end\n end", "def winner(board)\n winning_combo = won?(board)\n if winning_combo\n return board[winning_combo[0]]\n end\nend", "def winner\n @best_hand = {}\n @eg_users.each do |user|\n @usr = user[0]\n @best_hand[@usr] = []\n cards = []\n cards = Array.new(@communal_cards)\n cards << user[1]\n cards << user[2]\n calculate_hand cards\n end\n best_hnd_key = determine_winner\n end", "def winner\n win_hash = { basic: basic_winner,\n war: war_winner,\n mutually_assured_destruction: \"No Winner\"\n }\n win_hash[type]\n end", "def winner(board)\n win_combo = won?(board)\n if win_combo\n return board[win_combo[0]]\n end\nend", "def winner(board)\n if win_combo = won?(board)\n board[win_combo.first]\n else\n nil\n end\nend", "def show_winner()\n\t\tif player1_count() > player2_count\n\t\t\treturn @player1 \n\t\telsif player2_count() > player1_count\n\t\t\treturn @player2\n\t\telse \n\t\t\treturn nil \n\t\tend\n\tend", "def compute_state # {{{\n\n player_moves = []\n ki_moves = []\n\n player_moves = self.get_moves_as_hash true\n ki_moves = self.get_moves_as_hash false\n\n return WON if has_winning_combination player_moves\n return LOST if has_winning_combination ki_moves\n\n return DRAWN if player_moves.count + ki_moves.count == 3*3\n\n RUNNING\n end", "def winner\n if won?\n puts \"Player #{@winner} has won the game!\"\n return @winner\n else\n puts \"No winner yet!\"\n end\n end", "def winner(board)\n if win_combo = won?(board)\n board[win_combo.first]\n end\nend", "def winner(board)\n if winning_combination = won?(board)\n board[winning_combination[0]]\n end\nend", "def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end", "def determine_winner_one_game\n if @weapon_p1 == \"r\" && @weapon_p2 == \"s\"\n return 1 \n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"p\"\n return 1 \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"r\" \n return 1 \n \n elsif @weapon_p1 == \"p\" && @weapon_p2 == \"s\"\n return 2\n elsif @weapon_p1 == \"r\" && @weapon_p2 == \"p\"\n return 2\n elsif @weapon_p1 == \"s\" && @weapon_p2 == \"r\"\n return 2 \n\n else\n return nil\n end \n end", "def winner\n players.sort.last\n end", "def winner?\n not @winners[@pick].nil?\n end", "def winner\n if winning_array = won?\n @board[winning_array[0]]\n end\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def rps_game_winner(game)\n hash = Hash[*game.flatten()]\n raise WrongNumberOfPlayersError unless (game.length && hash.size) == 2 \n strat_check(hash)\n winner = comp_to(hash)\n puts \"#{winner}\"\nend", "def determine_game_winner(p1, p2)\n winning_choices = {spock: [\"scissors\", \"rock\"], paper: [\"rock\", \"spock\"], scissors: [\"paper\", \"lizard\"], rock: [\"scissors\", \"lizard\"], lizard: [\"spock\", \"paper\"]}\n \n if p1.move == p2.move\n winner = Player.new(\"Neither\")\n elsif\n winning_choices[p1.move.to_sym].include?(p2.move.to_s)\n winner = p1\n else\n winner = p2\n end\n winner.score += 1\n return winner\n end", "def calculate_winner\n self.winner = case human.move <=> computer.move\n when 1\n human\n when -1\n computer\n when 0\n 'tie'\n end\n end", "def winner\n player_alive?(Player1) ? Player1 : Player2\n end", "def get_current_game_state(lobby_id)\n find_lobby(lobby_id).game_state\n end", "def winner\n @winner\n end", "def winner\n if won?\n return @board[ won?[0] ]\n else\n return nil\n end\n end", "def play_game\nget_winner(comp_choose_rps,user_choose_rps)\t\nend", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def determine_match_winner\n @games_to_win = ((total_number_of_games / 2.0).floor) + 1\n if player1.score == games_to_win\n return player1\n elsif player2.score == games_to_win\n return player2\n else\n return nil\n end\n end", "def process_picks()\n\tsession[\"round_winner\"] = round_win(session[\"p1_pick\"], session[\"p2_pick\"])\n tally_score(session[\"round_winner\"])\n session[\"game_winner\"] = the_winner(session[\"p1_total_score\"], session[\"p2_total_score\"])\nend", "def winner\n win_combo = won?\n if win_combo\n @board[win_combo[0]] # == 'X' || 'O'\n else\n nil\n end\n end", "def winner(board)\n token = nil\n if won?(board) != nil\n win_combo = won?(board)\n token = board[win_combo[0]]\n end\n token\nend", "def winner\n if won? != false && won? != nil\n win = won?\n return @board[win[0]]\n else\n return nil\n end\n end", "def winner\r\n if self.won? != false\r\n if self.current_player == \"X\"\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end\r\n end", "def play(p1_choice,p2_choice)\n if p1_choice == \"rock\"\n if p2_choice == \"paper\"\n self.winner_id = p2_choice.id\n elsif p2_choice == \"scissor\"\n self.winner_id = p1_choice.id\n end\n\n return winner_id\n end\n\n if p1_choice == \"paper\"\n if p2_choice == \"rock\"\n return @winner_id = p1_choice.id\n elsif p2_choice == \"scissor\"\n return @winner_id = p2_choice.id\n else\n return @winner_id\n end\n end\n\n if p1_choice == \"scissor\"\n if p2_choice == \"rock\"\n return @winner_id = p2_choice.id\n elsif p2_choice == \"paper\"\n return @winner_id = p1_choice.id\n else\n return @winner_id\n end\n end\n\n\n # plays game\n # return either p1_choice or p2_choice winner\n end", "def winner(board)\n token = nil\n if won?(board) != nil\n win_combo = won?(board)\n token = board[win_combo[0]]\n end\n token\nend", "def current_player\n { name: @game.cur_player.name, home_base: @game.cur_player.home_base }\n end", "def winner\n WIN_COMBINATIONS.each do |win_combination|\n #puts win_combination.inspect\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n \n position_1 = @board[win_index_1] \n position_2 = @board[win_index_2] \n position_3 = @board[win_index_3] \n \n if position_1 == position_2 && position_2 == position_3 && position_taken?(win_index_1)\n return position_1\n end\n end\n nil\n end", "def winner\n big_p = 1\n \n marks = self.unrolled\n @@All_Runs.each do |run|\n #p = product of all the slots\n p = run.map {|i| marks[i]}.inject(:*)\n return :x if p == 8\n return :o if p == 1\n big_p *= p\n end\n \n return (big_p == 0) ? nil : :cat\n end", "def current_player()\n # Assume player X goes first\n return turn_count() % 2 == 0 ? \"X\" : \"O\"\n end", "def winner\n if check_rows_for_winner || check_columns_for_winner || check_diagonals_for_winner\n return @player\n else\n return nil\n end\n end", "def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n game.each do |sign|\nif sign[1] != \"R\" and sign[1] != \"P\" and sign[1] != \"S\"\nraise NoSuchStrategyError\nend\n end\n if game[0][1] == \"R\" and game[1][1] != \"P\"\nreturn game[0]\n elsif game[0][1] == \"P\" and game[1][1] != \"S\"\nreturn game[0]\n elsif game[0][1] == \"S\" and game[1][1] != \"R\"\nreturn game[0]\n else\nreturn game[1]\n end\nend", "def return_key\n previous_game_state.current_level = @choice\n previous_game_state.state = :idle\n pop_game_state(:setup => false)\n end", "def determine_result(player, computer)\n if win?(player, computer)\n \"Win\"\n elsif win?(computer, player)\n \"Lose\"\n else\n \"Tie\"\n end\nend", "def pick_a_winner\n if @winners.empty?\n puts \"Save your money. There are no winners.\"\n return false\n end\n pick_cnt = 0\n until winner?\n pick_cnt += 1\n pick\n end\n puts \"We have a winner! #{to_s} after #{pick_cnt} picks.\"\n puts \" Date of winning drawing: #{@winners[@pick]}\"\n puts\n true\n end", "def find_winner\n\t\t@counter = 0\n\t\t@players.each do |player|\n\t\t\tif player.points > @winning\n\t\t\t\t@winner = @counter + 1\n\t\t\tend\n\t\t\t@counter += 1\n\t\tend\n\t\treturn @winner\n\tend", "def winner(board)\nif winning_combination = won?(board)\nboard[winning_combination[0]]\nend\nend", "def game_state\n if @game_state.nil?\n @game_state = GameState.new(@player_count,@mode, 6, 7)\n end\n @game_state\n end", "def track_p2_wins(winner)\n if winner == 2\n return 1\n else\n return 0\n end\nend", "def current_player()\n current_turn = turn_count()\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def find_winner\n if @player_1.life == 0\n return 2\n end\n return 1\n end", "def compute_team_winner\n if completed?\n team_winner\n else\n if first_team && second_team\n if sets_won(first_team) == min_sets_to_play\n first_team\n elsif sets_won(second_team) == min_sets_to_play\n second_team\n end\n end\n end\n end", "def who_won?\n which = rand(2) + 1\n if which == 1\n return @player1\n else\n return @player2\n end\n end", "def winner\n won = \"\"\n if winner = won?\n won = @board[winner.first]\n end\n end", "def current_turn()\n @players[@turn]\n end", "def loser\n return winner == :player_a ? :player_b : :player_a\n end", "def winner\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end", "def winner\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end", "def winner\n win_combination = won?\n if win_combination == false\n nil\n elsif @board.cells[win_combination[0]] == \"X\"\n return \"X\"\n elsif @board.cells[win_combination[0]] == \"O\"\n return \"O\"\n end\n end", "def winner(board)\n if winning_combo = won?(board)\n # winning_comobo = won?(board) # Erica\n # if winning_combo.present? # Erica\n board[winning_combo.first] \n end\nend", "def main_game\n p1_wins = 0\n p2_wins = 0\n puts \"Let's play Rock-Paper-Scissors!\"\n games = how_many_games\n best_of(games)\n\n until p1_wins == games || p2_wins == games\n winner = one_round\n display_winner(winner)\n p1_wins += track_p1_wins(winner)\n p2_wins += track_p2_wins(winner)\n end\n\n overall_winner = overall_winner?(p1_wins, p2_wins)\n display_overall_winner(overall_winner)\nend", "def evaluate_winner\n\t\treturn 100 if win?(\"x\")\n\t\treturn -100 if win?(\"o\")\n\t\treturn 0 if blocked?\n\tend", "def winner(board)\n return board[won?(board)[0]] if won?(board)\nend", "def current\n self.players[self.current_turn]\n end", "def compare_hands\n players_hash = Hash.new(0)\n @active_players.each do |player|\n players_hash[player] = player.hand.analyze_hand_value\n end\n\n highest_val = players_hash.values.max\n winners = players_hash.reject { |_, val| val != highest_val }\n\n winners.keys.each do |winner|\n winner.chip_count += @pot.to_f / winners.length.to_f\n end\n winners_str = \"This rounds winner(s) is/are\"\n winners.keys.each do |winner|\n winners_str << \" #{winner.name}\"\n end\n winners_str << \"!!!!\\n\"\n puts winners_str\n end", "def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n @first_player = game[0];\n @second_player = game[1];\n \n raise NoSuchStrategyError unless (@first_player[1] =~ /\\A[RPS]\\z/i) and (@second_player[1] =~ /\\A[RPS]\\z/i)\n # if the first and second player chose the same move, the first player wins\n if @first_player[1] == @second_player[1]\n @winner = @first_player;\n # if the first and second player choose different moves... who wins?\n else\n # if the first player chooses rock\n if @first_player[1].upcase == 'R'\n # second player wins if he chooses paper\n if @second_player[1].upcase == 'P'\n @winner = @second_player\n # second player loses if he chooses scissors\n else\n @winner = @first_player\n end\n # if the first player chooses paper\n elsif @first_player[1].upcase == 'P'\n # second player loses if he chooses rock\n if @second_player[1].upcase == 'R'\n @winner = @first_player\n # second player wins if he chooses scissors\n else\n @winner = @second_player\n end\n # if the first player chooses scissors\n else\n # second player loses if he chooses paper\n if @second_player[1].upcase == 'P'\n @winner = @first_player\n # second player wins if he chooses rock\n else\n @winner = @second_player\n end\n end\n end\n # return the winner\n return @winner;\nend", "def current_player\n turns_played = turn_count()\n if turns_played % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\n if turn_count.even?\n player_1\n else\n player_2\n end\n end", "def determining_winner\n if @player_hand_points = 21 && @dealer_hand_points < 21 || 21 > @player_hand_points > @dealer_hand_points || @dealer_hand_points > 21\n @player_win\n elsif @player_hand_points > 21 && @dealer_hand_points > 21 || @player_hand_points = @dealer_hand_points\n @player_tie\n else @dealer_hand_points = 21 && @player_hand_points < 21 || 21 > @dealer_hand_points > @player_hand_points || @player_hand_points > 21\n @player_loss\n end\n end", "def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n @P1 = game[0][1]\n @P2 = game[1][1]\n\n \n if(@P1.match(/[RPS]/)) && (@P2.match(/[RPS]/))\n\n if(@P1 == \"R\") && (@P2 == \"S\")\n return game[0]\n elsif(@P1 == \"R\") && (@P2 == \"P\")\n\treturn game[1]\n end\n\t\n if(@P1 == \"P\") && (@P2 == \"R\")\n return game[0]\n elsif(@P1 == \"P\") && (@P2 == \"S\")\n\treturn game[1]\n end\n \n \n if(@P1 == \"S\") && (@P2 == \"P\")\n\treturn game[0]\n elsif(@P1 == \"S\") && (@P2 == \"R\")\n\treturn game[1]\n end\n end\n\n end", "def one_round\n player1_weapon = get_player_one_weapon\n player2_weapon = get_player_two_weapon\n return winner?(player1_weapon,player2_weapon)\nend", "def current_player\n board.turn_count % 2 == 0 ? player_1 : player_2\n end", "def current_player\n self.board.turn_count.even?? self.player_1 : self.player_2\n end" ]
[ "0.6421932", "0.633145", "0.6323206", "0.62890625", "0.6282806", "0.6246933", "0.62404686", "0.61526936", "0.6102675", "0.60710114", "0.6065517", "0.6040621", "0.60367024", "0.60008126", "0.59787446", "0.5972528", "0.5962908", "0.5958537", "0.5951555", "0.593951", "0.59276766", "0.5912728", "0.59102994", "0.58965904", "0.58864987", "0.5878925", "0.5870518", "0.586888", "0.58688027", "0.58643264", "0.58353186", "0.58160365", "0.5808911", "0.58086747", "0.5801398", "0.5797516", "0.57929194", "0.5787705", "0.5781349", "0.5780797", "0.5769472", "0.57553214", "0.5754296", "0.57431006", "0.5736058", "0.5731609", "0.57249916", "0.5723594", "0.5717018", "0.5707913", "0.5706535", "0.57033557", "0.57023776", "0.56919783", "0.5682003", "0.56789786", "0.5664573", "0.5657822", "0.56572086", "0.565545", "0.56530976", "0.56525576", "0.56522554", "0.5651488", "0.56497216", "0.56456286", "0.56450653", "0.56439376", "0.56372947", "0.56365967", "0.56281996", "0.5626488", "0.56246704", "0.5624663", "0.5617469", "0.5611494", "0.561016", "0.5603759", "0.56030196", "0.56018364", "0.559869", "0.5593887", "0.55923533", "0.55861455", "0.5580497", "0.5579372", "0.55783397", "0.5571589", "0.556916", "0.55680114", "0.5567506", "0.5564983", "0.55628675", "0.5562109", "0.55612653", "0.5559678", "0.55584705", "0.55506366", "0.55480653", "0.5544043" ]
0.6818288
0
Gets player based on his mark
def player_by_mark(mark) player = if PLAYER_MARKS.key(mark) == :player1 @player1 else @player2 end player end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_player_by_marker(marker)\r\n @players.find { |player| player.marker == marker }\r\n end", "def find_player(name)\n for footballer in @players\n return footballer if @players.include?(name)\n end\n end", "def player\n fetch('football.players')\n end", "def player_by_name name\n @players.select {|p| p.name == name}.first\n end", "def current_player\n players.first\n end", "def find_player(name)\n all_players.find {|player| name == player.fetch(:player_name)}\nend", "def player(player_name)\n players.find{|player| player.name == player_name}\n end", "def current_player\n @players.first\n end", "def team_player_plays_on(player)\n teams.select { |t| t.players.include?(player) }.first\n end", "def get_player_by_user(input_user)\n #current_name=self.playing_user_names.select{|name| self.user_hash[name] == input_user}.first\n current_name=input_user.nick #this uses user.nick, but other places use this too\n return self.player_hash[current_name] #could return nil if user doesn't exist\n end", "def find_player_with_user_id(user_id)\n go_fish.find_player_with_user_id(user_id)\n end", "def current_player\n @players.first\n end", "def get_player(id)\n\t\treturn @players[id]\n\tend", "def get_player\n\t @name\n\tend", "def player_by_id id\n @players.select {|p| p.id == id}.first\n end", "def current_player\n @players.each do |name, letter|\n if letter == whose_turn\n return name\n end\n end\n end", "def current_player\n @players.first\n end", "def current_player\n @players[@turn%2]\n end", "def first_player\n singles_player_of_team first_team\n end", "def getplayer1\r\n\t\t\treturn @player1\r\n\t\tend", "def get_player_by_name n\n @players.each{|p| return p if p.try(:name).try(:downcase) == n.try(:downcase) }\n end", "def get_player(team, position)\n if team.eql?(:red)\n if position == 1\n Player.find(r1_id)\n elsif position == 2\n Player.find(r2_id)\n end\n elsif team.eql?(:blue)\n if position == 1\n Player.find(b1_id)\n elsif position == 2\n Player.find(b2_id)\n end\n end\n end", "def starters\n self.players.starter\n end", "def get_players\n\n end", "def getCurrentPlayer() # : Player\n @currentPlayer\n end", "def players\n users\n end", "def leader\n self.players.order(score: :desc).first\n end", "def line_up_starters(match)\n players = LineUp.where(:club_id => self.id, :match_general_id => match, :position => (1..11)).map do |lu|\n lu.player\n end\n return players\n end", "def second_player\n singles_player_of_team second_team\n end", "def player(name)\n players.detect { |p| p.name == name }\n end", "def player1\n @players.first\n end", "def get_hanchan_player(hanchan_player_id)\n return DB[:hanchan_players].first(id: hanchan_player_id)\nend", "def favorite_players(fan)\n Fan.find_by(name: fan).players\nend", "def players; [@hunter, @prey] end", "def player\n\t\t@current_player\n\tend", "def current_player\n Player.find(player_turn) unless player_turn.nil?\n end", "def p1\n if (s = session[:players][0]) and (p = Player.find(s)) then return p end\n end", "def get_curr_player \n current_player = @player_arr.first()\n return current_player\n end", "def getplayer2\r\n\t\t\treturn @player2\r\n\t\tend", "def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end", "def players\n go_fish.players\n end", "def player\n\t\t\tPlayer.find(self.playerID)\n\t\tend", "def player_stats(name)\n all_players.find do |player|\n player[:player_name] == name\n end\nend", "def find_player(players, name)\n players.find do |player|\n player[:player_name] == name\n end\nend", "def show\n @players_on_football_field=@user_team.players_on_football_field\n @first_team_goalkeeper=@user_team.user_team_players.first_team_goalkeeper[0].player\n end", "def player_for(table_id)\n\t\t\t\tpl = @players[table_id]\n\t\t\t\traise \"No such table #{table_id}\" unless pl\n\t\t\t\treturn pl\n\t\t\tend", "def get_player(nickname)\n response = get(RESOURCE_PATH, nickname, headers: { 'API-VERSION': 'v2' })\n response_body = JSON.parse(response.body, symbolize_names: true)\n\n Rails.logger.info(\"GS Get Player Response: #{response_body}\")\n\n if response.success?\n #TODO: deserialize response json into Player object automatically\n nickname = response_body[:nickname]\n ext_id = response_body[:ext_id]\n avatar = response_body[:avatar]\n theme = response_body[:theme]\n player_point_types = []\n point_types_response = response_body[:point_types]\n (point_types_response || []).each do |point_type_response|\n player_point_types << GameServer::Model::PlayerPointType.new(point_name: point_type_response[:name], count: point_type_response[:amount])\n end\n\n player = GameServer::Model::Player.new(nickname, ext_id, avatar, theme)\n player.player_point_types = player_point_types\n\n get_player_response = GameServer::Client::Response::GetPlayerResponse.new(true, nil, player)\n else\n error_message = response_body[:error_message]\n\n get_player_response = GameServer::Client::Response::GetPlayerResponse.new(false, error_message, nil)\n end\n\n return get_player_response\n end", "def player_relative_to(player, index)\n current = players.index(player)\n players.fetch((current + index) % players.size)\n end", "def cards_played(player) \n @played[player]\n end", "def get_player_id\n\t\t@player_id\n\tend", "def player_stats(player_name)\n game_hash.each do |place, team|\n team[:players].each do |player|\n if player[:player_name] == player_name\n return player\n end\n end\n end\n end", "def goid\n @player\n end", "def find_score \n player = self.find_winner\n if player == 1\n return @player_1.life\n end\n return @player_2.life\n end", "def show_favorite_players(fan) #this method is backend finding the players of a specifc fan\n players_array = favorite_players(fan)\n players_array.each do |player|\n puts player.name \n end\nend", "def get_player_reference\n if @player.nil?\n \"Anonymous\"\n else\n @player\n end\n end", "def player_by_number(number)\n players.each do |name, stats|\n if stats[:number] == number\n return name\n end\n end\nend", "def matching_player(player_name)\n all_players.find do |player|\n player[:player_name] == player_name\n end\nend", "def team_of_player(player)\n if player\n if first_team.include_player?(player)\n first_team\n elsif second_team.include_player?(player)\n second_team\n end\n end\n end", "def player_name\n player.name\n end", "def getPlayer(playerIndex)\n\t\treturn @players[playerIndex]\n\tend", "def points_scored_for_player(name,game)\n game[:home_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\n game[:away_team][:players].each do |player_hash|\n return player_hash[:stats][:points] if player_hash[:player_name] == name\n end\nend", "def find_player(player)\n found = false\n for name in @players\n if player == name\n found = true\n end\n end\n return found\n end", "def player1\n if self.game_type == 'cvc'\n player1 = Computer.find(self.player1_id)\n else \n player1 = Human.find(self.player1_id)\n end\n return player1\n end", "def num_points_scored(name)\n players = get_all_players # Works!\n player = find_player(players, name) # Up next...\n player[:points]\n \nend", "def get_next_player(player)\n \tresult = player\n \tif (not self.players.nil?) and (not self.players.empty?)\n \t\tif self.players.first == player\n \t\t\tresult = self.players.last\n \t\telse\n \t\t\tresult = self.players.first\n \t\tend\n \tend\n send_update\n \treturn result\n end", "def player_position(name)\n @players_info[name][0]\n end", "def player\n return $BlizzABS.actors[0]\n end", "def current\n self.players[self.current_turn]\n end", "def result\n loser = game_players.find do |game_player|\n game_player.ships.all?(&:sunk?) && game_player.ships.size > 0\n end\n\n if loser\n return game_players.find { |game_player| game_player.id != loser.id }\n end\n end", "def show\n @player = Player.includes(:team).find(params[:id])\n end", "def get_player_on_turn(turn)\n\t\tif turn%2==0 then\n\t\t\treturn @player2\n\t\telse\n\t\t\treturn @player1\n\t\tend\t\t\n\tend", "def get_next_player\n crnt_plyr_indx = @game.user.index(@game.whoseTurn)\n temp_usr_array = @game.user.rotate(crnt_plyr_indx)\n if(@game.clockwise) then\n return User.find(temp_usr_array[1])\n else\n return User.find(temp_usr_array[-1])\n end\n end", "def get_winning_player\n # if one player has all the cards\n players.map{|p| @winning_player = p if p.num_cards_remaining == Deck.num_cards}\n\n # if that's not the case, take the player with the highest number of cards\n if @winning_player.blank?\n @winning_player = CardFuncs::player_with_highest_card_count players\n end\n @winning_player\n end", "def player_board\n boards.player.first\n end", "def find_player_by_user(user_id)\n if self.user_id == user_id\n # This is the mod\n return nil\n end\n last_registered_player_id = self.last_registered_player_id.to_i\n if last_registered_player_id == -1\n # no users in this game, return as appropriate\n return nil\n end\n while last_registered_player_id != -1\n curr_player = Player.find(last_registered_player_id)\n if curr_player.user_id == user_id\n return curr_player\n end\n last_registered_player_id = curr_player.prev_player_id\n end\n # search failed to find player in the player list\n return nil\n end", "def lead_card\n player = lead_player\n @played[player]\n end", "def show\n # find the player by their login\n @player = Player.find_by_login(params[:id])\n # 404 if player isn't found\n raise ActiveRecord::RecordNotFound unless @player\n end", "def authorized_player(id)\n player = Player.find(id)\n if logged_in? && player == current_player\n return player\n end\n end", "def retrieve_current_player\n session[:current_player]\n end", "def get_character(param)\n if $game_party.in_battle\n nil\n elsif param == -1\n $game_player\n elsif param < -1\n $game_player.followers[param.abs-2]\n else\n $game_map.events[param]\n end\n end", "def current_turn()\n @players[@turn]\n end", "def get_player(msg)\n nick = msg.user.nick\n player = Player.nick_exists? nick\n # Check that the player exists\n unless player\n msg.reply \"#{nick} does not have a character yet.\"\n msg.reply \"Use !new to get started.\"\n return nil\n end\n player\n end", "def best_line\n mark = @board.current_player.mark\n sorted_lines = sort_by_mark(mark)\n sorted_lines[0]\n end", "def belongs_to_player\n Player.where({ plyrattrs: self.attributes }).first\n end", "def winner\n<<<<<<< HEAD\n @winner_player\n end", "def get_player\n store = YAML::Store.new pathname\n store.transaction { store[:player] }\n end", "def findPlayer\n playerFound = false\n finishFound = false\n @maze.each_with_index do |row, rowIndex|\n row.each_with_index do |col, colIndex|\n case col\n when PLAYER_CHAR then\n raise 'More than one player' if playerFound\n playerFound = true\n @playerRow = rowIndex\n @playerCol = colIndex\n when FINISH_CHAR then finishFound = true\n when TRACK_MARKER then raise 'Track marker playerFound in maze'\n end\n end\n end\n raise 'No player' unless playerFound\n end", "def cursor\n return $game_player\n end", "def cursor\n return $game_player\n end", "def player_stats(player_name_arg)\n get_me_all_players_please().find do |player_hash|\n player_hash[:player_name] == player_name_arg\n #binding.pry\n end\nend", "def find_winner\n if @player_1.life == 0\n return 2\n end\n return 1\n end", "def score(player)\n @score[player]\n end", "def players\n @players.select(&:playing)\n end", "def players_by_position(position)\n non_injured.select{ |athlete| athlete['position'] == position }\n end", "def select_position\n @players = @game.players\n end", "def current_player\n\tif $turn == 0\n\t\tplayerone\n\telse\n\t\tplayertwo\n\tend\nend", "def current_player\n if(player_id = session[:player_id])\n return Player.find_by(id: player_id)\n elsif (player_id = cookies[:player_id])\n player = Player.find_by(id: player_id)\n if player && player.authenticate(cookies[:remember_token])\n log_in player\n\t return player\n end\n end\n end", "def player_name(id)\n name = Player.find(id)\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end" ]
[ "0.7634937", "0.6722426", "0.6719397", "0.6598804", "0.6564673", "0.65433323", "0.65272146", "0.64467496", "0.6410199", "0.64043903", "0.63966817", "0.6336073", "0.63250595", "0.6319834", "0.63119364", "0.6310581", "0.6298843", "0.6285358", "0.62699217", "0.6233654", "0.6180878", "0.61789", "0.61642045", "0.6152025", "0.61145216", "0.6106186", "0.6098556", "0.6085328", "0.6072865", "0.6065978", "0.6055605", "0.6050281", "0.6040326", "0.6026739", "0.6008359", "0.6004245", "0.59846586", "0.59677166", "0.59669507", "0.5953069", "0.5934814", "0.5932449", "0.5891445", "0.5859156", "0.58470404", "0.5844486", "0.58318955", "0.58307683", "0.58297276", "0.581682", "0.58134705", "0.5804303", "0.5803952", "0.57897675", "0.57876855", "0.5781746", "0.57806337", "0.5769536", "0.5764984", "0.5764406", "0.5763744", "0.5760409", "0.57598937", "0.5755331", "0.5750882", "0.57474965", "0.57395804", "0.57360494", "0.57289267", "0.57247543", "0.5721786", "0.5704805", "0.57018197", "0.56970507", "0.5695028", "0.5686555", "0.5672259", "0.5661179", "0.5658079", "0.56492877", "0.56412774", "0.56302637", "0.56236386", "0.56092566", "0.5600598", "0.5598435", "0.5586465", "0.55733514", "0.55733514", "0.55629927", "0.5561363", "0.5560978", "0.5560104", "0.5557257", "0.55526376", "0.55501753", "0.5542295", "0.5540752", "0.55246097", "0.55246097" ]
0.8405265
0
Checks if the player passed is allowed to play
def valid_player?(player) @current_player == player.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_play?( player_id )\n player = Player.find(player_id) if player_id\n return true if not restricted or (player and player.admin)\n found = RestrictedGamePlayerList.find( :first, :conditions => ['fk_game_id = ? and fk_player_id = ?', id, player.id ]) if player\n found ? true : false\n end", "def new_player_allowed?; false end", "def taken?\n return !@player.nil?\n end", "def can_control?\n player_iface['CanControl']\n end", "def allowed_player\n player = Player.where(id: params[:player_id], access_code: params[:access_code]).take\n if player == nil\n render nothing: true, status: :unauthorized\n return\n end\n \n # If player doesn't have player identifier set yet, set it\n if player.uniqkey == nil\n player.uniqkey = params[:uniqkey]\n player.save\n else\n if player.uniqkey != params[:uniqkey]\n render nothing: true, status: :unauthorized\n return\n end\n end\n end", "def verify_player(msg)\n nick = msg.user.nick\n player = get_player msg\n return nil unless player\n # Check that the player is ready for use.\n # The idea is to tell the user everything he needs to set, all at once.\n ready = true\n unless player.name\n msg.reply \"#{nick} does not have a name yet!\"\n msg.reply \"Spare yourself an existential crisis and set a name with !name.\"\n ready = false\n end\n unless player.backstory\n msg.reply \"#{nick} does not have a backstory!\"\n msg.reply \"Who even are you? Tell us with !player set backstory.\"\n ready = false\n end\n unless player.race\n msg.reply \"#{nick} has no race!\"\n msg.reply \"Use !player set race to forever idetifiy as a single stereotype.\"\n msg.reply \"Use !races to get a list the playable races.\"\n ready = false\n end\n unless player.baseType\n msg.reply \"#{nick} has no base class!\"\n msg.reply \"High school is full of cliques. Now choose one with !player set class.\"\n msg.reply \"Use !classes to get a list of the playable classes.\"\n ready = false\n end\n ready ? player : nil\n end", "def new_player_required?; false end", "def playable?\n @my_turn && @game_status != :ended\n end", "def players_allowed_to_play\n return if self.manager.nil? || self.players.nil?\n\n self.players.each do |p|\n unless p.tournaments.include? self.manager\n errors.add(:match, \"players must be in same tournament as match\")\n end\n end\n end", "def player_has_played?(player)\n played_cards[player].present?\n end", "def from_player?\n return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)\n end", "def validate_player\n \t@player = Player[params[:player_id]]\n if @player.nil?\n render_error(Error::NORMAL, \"Invalid player id\") and return\n end\n end", "def playable?\n false\n end", "def game_play?()\n if self.admin\n return false\n elsif self.team.nil?\n return false\n elsif !self.team_adopt\n return false\n end\n game=Game[self.team.active_game]\n if game.nil?\n return false\n end\n\n if game.run?\n return true\n elsif game.owner?(self)\n return true\n end\n\n return false\n end", "def caught_by_player?\n return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)\n end", "def is_playable?(card)\n # if not card in hand of player which turn is\n return false unless @hands[@on_move].include?(card)\n \n #if no cards played this turn any card is playable\n if cards_played_size == 0\n return true\n end \n end", "def exclusive_play\n if(player2_move == player1_move)\n self.errors.add(:player1_move, \" only one player can play a move\")\n end\n end", "def right_player?\n current_player == Player.find(@piece.owner)\n end", "def onalg_player_cardsnot_allowed(player, cards)\r\n lbl_card = cards[0]\r\n log \"#{player.name} ha giocato una carta non valida [#{nome_carta_ita(lbl_card)}]\\n\"\r\n @player_on_gui[:can_play] = true\r\n end", "def can_play(player_cnt)\n if @cards.length >= player_cnt * AVERAGE_HAND_SIZE\n return 1\n end\n return nil\n end", "def current_player?\n !!current_player\n #!! turns the object into a boolean\n #NB current_player is not a local variable. It's a call to the method current_player\n end", "def must_be_my_turn\n @game = Game.find(params[:game_id])\n @player = Player.find(params[:id])\n unless @game.turn_player == @player\n render nothing: true, status: :forbidden\n end\n end", "def players_unplayable(player_ids, user)\n player_ids.each do |pid|\n player = Player.find(pid)\n unless player.playable\n if player.user != user\n return true\n end\n end\n end\n false\n end", "def logged_in?\n !current_player.nil?\n end", "def logged_in?\n !current_player.nil?\n end", "def playing?\n self.play_start != nil\n end", "def isUsernameAvailable(username)\n player = self.playerWithUsername username\n return player == nil\n end", "def is_playable?\n is_playable = false\n x = 0\n while ((x < self.width) && (!is_playable))\n is_playable = (@assignment[x][0] == nil);\n x += 1\n end\n is_playable\n end", "def played_by?(username)\n @first_player.name == username || @second_player.name == username\n end", "def own_game?\n return unless @game.black_player_id\n return if @game.white_player_id == current_user.id || @game.black_player_id == current_user.id\n\n flash[:alert] = \"Sorry, you're not a player in that game\"\n redirect_to games_path\n end", "def not_played_by?(player)\n opponent?(player) ?\n opponent_moves.last.opponent_choice.nil? :\n player_moves.last.player_choice.nil?\n end", "def player_in_lobby\n lobby.player(self) rescue false\n end", "def can_pass_to? target_player\n\t\treturn false unless target_player.is_a? Player\n\t\tres = can_move?\n\t\tres &= @has_ball\n\t\tres &= !@team.pass?\n\t\tres &= target_player\n\t\tres &= target_player != self\n\t\tres &= target_player.team == @team\n\t\tres &= target_player.health == Health::OK\n\t\tres &= dist(self, target_player) <= 10.5\n\tend", "def playing?\n redirect_to matche_url(@match), alert: I18n.t(:alert, scope: 'custom.controller.comment.playing') unless playing_user?(@match, current_user)\n end", "def playable?\n video_source\n end", "def player_in_ongoing_game\n ongoing_game.player(self) rescue false\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 member?(player)\n players.include?(player)\n end", "def player_exist?(name)\n log \"Checking existence of #{name}\", Logger::Medium\n @storage.player_exist?(name)\n end", "def check_if_valid(player_move)\n [\"rock\", \"paper\", \"scissors\", \"spock\", \"lizard\"].include?(player_move.downcase)\n end", "def playing?\n players.select{|player| player.lives > 0}.count > 1\n end", "def can_call?(player)\n return (self.high_bet > player.in_pot_current)\n end", "def in_check(player, board)\r\n king_loc = find_my_king(player, board)\r\n dangerous_player = offending_player(king_loc, player, board)\r\n if dangerous_player.nil?\r\n return false \r\n end\r\n return true\r\n end", "def valid_play(x, y)\n temp = @board.length - 1\n x.between?(0,temp) && y.between?(0,temp) ? true : false\n end", "def can_watch?(song)\n song.open? ||\n song.closed? && authenticated? ||\n authenticated? && @current_user.played?(song)\n end", "def can_player_make_another_action_choice?\n @player_actions.size.upto(@logic.battle_info.vs_type - 1) do |position|\n next_pokemon = @logic.battler(0, position)\n # If there's no Pokemon at this position, then it's probably the end of the team\n break unless next_pokemon\n # If it's not our Pokemon we don't control it\n next(@player_actions << {}) if next_pokemon.party_id != 0\n # If the Pokemon is dead, we also don't control it\n next(@player_actions << {}) if next_pokemon.dead?\n # This Pokemon can be controlled\n return true\n end\n return false\n end", "def won_by?(player)\n\t\tcase player\n\t\twhen :hunter\n\t\t\tif players_within_distance?\n\t\t\t\t\"CAPTURE\"\n\t\t\telsif @prey.time_taken > $time_limit\n\t\t\t\t\"TIMEOUT\"\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\twhen :prey\n\t\t\tif players_surrounded?\n\t\t\t\t\"ESCAPE\"\n\t\t\telsif hunter_trapped?\n\t\t\t\t\"ESCAPE\"\n\t\t\telsif @hunter.time_taken > $time_limit\n\t\t\t\t\"TIMEOUT\"\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def ready_to_begin?\n @game.players.size == @limit\n end", "def nextTurnAllowed\n return (@currentPlayer.nil? or @currentPlayer.validState)\n end", "def in_play?\n started? || in_progress?\n end", "def is_current_player(user) \n\t\treturn user.id == self.current_player\n\tend", "def game_over?\n remaining_players == 1\n end", "def playable\r\n\t\t@phand.each do |x| #go through player hand\r\n\t\t\tif @attack[-1].suit == @trump.suit && x.suit == @trump.suit && x.value > @attack[-1].value\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @trump.suit && @attack[-1].suit != @trump.suit #player can always trump any non trump\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.suit == @attack[-1].suit && x.value > @attack[-1].value #player can play a higher card of the same suit\r\n\t\t\t\tx.canplay = true\r\n\t\t\telsif x.value == @attack[-1].value && @defend.count == 0\r\n\t\t\t\tx.canplay = true\r\n\t\t\telse\r\n\t\t\t\tx.canplay = false\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def validate_command\n if requester != player\n errors.add(:allowed, I18n.t(\"errors.not_authorized\"))\n end\n unless airlift?\n if game.actions_taken == 4\n errors.add(:allowed, I18n.t(\"player_actions.no_actions_left\"))\n end\n if proposal.turn_nr != game.turn_nr\n errors.add(:allowed, I18n.t(\"movement_proposals.expired\"))\n end\n if destination_is_not_a_neighbor? && another_player_is_not_at_destination?\n errors.add(:allowed, I18n.t(\"movement_proposals.not_allowed\"))\n end\n end\n end", "def alg_player_cardplayed(player, lbl_card)\n str = \"#{player.name},#{lbl_card}\"\n @net_controller.send_data_to_server( @net_controller.build_cmd(:alg_player_cardplayed, str) )\n @log.debug(\"<client>alg_player_cardplayed: #{str}\")\n return :allowed # avoid dumb comment\n end", "def check_players\n errors[:base] << \"You aren't ready to fight!\" unless ready_to_fight?\n end", "def Winner?(player)\r\n end", "def isPlayerStarter?(context_player_id)\n\t\tok = false\n\t\tself.player_games.each do |value|\n\t\t\tif value.player_id == context_player_id && value.o == 1\n\t\t\t\tok = true\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\t\n\t\tok\n\tend", "def autoplay_blocked_by_level?\n # Wrapped since we store our serialized booleans as strings.\n self.never_autoplay_video == 'true'\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 playing?\n self.in_progress? or self.caught_up?\n end", "def in_play?\n self.round.in_play?\n end", "def check player\n\t\tin_check = false\n\t\tenemy = player.name == \"Player1\" ? player2 : player1\n\t\tenemy.tokens.each do |token|\n\t\t\ttoken.each do |piece|\n\t\t\t\tif( piece.next_moves(@board).include?(player.tokens[-1][0].position) &&\n\t\t\t\t\t!piece.path_blocked?(player.tokens[-1][0].position, @board))\n\t\t\t\t\tin_check = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tin_check\n\tend", "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 player_check(player_to_check)\n for player in @players\n return true if player_to_check == player\n end\n return false # could have used .include? method\n end", "def logged_in?\n !session[:player_id].nil?\n end", "def set_player_move?(player, move)\n if possible_plays.include?(move)\n player.move = move\n true\n else\n false\n end\n end", "def at_max_players?\n self.player_count == MAX_PLAYERS\n end", "def has_access\n if !current_user\n return false\n elsif current_user.mtu_id != @player.mtu_id && !Player.exists?(mtu_id: current_user.mtu_id, committee: true)\n return false\n end\n return true\n end", "def allowed?\n allowed\n end", "def game_over?\n @players.all? {|p| p.last_turn == \"skipped turn\"} || (@letter_bank.empty? && current_player.rack_empty?)\n end", "def logged_in?\n @current_player.is_a?(Player)\n end", "def show\n if @playlist.public or (user_signed_in? and (@playlist.user == current_user or are_friends(current_user, @playlist.user) or current_user.admin))\n @isPlayer = true\n else\n redirect_to new_user_session_path\n end\n end", "def playing?\n puts 'playing?()'\n (session[:playing] == true)\n end", "def starter?\n games_played < Player::STARTER_BOUNDARY\n end", "def starter?\n games_played < Player::STARTER_BOUNDARY\n end", "def no_player_can_move?\n !valid_move?(:black) && !valid_move?(:red)\n end", "def human?\n return self.class == Player\n end", "def played?\n winner.present?\n end", "def login_authorized?(player, web_player_id)\n player_str = \"#{player} (web_id: #{web_player_id.inspect})\"\n only_in_production(\"authorization for #{player_str}\") do\n response = post_to_web(player.galaxy.callback_url,\n \"check_play_auth\",\n 'web_player_id' => web_player_id,\n 'server_player_id' => player.id\n )\n\n check_response(response)\n end\n rescue Error => e\n false\n end", "def is_acting_player?\n\t\t\t@_iap ||= @state_hash['state']['acting_player']['id'] == @player_id\n\t\tend", "def is_acting_player?\n\t\t\t@_iap ||= @state_hash['state']['acting_player']['id'] == @player_id\n\t\tend", "def phase_playing_player\n turn.phase.is_a?(BlockPhase) ? defending_player : playing_player\n end", "def ready_to_start?\n\t\tenabled_players = @entries.select do |entry|\n\t\t\tentry.enabled\n\t\tend\n\t\tenabled_players.size() >= Constants::MIN_PLAYERS &&\n\t\t\tnames_are_unique?(enabled_players)\n\tend", "def any_player_other_than?(player)\n @players.length > 1 || (@players.length == 1 && @players.first != player)\n end", "def enough_human_players?\n players.length >= needed_players\n end", "def is_playlist\n return @play_list != nil\n end", "def show_play_complete_player\n # nothing\n end", "def minimum_players?\n self.players.count == MIN_PLAYERS\n end", "def game_over?\n (@player1.lives == 0) || (@player2.lives == 0)\n end", "def allowed?\n true\n end", "def allow?(*args)\n true\n end", "def allowed?\n true\n end", "def allowed?\n true\n end", "def has_played?\n stats != nil\n end", "def check_player\n if self.moves == nil or self.moves.length % 2 == 0\n @current_player = 1\n else\n @current_player = 2\n end \n end", "def show_play_complete_player\n\t\t# nothing\n\tend", "def still_playing\n if victory == true\n @stillPlaying = false\n end\n return @stillPlaying \n end", "def check_user_play\n @play = GamePlay.where('game_id = ? AND user_id = ?', params[:game_id], request.env['HTTP_USER_ID'])\n if @play.empty?\n render json: { message: 'need to add play' }\n else\n render json: { message: 'need to update play' }\n end\n end", "def has_valid_credentials\n\t\tif session[:player_id] == nil\n\t\t\treturn false\n\t\telse\n\t\t\tsessionPlayer = Player.find_by_id(session[:player_id])\n\t\t\treturn ((session[:email] == sessionPlayer.email) and (params[:id].to_s == session[:player_id].to_s))\n\t\tend\n\tend" ]
[ "0.7887071", "0.7616827", "0.7137509", "0.69422543", "0.6933388", "0.6924123", "0.68694174", "0.6862092", "0.6848318", "0.6805023", "0.6784429", "0.6766935", "0.67457587", "0.6692774", "0.66658586", "0.6661943", "0.66613704", "0.6645179", "0.65789646", "0.65653706", "0.65153813", "0.6471134", "0.6463842", "0.64248294", "0.64248294", "0.64242953", "0.6422815", "0.64023614", "0.638095", "0.63792765", "0.6375153", "0.6370761", "0.63694113", "0.63683146", "0.63532", "0.6353183", "0.6344981", "0.63146573", "0.6304859", "0.6289992", "0.62687844", "0.6259959", "0.6257125", "0.6248571", "0.62436897", "0.624362", "0.62370926", "0.62204677", "0.621205", "0.62009084", "0.61982286", "0.61923635", "0.61825794", "0.6178654", "0.61579347", "0.6154773", "0.6143628", "0.61420083", "0.6135058", "0.61205035", "0.6119311", "0.61081153", "0.610721", "0.6087942", "0.608098", "0.60781986", "0.6077687", "0.6075294", "0.60613215", "0.6040176", "0.6030522", "0.60276943", "0.6018095", "0.60157824", "0.6009735", "0.6009735", "0.6005739", "0.60041326", "0.600249", "0.5994684", "0.59923095", "0.59923095", "0.59916633", "0.5984981", "0.5983915", "0.5977471", "0.59743863", "0.5971122", "0.59680516", "0.5964782", "0.59631026", "0.5961559", "0.5958564", "0.5958564", "0.5951538", "0.59489447", "0.59482473", "0.59455323", "0.5941186", "0.5935724" ]
0.73155165
2
Checks if coordinate is valid
def valid_pick?(x, y) @game_array[x][y] == nil rescue fail InvalidPickException.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_coordinate?(coord)\n if coord.size == 2 && coord[0].between?(0, 7) && coord[1].between?(0, 7)\n true\n else\n false\n end\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def coordinate_valid?(x, y)\n (x >= 0) && (y >= 0) && (x < @width) && (y < @height)\n end", "def valid_coordinates\n input.length == 2 && input.all? { |value| value.match? /\\A\\d+\\z/ }\n end", "def valid?\n lat && lng\n end", "def valid?\n lat && lng\n end", "def valid_coordinates?(x_coord, y_coord)\n (0..width).include?(x_coord) && (0..height).include?(y_coord)\n end", "def validate(coordinate)\n if coordinate >= 0 and coordinate < 5\n return true\n else\n return false\n end\n end", "def valid?(coordinates) ##this will need to check if the placement of coorindates is valid, sequential in row/number\n\t\thorizontal_valid?(coordinates) || vertical_valid?(coordinates)\n\tend", "def test_the_coordinates_are_valid\n assert_equal true, @board.valid_coordinate?(\"A1\")\n assert_equal false, @board.valid_coordinate?(\"ZZ\")\n end", "def check_valid?(coordinates)\n valid = false\n x = coordinates[0]\n y = coordinates[1]\n if (x > 0 && x <= @size) && (y > 0 && y <= @size)\n if @game_board[coord_to_array(coordinates)] == \" \"\n valid = true\n else\n puts \"\\nLocation already taken! Please try again.\"\n end\n else\n puts \"\\nInput does not fit parameters of the board. Please try again.\"\n end\n return valid\n end", "def valid?\n !@lat.nil? && !@lon.nil? && @lat.to_f.abs < 90 && @lon.to_f.abs < 90\n end", "def invalid?(x, y, message=\"Specified co-ordinates are outside the document\")\n if @matrix.invalid?(xform(x), xform(y))\n Logger.warn(message)\n return true\n end\n false\n end", "def validate!\n [x, y, z].each { |c| return false if c == '' or c.nil? }\n sorted = [x.abs, y.abs, z.abs].sort\n if EXTRA_VALIDATION\n if x.abs >= 100 or y.abs >= 100 or z.abs >= 100\n self.problems << \"Invalid coordinate: at least one dimension >= 100.\"\n end\n if sorted[0] == 0 and sorted[1] == 0\n self.problems << \"At least two dimensions have value == 0; coordinate may not be real.\"\n end\n elsif x.abs >= 100 or y.abs >= 100 or z.abs >= 100 or sorted[0] == 0 and sorted[1] == 0\n return false\n end\n self\n end", "def valid_coordinate?(coordinate)\n @board_hash.include?(coordinate)\n end", "def valid?\n lat && lng && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180\n end", "def valid_point\n not (@point.time.nil? or @point.latitude.nil? or @point.longitude.nil?)\n end", "def valid_position?(x, y)\n !!(x && y && x > 0 && y > 0 && x <= 8 && y <= 8)\n end", "def check_valid_position(xcoord, ycoord)\n\tif xcoord >= GRID_SIZE || xcoord < 0\n\t\treturn false\n\telsif ycoord >= GRID_SIZE || ycoord < 0\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend", "def coordinates_valid?(@coordinates)\n #still need to set conditions for validation to be true.\n\n #for 2-unit shit\n if true\n @user_ship_1.set_coordinates(@coordinates)\n else\n #need to kick back to BoardGame with out Board knowing about BoardGame\n @Messages.error_ship_location_is_invalid\n coordinates_match\n end\n\n #for 3-unit ship\n if true\n @user_ship_2.set_coordinates(@coordinates)\n else\n #need to kick back to BoardGame with out Board knowing about BoardGame\n @Messages.error_ship_location_is_invalid\n coordinates_match\n #place_your_3_unit_ship\n end\n end", "def validate_x_y_coords(x, y)\n validate_x_coords(x)\n validate_y_coords(y)\n end", "def valid_coordinates?(x, y)\n (1..board_width).include?(x.to_i + 1) &&\n (1..board_height).include?(y.to_i + 1)\n end", "def valid_coords(i, j)\n (0...height) === i && (0...width) === j\n end", "def validate_xy(x, y)\n (x >= 0 && y >= 0) && (x <= @size - 1 && y <= @size - 1)\n end", "def valid?\n @x.is_a?(Integer) &&\n @y.is_a?(Integer) &&\n orientation_set?\n end", "def is_latlng?\n coordinates && coordinates.valid?\n end", "def valid_coord?(cell, ship)\n if cell && cell.empty?\n find_cells = build_ship_with_index_cell(ship.size, cell)\n if find_cells&.all? do |look_cell|\n !look_cell.nil?\n end && find_cells.select(&:empty?).count == find_cells.count\n set_ship_cells(ship, find_cells)\n true\n else\n puts \"Ship cannot be placed at this coordinate, try again\".yellow\n false\n end\n else\n puts \"Cell not available, try again\".yellow\n false\n end\n end", "def position_is_valid?(position)\r\n position.x < @col &&\r\n position.y < @row &&\r\n position.x >= 0 &&\r\n position.y >= 0\r\n end", "def valid_place?(x, y)\n @table.validate_pos(x, y)\n end", "def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end", "def valid?(x, y)\n return (x >= 0 and x < $game_map.width and y >= 0 and y < $game_map.height)\n end", "def valid?(x, y)\n x >= 0 && x < MAX_WIDTH && y >= 0 && y < MAX_HEIGHT\n end", "def valid_location(x, y)\n return (x >= 0) && (x < Settings.get_horizontal_size) && (y >= 0) && (y < Settings.get_vertical_size)\n end", "def valid?\n test_bounds(x, @xmin, @xmax) && test_bounds(y, @ymin, @ymax)\n end", "def valid_board_coordinates?(x, y)\n x >= 0 && y >= 0 && x < 3 && y < 3\n end", "def validate(x_coordinate, y_coordinate)\n if x_coordinate >= 0 && x_coordinate < maze.length && y_coordinate >= 0 && y_coordinate < maze[0].length\n [x_coordinate, y_coordinate]\n else\n nil\n end\n end", "def valid_place?(x_position, y_position)\n x_position.between?(0, @dimension) &&\n y_position.between?(0, @dimension)\n end", "def self_valid?(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # checks if coordinates are valid\n return (x >= 0 && x < width * pix - pix + 1 && y >= 0 && y < height * pix - pix + 1)\n end", "def position_is_valid?(position)\n position.x < @length &&\n position.y < @width &&\n position.x >= 0 &&\n position.y >= 0\n end", "def valid?\n x.between?(0, 6) && y.between?(-1, 6)\n end", "def validation\n self.nation ||= region.nation\n unless !@x || !@y || @x == '' || @y == ''\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def sanity_check_ballot_coords\n \n end", "def validate_coords\n (0..1).each do |index|\n if params.try(:[], index).try(:to_i) > 5 || params.try(:[], index).try(:to_i) < 0\n errors[:params] << \"[PLACE] #{index+1} param should be more than -1 and less than 6\"\n end\n end\n end", "def valid?\n return false if @height.nil?\n return false if @height < 0\n return false if @width.nil?\n return false if @width < 0\n return false if @x.nil?\n return false if @x < 0\n return false if @y.nil?\n return false if @y < 0\n true\n end", "def valid_xy?(c)\n if (c.length == 2 && c[0].is_i? && c[1].is_i?)\n return true\n else\n return false\n end\n end", "def valid?(x, y)\n return (x >= 0 and x < width and y >= 0 and y < height)\n end", "def position_valid?(x, y)\n position_within_bounds?(x, y) && position_free?(x, y)\n end", "def validate_pos(x, y)\n return x.between?(0, @size_x - 1) && y.between?(0, @size_y - 1)\n end", "def valid_pos?(pos)\n pos.all? { |coordinate| coordinate.between?(0, 7)}\n end", "def isLegalCoord(row, col)\n legal = false\n if row == '1' || row == '7'\n if col == 'A' || col == 'D' || col == 'G'\n legal = true\n end\n elsif row == '2' || row == '6'\n if col == 'B' || col == 'D' || col == 'F'\n legal = true\n end\n elsif row == '3' || row == '5'\n if col == 'C' || col == 'D' || col == 'E'\n legal = true\n end\n elsif row == '4'\n if col == 'A' || col == 'B' || col == 'C' || col == 'E' || col == 'F' || col == 'G'\n legal = true\n end\n end\n\n return legal\n end", "def chk_safe_coords(x, y)\n # If x or y is negative or greater than 4\n if x < 0 || x > 4 || y < 0 || y > 4\n return false # Return \"unsafe\"\n else\n return true # Return \"safe\"\n end\nend", "def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction\"\n return false\n end\n return true\n end", "def valid?(pos) #getter\n #pos shoul be 2 number like [2,n]\n #need to check if [2,n] is in our @grid\n row,col = pos\n pos.all? {|num| num >= 0 && num < @n}\n end", "def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end", "def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end", "def is_valid?\n return is_closed? && (@polygon_points.length >= 3)\n end", "def validate_coordinate(x, y, msg)\n\t\twhile !numbers.include?(y) || !letters.include?(x.upcase)\n\t\t\tputs msg\n\t\t\tinput = gets.chomp.chars\n\t\t\tif input.count == 2\n\t\t\t\tx, y = input[0], input[1]\n\t\t\telsif input.count == 3 && input[1] == '1' && input[2] == '0'\n\t\t\t\tx, y = input[0], '10'\n\t\t\telse\n\t\t\t\tx, y = \"X\", \"X\"\n\t\t\tend\n\t\t\tmsg = \"That's not a valid coordinate, try again... (eg A1-J10)\"\n\t\tend\n\t\treturn x, y\n\tend", "def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end", "def legal(coords)\n row_dist = (@row - coords[0]).abs\n col_dist = (@column - coords[1]).abs\n if row_dist > 1 || col_dist > 1\n return false\n elsif check\n puts \"cant move into check\"\n return false\n else\n return occupied?(coords)\n end\n end", "def validate?\n ( @x <= @y && @d > 0 )\n end", "def valid_piece_movement?(coordinates)\n row = coordinates[:row]\n column = coordinates[:column]\n @active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])\n end", "def check_grid_coordinates(x, y)\n (x >= 0) && (x < @height) && (y >= 0) && (y < @width)\n end", "def valid?(position)\n row, col = position\n position.all? {|i| i >= 0 && i< @grid.length}\n \n end", "def valid_cell?(coordinates)\n @board.cells[coordinates[0]][coordinates[1]].state == \" \"\n end", "def validate_position\n errors.add_to_base(\"Node is not in the world\") unless in_world?\n end", "def move_valid?(x, y)\n coordinate_valid?(x, y) && !@visited[y][x]\n end", "def move_valid?(x, y)\n coordinate_valid?(x, y) && !@visited[y][x]\n end", "def valid_location?(x, y)\n return false if x > @storage.length - 1\n return false if y > @storage.first.length - 1\n\n true\n end", "def check_coords(coord)\n target = $new_game.grid[coord[0]][coord[1]]\n if target[:ship] == true\n $new_game.hits += 1\n $new_game.targets -= 1\n target[:display] = \"XX\"\n self.hit\n else\n # Miss\n target[:display] = \"OO\"\n $new_game.lives -= 1\n self.miss\n end\n $prompt.collect_coords\n end", "def validate_position(current_x_pos, current_y_pos)\n \n if (@bottom_left_X_pos..@top_right_X_pos).member?(current_x_pos) &&\n (@bottom_left_Y_pos..@top_right_Y_pos).member?(current_y_pos)\n return true\n end\n\n return false\n end", "def pass_boundary_check?(coordinate)\n coordinate.each do |c|\n if c.is_i?\n if c < 0\n return false\n elsif c > @map.my_matrix.length-1\n return false\n elsif c > @map.my_matrix[0].length-1\n return false\n end\n end\n end\n true\n end", "def valid?\n\t\tarea != 0\n\tend", "def coordinate?(value)\n !! value.to_f\n end", "def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end", "def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end", "def valid_square?(pos)\n y, x = pos\n y.between?(0, @Y_DIM-1) && x.between?(0, @X_DIM-1)\n end", "def valid_placement?(ship, coords)\n size_check(ship, coords) && cons_check(coords) && ship_check(coords)\n end", "def valid_position?(x, y)\n !negative_positions?(x, y) && positions_inside_table?(x, y)\n end", "def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end", "def require_coordinates!\n if params[:longitude] && params[:latitude]\n @coordinates = Coordinates.new(params[:longitude].to_f, params[:latitude].to_f)\n end\n unless @coordinates\n render nothing: true, status: :bad_request and return\n end\n end", "def test_player_coord_input\n # true if finalize_ship_coords == true\n @ship.valid_coords = finalize_ship_coords(@player_orientation,\n @player_base_coords)\n end", "def coordinates?(latitude, longitude)\n coordinate?(latitude) && coordinate?(longitude)\n end", "def validate_move(world, new_coords)\n true if new_coords[0].between?(0, world.size-1) && new_coords[1].between?(0, world.size-1)\n end", "def has_point(x, y)\n is_negative = (x < 0 or y < 0)\n is_greater_than_dimensions = (x > @width or y > @height)\n\n if is_negative or is_greater_than_dimensions\n result = false\n puts \"[#{x},#{y}] is Outside of Grid, Robot will ignore command\"\n else\n result = true\n end\n\n return result;\n end", "def validate_current_position_boundaries\n if (@initial_position.nil? || row_pos_invalid? || col_pos_invalid?) \n puts \"\\nPlease enter valid chess piece position. Eg: -position a1\"\n puts \"Please type one of these positions\"\n puts valid_boundaries\n @is_valid = false\n end\n end", "def direction_valid?(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # checks if coordinates are valid\n return (x >= 0 && x < width * pix && y >= 0 && y < height * pix)\n end", "def check_coordinates(trace)\n coordinates = trace[:coordinates] || trace.coordinates\n\n coordinates.each do |c|\n lat = c[:latitude] || c.latitude\n long = c[:longitude] || c.longitude\n\n expect(lat).to be_a(Float)\n expect(long).to be_a(Float)\n end\n end", "def validation\n self.country ||= province.country\n unless !@x || !@y || @x == \"\" || @y == \"\"\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end", "def is_valid?(x, y)\n return false if x < 0 || x >= @matrix.first.length\n return false if y < 0 || y >= @matrix.length\n return false unless @matrix[y][x] == 1\n return false if @visited[y][x]\n true\n end", "def validate_placement(input)\n begin\n coordinates = input[6..-1].split(',')\n x_input = coordinates[0].to_i\n y_input = coordinates[1].to_i\n direction_input = coordinates[2]\n rescue\n return false\n end\n if input[0..5] == 'PLACE ' && (Robot::VALID_XY_COORDS.include? x_input) && (Robot::VALID_XY_COORDS.include? y_input) && (Robot::VALID_DIRECTIONS.include? direction_input)\n update_position(x_input, y_input, direction_input)\n else\n false\n end\n end", "def invalid_inputs\n puts \"Invalid input! Your positions must have x and y coordinates \"\\\n \"between 0 and 7.\"\n end", "def validate_position(transition)\n newx, newy, newdir = transition.args\n valid = valid_coordinates?(newx, newy) && Directions.include?(newdir.to_s)\n throw :halt unless valid\n end", "def validate_position(row,col)\n if row<=@board.size and col <=@board.size\n if @board[row][col]==EMPTY_POS\n return true\n else\n puts \"position is occupied\"\n end\n else\n puts \"invalid position\"\n end\n return false\n end", "def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\n end", "def validate_place(x,y,direction,placed,place_position)\n params=place_position.split(',')\n if is_integer(params[0]) && is_integer(params[1]) # Checking invalid inputs\n temp_x=params[0].to_i\n temp_y=params[1].to_i\n else\n return x,y,direction,placed # Place invalid, return\n end \n if validate(temp_x) && validate(temp_y) # Checking board boundaries\n if ['NORTH','EAST','WEST','SOUTH'].include?(params[2]) # Checking valid Directions\n x=temp_x\n y=temp_y\n direction=params[2]\n return x,y,direction,true #place is valid return updated coordinates and placed_state\n end\n end\n return x,y,direction,placed # Place invalid, return\n end", "def validate(arg)\n arg.each do |arg|\n if arg[0].to_f > 90 || arg[0].to_f < -90\n msg = \"Latitude '#{arg[0]}' is invalid - must be between -90 and 90\"\n raise Error, msg\n end\n if arg[1].to_f > 180 || arg[1].to_f < -180\n msg = \"Longitude '#{arg[1]}' is invalid - must be between -180 and 180\"\n raise Error, msg\n end\n end\n end", "def is_position_valid?(position)\n # Matching starting point as number and ending point as number and consider only one digit in Regexp condition.\n if /(^[1-9]$)/.match(position) != nil \n # If position is already occupied by \"X\" or \"O\", can't override that position again.\n if @board_value_hash[position.to_i] == nil\n return true\n else\n puts \"The position is already entered, please enter different position\\n\"\n end\n else\n return false\n end\n end", "def coordinates_changed?\n if self.address_changed?\n unless self.lat_changed? || self.lng_changed?\n self.errors.add(:address, 'cannot be geo-located. Please try to be more specific')\n return false\n end\n end\n true\n end", "def has_coordinate(position)\n position.all? { |coordinate| coordinate >= 0 && coordinate < @size }\n end", "def valid_position?(pos)\n r,c = pos\n row_len = @maze[0].length\n col_len = @maze[0].length\n\n # is within bounds of the maze\n r >= 0 && c >= 0 && r < row_len && c < col_len\n end", "def safe_position?(x, y)\n x >= 0 &&\n x <= 4 &&\n y >= 0 &&\n y <= 4\n end" ]
[ "0.82979584", "0.8192852", "0.8192852", "0.7826597", "0.76703984", "0.76703984", "0.76449007", "0.76235414", "0.7591091", "0.7516829", "0.7498058", "0.7442862", "0.741248", "0.7405246", "0.7370985", "0.7362539", "0.73473847", "0.7329087", "0.73235327", "0.7300762", "0.72913915", "0.7276302", "0.7257142", "0.72492534", "0.7172402", "0.71714836", "0.70690894", "0.70468855", "0.70350504", "0.7033842", "0.7033842", "0.70282644", "0.7027701", "0.70256954", "0.7019107", "0.7009966", "0.7007721", "0.694443", "0.6916027", "0.6908799", "0.6901642", "0.6879482", "0.68553346", "0.68446755", "0.6835968", "0.68045753", "0.6793259", "0.67663896", "0.6724075", "0.671457", "0.67078924", "0.6693192", "0.6670137", "0.6669775", "0.6661008", "0.6661008", "0.6660616", "0.6655132", "0.66499186", "0.66475815", "0.663672", "0.6634512", "0.6621328", "0.6618037", "0.6610426", "0.660656", "0.660656", "0.6568004", "0.6561905", "0.6554202", "0.6528571", "0.6526229", "0.6522488", "0.6520647", "0.65159124", "0.6502057", "0.6490029", "0.64878273", "0.6479221", "0.64774805", "0.6476725", "0.6466093", "0.64441437", "0.64272076", "0.6426099", "0.64183724", "0.6411842", "0.63951796", "0.6392556", "0.6383523", "0.6382294", "0.6375417", "0.6374849", "0.6365232", "0.63404864", "0.6339779", "0.63279045", "0.6319699", "0.6312648", "0.63095194", "0.63011795" ]
0.0
-1
Returns the mark of the winner if there' one.
def winner_mark check_columns || check_rows || check_left_diagonal || check_right_diagonal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end", "def detect_winner\n winning_marker = nil\n\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_MARKER)\n line_markers.uniq!\n winning_marker = line_markers[0] if line_markers.size == 1\n break if !!winning_marker\n end\n\n winning_marker\n end", "def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end", "def winner\n return @winner\n end", "def get_determine_set_winner()\n return @score_count.get_determine_set_winner()\n end", "def winner\n return @board[won?[0]] if won?\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n markers = squares.map(&:marker)\n return markers[0] if markers.uniq.size == 1 && squares[0].marked?\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n line_squares = squares.values_at(*line)\n next if line_squares.any?(&:unmarked?)\n markers = line_squares.map(&:marker)\n return markers.first if winner?(markers)\n end\n nil\n end", "def winner\n self.won?? self.board.cells[self.won?[0]] : nil\n end", "def winner\n won? ? board.cells[won?[0]] : nil\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def winner\n won = \"\"\n if winner = won?\n won = @board[winner.first]\n end\n end", "def winner\n if won?\n winner = won?\n return @board[winner[0]]\n else\n return nil\n end\n end", "def winner \n @board[won?[0]] if won?\n end", "def winner()\n if won?()\n return @board[won?()[0]]\n end\n return nil\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def winner\n if won?\n return @board[ won?[0] ]\n else\n return nil\n end\n end", "def winner\n if !won?\n nil\n else winner = @board[won?[0]]\n\n end\n\n end", "def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end", "def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker # return the corresponding detected marker\n end\n end\n nil\n end", "def winner\n big_p = 1\n \n marks = self.unrolled\n @@All_Runs.each do |run|\n #p = product of all the slots\n p = run.map {|i| marks[i]}.inject(:*)\n return :x if p == 8\n return :o if p == 1\n big_p *= p\n end\n \n return (big_p == 0) ? nil : :cat\n end", "def winning_marker\n WINNING_LINES.each do |line|\n full_line_mark = full_line_check(@squares.values_at(*line))\n next if full_line_mark.nil?\n return full_line_mark\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end", "def winner\n if won? == nil\n return nil\n else\n winning_position = won?\n winning_index = winning_position[0]\n @board[winning_index]\n end\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end", "def detect_winner # iterate through winning lines, and see if square in each 3 elements\n # in this line array matches the human marker or computer marker, if so return that marker\n # if no match return nil\n WINNNING_LINES.each do |line| # line is 3 element arr representing winning line\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTGame::HUMAN_MARKER # vid 8 refactor\n elsif count_computer_marker(@squares.values_at(*line)) == 3\n return TTTGame::COMPUTER_MARKER\n end\n end\n nil # if we dno't put this, then .each will return array\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n\n nil\n end", "def winner\n if won = won?\n board.cells[won.first]\n end\n #won? == false ? nil : @board.cells[winner[0]];\n end", "def winner\n if object.team_winner.nil?\n nil\n else\n if object.match.doubles\n object.team_winner.id\n else\n object.team_winner.first_player.id\n end\n end\n end", "def winning_marker\n WINNING_COMBOS.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winner\n if self.won?\n self.board.cells[self.won?[0]]\n elsif self.draw?\n nil\n end\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if identical_markers?(3, squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winner\n return WHITEMAN unless board.has?(BLACKMAN)\n return BLACKMAN unless board.has?(WHITEMAN)\n return nil\n end", "def detect_winner(brd)\n Board::WINNING_LINES.each do |line|\n if brd.position_values[line[0]] == Board::PLAYER_MARKER &&\n brd.position_values[line[1]] == Board::PLAYER_MARKER &&\n brd.position_values[line[2]] == Board::PLAYER_MARKER\n return 'Player'\n elsif brd.position_values[line[0]] == Board::CPU_MARKER &&\n brd.position_values[line[1]] == Board::CPU_MARKER &&\n brd.position_values[line[2]] == Board::CPU_MARKER\n return 'CPU'\n end\n end\n nil\n end", "def winner\n #return token x or o that won the game\n won = \" \"\n if winner = won?\n won = @board[winner.first]\n end\nend", "def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements in 'line' array match the human marker\n # or computer marker, if so return that marker, if no match return nil\n WINNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n return squares.first.marker if three_identical_markers?(squares)\n end\n nil\n end", "def is_winner?(mark)\n\t WIN_CONFIGS.any? do |line|\n\t line.all? do |elem|\n\t\t row, col = to_row_col(elem)\n\t\t @grid[row][col] == mark unless (row.nil? || col.nil?)\n\t\tend\n\t end\n\tend", "def winner\n if won? != false && won? != nil\n win = won?\n return @board[win[0]]\n else\n return nil\n end\n end", "def winner(board)\n won?(board) ? board[won?(board)[0]] : nil\nend", "def winner\n if won?\n win_combination = won?\n token = @board[win_combination[0]]\n return token\n end\n end", "def winner\n scoreboard.first\n end", "def winner\n index = won?\n if index && @board.cells[index[0]] == \"X\"\n return \"X\"\n elsif index && @board.cells[index[0]] == \"O\"\n return \"O\"\n else\n return nil\n end\n end", "def winner\n won = won?()\n if won != false\n if @board[won[0]] == \"X\"\n return \"X\"\n elsif @board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\n end", "def winner\n if winning_array = won?\n @board[winning_array[0]]\n end\n end", "def winning_marker\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_MARKER)\n return line_markers.first if line_markers.uniq.size == 1\n end\n\n nil\n end", "def winner\n @winner\n end", "def winning_marker\r\n WINNING_LINES.each do |line|\r\n winning_marker = check_for_winning_marker(@squares.values_at(*line))\r\n return winning_marker if winning_marker\r\n end\r\n nil\r\n end", "def winner?\n\t\t@winner\n\tend", "def did_mark_win?(mark)\n (@board.rows + @board.columns + @board.diagonals).any? do |line|\n line == mark * 3\n end\n end", "def winner\n if won?\n puts \"Player #{@winner} has won the game!\"\n return @winner\n else\n puts \"No winner yet!\"\n end\n end", "def winner\n if (self.homeScore > self.awayScore)\n return self.home_team\n elsif (self.awayScore > self.homeScore)\n return self.away_team\n else\n return nil\n end\n end", "def winner(board)\n return board[won?(board)[0]] if won?(board)\nend", "def someone_won?\n !!winnning_marker\n end", "def check_winner\r\n\t\tif board.winner?(p1.marker)\r\n\t\t\ttrue\r\n\t\telsif board.winner?(p2.marker)\r\n\t\t\ttrue\r\n\t\telse\r\n\t\t\tfalse\r\n\t\t\t\r\n\t\tend\r\n\tend", "def winner\n winner=winner_row()\n if winner\n return winner\n end\n\n winner=winner_col()\n if winner\n return winner\n end\n \n winner=winner_daigonal()\n if winner \n return winner\n end\n\n # if no winner \n return \n end", "def winner(board)\n if token = won?(board)\n board[token.first]\nend\nend", "def winner\n if combo = won?\n winner = board.position(combo.first + 1)\n end\n winner\n end", "def detect_winner(brd)\n WINNING_LINES.each do |line|\n if brd.values_at(*line).count(PLAYER_MARKER) == 3\n return 'Player'\n elsif brd.values_at(*line).count(COMPUTER_MARKER) == 3\n return 'Computer'\n end\n end\n nil\nend", "def winner_move(game, mark)\n (0..2).each do |x|\n (0..2).each do |y|\n board = game.board.dup #using the board's deep dup method\n pos = [x, y]\n\n next unless board.empty?(pos) #makes sure current position is empty\n board[pos] = mark #sets the current position on the dup'd board\n\n #returns the position if pos would make computer the winner\n # (remember, mark is set by the game object to track who is who)\n return pos if board.winner == mark\n end\n end\n\n # no winning move\n nil\n end", "def winner\n if won?\n win_array = won?\n position = win_array[0]\n @board[position]\n else \n nil\n end\nend", "def winner(board)\n if won?(board)\n winning_index = won?(board)[0]\n winning_token = board[winning_index]\n else\n nil\n end\nend", "def winner\n\t\tputs @board[won?[0]] + \" Won the Game!\" \n\tend", "def winner(board)\n if won?(board) != nil\n board[won?(board)[0]]\n else\n end\nend", "def winner(board)\n if won?(board) != nil\n board[won?(board)[0]]\n else\n end\nend", "def winner(board)\n if won?(board) then return board[won?(board)[0]]\n end\nend", "def winner(board)\n if won?(board)\n return board[won?(board)[0]]\n end\nend", "def winner\n tie_string = \"\"\n @players.each do |player|\n if @position[player] == @length\n tie_string << \"#{player}\"\n end\n end\n\n if tie_string.length > 1\n return \"no one\"\n else\n return tie_string[0]\n end\n\n end", "def determine_winner\n \tif self.won?(@player_symbol) then\n \t\t@over = true\n \treturn \"Player\" \n \tend\n \tif self.won?(@computer_symbol) then\n \t\t@over = true\n \t return \"Computer\" \n \tend\n \tif self.open_spots.count == 0 then\n \t\t@over = true\n \t\treturn \"Draw\"\n \tend\n return \"\" \n end", "def winner(board)\n winner = won?(board)\n return won?(board) == false ? nil : board[winner[0]]\nend", "def winner(board)\n # Return the square entry from the winning configuration\n won?(board) ? board[won?(board)[0]] : nil\nend", "def winner\r\n self.results_hash[:winner]\r\n end", "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n end\nend", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def winner()\n if won?()\n win = won?()\n if @board[win[0]] == \"X\"\n return \"X\"\n elsif @board[win[0]] == \"O\"\n return \"O\"\n else @board[win[0]] != \"X\" && @board[win[0]] != \"O\" #srsly..this is like ducttape over a huge hole\n return nil\n end\n end\nend", "def find_winner\n\t\t@counter = 0\n\t\t@players.each do |player|\n\t\t\tif player.points > @winning\n\t\t\t\t@winner = @counter + 1\n\t\t\tend\n\t\t\t@counter += 1\n\t\tend\n\t\treturn @winner\n\tend", "def winner\n if winning_combo = won?\n @board[winning_combo.first]\n end\n end", "def winner(board)\n if won?(board)\n winner = won?(board)\n return board[winner[0]]\n else\n return nil\n end\nend", "def winner(board)\n if !won?(board) == false\n board[won?(board).first]\n end\nend", "def winning_node?(curr_mark)\n if @board.over?\n @board.winner = curr_mark\n elsif self.next_mover_mark == curr_mark\n self.children.any?{|node| node.winning_node?(curr_mark)}\n else\n self.children.all?{|node| node.winning_node?(curr_mark)}\n end\n end", "def someone_won_round?\r\n !!winner\r\n end", "def winner(board)\n token = nil\n if won?(board) != nil\n win_combo = won?(board)\n token = board[win_combo[0]]\n end\n token\nend", "def winner(board)\n if winner_array = won?(board)\n return board[winner_array[0]]\n else\n return nil\n end\nend", "def winner(board)\n if won?(board) != false\n return board[won?(board)[0]]\n end\nend", "def winnning_marker\n WINNING_POSITIONS.each do |line|\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTPlay::HUMAN_MARKER\n end\n if count_computer_marker(@squares.values_at(*line)) == 3\n return TTTPlay::COMPUTER_MARKER\n end\n end\n\n nil\n end", "def winner\n @board.sort_by {|player, board_position| board_position}.last.first\n end", "def winner\n match = horizontal_match || vertical_match || diagonal_match\n match ? @last_drop[:piece] : nil\n end", "def winner\n if won? == false\n return nil\n end\n\n a = won?\n\n if @board[a[0]] == \"X\"\n return \"X\"\n else \n return \"O\"\n end\nend", "def winner(board)\n token = nil\n if won?(board) != nil\n win_combo = won?(board)\n token = board[win_combo[0]]\n end\n token\nend", "def winner(board)\n if won = won?(board)\n board[won[0]]\n end\nend", "def winner(board)\n if won = won?(board)\n board[won[0]]\n end\nend" ]
[ "0.72931373", "0.7159105", "0.7120302", "0.7116167", "0.7069459", "0.7044866", "0.7042786", "0.70193595", "0.6972146", "0.6940247", "0.69343424", "0.6909656", "0.69010454", "0.6862981", "0.6847705", "0.6845852", "0.68334943", "0.68204415", "0.68136674", "0.6807911", "0.6799573", "0.6794141", "0.678042", "0.6759856", "0.6756453", "0.6751758", "0.67453897", "0.6737602", "0.6737602", "0.6737602", "0.6737602", "0.6737602", "0.6737602", "0.6737602", "0.6737602", "0.6728345", "0.67235535", "0.6685825", "0.6685081", "0.66775537", "0.6671608", "0.6667588", "0.6665057", "0.6658994", "0.6650433", "0.66454595", "0.6630173", "0.6619474", "0.6609547", "0.66006744", "0.65998596", "0.6595773", "0.6592889", "0.6590894", "0.65659606", "0.6564933", "0.65633065", "0.65596294", "0.6549786", "0.65336335", "0.6524541", "0.6521414", "0.6514599", "0.6491465", "0.6467178", "0.64386845", "0.6433556", "0.64230347", "0.6420446", "0.6413789", "0.6397793", "0.63954437", "0.63923556", "0.63923556", "0.63921815", "0.6391357", "0.6390939", "0.6390599", "0.63901377", "0.6387825", "0.63828087", "0.63732636", "0.6366572", "0.63604313", "0.6358771", "0.6354516", "0.6354005", "0.6351595", "0.63515514", "0.63442016", "0.6340922", "0.6340536", "0.6340485", "0.63359135", "0.6328918", "0.6322837", "0.6319997", "0.62970746", "0.6296903", "0.6296903" ]
0.64696664
64
Check if the values in the columns match and returns the mark
def check_columns for column in 0..2 if @game_array[0][column] == @game_array[1][column] && @game_array[0][column] == @game_array[2][column] && !@game_array[0][column].nil? result = @game_array[0][column] end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def win_col?(mark)\n @grid.transpose.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == 2) )\n\t\t\tif(values.include?(nil))\n\t\t\t\treturn values.index(nil)\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def contains_mine?(row, col)\n @field[row][col].contains_mine?\n end", "def contains_mine?(row, col)\n @mine_field[[row,col]]\n end", "def contains_mine?(row, col)\n @field[row][col].mined\n end", "def contains_mine?(row, col)\n @field[row][col].mine[:exists] == true\n end", "def did_mark_win?(mark)\n (@board.rows + @board.columns + @board.diagonals).any? do |line|\n line == mark * 3\n end\n end", "def win_row?(mark)\n @grid.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def igual (mat)\n end", "def contains_mine?(row, col)\n if @mine_field[:bombs][col][row] == true && @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end", "def contains_mine?(row, col)\n @value_grid[[row, col]][:mine]\n end", "def contains_mine?(row, col)\n @grid[row][col].fill == \"mine\"\n end", "def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end", "def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end", "def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end", "def identical_symbols(row_or_column)\n row_or_column[0] * 3 == row_or_column\n end", "def two_in_a_row(row, marker)\n if row.values.count(marker) == 2\n row.select{|_k,v| v == ' '}.keys.first\n else\n false\n end\n end", "def contains_mine?(row, col)\n grid[row][col].fill == 1\n end", "def contains_mine?(row, col)\n @mines[row][col]\n end", "def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end", "def check_columns_for_winner\n # TODO\n end", "def hacked(record)\n diff(record.first)\n .first\n .find { |l| grid.any? { |g| l.eql? g } }\n end", "def winner_via_column?(player)\n columns.any? do |column|\n column.cells.all? {|cell| cell.value == player.marker}\n end\n end", "def compare_pegs(row)\n guess == @answer_key\n end", "def marked?(mark)\n @marks.include?(mark)\n end", "def two_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n return true\n end\n end\n end", "def same_row?(character_one, character_two)\n character_one[:row] == character_two[:row]\n end", "def three_identical_markers?(squares)\n markers = squares.select(&:marked?).collect(&:marker)\n return false if markers.size != 3\n markers.min == markers.max\n end", "def check_coord_marked?(coord)\n case coord\n when \"a1\"\n if @array[0][0] != \" \"\n true\n end\n when \"a2\"\n if @array[0][1] != \" \"\n true\n end\n when \"a3\"\n if @array[0][2] != \" \"\n true\n end\n when \"b1\"\n if @array[1][0] != \" \"\n true\n end\n when \"b2\"\n if @array[1][1] != \" \"\n true\n end\n when \"b3\"\n if @array[1][2] != \" \"\n true\n end\n when \"c1\"\n if @array[2][0] != \" \"\n true\n end\n when \"c2\"\n if @array[2][1] != \" \"\n true\n end\n when \"c3\"\n if @array[2][2] != \" \"\n true\n end\n end\n end", "def check_columns\n @board.each do |column|\n column = column.join(\"\")\n if column.match(/RRRR|BBBB/) != nil\n @winning_score = column\n return true\n end\n end\n return false\n end", "def x_in_cell?\n\n end", "def in_column?\n @board.transpose.each do |column|\n if column == @key\n return true\n end\n end\n false\n end", "def searchCol (twoLetters)\n\t\ti = 0\n\t\ta = 0\n\t\twhile twoLetters[0] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la letra en la fila, cambia a la siguiente y reinicia puntero\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\ta +=1\n\t\t\t\ti = 0\n\t\t\tend\n\t\tend\n\t\ta = 0\n\t\t# Busca la segunda letra en la columna\n\t\twhile twoLetters[1] != @matrizAbcd[a][i]\n\t\t\ta += 1\n\t\t\t# Si no encuentra la segunda letra, regresa false\n\t\t\tif a >= @matrizAbcd.length\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\tif twoLetters[1] == @matrizAbcd[a][i]\n\t\t\treturn true\n\t\tend\n\tend", "def marked(row, pos)\n @board[row][pos] != 0\n end", "def contains_mine?(row, col)\n cell = @grid[row][col]\n cell.contains_mine\n end", "def is_match? cells\n\t\towners = []\n\n\t\tcells.each_with_index do |cell, i|\n\t\t\towners[i] = cell.name\n\t\tend\n\n\t\towners.uniq.length == 1\n\tend", "def has?(x, y)\n [x, y].count{|c| @map_cells_range.include? c} == 2\n end", "def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end", "def seats_touch?(seat_a, seat_b)\n #Redefine letters to numbers\n row_a= row_to_num(seat_a[0])\n row_b= row_to_num(seat_b[0])\n #check to see if column number are <= 1 different from eachother\n col_off = (seat_a[1]-seat_b[1]).abs <= 1 \n row_off = (row_a-row_b).abs <= 1\n col_off && row_off\n end", "def check_column(column)\n if 0 == column\n \"b\"\n elsif 1 == column\n \"i\"\n elsif 2 == column\n \"n\"\n elsif 3 == column\n \"g\"\n elsif 4 == column\n \"o\"\n end\n end", "def max_marks_should_not_be_less_than_any_individual_marks\n #This will get hsh[subject_id] = 'corresponding_mark_column' in the marks table\n hsh = mark_columns_with_subject_ids(self.section) \n marks = Mark.for_section(self.section_id).for_exam(self.exam_id).all\n col_name = hsh[self.subject_id]\n marks.each do |mark|\n if mark.send(col_name) && max_marks && (mark.send(col_name) > max_marks)\n errors.add(:max_marks, \"should not be less than individual marks\")\n end\n end\n end", "def isMatch(selectedCard1, selectedCard2, matrix)\n\t\tpos1 = selectedCard1['x']\n\t\tpos2 = selectedCard1['y']\n\t\tpos3 = selectedCard2['x']\t\t\n\t\tpos4 = selectedCard2['y']\t\t\n\t\tprint matrix\n\t\tputs \"Position1 has the value #{matrix[pos1][pos2]} and Position2 has the value #{matrix[pos3][pos4]}\"\n\t\tif (matrix[pos1][pos2] == matrix[pos3][pos4])\n\t\t\tputs \"Match Found\"\n\t\t\treturn true\n\t\telse\n\t\t\tputs \"No Match\"\n\t\t\treturn false\n\t\tend\n\tend", "def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end", "def compare_all_rows\n @guess_rows.map do |guess|\n right_color = 0 \n right_spot = 0\n guess.get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = (guess.get_pins & @correct_row.get_pins).count\n [right_spot, right_color - right_spot, guess]\n end\n end", "def is_winner?(mark)\n\t WIN_CONFIGS.any? do |line|\n\t line.all? do |elem|\n\t\t row, col = to_row_col(elem)\n\t\t @grid[row][col] == mark unless (row.nil? || col.nil?)\n\t\tend\n\t end\n\tend", "def check_columns\n\t @board.columns.each do |column|\n\t first = column.first\n\t return first unless column.any? { |value| value != first }\n\t end\n\t nil\n\tend", "def squarocol?(array)\n size = array.size\n\n #check rows\n array.each { |a| return true if a.all? {|e| e == a[0]} }\n\n #check cols\n (0...size).each do |i|\n is_same = true\n array.each do |a|\n if a[i] != array[0][i] #item is not same as the first item in column\n is_same = false\n break\n end\n end\n return true if is_same\n end\n \n return false\nend", "def in_column?(table)\n\n table.length.times do |col|\n column_hash = Hash.new()\n\n table.length.times do |i|\n\n if column_hash[table[i][col]]\n return false\n end\n if table[i][col] != '.'\n column_hash[table[i][col]] = 1\n end\n end\n end\n end", "def matches_column?(c)\n if (value = self[c.name])\n return c.allows_value?(value)\n else\n return true\n end\n end", "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def share_item?(cell)\n row == cell.row || column == cell.column\n end", "def add_mark(row, column, symbol)\r\n mark_added = false\r\n\r\n #verify the cell is empty\r\n if @marks[row][column] == ' '\r\n @marks[row][column] = symbol\r\n @marked_cells += 1 #increment number of marked cells\r\n mark_added = true\r\n else\r\n return false\r\n end\r\n end", "def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end", "def in_rset?(col)\n @columns.key?(col)\n end", "def grid?(record)\n diff(record).any? { |d| d.find { |l| grid.any? { |g| l.eql? g } } }\n end", "def excel_columns_equal?(content)\n contents = CSV.parse(content)\n fields_arr = contents[0].map do |field|\n field.strip unless field.nil?\n end.compact\n saved_fields_arr = JSON.parse(self.fields_str).map{|f| f['name']}\n #saved_fields_arr = JSON.parse(self.fields_str).reduce({}, :merge).collect{|k,v| k}.concat(JSON.parse(self.ignored_str))\n return fields_arr.uniq.sort == saved_fields_arr.uniq.sort \n end", "def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements in 'line' array match the human marker\n # or computer marker, if so return that marker, if no match return nil\n WINNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end", "def known? x, y\n [:hit,:sunk,:miss].include? @known[x,y]\n end", "def keys_match?(my_row, other_row)\n\t\t# Ensure arguments are not nil\n\t\tif not (my_row and other_row)\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t# If each value at this key doesn't match, return false\n\t\t@keys.each do |key|\n\t\t\tif not my_row[key].to_s =~ /^#{other_row[key].to_s}$/i\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t\n\t\t#$stdout.puts \"Match: \" + my_row[\"split_zip\"] + \" AND \" + other_row[\"split_zip\"]\n\t\t\n\t\t# If we checked values at each key w/o mismatch, its the same\n\t\treturn true\n\tend", "def includeColumn? (col)\n return @cols.nil? ? true : @cols.member?(col)\nend", "def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end", "def check_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n cat = xuser.personal.category\n academic = xuser.academic\n sub_mark = sub_maps.pluck(cat)\n\n user_subs = academic.subject_entries.all\n ok = false\n i = 0\n sub_maps.each do |su|\n ok = false\n user_subs.each do |as|\n if su.subject_id === as.subject_id\n if sub_mark[i] <= as.marks\n ok = true\n end\n end\n end\n unless ok\n errors.add(:stream_id, \"This stream cannot be choosen since you dont have required marks/subject\")\n break\n end\n i += 1\n end\n ok\n end", "def win?(mark)\n win_row?(mark) || win_col?(mark) || win_diagonal?(mark)\n end", "def win_diagonal?(mark)\n a = (0...@grid.length).all? {|i| self[[i,i]] == mark }\n b = (0...@grid.length).all? {|i| self[[i, @grid.length - 1 - i]] == mark }\n a || b\n end", "def set_mark\n\n\tmark = Mark.find_by_mark_code(self.mark_code)\n\t if mark != nil \n\t\t self.mark = mark\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'mark_code' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def check_column\n count = 0\n \n # Get the players symbol.\n player_symbol = assignment[@last_insert_x - 1][@last_insert_y - 1]\n next_symbol = player_symbol\n \n i = @last_insert_y\n \n # Go to the bottom of the column.\n while (i <= height) && (next_symbol == player_symbol)\n i += 1\n count += 1\n next_symbol = assignment[@last_insert_x - 1][i - 1] \n end\n \n count >= 4\n end", "def compare_rows guess = -1\n right_color = 0\n right_spot = 0 \n\n @guess_rows[guess].get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = ((@guess_rows[guess].get_pins) & (@correct_row.get_pins)).count\n [right_spot, right_color]\n end", "def full?\n @cells.all? do |mark|\n mark == 'X' || mark == 'O'\n end\n end", "def valid_value?(row, column)\n return false unless %w[A B C].include?(row)\n return false unless [1,2,3].include?(column)\n true\n end", "def victory_column?(column_values)\n unique_values = column_values.uniq\n one_unique_value?(unique_values)\nend", "def contains_mine?(row, col)\n @board[row][col].mined\n end", "def none_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 0 && board.squares.values_at(*the_line).count(' ') == 3\n return true\n end\n end\n end", "def similar_value(a, b, c)\n @board[a[0]][a[1]] == @board[b[0]][b[1]] && @board[b[0]][b[1]] == @board[c[0]][c[1]]\n end", "def o_in_cell?\n\n end", "def any_mines_detonated?\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) && contains_mine?(row, column)\n return true\n end\n end\n end\n false\n end", "def any_mines_detonated?\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) && contains_mine?(row, column)\n return true\n end\n end\n end\n\n false\n end", "def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end", "def locode_data?(row)\n !row[2].nil?\n end", "def within_field?(row, col)\n (row >= 0 && row < @row_count) &&\n (col >= 0 && col < @column_count)\n end", "def row_col\n f = lambda do |board ,mark|\n board.any? { |row| row.all? {|cell| cell == mark } } end\n\n return :X if (f.call(@grid ,:X) || f.call(@grid.transpose,:X))\n return :O if (f.call(@grid ,:O) || f.call(@grid.transpose,:O))\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def has_winner?\n (@last_insert_x > 0) ? (check_column || check_row) : false\n \n end", "def any_mines_detonated?\n row_count.times do |row|\n column_count.times do |col|\n return true if cell_cleared?(row, col) && contains_mine?(row, col)\n end\n end\n false\n end", "def _puede_capturar?(columna, fila)\n (@columna - columna).abs == 1 and fila_siguiente == fila\n end", "def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend", "def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend", "def ==(cell)\n if @x == cell.x && @y == cell.y then\n true;\n else\n false;\n end\n end", "def win_check(mark, board)\n return true if ((board[7] == mark && board[8] == mark && board[9] == mark) || # Top horrizontal\n (board[4] == mark && board[5] == mark && board[6] == mark) || # middle horrizontal\n (board[1] == mark && board[2] == mark && board[3] == mark) or # bottom horrizontal\n (board[1] == mark && board[4] == mark && board[7] == mark) || # Left vertical\n (board[2] == mark && board[5] == mark && board[8] == mark) || # Middle vertical\n (board[3] == mark && board[6] == mark && board[9] == mark) || # Right vertical\n (board[1] == mark && board[5] == mark && board[9] == mark) || # Diagonal\n (board[3] == mark && board[5] == mark && board[7] == mark)) # diagonal\n return false\n end", "def any_mines_detonated?\n for x in 0..@row_count - 1 do\n for y in 0..@column_count - 1 do\n if @cleared_field[[x,y]] && @mine_field[[x,y]]\n return true\n break\n end\n end\n end\n false\n\n end", "def horizontal\n column.include?(\"XXXX\") || column.include?(\"OOOO\") #true or false for 4 in a row x's or o's\n end", "def cell_cleared?(row, col)\n if @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end", "def vertical\n column.include?(\"XXXX\") || column.include?(\"OOOO\") #true or false for 4 in a row x's or o's\n end", "def full?(board)\n board.all? {\n |mark| mark == \"X\" || mark == \"O\"\n }\nend", "def valid_column? col\n !!(col <= @col)\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker # return the corresponding detected marker\n end\n end\n nil\n end", "def row_winner?(check_symbol)\n \t(@current_state[:A1] == check_symbol &&\n \t\t@current_state[:A2] == check_symbol &&\n \t\t@current_state[:A3] == check_symbol) ||\n \t(@current_state[:B1] == check_symbol &&\n \t\t@current_state[:B2] == check_symbol && \n \t\t@current_state[:B3] == check_symbol) ||\n \t(@current_state[:C1] == check_symbol &&\n \t\t@current_state[:C2] == check_symbol &&\n \t\t@current_state[:C3] == check_symbol)\n end", "def puede_avanzar_simple?(columna, fila)\n fila_siguiente == fila and @columna == columna\n end" ]
[ "0.6491086", "0.6491086", "0.6376026", "0.6355763", "0.6245685", "0.6240209", "0.62333274", "0.6158803", "0.61553764", "0.6153156", "0.6077127", "0.60412014", "0.6024577", "0.5898749", "0.5871368", "0.58528405", "0.5838406", "0.58351827", "0.5804053", "0.57812333", "0.5778949", "0.57780683", "0.5719366", "0.5711269", "0.57049084", "0.56955206", "0.56823957", "0.56795484", "0.56721264", "0.56373084", "0.557202", "0.5567956", "0.5565001", "0.555052", "0.55431587", "0.55339324", "0.5519692", "0.5512742", "0.55111563", "0.54831153", "0.5471516", "0.54674596", "0.5466648", "0.54636484", "0.5428057", "0.54273593", "0.5426695", "0.54162896", "0.54045886", "0.5398198", "0.53958297", "0.5381647", "0.53778744", "0.53654027", "0.53605855", "0.53602636", "0.5352597", "0.5343734", "0.5338888", "0.5334455", "0.5327127", "0.5312257", "0.53074795", "0.5300962", "0.5294355", "0.52927244", "0.5289113", "0.5288677", "0.5270418", "0.52668345", "0.52655023", "0.5256748", "0.5253403", "0.5248947", "0.5248879", "0.52470815", "0.52374196", "0.5233999", "0.5229828", "0.52162224", "0.5212751", "0.5195603", "0.51943266", "0.51943266", "0.5168374", "0.5164483", "0.5163074", "0.5154093", "0.5154093", "0.515339", "0.5152323", "0.5148101", "0.5140529", "0.51296574", "0.51293534", "0.512497", "0.5105727", "0.50995624", "0.5098646", "0.5092252" ]
0.52624106
71
Check if the values in the rows match and returns the mark
def check_rows for row in 0..2 if @game_array[row][0] == @game_array[row][1] && @game_array[row][0] == @game_array[row][2] && !@game_array[row][0].nil? result = @game_array[row][0] end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_row?(mark)\n @grid.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == 2) )\n\t\t\tif(values.include?(nil))\n\t\t\t\treturn values.index(nil)\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end", "def contains_mine?(row, col)\n @field[row][col].mine[:exists] == true\n end", "def contains_mine?(row, col)\n @mine_field[[row,col]]\n end", "def contains_mine?(row, col)\n @field[row][col].contains_mine?\n end", "def did_mark_win?(mark)\n (@board.rows + @board.columns + @board.diagonals).any? do |line|\n line == mark * 3\n end\n end", "def contains_mine?(row, col)\n @value_grid[[row, col]][:mine]\n end", "def contains_mine?(row, col)\n @field[row][col].mined\n end", "def two_in_a_row(row, marker)\n if row.values.count(marker) == 2\n row.select{|_k,v| v == ' '}.keys.first\n else\n false\n end\n end", "def igual (mat)\n end", "def contains_mine?(row, col)\n if @mine_field[:bombs][col][row] == true && @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end", "def same_row?(character_one, character_two)\n character_one[:row] == character_two[:row]\n end", "def two_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n return true\n end\n end\n end", "def compare_pegs(row)\n guess == @answer_key\n end", "def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end", "def compare_all_rows\n @guess_rows.map do |guess|\n right_color = 0 \n right_spot = 0\n guess.get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = (guess.get_pins & @correct_row.get_pins).count\n [right_spot, right_color - right_spot, guess]\n end\n end", "def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end", "def in_a_row(number, marker)\n WINNING_LINES.select do |line|\n counts = count_markers(line)\n counts[marker] == number && counts[Square::INITIAL_MARKER] == (3 - number)\n end\n end", "def check_marks\n stream = Stream.find(stream_id)\n sub_maps = stream.sub_str_maps.all\n xuser = self.user\n cat = xuser.personal.category\n academic = xuser.academic\n sub_mark = sub_maps.pluck(cat)\n\n user_subs = academic.subject_entries.all\n ok = false\n i = 0\n sub_maps.each do |su|\n ok = false\n user_subs.each do |as|\n if su.subject_id === as.subject_id\n if sub_mark[i] <= as.marks\n ok = true\n end\n end\n end\n unless ok\n errors.add(:stream_id, \"This stream cannot be choosen since you dont have required marks/subject\")\n break\n end\n i += 1\n end\n ok\n end", "def contains_mine?(row, col)\n @mines[row][col]\n end", "def marked?(mark)\n @marks.include?(mark)\n end", "def marked(row, pos)\n @board[row][pos] != 0\n end", "def keys_match?(my_row, other_row)\n\t\t# Ensure arguments are not nil\n\t\tif not (my_row and other_row)\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t# If each value at this key doesn't match, return false\n\t\t@keys.each do |key|\n\t\t\tif not my_row[key].to_s =~ /^#{other_row[key].to_s}$/i\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t\n\t\t#$stdout.puts \"Match: \" + my_row[\"split_zip\"] + \" AND \" + other_row[\"split_zip\"]\n\t\t\n\t\t# If we checked values at each key w/o mismatch, its the same\n\t\treturn true\n\tend", "def contains_mine?(row, col)\n @grid[row][col].fill == \"mine\"\n end", "def compare_rows guess = -1\n right_color = 0\n right_spot = 0 \n\n @guess_rows[guess].get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = ((@guess_rows[guess].get_pins) & (@correct_row.get_pins)).count\n [right_spot, right_color]\n end", "def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end", "def contains_mine?(row, col)\n grid[row][col].fill == 1\n end", "def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend", "def reducable(row, x)\n row.select {|values| values.include?(x) }.length == 1\nend", "def also_present?(row, other)\n\t\n\t\tother.each do |other_row|\n\t\t\tif keys_match?(row, other_row)\n\t\t\t\treturn other_row\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn false\n\tend", "def three_identical_markers?(squares)\n markers = squares.select(&:marked?).collect(&:marker)\n return false if markers.size != 3\n markers.min == markers.max\n end", "def hacked(record)\n diff(record.first)\n .first\n .find { |l| grid.any? { |g| l.eql? g } }\n end", "def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements in 'line' array match the human marker\n # or computer marker, if so return that marker, if no match return nil\n WINNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end", "def none_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 0 && board.squares.values_at(*the_line).count(' ') == 3\n return true\n end\n end\n end", "def win_col?(mark)\n @grid.transpose.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def victory_row?(row_values)\n unique_values = row_values.uniq\n one_unique_value?(unique_values)\nend", "def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end", "def locode_data?(row)\n !row[2].nil?\n end", "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def isMatch(selectedCard1, selectedCard2, matrix)\n\t\tpos1 = selectedCard1['x']\n\t\tpos2 = selectedCard1['y']\n\t\tpos3 = selectedCard2['x']\t\t\n\t\tpos4 = selectedCard2['y']\t\t\n\t\tprint matrix\n\t\tputs \"Position1 has the value #{matrix[pos1][pos2]} and Position2 has the value #{matrix[pos3][pos4]}\"\n\t\tif (matrix[pos1][pos2] == matrix[pos3][pos4])\n\t\t\tputs \"Match Found\"\n\t\t\treturn true\n\t\telse\n\t\t\tputs \"No Match\"\n\t\t\treturn false\n\t\tend\n\tend", "def share_item?(cell)\n row == cell.row || column == cell.column\n end", "def identical_symbols(row_or_column)\n row_or_column[0] * 3 == row_or_column\n end", "def is_match? cells\n\t\towners = []\n\n\t\tcells.each_with_index do |cell, i|\n\t\t\towners[i] = cell.name\n\t\tend\n\n\t\towners.uniq.length == 1\n\tend", "def contains_mine?(row, col)\n cell = @grid[row][col]\n cell.contains_mine\n end", "def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end", "def searchRow (twoLetters)\n\t\ti = 0\n\t\ta = 0\n\t\twhile twoLetters[0] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la letra en la fila, cambia a la siguiente y reinicia puntero\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\ta +=1\n\t\t\t\ti = 0\n\t\t\tend\n\t\tend\n\t\ti = 0\n\t\t# Busca la segunda letra en la fila\n\t\twhile twoLetters[1] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la segunda letra, regresa false\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\tif twoLetters[1] == @matrizAbcd[a][i]\n\t\t\treturn true\n\t\tend\n\tend", "def has?(x, y)\n [x, y].count{|c| @map_cells_range.include? c} == 2\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker # return the corresponding detected marker\n end\n end\n nil\n end", "def check_rows\n row_winner = nil\n\n # joins row and checks iteration count of x or o in strings to find winner\n @board.each do |row|\n row_str = row.join\n if row_str.count('x') == @board.size\n row_winner = 'x'\n elsif row_str.count('o') == @board.size\n row_winner = 'o'\n end\n end\n\n row_winner\n end", "def check_draw?\n @rows.all? do |row|\n row.all? { |cell| cell == \"X\" || cell == \"O\" }\n end\n end", "def is_matched(ind)\n\t\treturn @tile_Array[ind].return_match\n\tend", "def x_in_cell?\n\n end", "def grid?(record)\n diff(record).any? { |d| d.find { |l| grid.any? { |g| l.eql? g } } }\n end", "def find_at_risk_square(line, board, marker)\n if board.values_at(*line).count(marker) == 2\n board.select { |k, v| line.include?(k) && v == INITIAL_MARKER }.keys.first\n else\n nil\n end\nend", "def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end", "def is_winner?(mark)\n\t WIN_CONFIGS.any? do |line|\n\t line.all? do |elem|\n\t\t row, col = to_row_col(elem)\n\t\t @grid[row][col] == mark unless (row.nil? || col.nil?)\n\t\tend\n\t end\n\tend", "def subtitle_mark_counts_match?(content_at, subtitle_marker_csv)\n content_at_count = content_at.count('@')\n subtitle_marker_csv_count = subtitle_marker_csv.strip.count(\"\\n\")\n\n # compare the two counts\n if 0 == content_at_count || content_at_count == subtitle_marker_csv_count\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n [\n Reportable.error(\n [@file_to_validate.last.path],\n [\n 'Subtitle_mark count mismatch',\n \"content_at contains #{ content_at_count }, but subtitle_marker_csv contains #{ subtitle_marker_csv_count } subtitle_marks.\"\n ]\n )\n ]\n )\n end\n end", "def row_winner?(check_symbol)\n \t(@current_state[:A1] == check_symbol &&\n \t\t@current_state[:A2] == check_symbol &&\n \t\t@current_state[:A3] == check_symbol) ||\n \t(@current_state[:B1] == check_symbol &&\n \t\t@current_state[:B2] == check_symbol && \n \t\t@current_state[:B3] == check_symbol) ||\n \t(@current_state[:C1] == check_symbol &&\n \t\t@current_state[:C2] == check_symbol &&\n \t\t@current_state[:C3] == check_symbol)\n end", "def any_mines_detonated?\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) && contains_mine?(row, column)\n return true\n end\n end\n end\n\n false\n end", "def any_mines_detonated?\n (0..row_count).each do |row|\n (0..column_count).each do |column|\n if cell_cleared?(row, column) && contains_mine?(row, column)\n return true\n end\n end\n end\n false\n end", "def seats_touch?(seat_a, seat_b)\n #Redefine letters to numbers\n row_a= row_to_num(seat_a[0])\n row_b= row_to_num(seat_b[0])\n #check to see if column number are <= 1 different from eachother\n col_off = (seat_a[1]-seat_b[1]).abs <= 1 \n row_off = (row_a-row_b).abs <= 1\n col_off && row_off\n end", "def has_row_values?(row_value)\n @values_map.has_key?(row_value.to_s)\n end", "def check_coord_marked?(coord)\n case coord\n when \"a1\"\n if @array[0][0] != \" \"\n true\n end\n when \"a2\"\n if @array[0][1] != \" \"\n true\n end\n when \"a3\"\n if @array[0][2] != \" \"\n true\n end\n when \"b1\"\n if @array[1][0] != \" \"\n true\n end\n when \"b2\"\n if @array[1][1] != \" \"\n true\n end\n when \"b3\"\n if @array[1][2] != \" \"\n true\n end\n when \"c1\"\n if @array[2][0] != \" \"\n true\n end\n when \"c2\"\n if @array[2][1] != \" \"\n true\n end\n when \"c3\"\n if @array[2][2] != \" \"\n true\n end\n end\n end", "def valid_value?(row, column)\n return false unless %w[A B C].include?(row)\n return false unless [1,2,3].include?(column)\n true\n end", "def ==(cell)\n if @x == cell.x && @y == cell.y then\n true;\n else\n false;\n end\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end", "def _row_contains_data(row)\n if row.length > 1 then\n row[1..-1].each do |value|\n if value && value.length > 0 then\n return true\n end\n end\n end\n return false\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n\n nil\n end", "def eql?(other)\n (@row1.eql? other.row1) && (@row2.eql? other.row2) && (@row3.eql? other.row3)\n end", "def set_mark\n\n\tmark = Mark.find_by_mark_code(self.mark_code)\n\t if mark != nil \n\t\t self.mark = mark\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'mark_code' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def win?(mark)\n win_row?(mark) || win_col?(mark) || win_diagonal?(mark)\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end", "def value_on_new_line?\n key.loc.line != value.loc.line\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end", "def similar_value(a, b, c)\n @board[a[0]][a[1]] == @board[b[0]][b[1]] && @board[b[0]][b[1]] == @board[c[0]][c[1]]\n end", "def validating_position?(board, position, marker)\n \tboard[position] == position + 1\nend", "def match()\n array_rows = @tablero.row_vectors() #Obtiene un array con todas las filas del tablero\n array_cols = @tablero.column_vectors() #Obtiene un array con todas las columnas del tablero\n diagonal1 = []\n diagonal2 = []\n diagonals = []\n #Obtiene la diagonal normal\n (0...@tablero.row_vectors.length).each do |i|\n diagonal1.push(@tablero.component(i, i))\n end\n #Obtiene la diagonal invertida\n (0...@tablero.row_vectors.length).each do |i|\n diagonal2.push(@tablero.component(i, @tablero.row_vectors.length - i - 1))\n end\n diagonals.push(diagonal1, diagonal2) #Los arrays de las diagonales se asignan a otro array\n\n #Se pregunta si existe algun match en filas o columnas o en las diagonales, si si regresa true\n if look_for_a_match(array_rows) || self.look_for_a_match(array_cols) || self.look_for_a_match(diagonals)\n return true\n else\n return false\n end\n end", "def add_mark(row, column, symbol)\r\n mark_added = false\r\n\r\n #verify the cell is empty\r\n if @marks[row][column] == ' '\r\n @marks[row][column] = symbol\r\n @marked_cells += 1 #increment number of marked cells\r\n mark_added = true\r\n else\r\n return false\r\n end\r\n end", "def has_tied(new_board)\n new_board.each_with_index do |row,i|\n row.each_with_index do |col,j|\n return false if new_board[i][j] == '-'\n end\n end\n true\nend", "def res_include(x, y, res)\r\n res.each{|rx, ry| return true if x == rx && y == ry}\r\n return false\r\n end", "def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end", "def is_present_in_row?(number, cords)\n row = get_row(cords)\n row.include? number\n end", "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n markers = squares.map(&:marker)\n return markers[0] if markers.uniq.size == 1 && squares[0].marked?\n end\n nil\n end", "def ordered_mark_rows\n\t\tif @row < @mark_row\n\t\t\trow = @mark_row\n\t\t\tmark_row = @row\n\t\telse\n\t\t\trow = @row\n\t\t\tmark_row = @mark_row\n\t\tend\n\t\treturn mark_row,row\n\tend", "def match_id_array_exists?(match_id_array)\n match_id_array.each do |match_id|\n return true if @matched_cells.has_key?(match_id)\n end\n end", "def has_common (row_num, row_min)\n row = @rows[row_num]\n result = false\n if row_min != 0 then\n result = true\n row.each do |num|\n if result == true then\n if (num != 0) && ((num.abs).modulo(row_min.abs) != 0) then\n result = false\n end\n end\n end\n end\n return result\n end", "def exact_matches(loc=@counter)\n matches = 0\n 4.times{ |x| matches += 1 if @guessgrid[loc][x] == @code[x] }\n matches\n end", "def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end", "def contains_mine?(row, col)\n @board[row][col].mined\n end", "def marking_started?\n Result.joins(:marks, submission: :grouping)\n .where(groupings: { assessment_id: id },\n submissions: { submission_version_used: true })\n .where.not(marks: { mark: nil })\n .any?\n end" ]
[ "0.6576819", "0.64427215", "0.64427215", "0.63887995", "0.63436323", "0.63322115", "0.6248598", "0.6242804", "0.6214553", "0.6196654", "0.6159198", "0.614876", "0.61060923", "0.6044447", "0.60108215", "0.6001716", "0.5980675", "0.59525764", "0.5928814", "0.584666", "0.584071", "0.58359253", "0.58321625", "0.57749635", "0.5770927", "0.5762618", "0.5755536", "0.57539815", "0.5747772", "0.5727574", "0.57239527", "0.57239527", "0.57170665", "0.5711024", "0.57098955", "0.56919295", "0.5689598", "0.56832284", "0.5645439", "0.5607594", "0.56023943", "0.5602388", "0.55822873", "0.5566249", "0.55415094", "0.5540027", "0.55264515", "0.54955256", "0.54733", "0.54699624", "0.54420793", "0.5424689", "0.54211545", "0.5419784", "0.5413556", "0.540572", "0.53930885", "0.5385012", "0.5379463", "0.5370993", "0.5359134", "0.5330753", "0.5327763", "0.532412", "0.53240246", "0.53226936", "0.5322181", "0.5319555", "0.53190863", "0.5312393", "0.5291523", "0.52873874", "0.5287272", "0.52775204", "0.5277382", "0.5277382", "0.5277382", "0.5277382", "0.5277382", "0.5277382", "0.5277382", "0.5277382", "0.5274737", "0.52736455", "0.5261592", "0.5259606", "0.52538234", "0.52494884", "0.52492875", "0.52463037", "0.52460647", "0.5235849", "0.52347773", "0.5224046", "0.52165675", "0.5212027", "0.52040595", "0.5200184", "0.5197927", "0.5190312" ]
0.5362152
60
Check if the values in the right diagonal match and returns the mark
def check_right_diagonal if @game_array[0][2] == @game_array[1][1] && @game_array[0][2] == @game_array[2][0] && !@game_array[0][2].nil? @game_array[0][2] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_diagonal?(mark)\n a = (0...@grid.length).all? {|i| self[[i,i]] == mark }\n b = (0...@grid.length).all? {|i| self[[i, @grid.length - 1 - i]] == mark }\n a || b\n end", "def win_diagonal?(mark)\n ltr_diagonal = []\n rtl_diagonal = []\n @grid.each.with_index do |row,r|\n row.each.with_index do |col,c|\n if r == c \n ltr_diagonal << col\n end\n \n if (row.length - r - 1) == c\n rtl_diagonal << col\n end\n end\n end\n ltr = (ltr_diagonal.uniq.length == 1) && ltr_diagonal.include?(mark) \n rtl = (rtl_diagonal.uniq.length == 1) && rtl_diagonal.include?(mark)\n ltr || rtl\n\n end", "def win_diagonal?(mark)\n diag1 = []\n diag2 = []\n @grid.each_with_index do |row, idx|\n diag1 << @grid[idx][idx]\n diag2 << @grid[idx][(idx+1)*-1]\n end\n (diag1.uniq[0] == mark && diag1.uniq.length == 1) || (diag2.uniq[0] == mark && diag2.uniq.length == 1)\n end", "def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end", "def check_diagonals(player_mark)\n left_diag_arr = [@state[0][0], @state[1][1], @state[2][2]]\n right_diag_arr = [@state[0][2], @state[1][1], @state[2][0]]\n return true if count(left_diag_arr, player_mark) == 3\n return true if count(right_diag_arr, player_mark) == 3\n return false\n end", "def diagonal_left_right\n func = lambda do |arr, mark|\n return mark if arr.all? { |el| el == mark } end\n\n left = []; len = @grid.length\n (0...len).each { |i| left << @grid[i][i] }\n\n right = []; len = @grid.length - 1\n (0...@grid.length).each { |i| right << @grid[i][len-i] }\n\n return :X if (func.call(left, :X) == :X) || (func.call(right, :X) == :X)\n return :O if (func.call(left, :O) == :O) || (func.call(right, :O) == :O)\n end", "def check_diagonal2\n cell = @last_cell_played\n count = 1\n while cell.rd && cell.rd.color == cell.color\n cell = cell.rd\n end\n while cell.lu && cell.lu.color == cell.color\n cell = cell.lu\n count += 1\n end\n return true if count >= 4\n false\n end", "def did_mark_win?(mark)\n (@board.rows + @board.columns + @board.diagonals).any? do |line|\n line == mark * 3\n end\n end", "def check_diagonal1\n cell = @last_cell_played\n count = 1\n while cell.ld && cell.ld.color == cell.color\n cell = cell.ld\n end\n while cell.ru && cell.ru.color == cell.color\n cell = cell.ru\n count += 1\n end\n return true if count >= 4\n false\n end", "def igual (mat)\n end", "def check_diagonals\n diagonal_winner = nil\n # stores the markers\n backward_diagonal = ''\n forward_diagonal = ''\n\n # for a diagonal to be a winner it takes the row[n], row[n+1], row[n+2] and so on..\n @board.each_with_index do |row,index|\n\n # check if left to right diagonal is a winner\n row.each_with_index do |marker, position|\n if position == index\n backward_diagonal += marker\n end\n end\n\n # check if right to left diagonal is a winner\n reversed_row = row.reverse\n reversed_row.each_with_index do |marker, position|\n if position == index\n forward_diagonal += marker\n end\n end\n end\n\n # checks iteration count of x or o in strings to find winner\n if backward_diagonal.count('x') == @board.size || forward_diagonal.count('x') == @board.size\n diagonal_winner = 'x'\n elsif backward_diagonal.count('o') == @board.size || forward_diagonal.count('o') == @board.size\n diagonal_winner = 'o'\n end\n\n diagonal_winner\n end", "def check_left_diagonal\n if @game_array[0][0] == @game_array[1][1] &&\n @game_array[0][0] == @game_array[2][2] &&\n !@game_array[0][0].nil?\n\n @game_array[0][0]\n end\n end", "def right_edge?(row,col)\n\t\tpixels[row][col-1] == nil\n\tend", "def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end", "def in_ascending_diagonal?\n if @board.each_with_index.map {|row, index| row[4-index]} == @key\n true\n else\n false\n end\n end", "def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end", "def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end", "def win?(mark)\n win_row?(mark) || win_col?(mark) || win_diagonal?(mark)\n end", "def passed_right_edge?(nxt_spc)\n\t\tnxt_spc% @board_width==0\n\tend", "def check_diagonal?(side)\n i = -1\n j = 3\n dia_left = all? do |child|\n i += 1\n child[i] == side\n end\n dia_right = all? do |child|\n j -= 1\n child[j] == side\n end\n dia_left || dia_right\n end", "def in_descending_diagonal?\n if @board.each_with_index.map {|row, index| row[index]} == @key\n true\n else\n false\n end\n end", "def winner_via_diagonal?(player)\n diagonals.any? do |diagonal|\n diagonal.cells.all? {|cell| cell.value == player.marker}\n end\n end", "def find_at_risk_square(line, board, marker)\n if board.values_at(*line).count(marker) == 2\n board.select { |k, v| line.include?(k) && v == INITIAL_MARKER }.keys.first\n else\n nil\n end\nend", "def marked(row, pos)\n @board[row][pos] != 0\n end", "def two_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n return true\n end\n end\n end", "def check_diagonals\n 0.upto(2) do |i|\n 0.upto(3) do |j|\n if (@board[j][i].to_s + @board[j + 1][i + 1].to_s + @board[j + 2][i + 2].to_s + @board[j + 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n 3.upto(6) do |j|\n if (@board[j][i].to_s + @board[j - 1][i + 1].to_s + @board[j - 2][i + 2].to_s + @board[j - 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n end\n return false\n end", "def at_rightmost_side?\n\t\tcl[1] == @map.nr_columns\n\tend", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == 2) )\n\t\t\tif(values.include?(nil))\n\t\t\t\treturn values.index(nil)\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def right_aligned?\n value == :right\n end", "def block_diagonally?(referee, board)\n block_diagonally = false\n\n opp_token = (@token == 'X' ? 'O' : 'X')\n\n # No need to check if opponent does not control center\n if board.board[1][1] == opp_token\n corner_tokens_r1 = board.board[0].each_with_index.select \\\n { |p, i| p == opp_token && (i.zero? || i == 2) }\n\n corner_tokens_r2 = board.board[2].each_with_index.select \\\n { |p, i| p == opp_token && (i.zero? || i == 2) }\n\n\n # May not block, since the opposite corner may already be\n # blocked\n if !corner_tokens_r1.empty?\n # block opposite corner\n row = 2\n\n col = corner_tokens_r1[0][1].zero? ? 2 : 0\n\n block_diagonally = true if board.space_empty?(row, col)\n elsif !corner_tokens_r2.empty?\n # block opposite corner\n row = 0\n\n col = corner_tokens_r2[0][1].zero? ? 2 : 0\n\n block_diagonally = true if board.space_empty?(row, col)\n end\n end\n\n referee.place_token(self, row, col) if block_diagonally\n\n block_diagonally\n end", "def check_diaganol(x_target, y_target)\n\n x = coordinate_x\n y = coordinate_y\n \n\n #top to bottom and left to right\n if x < x_target and y > y_target\n while x < x_target do \n x = x + 1 \n y = y - 1\n\n return true if is_occupied?(x, y) == true\n end\n end\n\n #top to bottom and right to left\n if x > x_target and y > y_target\n while x > x_target do \n \n x = x - 1 \n y = y - 1\n return true if is_occupied?(x, y)\n \n end\n end\n\n #bottom to top and right to left\n if x > x_target and y < y_target\n while x > x_target do \n x = x - 1 \n y = y + 1\n \n return true if is_occupied?(x, y)\n end\n end\n\n #bottom to top and left to right\n if x < x_target and y < y_target\n while x < x_target do \n x = x + 1 \n y = y + 1\n return true if is_occupied?(x, y)\n end\n end\n\n return false\n end", "def win_col?(mark)\n @grid.transpose.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def valid_coord_by_diagonal?(coordinates)\n if row_ord?(coordinates) || column_ord?(coordinates)\n true\n else\n false\n end\n end", "def contains_mine?(row, col)\n grid[row][col].fill == 1\n end", "def check_diag_ne\n 0.upto(@num_col - 4) do |col|\n consecutive = 0\n curr_tile = @board[0][col]\n @num_row.times do |row|\n break if col + row == @num_col\n next unless @board[row][col+row]\n if curr_tile == @board[row][col+row]\n consecutive += 1\n return true if consecutive == 4\n else\n curr_tile = @board[row][col+row]\n consecutive = 1\n end\n end\n end\n false\n end", "def check_diagnal_win? \n \t\tfirst_diag=@board[2][1]!=0&&@board[1][2]!=0&&(@board[3][0]==@board[2][1]&&@board[3][0]==@board[1][2]&&@board[3][0]==@board[0][3]) #if center is not equal to 0, and \n \t\t#if two center elements from bottom left to top right are not 0 and\n \t\t#bottom left element is equal to center bottom left element and\n \t\t#bottom left element is equal to center top right element and \n \t\t#bottom left element is equal to top right element then first_diag is equal to true, else equal to false\n \t\tsecond_diag=@board[1][1]!=0&&@board[2][2]!=0&&(@board[0][0]==@board[1][1]&&@board[0][0]==@board[2][2]&&@board[0][0]==@board[3][3]) #if center is not equal to 0, and\n \t\t#if two center elements from top left to bottom right are not 0 and \n \t\t#top left element is equal to center top left element and\n \t\t#top left element is equal to center bottom right element and \n \t\t#top left element is equal to bottom right element then second_diag is equal to true, else equal to false\n \t\treturn true if (first_diag||second_diag) #if first_diag is true or second_diag is true, return true. If both are\n \t\t#false, return false.\n \t\treturn false\n \tend", "def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end", "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def left_edge?(row,col)\n\t\tpixels[row][col+1] == nil\n\tend", "def check_right_to_left\n i = 0\n index_array = []\n @bingo_board.each do\n index_array << @bingo_board[i][i]\n i += 1\n end\n if index_array == ['x', 'x', 'x', 'x', 'x']\n puts \"BINGO!\"\n end\n end", "def win_check(mark, board)\n return true if ((board[7] == mark && board[8] == mark && board[9] == mark) || # Top horrizontal\n (board[4] == mark && board[5] == mark && board[6] == mark) || # middle horrizontal\n (board[1] == mark && board[2] == mark && board[3] == mark) or # bottom horrizontal\n (board[1] == mark && board[4] == mark && board[7] == mark) || # Left vertical\n (board[2] == mark && board[5] == mark && board[8] == mark) || # Middle vertical\n (board[3] == mark && board[6] == mark && board[9] == mark) || # Right vertical\n (board[1] == mark && board[5] == mark && board[9] == mark) || # Diagonal\n (board[3] == mark && board[5] == mark && board[7] == mark)) # diagonal\n return false\n end", "def check_diagonal\n RulesContracts.classic_model(@game_state_model)\n # testing for bitboard errors\n # (0..7).each { |y|\n # (0..7).each { |x|\n # if @grid[y][x] == 1 and y <= 4 and x >= 3\n # puts \" #{x}/#{y} #{@grid[y][x]} || #{x-1}/#{y+1} #{@grid[y + 1][x - 1]} || #{x-2}/#{y+2} #{@grid[y + 2][x - 2]} || #{x-3}/#{y+3} #{@grid[y + 3][x - 3]}\"\n # puts \"#{@grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1}\"\n # end\n # }\n # }\n \n (0..7).each { |y|\n (0..7).each { |x|\n if y <= 4 and x <= 4\n if @grid[y][x] == 2 and @grid[y + 1][x + 1] == 2 and @grid[y + 2][x + 2] == 2 and @grid[y + 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x + 1] == 1 and @grid[y + 2][x + 2] == 1 and @grid[y + 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y <= 4 and x >= 3\n if @grid[y][x] == 2 and @grid[y + 1][x - 1] == 2 and @grid[y + 2][x - 2] == 2 and @grid[y + 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1\n @winner = 0\n return true\n end\n end\n if y >= 3 and x <= 4\n if @grid[y][x] == 2 and @grid[y - 1][x + 1] == 2 and @grid[y - 2][x + 2] == 2 and @grid[y - 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x + 1] == 1 and @grid[y - 2][x + 2] == 1 and @grid[y - 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y >= 3 and x >= 3\n \n if @grid[y][x] == 2 and @grid[y - 1][x - 1] == 2 and @grid[y - 2][x - 2] == 2 and @grid[y - 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x - 1] == 1 and @grid[y - 2][x - 2] == 1 and @grid[y - 3][x - 3] == 1\n @winner = 0\n return true\n end \n \n end \n }\n }\n return false\n end", "def check_diagonally_right(x, y, numbers_in_product)\n (0...numbers_in_product).inject(1) do |product, i|\n product * matrix[y+i][x+i]\n end\n end", "def check_left_to_right\n i = 0\n i2 = 4\n index_array = []\n @bingo_board.each do\n index_array << @bingo_board[i][i2]\n i += 1\n i2 -= 1\n end\n if index_array == ['x', 'x', 'x', 'x', 'x']\n puts \"BINGO!\"\n end\n end", "def squaragonal?(array)\n diag_right = 1\n diag_left = 1\n\n (0...array.length - 1).each do |i|\n (0...array.length - 1).each do |j|\n diag_right += 1 if array[i][j] == array[i + 1][j + 1]\n # diag_left += 1 if array[array.length - i - 1][j] == array[array.length - i - 2][j + 1]\n diag_left += 1 if array[-(i + 1)][j] == array[-(i + 2)][j + 1]\n end\n end\n if diag_right == array.length || diag_left == array.length\n return true\n else\n return false\n end\nend", "def pawn_diagonal?(x,y)\n diagonal?(x, y) && x_diff(x) == 1\n end", "def should_check_diagonal?\n return false unless @two_dimensional_arrays[2].any? { |column| column != \".\" }\n true\n end", "def row_col\n f = lambda do |board ,mark|\n board.any? { |row| row.all? {|cell| cell == mark } } end\n\n return :X if (f.call(@grid ,:X) || f.call(@grid.transpose,:X))\n return :O if (f.call(@grid ,:O) || f.call(@grid.transpose,:O))\n end", "def contains_mine?(row, col)\n @grid[row][col].fill == \"mine\"\n end", "def part_of_right_x?(x, y)\n x == (size - y - 1)\n end", "def diagonal_line (board)\n if (board[0][0] == \"O\" && board[1][1] == \"O\" && board[2][2] == \"O\")\n return true\n elsif (board[2][0] == \"O\" && board[1][1] == \"O\" && board[0][2] == \"O\")\n return true\n elsif (board[0][0] == \"X\" && board[1][1] == \"X\" && board[2][2] == \"X\")\n return true\n elsif (board[2][0] == \"X\" && board[1][1] == \"X\" && board[0][2] == \"X\")\n return true\n end\n return false\n end", "def contains_mine?(row, col)\n @mine_field[[row,col]]\n end", "def winning_diagonal?(piece)\n diagonals.any? do |diag|\n diag.all?{|cell| cell == piece }\n end\n end", "def diagonal_check\n \t\n \tdef diagonal_iteration(index)\n \t\ti = index\n \t\t@board.each do |row|\n \t\t return false if row[i] != 'x'\n \t\t i += 1 if index == 0\n \t\t i -= 1 if index == 4\n \t\tend\n \t\treturn true\n \tend\n\n \tif @board[0][0] == 'x'\n \t\treturn diagonal_iteration(0)\n elsif @board[0][4] == 'x' \n \t\treturn diagonal_iteration(4)\n end\n \treturn false\n end", "def match()\n array_rows = @tablero.row_vectors() #Obtiene un array con todas las filas del tablero\n array_cols = @tablero.column_vectors() #Obtiene un array con todas las columnas del tablero\n diagonal1 = []\n diagonal2 = []\n diagonals = []\n #Obtiene la diagonal normal\n (0...@tablero.row_vectors.length).each do |i|\n diagonal1.push(@tablero.component(i, i))\n end\n #Obtiene la diagonal invertida\n (0...@tablero.row_vectors.length).each do |i|\n diagonal2.push(@tablero.component(i, @tablero.row_vectors.length - i - 1))\n end\n diagonals.push(diagonal1, diagonal2) #Los arrays de las diagonales se asignan a otro array\n\n #Se pregunta si existe algun match en filas o columnas o en las diagonales, si si regresa true\n if look_for_a_match(array_rows) || self.look_for_a_match(array_cols) || self.look_for_a_match(diagonals)\n return true\n else\n return false\n end\n end", "def winning_diagonal?(piece)\n diagonals.any? do |diag|\n diag.all?{|cell| cell == piece }\n end\n end", "def contains_mine?(row, col)\n if @mine_field[:bombs][col][row] == true && @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end", "def squarocol?(arr)\n (0..arr.length-1).each do |i|\n row_counter = 1\n col_counter = 1\n\n (0...arr.length-1).each do |j|\n row_counter += 1 if arr[i][j] == arr[i][j + 1]\n col_counter += 1 if arr[j][i] == arr[j + 1][i]\n \n end\n\n if row_counter == arr.length || col_counter == arr.length\n return true\n end\n \n end\n false\nend", "def two_squares?(x,y)\n return on_home_row? && (x_diff(x) == 0) && (y_diff(y) == 2)\n end", "def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end", "def check_glabella(x, y)\n\t\t\t@right_eye_width = @right_eye_width + 1\t\n\t\t\twrite_to_image(x, y, 'blue')\n\t\t\treturn true if check_right_eye\n\t\t\treturn false\t\t\t\t\t\t\n\t\tend", "def identify_neighbours\n @x.times{ |r|\n @y.times{|c| \n #+1,+1 0,+1 +1,0\n @mat[r][c].add_neighbour @mat[r+1][c+1] unless @mat[r+1].nil? || @mat[r+1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r][c+1] unless @mat[r].nil? || @mat[r][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c] unless @mat[r+1].nil? || @mat[r+1][c].nil?\n \n #-1,-1 0,-1 -1,0\n @mat[r][c].add_neighbour @mat[r-1][c-1] unless @mat[r-1].nil? || @mat[r-1][c-1].nil?\n @mat[r][c].add_neighbour @mat[r-1][c] unless @mat[r-1].nil? || @mat[r-1][c].nil?\n @mat[r][c].add_neighbour @mat[r][c-1] unless @mat[r].nil? || @mat[r][c-1].nil?\n \n #+1,-1 -1,+1\n @mat[r][c].add_neighbour @mat[r-1][c+1] unless @mat[r-1].nil? || @mat[r-1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c-1] unless @mat[r+1].nil? || @mat[r+1][c-1].nil?\n \n }\n \n } \n end", "def check_coord_marked?(coord)\n case coord\n when \"a1\"\n if @array[0][0] != \" \"\n true\n end\n when \"a2\"\n if @array[0][1] != \" \"\n true\n end\n when \"a3\"\n if @array[0][2] != \" \"\n true\n end\n when \"b1\"\n if @array[1][0] != \" \"\n true\n end\n when \"b2\"\n if @array[1][1] != \" \"\n true\n end\n when \"b3\"\n if @array[1][2] != \" \"\n true\n end\n when \"c1\"\n if @array[2][0] != \" \"\n true\n end\n when \"c2\"\n if @array[2][1] != \" \"\n true\n end\n when \"c3\"\n if @array[2][2] != \" \"\n true\n end\n end\n end", "def squaragonal?(mat)\n n = mat.length\n # check UL to BR\n f_ele = mat[0][0]\n i = 0\n j = 0\n all_same = true\n while i<n\n all_same &= f_ele == mat[i][i]\n i+=1\n end\n return true if all_same\n # check BL to UR\n # debugger\n f_ele = mat[n-1][0]\n j = n-1\n i = 0\n all_same = true\n while i<n\n all_same &= f_ele == mat[i][j]\n i+=1\n j-=1\n end\n return true if all_same\n false\nend", "def leaf?\n right - left == 1\n end", "def squarocol?(matrix)\n d = matrix.length\n d.times do |i|\n return true if matrix[i].all?{ |el| el == matrix[i][0]}\n end\n\n\n \n d.times do |c|\n flag = 0\n n = matrix[0][c]\n d.times do |r|\n if !(matrix[r][c] == n)\n flag = 1\n break\n end\n end\n return true if flag == 0\n end\n false\nend", "def at_risk_square(marker)\n unmarked_square = nil\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if threatened_row?(squares, marker)\n line.each do |square|\n if @squares[square].unmarked?\n unmarked_square = square\n end\n end\n end\n end\n unmarked_square\n end", "def passed_left_edge?(nxt_spc)\n\t\tnxt_spc% @board_width == (@board_width-1)\n\tend", "def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end", "def diagonal_win?\n (0..3).each do |column|\n (0..2).each do |row|\n return true if down_right_win?(row, column)\n end\n end\n (3..6).each do |column|\n (0..2).each do |row|\n return true if down_left_win?(row, column)\n end\n end\n false\n end", "def compare_rows guess = -1\n right_color = 0\n right_spot = 0 \n\n @guess_rows[guess].get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = ((@guess_rows[guess].get_pins) & (@correct_row.get_pins)).count\n [right_spot, right_color]\n end", "def diagonal_left\n end", "def won?\n if (diagonal_match || across_match || down_match)\n return true\n end\n return false\n end", "def check_right_eye\n\t\t\tif @right_eye_width >= MIN_EYE_WIDTH and @right_eye_width < (@left_eye_width + 1)\t\n\t\t\t\treturn true if check_mouth\n\t\t\tend\n\t\t\treturn false\n\t\tend", "def contains_mine?(row, col)\n @mines[row][col]\n end", "def visited(x, y, matrix)\n if open_room(x,y, matrix)\n return matrix[y][x] == '*'\n end\n end", "def win_row?(mark)\n @grid.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def squaragonal?(matrix)\n key1 = matrix[0][0]\n key2 = matrix[0][matrix.size - 1]\n test_dr = true\n test_dl = true\n\n (0...matrix.size).each do |i|\n test_dr = false unless matrix[i][i] == key1\n end\n\n j = matrix.size - 1\n (0...matrix.size).each do |i|\n test_dl = false unless matrix[i][j] == key2\n j -= 1\n end\n\n test_dr || test_dl\nend", "def won?\n for x in 0..@matrix.length - 1\n for y in 0..@matrix[x].length - 1\n return false if @matrix[x][y] == \"OO\"\n end\n end\n\n true\n end", "def isMine(x,y)\n @squares[x][y] == MINE_MARKER\n end", "def diag_winner?(check_symbol)\n \t(@current_state[:A1] == check_symbol &&\n \t\t@current_state[:B2] == check_symbol &&\n \t\t@current_state[:C3] == check_symbol) ||\n \t(@current_state[:A3] == check_symbol &&\n \t\t@current_state[:B2] == check_symbol && \n \t\t@current_state[:C1] == check_symbol) \n end", "def winner_diagonals\n\n # Start at the top left, get the player symbol (X or O) to match\n first_symbol = @board[0][0]\n\n # Traverse the diagonal from top left to bottom right\n for index in 1..BOARD_MAXIMUM_INDEX\n\n # Does this cell match the first symbol?\n if first_symbol != @board[index][index]\n\n # No, this diagonal IS NOT a winning combination\n break\n\n # At the end of this diagonal and not all empty?\n elsif index == BOARD_MAXIMUM_INDEX and first_symbol != EMPTY_POSITION\n\n # Yes, this diagonal IS a winning combination\n return first_symbol\n\n end\n\n end\n\n # Start at the top right, get the player symbol (X or O) to match\n row = 0 # Top\n column = BOARD_MAXIMUM_INDEX # Right\n first_symbol = @board[row][column]\n\n # Loop through each row (backwards diagonal)\n while row < BOARD_MAXIMUM_INDEX\n \n row += 1 # Down to the next row\n column -= 1 # Left to the next column\n\n # Does this cell match the first symbol?\n if first_symbol != @board[row][column]\n\n # No, this diagonal IS NOT a winning combination\n break\n\n # At the end of this diagonal and not all empty?\n elsif row == BOARD_MAXIMUM_INDEX and first_symbol != EMPTY_POSITION\n\n # Yes, this diagonal IS a winning combination\n return first_symbol\n\n end\n\n end\n\n # Nope, no winner in any diagonal\n return\n\n end", "def can_go_right?(the_maze, floor, position)\r\n (position + 1 < the_maze[floor].size) and (the_maze[floor][position + 1] == \"0\")\r\nend", "def diag?(twod_arr)\n first_diag = []\n second_diag = [] # two arrays for later storage\n\n (0...twod_arr.length).each do |idx| # looping though the length of the array\n first_diag << twod_arr[idx][idx] # storeing the first diag, it's easy since its index will always be the same\n second_diag << twod_arr[idx][twod_arr.length - 1 -idx] #second diag, this is the invert of \n end\n\n first_diag.uniq.length == 1 || second_diag.uniq.length == 1\nend", "def contains_mine?(row, col)\n @field[row][col].contains_mine?\n end", "def row_winning_move\n\t\t@board.grid.each_with_index do |row, r|\n\t\t\tother_nil_index = contains_two_marks(row)\n\t\t\tif(other_nil_index)\n\t\t\t\treturn [r, other_nil_index]\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def vertical_c4?\n result=true\n\n this_column = @play_field[@last_move]\n\n return false if this_column.length < 4\n\n last_move_color = this_column[-1]\n\n\n\n #checks if the top 4 in the stack are all the same color\n this_column[-4..-1].all? {|move| move == last_move_color}\n\n\n end", "def check_diag b, play\n x = 0\n while x < 4\n y = 0\n while y < 4\n if b[x][y] == play\n if b[x+1][y+1] == play\n if b[x+2][y+2] == play\n if b[x+3][y+3] == play\n win = true\n end\n end\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return win\nend", "def squaragonal?(grid)\n match?(grid) || match?(grid.reverse)\nend", "def valid_diagonal(top, right, n)\n bits = 0\n\n if top\n if right\n (@size - n).times { |i|\n if @state[((@size + 1) * i) + n]\n bits += 1\n end\n }\n else\n (n + 1).times { |i|\n if @state[((@size - 1) * i) + n]\n bits += 1\n end\n }\n end\n else\n n_pos = n + ((@size - 1) * @size)\n if right\n (@size - n).times { |i|\n if @state[n_pos - ((@size - 1) * i)]\n bits += 1\n end\n }\n else\n (n + 1).times { |i|\n if @state[n_pos - ((@size + 1) * i)]\n bits += 1\n end\n }\n end\n end\n\n if bits > 1\n return false\n else\n return true\n end\n end", "def diagonal_victory(b)\n if victory_diagonal?(board_diagonal_values(b, true))\n 1\n elsif victory_diagonal?(board_diagonal_values(b, false))\n 2\n else\n false\n end\nend", "def check_diag(row, col)\n\n # North-East diagonal\n row_i = row-1\n col_i = col+1\n while row_i > -1 and col_i < 8\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i -= 1\n col_i += 1\n end\n\n # North-West diagonal\n row_i = row-1\n col_i = col-1\n while row_i > -1 and col_i > -1\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i -= 1\n col_i -= 1\n end\n\n # South-East diagonal\n row_i = row+1\n col_i = col+1\n while row_i < 8 and col_i < 8\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i += 1\n col_i += 1\n end\n\n # South-West diagonal\n row_i = row+1\n col_i = col-1\n while row_i < 8 and col_i > -1\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i += 1\n col_i -= 1\n end\n\n return true\n end", "def check_diag2 b, play\n x = 0\n while x < 4\n y = 0\n while y < 3\n if b[x+3][y] == play\n if b[x+2][y+1] == play\n if b[x+1][y+2] == play\n if b[x][y+3] == play\n win = true\n end\n end\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return win\nend", "def opposite_corners?\n (@grid[\"a1\"] == @player_mark && @grid[\"c3\"] == @player_mark) || (@grid[\"a3\"] == @player_mark && @grid[\"c1\"] == @player_mark)\n end", "def block_diagonal_win?\n \tblank_x = -1\n \tx_row_total = 0\n \t\n \t3.times do |i|\t\n\t\t\tif @game_board[i][i] == \"X\"\n\t\t\t\tx_row_total += 1\n\t\t\telse \n\t\t\t\tblank_x = i\n\t\t\tend\n\n\t\t\tif x_row_total == 2 && blank_x > -1\n\t\t\t\t@game_board[blank_x][blank_x] = \"O\"\n\t\t\t\ttrue\n\t\t\tend\n \tend\n \tfalse\n end", "def contains_mine?(row, col)\n @value_grid[[row, col]][:mine]\n end", "def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end", "def vert_diag_row(row_index, col_index, token)\n if cur_board[row_index + 1][col_index] == token\n cur_board[row_index + 2][col_index] == token && cur_board[row_index + 3][col_index] == token\n elsif cur_board[row_index + 1][col_index - 1] == token\n cur_board[row_index + 2][col_index - 2] == token && cur_board[row_index + 3][col_index - 3] == token\n elsif cur_board[row_index + 1][col_index + 1] == token\n cur_board[row_index + 2][col_index + 2] == token && cur_board[row_index + 3][col_index + 3] == token\n else\n false\n end\n end", "def attacking_diagonal?\n false\n end" ]
[ "0.7571535", "0.7216157", "0.7054185", "0.6841443", "0.6765728", "0.67306817", "0.66725546", "0.6565866", "0.65572274", "0.6421982", "0.6392166", "0.63188857", "0.630378", "0.6287454", "0.6260397", "0.62586176", "0.6256932", "0.6245273", "0.6194855", "0.61873436", "0.6178742", "0.6155633", "0.61328065", "0.6120005", "0.61149913", "0.610836", "0.61027056", "0.6045042", "0.60318565", "0.60292345", "0.59882015", "0.598688", "0.5976149", "0.5960449", "0.5951733", "0.59427834", "0.59408563", "0.5930803", "0.5930803", "0.58711725", "0.5863118", "0.58539575", "0.58511394", "0.5847135", "0.5831291", "0.58229387", "0.58205503", "0.5805151", "0.57953113", "0.579521", "0.5773288", "0.5770237", "0.57678694", "0.57674086", "0.5766952", "0.57637733", "0.5752107", "0.5751294", "0.5749732", "0.5739044", "0.5730295", "0.5726753", "0.57246095", "0.5723436", "0.57149106", "0.57132065", "0.5709759", "0.5701917", "0.5694693", "0.5692715", "0.56890893", "0.5687922", "0.56877536", "0.5683644", "0.5681326", "0.5665393", "0.5664777", "0.5664366", "0.56462795", "0.56422776", "0.5640061", "0.5638148", "0.5626326", "0.56192183", "0.5602549", "0.55979836", "0.55931455", "0.55847615", "0.55841494", "0.55808395", "0.5575663", "0.5572997", "0.5570285", "0.55665827", "0.5566351", "0.5563923", "0.5563153", "0.5561991", "0.55609107", "0.55532736" ]
0.66039675
7
Check if the values in the right diagonal match and returns the mark
def check_left_diagonal if @game_array[0][0] == @game_array[1][1] && @game_array[0][0] == @game_array[2][2] && !@game_array[0][0].nil? @game_array[0][0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_diagonal?(mark)\n a = (0...@grid.length).all? {|i| self[[i,i]] == mark }\n b = (0...@grid.length).all? {|i| self[[i, @grid.length - 1 - i]] == mark }\n a || b\n end", "def win_diagonal?(mark)\n ltr_diagonal = []\n rtl_diagonal = []\n @grid.each.with_index do |row,r|\n row.each.with_index do |col,c|\n if r == c \n ltr_diagonal << col\n end\n \n if (row.length - r - 1) == c\n rtl_diagonal << col\n end\n end\n end\n ltr = (ltr_diagonal.uniq.length == 1) && ltr_diagonal.include?(mark) \n rtl = (rtl_diagonal.uniq.length == 1) && rtl_diagonal.include?(mark)\n ltr || rtl\n\n end", "def win_diagonal?(mark)\n diag1 = []\n diag2 = []\n @grid.each_with_index do |row, idx|\n diag1 << @grid[idx][idx]\n diag2 << @grid[idx][(idx+1)*-1]\n end\n (diag1.uniq[0] == mark && diag1.uniq.length == 1) || (diag2.uniq[0] == mark && diag2.uniq.length == 1)\n end", "def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end", "def check_diagonals(player_mark)\n left_diag_arr = [@state[0][0], @state[1][1], @state[2][2]]\n right_diag_arr = [@state[0][2], @state[1][1], @state[2][0]]\n return true if count(left_diag_arr, player_mark) == 3\n return true if count(right_diag_arr, player_mark) == 3\n return false\n end", "def diagonal_left_right\n func = lambda do |arr, mark|\n return mark if arr.all? { |el| el == mark } end\n\n left = []; len = @grid.length\n (0...len).each { |i| left << @grid[i][i] }\n\n right = []; len = @grid.length - 1\n (0...@grid.length).each { |i| right << @grid[i][len-i] }\n\n return :X if (func.call(left, :X) == :X) || (func.call(right, :X) == :X)\n return :O if (func.call(left, :O) == :O) || (func.call(right, :O) == :O)\n end", "def check_diagonal2\n cell = @last_cell_played\n count = 1\n while cell.rd && cell.rd.color == cell.color\n cell = cell.rd\n end\n while cell.lu && cell.lu.color == cell.color\n cell = cell.lu\n count += 1\n end\n return true if count >= 4\n false\n end", "def check_right_diagonal\n if @game_array[0][2] == @game_array[1][1] &&\n @game_array[0][2] == @game_array[2][0] &&\n !@game_array[0][2].nil?\n\n @game_array[0][2]\n end\n end", "def did_mark_win?(mark)\n (@board.rows + @board.columns + @board.diagonals).any? do |line|\n line == mark * 3\n end\n end", "def check_diagonal1\n cell = @last_cell_played\n count = 1\n while cell.ld && cell.ld.color == cell.color\n cell = cell.ld\n end\n while cell.ru && cell.ru.color == cell.color\n cell = cell.ru\n count += 1\n end\n return true if count >= 4\n false\n end", "def igual (mat)\n end", "def check_diagonals\n diagonal_winner = nil\n # stores the markers\n backward_diagonal = ''\n forward_diagonal = ''\n\n # for a diagonal to be a winner it takes the row[n], row[n+1], row[n+2] and so on..\n @board.each_with_index do |row,index|\n\n # check if left to right diagonal is a winner\n row.each_with_index do |marker, position|\n if position == index\n backward_diagonal += marker\n end\n end\n\n # check if right to left diagonal is a winner\n reversed_row = row.reverse\n reversed_row.each_with_index do |marker, position|\n if position == index\n forward_diagonal += marker\n end\n end\n end\n\n # checks iteration count of x or o in strings to find winner\n if backward_diagonal.count('x') == @board.size || forward_diagonal.count('x') == @board.size\n diagonal_winner = 'x'\n elsif backward_diagonal.count('o') == @board.size || forward_diagonal.count('o') == @board.size\n diagonal_winner = 'o'\n end\n\n diagonal_winner\n end", "def right_edge?(row,col)\n\t\tpixels[row][col-1] == nil\n\tend", "def winner\n (@rows + cols + diagonals).each do |row|\n return :x if row.all? { |mark| mark == :x }\n return :o if row.all? { |mark| mark == :o }\n end\n \n nil\n end", "def in_ascending_diagonal?\n if @board.each_with_index.map {|row, index| row[4-index]} == @key\n true\n else\n false\n end\n end", "def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end", "def check_matches\n #check for horizontal matches\n match_found = false \n for i in (0..@width-3)\n for j in (0..@height-1)\n if (@board[i][j] and @board[i+1][j] and @board[i+2][j] and \n @board[i][j].color == @board[i+1][j].color and @board[i][j].color == @board[i+2][j].color)\n @board[i][j].marked = @board[i+1][j].marked = @board[i+2][j].marked = true\n match_found = true\n end\n end\n end\n #check for vertical matches\n for i in (0..@width-1)\n for j in (0..@height-3)\n if (@board[i][j] and @board[i][j+1] and @board[i][j+2] and \n @board[i][j].color == @board[i][j+1].color and @board[i][j].color == @board[i][j+2].color)\n @board[i][j].marked = @board[i][j+1].marked = @board[i][j+2].marked = true\n match_found = true\n end\n end\n end\n\n return match_found \n end", "def win?(mark)\n win_row?(mark) || win_col?(mark) || win_diagonal?(mark)\n end", "def passed_right_edge?(nxt_spc)\n\t\tnxt_spc% @board_width==0\n\tend", "def check_diagonal?(side)\n i = -1\n j = 3\n dia_left = all? do |child|\n i += 1\n child[i] == side\n end\n dia_right = all? do |child|\n j -= 1\n child[j] == side\n end\n dia_left || dia_right\n end", "def in_descending_diagonal?\n if @board.each_with_index.map {|row, index| row[index]} == @key\n true\n else\n false\n end\n end", "def winner_via_diagonal?(player)\n diagonals.any? do |diagonal|\n diagonal.cells.all? {|cell| cell.value == player.marker}\n end\n end", "def find_at_risk_square(line, board, marker)\n if board.values_at(*line).count(marker) == 2\n board.select { |k, v| line.include?(k) && v == INITIAL_MARKER }.keys.first\n else\n nil\n end\nend", "def marked(row, pos)\n @board[row][pos] != 0\n end", "def two_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n return true\n end\n end\n end", "def check_diagonals\n 0.upto(2) do |i|\n 0.upto(3) do |j|\n if (@board[j][i].to_s + @board[j + 1][i + 1].to_s + @board[j + 2][i + 2].to_s + @board[j + 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n 3.upto(6) do |j|\n if (@board[j][i].to_s + @board[j - 1][i + 1].to_s + @board[j - 2][i + 2].to_s + @board[j - 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n end\n return false\n end", "def at_rightmost_side?\n\t\tcl[1] == @map.nr_columns\n\tend", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == 2) )\n\t\t\tif(values.include?(nil))\n\t\t\t\treturn values.index(nil)\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def right_aligned?\n value == :right\n end", "def block_diagonally?(referee, board)\n block_diagonally = false\n\n opp_token = (@token == 'X' ? 'O' : 'X')\n\n # No need to check if opponent does not control center\n if board.board[1][1] == opp_token\n corner_tokens_r1 = board.board[0].each_with_index.select \\\n { |p, i| p == opp_token && (i.zero? || i == 2) }\n\n corner_tokens_r2 = board.board[2].each_with_index.select \\\n { |p, i| p == opp_token && (i.zero? || i == 2) }\n\n\n # May not block, since the opposite corner may already be\n # blocked\n if !corner_tokens_r1.empty?\n # block opposite corner\n row = 2\n\n col = corner_tokens_r1[0][1].zero? ? 2 : 0\n\n block_diagonally = true if board.space_empty?(row, col)\n elsif !corner_tokens_r2.empty?\n # block opposite corner\n row = 0\n\n col = corner_tokens_r2[0][1].zero? ? 2 : 0\n\n block_diagonally = true if board.space_empty?(row, col)\n end\n end\n\n referee.place_token(self, row, col) if block_diagonally\n\n block_diagonally\n end", "def check_diaganol(x_target, y_target)\n\n x = coordinate_x\n y = coordinate_y\n \n\n #top to bottom and left to right\n if x < x_target and y > y_target\n while x < x_target do \n x = x + 1 \n y = y - 1\n\n return true if is_occupied?(x, y) == true\n end\n end\n\n #top to bottom and right to left\n if x > x_target and y > y_target\n while x > x_target do \n \n x = x - 1 \n y = y - 1\n return true if is_occupied?(x, y)\n \n end\n end\n\n #bottom to top and right to left\n if x > x_target and y < y_target\n while x > x_target do \n x = x - 1 \n y = y + 1\n \n return true if is_occupied?(x, y)\n end\n end\n\n #bottom to top and left to right\n if x < x_target and y < y_target\n while x < x_target do \n x = x + 1 \n y = y + 1\n return true if is_occupied?(x, y)\n end\n end\n\n return false\n end", "def win_col?(mark)\n @grid.transpose.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def valid_coord_by_diagonal?(coordinates)\n if row_ord?(coordinates) || column_ord?(coordinates)\n true\n else\n false\n end\n end", "def contains_mine?(row, col)\n grid[row][col].fill == 1\n end", "def check_diag_ne\n 0.upto(@num_col - 4) do |col|\n consecutive = 0\n curr_tile = @board[0][col]\n @num_row.times do |row|\n break if col + row == @num_col\n next unless @board[row][col+row]\n if curr_tile == @board[row][col+row]\n consecutive += 1\n return true if consecutive == 4\n else\n curr_tile = @board[row][col+row]\n consecutive = 1\n end\n end\n end\n false\n end", "def check_diagnal_win? \n \t\tfirst_diag=@board[2][1]!=0&&@board[1][2]!=0&&(@board[3][0]==@board[2][1]&&@board[3][0]==@board[1][2]&&@board[3][0]==@board[0][3]) #if center is not equal to 0, and \n \t\t#if two center elements from bottom left to top right are not 0 and\n \t\t#bottom left element is equal to center bottom left element and\n \t\t#bottom left element is equal to center top right element and \n \t\t#bottom left element is equal to top right element then first_diag is equal to true, else equal to false\n \t\tsecond_diag=@board[1][1]!=0&&@board[2][2]!=0&&(@board[0][0]==@board[1][1]&&@board[0][0]==@board[2][2]&&@board[0][0]==@board[3][3]) #if center is not equal to 0, and\n \t\t#if two center elements from top left to bottom right are not 0 and \n \t\t#top left element is equal to center top left element and\n \t\t#top left element is equal to center bottom right element and \n \t\t#top left element is equal to bottom right element then second_diag is equal to true, else equal to false\n \t\treturn true if (first_diag||second_diag) #if first_diag is true or second_diag is true, return true. If both are\n \t\t#false, return false.\n \t\treturn false\n \tend", "def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end", "def contains_mine?(row, col)\n false\n end", "def contains_mine?(row, col)\n false\n end", "def left_edge?(row,col)\n\t\tpixels[row][col+1] == nil\n\tend", "def check_right_to_left\n i = 0\n index_array = []\n @bingo_board.each do\n index_array << @bingo_board[i][i]\n i += 1\n end\n if index_array == ['x', 'x', 'x', 'x', 'x']\n puts \"BINGO!\"\n end\n end", "def win_check(mark, board)\n return true if ((board[7] == mark && board[8] == mark && board[9] == mark) || # Top horrizontal\n (board[4] == mark && board[5] == mark && board[6] == mark) || # middle horrizontal\n (board[1] == mark && board[2] == mark && board[3] == mark) or # bottom horrizontal\n (board[1] == mark && board[4] == mark && board[7] == mark) || # Left vertical\n (board[2] == mark && board[5] == mark && board[8] == mark) || # Middle vertical\n (board[3] == mark && board[6] == mark && board[9] == mark) || # Right vertical\n (board[1] == mark && board[5] == mark && board[9] == mark) || # Diagonal\n (board[3] == mark && board[5] == mark && board[7] == mark)) # diagonal\n return false\n end", "def check_diagonal\n RulesContracts.classic_model(@game_state_model)\n # testing for bitboard errors\n # (0..7).each { |y|\n # (0..7).each { |x|\n # if @grid[y][x] == 1 and y <= 4 and x >= 3\n # puts \" #{x}/#{y} #{@grid[y][x]} || #{x-1}/#{y+1} #{@grid[y + 1][x - 1]} || #{x-2}/#{y+2} #{@grid[y + 2][x - 2]} || #{x-3}/#{y+3} #{@grid[y + 3][x - 3]}\"\n # puts \"#{@grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1}\"\n # end\n # }\n # }\n \n (0..7).each { |y|\n (0..7).each { |x|\n if y <= 4 and x <= 4\n if @grid[y][x] == 2 and @grid[y + 1][x + 1] == 2 and @grid[y + 2][x + 2] == 2 and @grid[y + 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x + 1] == 1 and @grid[y + 2][x + 2] == 1 and @grid[y + 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y <= 4 and x >= 3\n if @grid[y][x] == 2 and @grid[y + 1][x - 1] == 2 and @grid[y + 2][x - 2] == 2 and @grid[y + 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y + 1][x - 1] == 1 and @grid[y + 2][x - 2] == 1 and @grid[y + 3][x - 3] == 1\n @winner = 0\n return true\n end\n end\n if y >= 3 and x <= 4\n if @grid[y][x] == 2 and @grid[y - 1][x + 1] == 2 and @grid[y - 2][x + 2] == 2 and @grid[y - 3][x + 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x + 1] == 1 and @grid[y - 2][x + 2] == 1 and @grid[y - 3][x + 3] == 1\n @winner = 0\n return true\n end \n end\n if y >= 3 and x >= 3\n \n if @grid[y][x] == 2 and @grid[y - 1][x - 1] == 2 and @grid[y - 2][x - 2] == 2 and @grid[y - 3][x - 3] == 2\n @winner = 1\n return true\n elsif @grid[y][x] == 1 and @grid[y - 1][x - 1] == 1 and @grid[y - 2][x - 2] == 1 and @grid[y - 3][x - 3] == 1\n @winner = 0\n return true\n end \n \n end \n }\n }\n return false\n end", "def check_diagonally_right(x, y, numbers_in_product)\n (0...numbers_in_product).inject(1) do |product, i|\n product * matrix[y+i][x+i]\n end\n end", "def check_left_to_right\n i = 0\n i2 = 4\n index_array = []\n @bingo_board.each do\n index_array << @bingo_board[i][i2]\n i += 1\n i2 -= 1\n end\n if index_array == ['x', 'x', 'x', 'x', 'x']\n puts \"BINGO!\"\n end\n end", "def squaragonal?(array)\n diag_right = 1\n diag_left = 1\n\n (0...array.length - 1).each do |i|\n (0...array.length - 1).each do |j|\n diag_right += 1 if array[i][j] == array[i + 1][j + 1]\n # diag_left += 1 if array[array.length - i - 1][j] == array[array.length - i - 2][j + 1]\n diag_left += 1 if array[-(i + 1)][j] == array[-(i + 2)][j + 1]\n end\n end\n if diag_right == array.length || diag_left == array.length\n return true\n else\n return false\n end\nend", "def pawn_diagonal?(x,y)\n diagonal?(x, y) && x_diff(x) == 1\n end", "def should_check_diagonal?\n return false unless @two_dimensional_arrays[2].any? { |column| column != \".\" }\n true\n end", "def row_col\n f = lambda do |board ,mark|\n board.any? { |row| row.all? {|cell| cell == mark } } end\n\n return :X if (f.call(@grid ,:X) || f.call(@grid.transpose,:X))\n return :O if (f.call(@grid ,:O) || f.call(@grid.transpose,:O))\n end", "def contains_mine?(row, col)\n @grid[row][col].fill == \"mine\"\n end", "def part_of_right_x?(x, y)\n x == (size - y - 1)\n end", "def diagonal_line (board)\n if (board[0][0] == \"O\" && board[1][1] == \"O\" && board[2][2] == \"O\")\n return true\n elsif (board[2][0] == \"O\" && board[1][1] == \"O\" && board[0][2] == \"O\")\n return true\n elsif (board[0][0] == \"X\" && board[1][1] == \"X\" && board[2][2] == \"X\")\n return true\n elsif (board[2][0] == \"X\" && board[1][1] == \"X\" && board[0][2] == \"X\")\n return true\n end\n return false\n end", "def contains_mine?(row, col)\n @mine_field[[row,col]]\n end", "def diagonal_check\n \t\n \tdef diagonal_iteration(index)\n \t\ti = index\n \t\t@board.each do |row|\n \t\t return false if row[i] != 'x'\n \t\t i += 1 if index == 0\n \t\t i -= 1 if index == 4\n \t\tend\n \t\treturn true\n \tend\n\n \tif @board[0][0] == 'x'\n \t\treturn diagonal_iteration(0)\n elsif @board[0][4] == 'x' \n \t\treturn diagonal_iteration(4)\n end\n \treturn false\n end", "def winning_diagonal?(piece)\n diagonals.any? do |diag|\n diag.all?{|cell| cell == piece }\n end\n end", "def match()\n array_rows = @tablero.row_vectors() #Obtiene un array con todas las filas del tablero\n array_cols = @tablero.column_vectors() #Obtiene un array con todas las columnas del tablero\n diagonal1 = []\n diagonal2 = []\n diagonals = []\n #Obtiene la diagonal normal\n (0...@tablero.row_vectors.length).each do |i|\n diagonal1.push(@tablero.component(i, i))\n end\n #Obtiene la diagonal invertida\n (0...@tablero.row_vectors.length).each do |i|\n diagonal2.push(@tablero.component(i, @tablero.row_vectors.length - i - 1))\n end\n diagonals.push(diagonal1, diagonal2) #Los arrays de las diagonales se asignan a otro array\n\n #Se pregunta si existe algun match en filas o columnas o en las diagonales, si si regresa true\n if look_for_a_match(array_rows) || self.look_for_a_match(array_cols) || self.look_for_a_match(diagonals)\n return true\n else\n return false\n end\n end", "def winning_diagonal?(piece)\n diagonals.any? do |diag|\n diag.all?{|cell| cell == piece }\n end\n end", "def contains_mine?(row, col)\n if @mine_field[:bombs][col][row] == true && @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end", "def squarocol?(arr)\n (0..arr.length-1).each do |i|\n row_counter = 1\n col_counter = 1\n\n (0...arr.length-1).each do |j|\n row_counter += 1 if arr[i][j] == arr[i][j + 1]\n col_counter += 1 if arr[j][i] == arr[j + 1][i]\n \n end\n\n if row_counter == arr.length || col_counter == arr.length\n return true\n end\n \n end\n false\nend", "def two_squares?(x,y)\n return on_home_row? && (x_diff(x) == 0) && (y_diff(y) == 2)\n end", "def contains_mine?(row, col)\n mine_locations.include?([row, col])\n end", "def check_glabella(x, y)\n\t\t\t@right_eye_width = @right_eye_width + 1\t\n\t\t\twrite_to_image(x, y, 'blue')\n\t\t\treturn true if check_right_eye\n\t\t\treturn false\t\t\t\t\t\t\n\t\tend", "def check_coord_marked?(coord)\n case coord\n when \"a1\"\n if @array[0][0] != \" \"\n true\n end\n when \"a2\"\n if @array[0][1] != \" \"\n true\n end\n when \"a3\"\n if @array[0][2] != \" \"\n true\n end\n when \"b1\"\n if @array[1][0] != \" \"\n true\n end\n when \"b2\"\n if @array[1][1] != \" \"\n true\n end\n when \"b3\"\n if @array[1][2] != \" \"\n true\n end\n when \"c1\"\n if @array[2][0] != \" \"\n true\n end\n when \"c2\"\n if @array[2][1] != \" \"\n true\n end\n when \"c3\"\n if @array[2][2] != \" \"\n true\n end\n end\n end", "def identify_neighbours\n @x.times{ |r|\n @y.times{|c| \n #+1,+1 0,+1 +1,0\n @mat[r][c].add_neighbour @mat[r+1][c+1] unless @mat[r+1].nil? || @mat[r+1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r][c+1] unless @mat[r].nil? || @mat[r][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c] unless @mat[r+1].nil? || @mat[r+1][c].nil?\n \n #-1,-1 0,-1 -1,0\n @mat[r][c].add_neighbour @mat[r-1][c-1] unless @mat[r-1].nil? || @mat[r-1][c-1].nil?\n @mat[r][c].add_neighbour @mat[r-1][c] unless @mat[r-1].nil? || @mat[r-1][c].nil?\n @mat[r][c].add_neighbour @mat[r][c-1] unless @mat[r].nil? || @mat[r][c-1].nil?\n \n #+1,-1 -1,+1\n @mat[r][c].add_neighbour @mat[r-1][c+1] unless @mat[r-1].nil? || @mat[r-1][c+1].nil?\n @mat[r][c].add_neighbour @mat[r+1][c-1] unless @mat[r+1].nil? || @mat[r+1][c-1].nil?\n \n }\n \n } \n end", "def squaragonal?(mat)\n n = mat.length\n # check UL to BR\n f_ele = mat[0][0]\n i = 0\n j = 0\n all_same = true\n while i<n\n all_same &= f_ele == mat[i][i]\n i+=1\n end\n return true if all_same\n # check BL to UR\n # debugger\n f_ele = mat[n-1][0]\n j = n-1\n i = 0\n all_same = true\n while i<n\n all_same &= f_ele == mat[i][j]\n i+=1\n j-=1\n end\n return true if all_same\n false\nend", "def leaf?\n right - left == 1\n end", "def squarocol?(matrix)\n d = matrix.length\n d.times do |i|\n return true if matrix[i].all?{ |el| el == matrix[i][0]}\n end\n\n\n \n d.times do |c|\n flag = 0\n n = matrix[0][c]\n d.times do |r|\n if !(matrix[r][c] == n)\n flag = 1\n break\n end\n end\n return true if flag == 0\n end\n false\nend", "def at_risk_square(marker)\n unmarked_square = nil\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if threatened_row?(squares, marker)\n line.each do |square|\n if @squares[square].unmarked?\n unmarked_square = square\n end\n end\n end\n end\n unmarked_square\n end", "def passed_left_edge?(nxt_spc)\n\t\tnxt_spc% @board_width == (@board_width-1)\n\tend", "def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end", "def diagonal_win?\n (0..3).each do |column|\n (0..2).each do |row|\n return true if down_right_win?(row, column)\n end\n end\n (3..6).each do |column|\n (0..2).each do |row|\n return true if down_left_win?(row, column)\n end\n end\n false\n end", "def diagonal_left\n end", "def compare_rows guess = -1\n right_color = 0\n right_spot = 0 \n\n @guess_rows[guess].get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = ((@guess_rows[guess].get_pins) & (@correct_row.get_pins)).count\n [right_spot, right_color]\n end", "def won?\n if (diagonal_match || across_match || down_match)\n return true\n end\n return false\n end", "def check_right_eye\n\t\t\tif @right_eye_width >= MIN_EYE_WIDTH and @right_eye_width < (@left_eye_width + 1)\t\n\t\t\t\treturn true if check_mouth\n\t\t\tend\n\t\t\treturn false\n\t\tend", "def contains_mine?(row, col)\n @mines[row][col]\n end", "def win_row?(mark)\n @grid.any? do |row|\n row.all? {|char| char == mark}\n end\n end", "def visited(x, y, matrix)\n if open_room(x,y, matrix)\n return matrix[y][x] == '*'\n end\n end", "def squaragonal?(matrix)\n key1 = matrix[0][0]\n key2 = matrix[0][matrix.size - 1]\n test_dr = true\n test_dl = true\n\n (0...matrix.size).each do |i|\n test_dr = false unless matrix[i][i] == key1\n end\n\n j = matrix.size - 1\n (0...matrix.size).each do |i|\n test_dl = false unless matrix[i][j] == key2\n j -= 1\n end\n\n test_dr || test_dl\nend", "def won?\n for x in 0..@matrix.length - 1\n for y in 0..@matrix[x].length - 1\n return false if @matrix[x][y] == \"OO\"\n end\n end\n\n true\n end", "def isMine(x,y)\n @squares[x][y] == MINE_MARKER\n end", "def diag_winner?(check_symbol)\n \t(@current_state[:A1] == check_symbol &&\n \t\t@current_state[:B2] == check_symbol &&\n \t\t@current_state[:C3] == check_symbol) ||\n \t(@current_state[:A3] == check_symbol &&\n \t\t@current_state[:B2] == check_symbol && \n \t\t@current_state[:C1] == check_symbol) \n end", "def winner_diagonals\n\n # Start at the top left, get the player symbol (X or O) to match\n first_symbol = @board[0][0]\n\n # Traverse the diagonal from top left to bottom right\n for index in 1..BOARD_MAXIMUM_INDEX\n\n # Does this cell match the first symbol?\n if first_symbol != @board[index][index]\n\n # No, this diagonal IS NOT a winning combination\n break\n\n # At the end of this diagonal and not all empty?\n elsif index == BOARD_MAXIMUM_INDEX and first_symbol != EMPTY_POSITION\n\n # Yes, this diagonal IS a winning combination\n return first_symbol\n\n end\n\n end\n\n # Start at the top right, get the player symbol (X or O) to match\n row = 0 # Top\n column = BOARD_MAXIMUM_INDEX # Right\n first_symbol = @board[row][column]\n\n # Loop through each row (backwards diagonal)\n while row < BOARD_MAXIMUM_INDEX\n \n row += 1 # Down to the next row\n column -= 1 # Left to the next column\n\n # Does this cell match the first symbol?\n if first_symbol != @board[row][column]\n\n # No, this diagonal IS NOT a winning combination\n break\n\n # At the end of this diagonal and not all empty?\n elsif row == BOARD_MAXIMUM_INDEX and first_symbol != EMPTY_POSITION\n\n # Yes, this diagonal IS a winning combination\n return first_symbol\n\n end\n\n end\n\n # Nope, no winner in any diagonal\n return\n\n end", "def can_go_right?(the_maze, floor, position)\r\n (position + 1 < the_maze[floor].size) and (the_maze[floor][position + 1] == \"0\")\r\nend", "def diag?(twod_arr)\n first_diag = []\n second_diag = [] # two arrays for later storage\n\n (0...twod_arr.length).each do |idx| # looping though the length of the array\n first_diag << twod_arr[idx][idx] # storeing the first diag, it's easy since its index will always be the same\n second_diag << twod_arr[idx][twod_arr.length - 1 -idx] #second diag, this is the invert of \n end\n\n first_diag.uniq.length == 1 || second_diag.uniq.length == 1\nend", "def contains_mine?(row, col)\n @field[row][col].contains_mine?\n end", "def row_winning_move\n\t\t@board.grid.each_with_index do |row, r|\n\t\t\tother_nil_index = contains_two_marks(row)\n\t\t\tif(other_nil_index)\n\t\t\t\treturn [r, other_nil_index]\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def vertical_c4?\n result=true\n\n this_column = @play_field[@last_move]\n\n return false if this_column.length < 4\n\n last_move_color = this_column[-1]\n\n\n\n #checks if the top 4 in the stack are all the same color\n this_column[-4..-1].all? {|move| move == last_move_color}\n\n\n end", "def check_diag b, play\n x = 0\n while x < 4\n y = 0\n while y < 4\n if b[x][y] == play\n if b[x+1][y+1] == play\n if b[x+2][y+2] == play\n if b[x+3][y+3] == play\n win = true\n end\n end\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return win\nend", "def squaragonal?(grid)\n match?(grid) || match?(grid.reverse)\nend", "def valid_diagonal(top, right, n)\n bits = 0\n\n if top\n if right\n (@size - n).times { |i|\n if @state[((@size + 1) * i) + n]\n bits += 1\n end\n }\n else\n (n + 1).times { |i|\n if @state[((@size - 1) * i) + n]\n bits += 1\n end\n }\n end\n else\n n_pos = n + ((@size - 1) * @size)\n if right\n (@size - n).times { |i|\n if @state[n_pos - ((@size - 1) * i)]\n bits += 1\n end\n }\n else\n (n + 1).times { |i|\n if @state[n_pos - ((@size + 1) * i)]\n bits += 1\n end\n }\n end\n end\n\n if bits > 1\n return false\n else\n return true\n end\n end", "def diagonal_victory(b)\n if victory_diagonal?(board_diagonal_values(b, true))\n 1\n elsif victory_diagonal?(board_diagonal_values(b, false))\n 2\n else\n false\n end\nend", "def check_diag(row, col)\n\n # North-East diagonal\n row_i = row-1\n col_i = col+1\n while row_i > -1 and col_i < 8\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i -= 1\n col_i += 1\n end\n\n # North-West diagonal\n row_i = row-1\n col_i = col-1\n while row_i > -1 and col_i > -1\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i -= 1\n col_i -= 1\n end\n\n # South-East diagonal\n row_i = row+1\n col_i = col+1\n while row_i < 8 and col_i < 8\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i += 1\n col_i += 1\n end\n\n # South-West diagonal\n row_i = row+1\n col_i = col-1\n while row_i < 8 and col_i > -1\n if @board[row_i][col_i] == '*'\n return false\n end\n row_i += 1\n col_i -= 1\n end\n\n return true\n end", "def opposite_corners?\n (@grid[\"a1\"] == @player_mark && @grid[\"c3\"] == @player_mark) || (@grid[\"a3\"] == @player_mark && @grid[\"c1\"] == @player_mark)\n end", "def check_diag2 b, play\n x = 0\n while x < 4\n y = 0\n while y < 3\n if b[x+3][y] == play\n if b[x+2][y+1] == play\n if b[x+1][y+2] == play\n if b[x][y+3] == play\n win = true\n end\n end\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return win\nend", "def block_diagonal_win?\n \tblank_x = -1\n \tx_row_total = 0\n \t\n \t3.times do |i|\t\n\t\t\tif @game_board[i][i] == \"X\"\n\t\t\t\tx_row_total += 1\n\t\t\telse \n\t\t\t\tblank_x = i\n\t\t\tend\n\n\t\t\tif x_row_total == 2 && blank_x > -1\n\t\t\t\t@game_board[blank_x][blank_x] = \"O\"\n\t\t\t\ttrue\n\t\t\tend\n \tend\n \tfalse\n end", "def contains_mine?(row, col)\n @value_grid[[row, col]][:mine]\n end", "def contains_mine?(row, col)\n if mine_locations.include?([row, col])\n true\n else\n false\n end\n end", "def vert_diag_row(row_index, col_index, token)\n if cur_board[row_index + 1][col_index] == token\n cur_board[row_index + 2][col_index] == token && cur_board[row_index + 3][col_index] == token\n elsif cur_board[row_index + 1][col_index - 1] == token\n cur_board[row_index + 2][col_index - 2] == token && cur_board[row_index + 3][col_index - 3] == token\n elsif cur_board[row_index + 1][col_index + 1] == token\n cur_board[row_index + 2][col_index + 2] == token && cur_board[row_index + 3][col_index + 3] == token\n else\n false\n end\n end", "def attacking_diagonal?\n false\n end" ]
[ "0.7571101", "0.72156817", "0.7053456", "0.6840885", "0.6764872", "0.67310846", "0.6671904", "0.6603409", "0.6565683", "0.6556923", "0.6420631", "0.63915753", "0.6303198", "0.62870777", "0.625943", "0.6259062", "0.62556356", "0.6244905", "0.61952555", "0.6186897", "0.61778545", "0.61540943", "0.61328375", "0.61192757", "0.6114565", "0.61074144", "0.6102994", "0.6045389", "0.6032713", "0.60286444", "0.59878564", "0.5985819", "0.59759194", "0.5959023", "0.5950827", "0.5941615", "0.5940533", "0.5929586", "0.5929586", "0.5870466", "0.5863326", "0.5853844", "0.5850129", "0.5845813", "0.58315367", "0.582259", "0.58197886", "0.580383", "0.57939285", "0.5793689", "0.5773825", "0.57698375", "0.5766659", "0.5766353", "0.5766326", "0.5762679", "0.5751219", "0.57499427", "0.57490075", "0.57381684", "0.5728793", "0.57264566", "0.5723859", "0.57234526", "0.57143366", "0.57137907", "0.5708895", "0.57026976", "0.5694873", "0.5692596", "0.56883585", "0.5687661", "0.5687351", "0.5682583", "0.5681921", "0.56639767", "0.5663532", "0.5663411", "0.56460404", "0.5641529", "0.56394726", "0.56369436", "0.56257695", "0.56198716", "0.5601609", "0.5596557", "0.55934656", "0.55837166", "0.55827945", "0.55801904", "0.5575568", "0.5571527", "0.5569316", "0.5566215", "0.5565239", "0.5563418", "0.5561695", "0.5560503", "0.55598676", "0.5551789" ]
0.6318227
12
creating a new user session when a user logs in
def create user = User.find_by :email => params[:email] if user.present? && user.authenticate(params[:password]) session[:user_id] = user.id redirect_to root_path else redirect_to login_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if user = User.find_by_login(params[:login])\n # Save the user ID in the session so it can be used in subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n end\n end", "def create\n\t\tuser = User.from_sso(cookies[:UTEP_SE], cookies[:UTEP_SA])\n\t\tlog_in(user) if user\n\t\tredirect_to root_url\n\tend", "def create\n reset_session\n u = User.authenticate(params[:session][:login], params[:session][:password])\n \n if u\n reset_session\n session[:user_id] = u.id\n session[:user_login] = u.login\n @current_user = User.find(session[:user_id])\n flash[:notice] = 'hi, again!'\n redirect_to dashboard_url\n else\n flash[:error] = 'Invalid login or password.'\n redirect_to root_url\n end\n end", "def create\n user = User.where(:username => params[:session][:username].downcase).first\n \n if user && user.authenticate(params[:session][:password])\n log_in user\n user['last_login'] = Time.now.to_datetime\n user.save\n flash[:success] = \"Welcome back #{user.username}!\"\n redirect_to home_path\n else\n # Otherwise, keep them on the login page.\n flash.now[:danger] = 'Invalid username or password'\n render 'new'\n end\n end", "def create_session\n @user = User.new(nickname: User.temp_user_name)\n @user.save\n session[:user_id] = @user.id\n @user\n end", "def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n previous_path = session[:login_redirect_to]\n set_new_user_session user, @session.remember_me\n\n redirect_to previous_path || root_path\n else\n flash.now[:login_error] = true\n render action: \"new\"\n end\n end", "def login_user\n\t @user_session = UserSession.new\t \n\tend", "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "def create\n if user = User.authenticate_with_credentials(params_for_login)\n # a session cookie is assigned to logged users\n session[:user_id] = user.id\n redirect_to session[:return_to]\n else\n redirect_to session[:return_to], flash: { error: \"Invalid email address\" }\n end\n end", "def new_user_session(user)\n session = new_session\n session.login!(user)\n return session\n end", "def create\n @user = User.find_or_create_from_auth_hash(auth_hash)\n # self.current_user = @user\n session[:user] = @user.id\n redirect_to '/'\n end", "def create\n # logging in can be done via email or username interchangeably\n user = User.find_by email: params[:session][:username].downcase\n # ||= only runs the find command if the user was not set by the above\n user ||= User.find_by username: params[:session][:username].downcase\n\n if user && user.authenticate(params[:session][:password])\n # Log the user in and redirect to the user's show page\n log_in user\n flash[:success] = \"Logged in as #{user.username}\"\n redirect_to user_url(user)\n else\n # Flash an error message\n flash.now[:danger] = 'Invalid email or password'\n render 'new'\n end\n end", "def create\n unless session[:user_id].present?\n user = User.create_user\n session[:user_id] = user.id\n end\n end", "def create\n user = User.find_by_username(params[:username])\n \n if user && user.authenticate(params[:password])\n session[:event_id] = nil\n session[:family_id] = nil\n session[:user_id] = user.id\n redirect_to(:home)\n else\n flash[:notice] = \"Invalid username or password\"\n redirect_to(:new_login)\n end\n end", "def create\n # find user from session cookie -> email, then authenticate\n @user = User.find_for_database_authentication(email: session_params[:email])\n if @user && @user.valid_password?(session_params[:password])\n sign_in(@user)\n # after signing in the user, refresh to show most updated saved user\n @user.reload\n render :show\n return\n end\n # return prevents login error\n invalid_login_attempt_error\n end", "def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend", "def create\n @user = User.find_by(email: session_params[:email])\n if @user && @user.authenticate(session_params[:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:user_id] = @user.id\n flash[:notice] = \"Welcome, #{@user.email}!\"\n redirect_to statuses_path\n else\n flash[:alert] = \"Please log in again\"\n render \"new\"\n end\n end", "def login_as(user)\n UserSession.create(users(user))\n end", "def create\n user = User.find_by(username: params[:session][:username])\n\n if user && user.authenticate(params[:session][:password])\n # Log the user in\n log_in user\n user.update_attribute(:is_login, true)\n redirect_to index_path\n else\n # Using render in case any error flash message is to shown in future. \n render 'new'\n end # END IF-ELSE login\n end", "def create\n session[:enable_admin_pages] = false\n user = User.find_by(netid: auth_hash['extra']['netid'])\n if user\n session[:netid] = user.netid\n flash[:success] = \"Signed in as #{user.name}\"\n\n # Check auth for admin paths - in this case they have a user record, so set true\n # In other apps further permissions can be checked e.g. admin user type\n session[:enable_admin_pages] = true\n\n redirect_to session[:return_url] || root_path\n else\n redirect_to not_authorized_path\n end\n end", "def create\n @user = User.find_or_create_by(uid: auth['uid']) do |u|\n u.name = auth['info']['name']\n u.email = auth['info']['email']\n end\n\n session[:user_id] = @user.id\n\n render 'welcome/home'\n end", "def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end", "def login_as(user)\n Session.create(users(user))\n end", "def create\n\n user = current_instance.users.where(username: params[:username]).first\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, notice: 'You have been successfully logged in to Unify.'\n else\n flash[:error] = 'Invalid username and/or password.'\n render :new\n end\n\n end", "def create_session\n # byebug\n user = User.find_by(\n email: params[:email],\n password: params[:password]\n )\n\n if (user.nil?)\n redirect_to action: \"sign_in\"\n else\n session[:user_id] = user.id\n\n redirect_to \"/users/#{user.id}\"\n end\n\n end", "def create\n unless current_user_session.nil?\n redirect_to root_url, :notice => \"You are already logged in.\"\n return\n end\n @user_session = UserSession.new(params[:user_session])\n\n if @user_session.save\n redirect_to(@user_session.user, :notice => \"Login successful. Welcome!\") \n else\n render :action => \"new\" \n end\n end", "def create\n\t\t# method interacts with session > new.html.erb view\n\t\tuser = User.where(email: params[:user_email]).first\n\t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to '/'\n\t\telse\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def create_session\n req_params = params[:user]\n unless req_params\n @msg = \"Login details not found\"\n render \"objects/msg.json\", status: :unauthorized and return\n end\n @user = User.find_by_email(req_params[:email])\n if @user && @user.authenticate(req_params[:password])\n session[:user_id] = @user.id\n render 'objects/user.json'\n else\n @msg = \"Email or password is invalid\"\n render \"objects/msg.json\", status: :unauthorized\n end\n end", "def create\n @user = User.where(username: params[:session][:username]).first\n if @user.password == params[:session][:password]\n session[:user_id]=@user.id\n log_in @user\n puts \"my sess = #{session[:user_id]}\"\n redirect_to @user\n else\n flash[:alert] = \"Invalid Username/Password. Please try again\"\n redirect_to login_path\n end\n end", "def create\n\t\tuser = User.find_by(email: params[:login][:email])\n\n\t\tif user && user.authenticate(params[:login][:password])\n\t\t\tsession[:user_id] = user.id.to_s\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\n\tend", "def create\n session[:user] = User.login_or_signup(params[:session])\n if logged_in?\n redirect_to('/')\n flash[:notice] = \"Logged in successfully\"\n else\n add_warning \"Bad username/password combination! Please try again.\"\n render :action => 'new'\n end\n end", "def set_session_for(user)\n UserSession.create(user)\n end", "def create\n puts \"\\n\\n users_controller create: running \\n\\n\"\n # Create a new user\n @user = User.new(params_user)\n if @user.save\n # Change ID session login to true\n @session = Session.new\n # need to make shure there arent more then one\n # need a timmer to delete automaticly in a day or 2\n id = SecureRandom.hex(64)\n key = SecureRandom.hex(64)\n @session.session_id = id\n @session.key = key\n @session.user_id = @user.id\n @session.save\n # Save ID and random temp hash in cookie\n cookies[:session_id] = id\n cookies[:key] = key\n # go to homepage\n redirect_to '/Events/homepage'\n end\n end", "def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end", "def new\n auth_hash = request.env['omniauth.auth']\n session[:auth_provider] = auth_hash[:provider]\n\n # look up auth_field, auth_value of User by provider, from config/initializers/omniauth.rb\n # Currently CAS is our only provider\n auth_config = ResearchMatch::Application.config.auth_providers[session[:auth_provider].to_sym]\n if auth_config\n auth_field = auth_config[:auth_field].to_s\n auth_value = auth_hash[auth_config[:auth_value]].to_s\n session[:auth_field] = auth_field\n session[:auth_value] = auth_value\n else\n flash[:error] = \"There were problems identifying your auth provider. Please try again or contact support.\"\n redirect_to home_path\n return\n end\n\n\n user = User.where(auth_field => auth_value).first\n if user.present?\n UserSession.new(user).save\n session[:user_id] = user.id # TODO remove (use only @user_session)\n redirect_to dashboard_path\n else\n if session[:auth_provider].to_sym == :google_oauth2\n session[:info_hash] = auth_hash[:info]\n end\n puts 'redirect_to new_user_path'\n redirect_to new_user_path\n end\n end", "def create\n\n logger.debug \"### Processing new login details\"\n user = User.authenticate(params[:email], params[:password])\n\n if user\n\n logger.debug \"### Login details matched - creating login session\"\n session[:user_id] = user.id\n flash[:notice] = \"Logged in!\"\n redirect_to(session[:return_to] || home_index_path) \n session.delete(:return_to)\n else\n logger.debug \"### User details didn't match - login denied\"\n flash[:error] = \"Invalid email or password\"\n render \"new\"\n end\n\n end", "def create\n unless ubiquo_users?\n UbiquoUser.create_first(params[:login],params[:password])\n end\n self.current_ubiquo_user = UbiquoUser.authenticate(params[:login],\n params[:password])\n if logged_in?\n if params[:remember_me] == \"1\"\n self.current_ubiquo_user.remember_me\n cookies[:auth_token] = {\n :value => self.current_ubiquo_user.remember_token ,\n :expires => self.current_ubiquo_user.remember_token_expires_at\n }\n end\n flash.discard\n redirect_back_or_default(ubiquo.home_path)\n else\n flash[:error] = t 'ubiquo.auth.login_invalid'\n render :action => 'new'\n end\n end", "def create\n \t@user = User.find_by(e_mail: params[:session][:email].downcase)\n \tif @user && @user.authenticate(params[:session][:password])\n \t\t# Login successful, save user_id to session and redirect to user page\n \t\tlog_in @user\n \t\tredirect_to home_path\n \telse\n \t\t# Login unsuccessful, redirect to Log In Page and display an error message\n \t\tflash.now[:danger] = 'Invalid email/password combination'\n render \"new\"\n \tend\n end", "def create\n @user = User.find_by(name: params[:username])\n if @user.authenticate(params[:password])\n session[:current_user_id] = @user.id\n end\n end", "def create_user\n \tunless @user\n \t\tflash[:notice_login] = \"Incorrect password or username.\"\n \t return render action: 'new_user'\n \tend\n \tsession[:comedian_id] = nil\n \tsession[:user_id] = @user.id\n\n \tflash[:notice_login] = 'Signed in!'\n \tredirect_to root_path\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n \n #if the user was found and the user.authenticate based on enetered password\n if user && user.authenticate(params[:session][:password])\n # we are saving user id into the session so the browsers cookies will handle this\n # this id will be used across sessions\n session[:user_id] = user.id\n \n # flash a success and redirect to the users page\n flash[:success] = \"You have successfully logged in\"\n redirect_to user_path(user)\n else\n # re render the login page, but since this is not a model backed form we wont have validation messages\n # add a message with flash\n flash.now[:danger] = \"Username or Password were incorrect\"\n render 'new'\n end\n end", "def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end", "def create\n @user_session = current_conference.user_sessions.new(params[:user_session])\n if @user_session.save\n flash[:notice] = t(\"error_messages.login_succeeded\")\n else\n flash[:error] = t(\"error_messages.login_failed\")\n end\n # Set the user_id in the cookie.\n # This normally runs as a :before_filter, but\n # in the current case, we have to rerun it because\n # we have changed the user_id in this action.\n # user_id_in_cookie(@user_session.record)\n respond_with @user_session, :location => \"/\"\n\n # if @user_session.save\n # flash[:notice] = \"Successfully logged in.\"\n # redirect_to root_path\n # else\n # if smartphone?\n # render \"new.s\", :layout => \"layouts/smartphone\"\n # elsif galapagos?\n # render_sjis \"new.g\", :layout => \"layouts/galapagos\"\n # else\n # render \"new\"\n # end\n # end\n end", "def new\n @user_session = UserSession.new(:email => session[:user_real_account_email])\n end", "def create\n user=ApiM8::Client::Account::Users.instance.login(params[:login], params[:password])\n puts user.current_user\n\n if user\n session[:current_user_id]=user.id\n redirect_to role_super_admin_dashboards_url, :notice => \"Logged in as #{params[:login]}!\"\n else\n flash[:danger] = 'Invalid email/password combination' # Not quite right!\n render \"new\"\n end\n\n\n end", "def create\n options = {:remember_me => true}.merge(params[:user_session])\n @user_session = UserSession.new(options)\n if @user_session.save\n redirect_back_or_default root_url\n else\n @failed = true\n render :action => :new\n end\n end", "def create\r\n\t\t# find the user based on the email\r\n\t\tuser = User.find_by(email: params[:session][:email].downcase) # all our emails in our database is downcased\r\n\t\t# check if the email is valid\r\n\t\tif user && user.authenticate(params[:session][:password])\r\n\t\t\t# simulate logging in\r\n\t\t\tsession[:user_id] = user.id # saving the user id in the session. The browsers cookies is going to handle this\r\n\t\t\t# saving the users id in the session hash which is backed by the browser\r\n\t\t\t# display a message\r\n\t\t\tflash[:success] = \"You have successfully logged in\"\r\n\t\t\tredirect_to user_path(user)\r\n\t\telse\r\n\t\t\t# give a message since it is not a model back form\r\n\t\t\tflash.now[:danger] = \"There was something wrong with your login information\"\r\n\t\t\t# flash.new persists for one http request. When we redirect the message will display in the next screen\r\n\t\t\t# render the new template to login\r\n\t\t\trender 'new'\r\n\t\tend\r\n\tend", "def create\n user = User.find_by_email(params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password]) && user.manager && !user.admin #syndicate manager\n sign_in user\n #redirect_back_or user\n redirect_back_or users_url\n #redirect_to users_url\n #sign in\n elsif user && user.authenticate(params[:session][:password]) && !user.manager && user.admin #superuser\n sign_in user\n #redirect_back_or user\n redirect_to admin_url\n else\n #error and re render sign in form\n flash[:error] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def user_log_in(user)\n session[:user_id] = user.id\n end", "def create\n #this references the funciton we made in user.rb\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash[:login_error] = \"Couldn't find a user with those credentials\"\n redirect_to new_session_path\n else\n redirect_to user\n end\n end", "def create\n\t\tuser = User.where(:email => params[:email]).first\n\t\tif user.present? && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tredirect_to root_path\n\t\telse \n\t\t\tredirect_to new_session_path\n\t\tend\n\n\tend", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n @err = nil\n\n # if the information is valid, log the user in and redirect them to their homepage\n if @user && @user.authenticate(params[:session][:password])\n log_in @user\n render '/users/home'\n\n # otherwise notify error that the value is invalid and print it to the log in page\n else\n # user info is incorrect\n @err = 'Invalid email/password combination'\n redirect_to '/sessions/new'\n end\n end", "def create\n user = Backend::User.authenticate(params[:session][:login],\n params[:session][:password])\n \n if user.nil?\n flash.now[:error] = I18n.translate('sessions.signin.flash.invalid')\n @title = I18n.translate('sessions.signin.title')\n render 'new'\n else \n sign_in_to_backend(user)\n if !user.admin? && !user.staff? && user.partner?\n redirect_to backend_partner_sites_path\n else\n redirect_to backend_dashboard_path\n end\n end \n\n end", "def create\n user = User.find_by_username(user_login_params[:username])\n if user and user.authenticate(user_login_params[:password])\n session[:current_user_key] = user.key\n redirect_to '/home'\n else\n redirect_to login_url, alert: \"Invalid user/password combination\" \n end\n end", "def create_session user_id\n @state.user_id = user_id\n end", "def create\n validate_params; return if performed?\n user = User.find_by(user_name: params[:session][:user_name])\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to root_path\n else\n flash.now[:error] = I18n.t('errors.log_in.create')\n render :new\n end\n end", "def create \n user = User.find_by(username: params[:user][:username])\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id \n redirect_to user_path(user)\n else\n redirect_to '/login'\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email])\n \tif user && user.authenticate(params[:session][:password])\n \t\tlog_in user\n \t\tredirect_back_or user\n \telse\n \t\tredirect_to login_path, notice: \"Invalid email/password combination\"\n \tend\n end", "def create\n # AR model which will interact with our database and create a new user\n user = User.new(user_params)\n saveUser = user.save\n \n if saveUser\n session[:user_id] = user.id\n redirect_to '/'\n else\n redirect_to '/signup'\n end\n end", "def login_nadrowski\n nadrowski = User.find_by_login 'nadrowski'\n UserSession.create(nadrowski)\n end", "def create\n if user_signed_in?\n session[:user_id] = user.id\n redirect_to user, notice: \"Logged in!\"\n else\n flash[:error] = \"Wrong Username or Password.\"\n redirect_to root_url\n end\n end", "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password]) && user.confirm\n session[:user_id] = user.id\n session[:expires_at] = Time.now + 120.minutes\n redirect_to main_url\n else\n flash[:error] = \"Invalid username or password\"\n render \"new\"\n end\n end", "def create\n logout_keeping_session!\n begin\n #this might be a hack to get an exception thrown but it works for now\n become_logged_in_as current_user\n rescue Exception => error\n handle_login_error error\n else # success!\n remember_me_flag = (params[:remember_me] == \"1\")\n handle_remember_cookie! remember_me_flag\n flash[:notice] = \"Welcome, #{current_user.identifier}\"\n redirect_back_or_default('/')\n end\n end", "def create\n @user = User.find(params[:user][:id])\n if !@user.nil?\n session[:user_id] = @user.id\n redirect_to user_path(@user), notice: \"logged in successfully \"\n else\n redirect_to signin_path\n end\n end", "def create_session\n self.current_user = authenticate_user(params[:user][:login], params[:user][:password], :trace => true)\n \n # store remember me in token\n if logged_in?\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n render :update do |page|\n # JS code to close modal\n # update page header to show user information\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS\n redirect_back_or_default(authentication_success_url || '/')\n end\n else\n # callback :after_authentication_error\n self.send(:after_authentication_error, self.current_user) if self.respond_to?(:after_authentication_error)\n if !performed? && request.xhr?\n render :update do |page|\n # JS code to re-display login dialog\n end\n elsif !performed?\n flash[:error] = user_class.is_suspended?(params[:user][:login], params[:user][:password]) ? \n \"Login nicht möglich, da Benutzer gesperrt wurde.\" : \n MESSAGE_LOGIN_ERROR\n render :action => 'new'\n end\n end\n end", "def new\n user = User.not_deleted.find_for_database_authentication(:email => params[:email])\n if user.nil? then\n expose :message=>'User or password incorrect for this site', :error=>true\n return;\n end\n\n # Invalidate any session the user ha now\n # invalidateUserSession user\n\n # Validate the password, as you can see, if the password is wrong, the user seession is already\n # gone, this can improve security.\n if !user.valid_password?(params[:password]) then\n expose :message=>'User or password incorrect for this site', :error=>true\n return;\n end\n\n #Validate the customer id\n if !user.isAdmin? && !user.valid_customer_id(params[:customer_id]) then\n expose :message=>'User, password or customer id incorrect for this site', :error=>true\n return\n end\n\n #Validate the user site\n if user.isSiteLogin? && (params[:site_name].nil? || !user.valid_site?(params[:site_name])) then\n expose :message=>'User, password or customer id incorrect for this site', :error=>true\n return\n end\n\n if params[:user_type] then\n if user.user_type_name.downcase != params[:user_type].downcase\n expose :message=>\"Only '#{params[:user_type].capitalize}' Users are available to use this app\", :error => true\n return\n end\n end\n\n # Create a new session\n site = Site.find_site_by_name params[:site_name]\n customer = Customer.find_by_customer_id params[:customer_id]\n token = generateUserSession(user, site, customer)\n\n setCurrentUser user\n expose :token => token, :role => getCurrentRole.role_id\n end", "def create\n user = User.find_by_credentials(params[:user][:name], params[:user][:password])\n if user \n #rails creates session cookie for us, session is a hash\n #generate new session token and set our session to that token\n login!(user)\n redirect_to chirps_url\n else\n # flash used for collecting errors \n # flash - lasts for now and the next response cycle, usually for redirects\n # flash.now - only persist for this response, usually for render\n\n #we want errors to render once but not again on refresh\n flash[:errors] = [\"Invalid username/password\"]\n # render :new\n redirect_to new_session_url\n end\n end", "def create\n # Find the user by their name\n user = User.find_by(name: params[:session][:name].downcase)\n # If the user exists and the user credentials are correct\n if user && user.authenticate(params[:session][:password])\n # Log the user in\n login user\n # Take the user to their profile page\n redirect_to me_path\n else\n # Notify the user that their credentials are incorrect\n flash[:error] = 'Invalid email/password combination'\n # Redirect to the home page\n redirect_to root_path\n end\n end", "def create\n @user = User.find_by(email: params[:session][:email].downcase)\n if @user&.authenticate(params[:session][:password]) # & for safe navigation\n log_in @user\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n redirect_back_or @user\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create_user_and_login \n\t\tinsert_into :users, {\n\t\t\tid: 1 ,\n\t\t\tfirst_name: 'First',\n\t\t\tlast_name: 'Last',\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password',\n\t\t\trole_id: 1,\n\t\t\tuid: \"a\"\n\t\t}\n\n\t\tproxy.post( 'http://my.ownet/api/session',{\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password'\n\t\t}.to_json)\n\tend", "def create\n user = User.find_by_email(sessions_params[:email])\n if user and user.authenticate(sessions_params[:password])\n login user\n end\n redirect_to rooth_path\n end", "def create\n # Locate user in database using given email.\n @user = User.find_by(email: params[:session][:email].downcase)\n\n # Did the user enter the correct password?\n if @user && @user.authenticate(params[:session][:password])\n\n log_in @user\n\n # Only remember the user if the checkbox is ticked.\n params[:session][:remember_me] == '1' ? remember(@user) : forget(@user)\n\n # Show success message, and send user to their profile page.\n flash[:success] = \"Welcome back #{@user.name}!\"\n redirect_back_or @user\n else\n flash.now[:danger] = 'Incorrect username and/or password!'\n render 'new'\n end\n end", "def create\n email = params[:session][\"email\"] # both will work ->: will use less memory\n password = params[:session][:password]\n user = User.authenticate(email, password)\n \n if user # if auth is successful\n session[:user_id] = user.id # this is a session\n flash[:notice] = \"You are logged in.\"\n redirect_to session[:referrer] || :root # to whatever is the root of your webserver ()\n #:referrer -> send to page that started from (if tried to edit if not logged in)\n else # if wrong credentials\n flash[:error] = \"add to your FAIL blog and Please try again!\"\n render :action => \"new\" # just shows def new end (at the beginning again)\n end\n end", "def create_session_with(user)\n @logged_in_recently = false\n self.current_user = user\n \n # store remember me in token\n if logged_in?\n @logged_in_recently = true\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n if return_to_url\n flash[:xhr_redirect] = true\n @return_to_url = return_to_url\n session[return_to_param] = nil\n end\n render :update do |page|\n page << close_modal_javascript\n page.replace status_dom_id, :partial => 'layouts/front/status_navigation'\n page << \"document.fire('authentication:success')\"\n page << \"document.fire('authentication:complete')\"\n page.redirect_to @return_to_url if @return_to_url\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS.t\n redirect_back_or_default('/')\n end\n else\n flash[:error] = MESSAGE_LOGIN_ERROR.t\n if request.xhr?\n render :update do |page|\n page.replace session_dom_id, :partial => 'new'\n page << \"document.fire('authentication:failure')\"\n page << \"document.fire('authentication:complete')\"\n end\n else\n render :action => 'new'\n end\n end\n end", "def create\n\n\t\t# grab the authentication return\n\t\tauth = request.env[\"omniauth.auth\"]\n\n\t\t# now create a temporary user with the auth element etc\n\t\tuser = User.omniauth_create auth\n\n\t\t# now set the session_id \n\t\tsession[:id] = user.id\n\n\t\t# redirect back to the root which can successfully switch the pages of the application etc\n\t\tredirect_to root_url, :notice => \"Successful Authentication\"\t\n\tend", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to home_path\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def log_in\n @user = User.new\n end", "def create\n user = User.find_by_email(session_params[:email])\n\n if user && user.authenticate(session_params[:password])\n session[:user_id] = user.id\n redirect_url = params[:redirect_to] || after_sign_in_path\n msg = \"Welcome back, #{user.full_name}.\"\n\n respond_to do |format|\n format.html { redirect_to redirect_url, notice: msg }\n format.js { render json: { logged_in: true } }\n format.json { render json: user }\n end\n else\n redirect_to(new_user_session_path, notice: \"Oops, sorry. Something was wrong with your email or password.\")\n end\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n if @user_session.save\n flash[:notice] = \"Welcome #{@user_session.login}!\"\n redirect_to post_auth_redirect_url\n else\n flash.now[:error] = \"Couldn't locate a user with those credentials\"\n render :action => :new\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email].downcase)\n \tif user and user.authenticate(params[:session][:password])\n \t\tlog_in(user)\n # redirect_to \"/users/#{user.id}\"\n redirect_to '/'\n \telse\n \t\tflash.now[:danger] = \"Invalid email/password confirmation!\"\n \t\trender 'new'\n \tend\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n session[:current_user_name], session[:current_user_id] = @user.name, @user.id\n redirect_to '/login'\n else\n render action: \"new\"\n end\n end", "def new\n if current_user\n redirect_to root_url\n end\n @user_session = UserSession.new\n end", "def create\n\t\t@user = User.new(user_params)\n\n\t\tif @user.save\n\t\t\t#login the user\n\t\t\tsession[:id] = params[:id]\n\t\t\t#redirect to user home page\n\t\t\tredirect_to home_path\n\n\t\telse\n\t\t\trender :new\n\t\t\t\n\t\tend\n\t\t\n\tend", "def create\n\t\t#render 'new'\n\t\tuser = User.find_by(email: params[:session][:email].downcase)\n\t\tif user && user.authenticate(params[:session][:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tflash[:success] = \"You have successfully logged in!\"\n\t\t\tredirect_to user_path(user)\n\t\telse\n\t\t\t#when u render using flash.now and when u redirect_to using flash.\n\t\t\tflash.now[:danger] = \"There is something wrong with your login information!\"\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n\t user = AdminUser.authenticate(params[:email], params[:password])\n\t logger.info 'session#create creating session'\n\t if user\n\t \tlogger.info 'session#create user authenticated'\n\t session[:user_id] = user.id\n\t redirect_to admin_category_index_path\n\t else\n\t flash.now.alert = \"Invalid email or password\"\n\t render \"new\", layout: \"login_layout\"\n\t end\n\tend", "def create\n user = User.find_by(email_address: params[:session][:email_address].downcase)\n if user && user.authenticate(params[:session][:password])\n session[:user_id] = user.id\n log_in user #helper method used here to log in user upon signup before redirect.\n params[:session][:remember_me] == '1' ? remember(user) : forget(user) #using ternary operator to reduce conditional to determine 1 or 0.\n remember user #helper method used to call user.remember generating a rmemeber token and saving its digest to database.\n redirect_to user notice: \"logged in\"\n else\n message = \"Account not activated.\"\n message += \"Check your email for the activation link.\"\n flash.now[:alert] = \"Email or password is invalid\"\n render '/users/new' \n end\n end", "def new\n\t\t@user_session = UserSession.new\n\tend", "def create\n user = User.find_by(username: params[:username])\n if user.authenticate(params[:password])\n session[:current_user] = user.id\n redirect_to users_path\n else\n redirect_to login_path\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n if user\n # token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join\n #session[:token] = token\n session[:user_id] = user.id\n # user.update(session: token)\n redirect_to root_url, :notice => \"Logged in!\" \n else\n flash.now.alert = \"Invalid credentials.\"\n render \"new\"\n end\n end", "def log_in_as(user)\n session[:regular_user_id] = user.id\n end", "def create\n user = User.find_by(email: params[:email]) # finds the user with the given email\n if user && user.authenticate(params[:password]) # checks whether the email and the password matches?\n if (user.role == \"user\")\n session[:current_user_id] = user.id\n redirect_to categories_path\n elsif (user.role == \"clerk\")\n # checks whether clerks account is activated?\n if (user.archived_by)\n flash[:error] = \"Your Account is de-activated by admin!!\"\n redirect_to new_sessions_path\n else\n session[:current_user_id] = user.id\n redirect_to clerks_path\n end\n else\n session[:current_user_id] = user.id\n redirect_to menu_categories_path\n end\n else\n flash[:error] = \"Your Login attempt was Invalid!!\"\n redirect_to new_sessions_path\n end\n end", "def create\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash.now[:error] = \"invalid emails/password combination\"\n render 'new'\n else #user logs in, creates session\n session[:remember_token] = user.id\n @user = User.find_by_id(session[:remember_token]) \n if(@user.email==\"admin@dreamatic.org\") #redirect admin to her page\n redirect_to :controller => 'users', :action => 'index'\n elsif session[:url] == nil\n redirect_to :controller => :users, :action => :show, :id => user.id\n else\n redirect_to session[:url]\n session[:url] = nil\n end\n end \n end", "def login\n redirect_to(root_url) && return if logged_in?\n @user = User.new params[:user]\n if meth = params[:type]\n usr = @user.send(meth)\n unless usr.new_record? # registration/login success\n session[:user_id] = usr.id\n redirect_to(root_url)\n end\n end\n end", "def create\n user = warden.authenticate!(scope: :user, recall: \"users/sessions#new\")\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n sign_in(\"user\", user)\n respond_with user, :location => after_sign_in_path_for(user)\n end", "def log_in(user)\n session[:user_id] = user.id\n end", "def log_in(user)\n session[:user_id] = user.id\n end", "def log_in(user)\n session[:user_id] = user.id\n end", "def log_in(user)\n session[:user_id] = user.id\n end", "def log_in(user)\n session[:user_id] = user.id\n end", "def log_in(user)\n session[:user_id] = user.id\n end" ]
[ "0.78682065", "0.7765376", "0.7755039", "0.7751684", "0.77149665", "0.7664976", "0.7584501", "0.75626665", "0.7562176", "0.75556874", "0.7549905", "0.75333136", "0.7526666", "0.7524522", "0.75129265", "0.7506285", "0.7475791", "0.74708873", "0.7445654", "0.7434086", "0.74324083", "0.7430341", "0.74277633", "0.74249697", "0.74224454", "0.74203354", "0.74008274", "0.73982406", "0.73889136", "0.73841524", "0.736213", "0.7361217", "0.73440206", "0.734085", "0.73239356", "0.731855", "0.7304221", "0.7297685", "0.7297632", "0.7296537", "0.7290308", "0.72841334", "0.72830135", "0.72820413", "0.7281459", "0.7278613", "0.7272414", "0.72711915", "0.7268213", "0.72581154", "0.7258042", "0.72560996", "0.7250227", "0.724774", "0.72451705", "0.72441584", "0.724303", "0.72422", "0.72363627", "0.7234756", "0.7224617", "0.72239476", "0.7220474", "0.7217364", "0.7210826", "0.7208845", "0.7208196", "0.7200884", "0.71966875", "0.7193697", "0.71819127", "0.7181508", "0.71796536", "0.7179502", "0.7177256", "0.71764094", "0.71746624", "0.71661514", "0.71531117", "0.7152617", "0.71487564", "0.71421605", "0.71374774", "0.71319", "0.71318746", "0.71299636", "0.71266013", "0.7121195", "0.711777", "0.71175987", "0.71172166", "0.7115419", "0.7107776", "0.7107766", "0.71033925", "0.71033925", "0.71033925", "0.71033925", "0.71033925", "0.71033925" ]
0.7132709
83
deleting a user session when the current user logs out
def destroy session[:user_id] = nil redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n session.delete(:user_id)\n @current_user = nil\nend", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil \n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n \tsession.delete(:user_id)\n \t@current_user = nil\n end", "def destroy\n session[:user_id] = nil\n @curr_user = nil\n redirect_to :log_in, :notice => \"Logged out\"\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_name)\n session.delete(:user_email)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def destroy\n session.delete(:user)\n end", "def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n session.delete(:user_type)\n session.delete(:user_email)\n @current_user = nil\n end", "def signout\n session.delete(:user_id)\n @current_user = nil\n end", "def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user=nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def sign_out\n session.delete(:user_id)\n @current_user = nil\nend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end", "def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end", "def log_out\n forget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:user_id)\n forget(@current_user)\n @current_user=nil\n end", "def signout\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend", "def destroy\n user_session.log_out\n redirect_to root_url\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def destroy\n\n session.delete(:user_id)\n redirect_to root_path, notice: \"logged out successfully \"\n\n end", "def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user= nil\n\tend", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end", "def sign_out\n session.delete(:user_id)\n @current_user = nil\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out!\"\n end", "def destroy\n\t\tsession.delete(:user_id)\n\t\tredirect_to login_path\n\tend", "def log_out\n session.delete(:user_id) #remove the user id from the browser cache\n @current_user = nil\n end", "def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def destroy\n\n # deletes user session\n session[:user_id] = nil\n redirect_to root_path, notice: 'Logged out.'\n end", "def logout\n session.delete(:user_id) if current_user\n end", "def sign_out\n session.delete(:user_id)\n end", "def destroy\n session[:user_id] = nil\n redirect_to sessions_path, flash: { info: 'Logged Out' }\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_url, :notice => \"Logged out\"\n end", "def destroy\n session[:user_id] = nil\n redirect_to root_path, notice: I18n.t(:session_logged_out)\n end", "def destroy\n @user_session = @current_user_session\n if @user_session\n @user_session.destroy\n end\n redirect_to login_path\n end", "def log_out \n session.clear\n @current_user = nil\n end", "def destroy\n\t\tsession.delete(:user_id)\n\t\tredirect_to root_url, notice: 'Logged out!'\n\tend", "def logout\n session.delete(:user_id)\n @current_user = nil\n end" ]
[ "0.8683788", "0.86628985", "0.86496997", "0.8622274", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.86085284", "0.860809", "0.8576951", "0.8575914", "0.8569449", "0.85686904", "0.85686904", "0.85686904", "0.85686904", "0.85686904", "0.85603887", "0.8558739", "0.85541266", "0.8546478", "0.8534018", "0.8533106", "0.8529232", "0.8527935", "0.8515429", "0.8515429", "0.8515429", "0.8515429", "0.85141945", "0.85067177", "0.85006094", "0.8498832", "0.84966505", "0.84949476", "0.848312", "0.847296", "0.8471706", "0.8470886", "0.84606713", "0.8460261", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456445", "0.8456276", "0.8455526", "0.84465575", "0.8446293", "0.84403455", "0.8431438", "0.8429531", "0.84282047", "0.8425739", "0.8419169", "0.8414212", "0.8413127", "0.8412056", "0.8403789", "0.84022164", "0.8398729" ]
0.0
-1
Sets the provided values on the thread object.
def update(opts = {}) result = self.class.post('/update_thread', :query => opts.merge(:forum_api_key => forum.key)) return result["succeeded"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n thread = args.first\n options.merge!(:thread => thread) if ([:ident, :link] & options.keys).empty?\n response = get('threads/set', options)\n end", "def set_Thread(value)\n set_input(\"Thread\", value)\n end", "def set_Thread(value)\n set_input(\"Thread\", value)\n end", "def cattr_setter_thread *names\n opts = Hash === names[-1] ? names.pop : EMPTY_HASH\n\n transform = opts[:setter_transform]\n transform = \"__val = (#{transform})\" if transform\n\n names.each do | name |\n instance_eval(expr = <<\"END\", __FILE__, __LINE__)\ndef self.#{name}= __val\n #{transform}\n Thread.current[:'#{self.name}.#{name}'] = [ __val ]\nend\nEND\n # $stderr.puts \"#{expr}\"\n end\n end", "def set _obj, _args\n \"_obj set _args;\" \n end", "def set(*args, &block)\n update(*args, &block)\n end", "def []= key, value\n Thread.current[key] = value\n end", "def threads=(value)\n value = value.to_i\n value = 1 if value < 1\n @threads = value\n end", "def set(*args, **kwargs)\n queue SetCommand, args, kwargs\n end", "def setTaskState _obj, _args\n \"_obj setTaskState _args;\" \n end", "def set(*args)\n # not supported\n end", "def set(*args)\n # not supported\n end", "def thread=(_arg0); end", "def initialize(thread, &block)\n @thread = thread\n @block = block\n\n @value_mutex = Mutex.new\n @value_cond = Turbine::ConditionVariable.new\n\n @called = false\n @value = nil\n @value_type = nil\n end", "def set_instance_variables(values)\n values.each_with_index do |value,i|\n name = self.class.takes[i]\n instance_variable_set \"@#{name}\",value\n end\n end", "def lbSetValue _obj, _args\n \"_obj lbSetValue _args;\" \n end", "def multithreaded=(multithreaded)\n set_default :multithreaded, multithreaded\n end", "def thread_accessor(*names, &initializer)\n thread_writer(*names)\n thread_reader(*names, &initializer)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_ThreadID(value)\n set_input(\"ThreadID\", value)\n end", "def set_instance_variables(values)\n values.each_with_index do |value,i|\n name = self.class.takes[i]\n instance_variable_set \"@#{name}\",value\n end\n @opt = {} if self.class.takes.include?(:opt) and @opt.nil?\n end", "def thread_writer(*names)\n ThreadAccessor.each(*names) do |key, meth|\n define_method(\"#{meth}=\"){|obj| Thread.current[key] = obj }\n end\n end", "def set_thread_obj\n @thread_obj = ThreadObj.find(params[:id])\n end", "def set_values\n self[:type] = @type\n self[:line] = @line\n self[:column] = @column\n self[:message] = @message\n self[:level] = @level\n end", "def set!(*args)\n end", "def setVariable _obj, _args\n \"_obj setVariable _args;\" \n end", "def setCurrentTask _obj, _args\n \"_obj setCurrentTask _args;\" \n end", "def set(values: nil,\n **_kwargs)\n # subclasses will generally want to call Client.munge_to_array()\n # on values before calling super()\n Cisco::Logger.debug(\"values: #{values})\") \\\n unless values.nil? || values.empty?\n # to be implemented by subclasses\n end", "def tvSetValue _args\n \"tvSetValue _args;\" \n end", "def set(fields)\n @set.call(fields)\n end", "def set(object, value); end", "def set_thread\n @thread = Threads.find(params[:id])\n end", "def set_vars args\n args.each do |arg,val|\n instance_variable_set \"@#{arg}\", val\n end\n\n args\n end", "def set_vars args\n args.each do |arg,val|\n instance_variable_set \"@#{arg}\", val\n end\n\n args\n end", "def set_thread_object\n @thread_object = ThreadObject.find(params[:id])\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set_ThreadIdentifier(value)\n set_input(\"ThreadIdentifier\", value)\n end", "def set(obj)\n @mutex.synchronize { @obj = obj }\n end", "def set_user_thread(user_id, user_thread)\n user_threads_lock.synchronize do\n user_threads[user_id] = user_thread\n end\n end", "def set=(value)\n @queue << \"set #{value}\"\n end", "def update!(**args)\n @set_values = args[:set_values] if args.key?(:set_values)\n @unset_values = args[:unset_values] if args.key?(:unset_values)\n end", "def _configure_locals( locals )\n return if locals.nil?\n\n locals.each do |k,v|\n Thread.current[:value] = v\n definition = \"#{k} = Thread.current[:value]\"\n eval(definition, get_binding)\n end\n end", "def update!(**args)\n @set_values = args[:set_values] if args.key?(:set_values)\n @unset_values = args[:unset_values] if args.key?(:unset_values)\n end", "def update!(**args)\n @set_values = args[:set_values] if args.key?(:set_values)\n @unset_values = args[:unset_values] if args.key?(:unset_values)\n end", "def setFSMVariable _obj, _args\n \"_obj setFSMVariable _args;\" \n end", "def setObjectArguments _obj, _args\n \"_obj setObjectArguments _args;\" \n end", "def threads=(int)\n if RUBY_ENGINE == 'jruby'\n @threads = int\n elsif int > 1\n puts \"########################################################\"\n puts \"# One thread has been measured best performing on MRI. #\"\n puts \"# Use JRuby for additional concurrency. #\"\n puts \"########################################################\"\n @threads = 1\n end\n end", "def set(values); end", "def set_values (type, time, x, y)\n\t\t@type=type\n\t\t@time=time\n\t\t@x=x\n\t\t@y=y\n\t\tself\n\tend", "def setVehicleLock _obj, _args\n \"_obj setVehicleLock _args;\" \n end", "def set_multiple(keys, values)\n @mutex.synchronize do\n raise \"Invalid size #{keys}=#{values}\" unless keys.size == values.size\n # pp keys,values\n keys.zip(values).each do |var, val|\n do_set(var,val) unless var.nil? or val.nil?\n end\n end\n end", "def thread_variable_set(key, value)\n _locals[key.to_sym] = value\n end", "def local=(ctx)\n Thread.current[@key] = ctx\n end", "def set(value)\n @mutex.synchronize { @value = value }\n end", "def set_all **kwargs\n kwargs.each { |name, value|\n set_var(name.to_s, value)\n }\n end", "def set=(_arg0); end", "def set!\n\t\t\t# This is actually fiber-local:\n\t\t\tThread.current[:async_task] = self\n\t\tend", "def setAttributes _obj, _args\n \"_obj setAttributes _args;\" \n end", "def set(value)\n @value = value\n time = Time.now\n @timestamp = time.to_i\n @timestamp_nsec = time.nsec\n @timestamp_tiebreaker = @tiebreaker\n end", "def priority=(value)\n unless SetThreadPriority(@thread, value)\n raise Error, get_last_error\n end\n end", "def set_arguments (args)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @thread_key = args[:thread_key] if args.key?(:thread_key)\n end", "def run()\n super() \n @@run_env[@name] = @value \n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n @values = args[:values] if args.key?(:values)\n end", "def timeouts_set=(_arg0); end", "def set(x, y)\n @x, @y = x, y\n end", "def assign_arguments(arguments)\n initial_arguments = @arguments\n initial_set_arguments = initial_arguments.assigned_arguments\n current_arguments = initial_set_arguments.dup\n\n # First assign normal values\n arguments.each do |key, value|\n @arguments = TaskArguments.new(self)\n @arguments.merge!(initial_set_arguments)\n assign_argument(key, value)\n current_arguments.merge!(@arguments) do |k, v1, v2|\n if v1 != v2\n raise ArgumentError, \"trying to override #{k}=#{v1} to #{v2}\"\n end\n v1\n end\n end\n initial_arguments.merge!(current_arguments)\n\n ensure\n @arguments = initial_arguments\n end", "def update!(**args)\n @run_duration = args[:run_duration] if args.key?(:run_duration)\n @state = args[:state] if args.key?(:state)\n @status_events = args[:status_events] if args.key?(:status_events)\n @task_groups = args[:task_groups] if args.key?(:task_groups)\n end", "def setFormationTask _obj, _args\n \"_obj setFormationTask _args;\" \n end", "def setTaskResult _obj, _args\n \"_obj setTaskResult _args;\" \n end", "def set_debugger_thread(thr)\n raise TypeError, \"Must be another Thread\" unless thr.kind_of?(Thread)\n\n @debugger_thread = thr\n end", "def thread_id=(value)\n @thread_id = value\n end", "def value=(val)\n mutex.lock\n @value = val\n ensure\n mutex.unlock\n end", "def lbSetData _obj, _args\n \"_obj lbSetData _args;\" \n end", "def set_thread_request\n LogUtils.request = request\n end", "def update!(**args)\n @cpu_time = args[:cpu_time] if args.key?(:cpu_time)\n @task_id = args[:task_id] if args.key?(:task_id)\n @wall_time = args[:wall_time] if args.key?(:wall_time)\n end", "def lnbSetValue _args\n \"lnbSetValue _args;\" \n end", "def assign(params) #:nodoc:\n params.each_pair do |key, value|\n self.send(\"#{key}=\", value) rescue self.instance_eval(\"@#{key}=value\") rescue next\n end\n end", "def thread_obj_params\n params.require(:thread_obj).permit(:thread_id, :value)\n end", "def set_ThreadLink(value)\n set_input(\"ThreadLink\", value)\n end", "def set_ThreadLink(value)\n set_input(\"ThreadLink\", value)\n end", "def set_ThreadLink(value)\n set_input(\"ThreadLink\", value)\n end", "def set_ThreadLink(value)\n set_input(\"ThreadLink\", value)\n end", "def set_ThreadLink(value)\n set_input(\"ThreadLink\", value)\n end" ]
[ "0.6643675", "0.6589539", "0.6589539", "0.6282379", "0.6186762", "0.6064623", "0.603919", "0.6023701", "0.59913737", "0.5866703", "0.58465093", "0.58465093", "0.58374023", "0.578899", "0.57770485", "0.5770627", "0.57376516", "0.5704353", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.56845194", "0.5678161", "0.56581914", "0.5648993", "0.56442124", "0.5537278", "0.55109465", "0.5510398", "0.5493377", "0.54865915", "0.5476394", "0.5472896", "0.545523", "0.5449072", "0.5449072", "0.5440665", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5440084", "0.5438001", "0.5405655", "0.54028803", "0.5388456", "0.5388182", "0.538774", "0.538774", "0.53817517", "0.53353053", "0.532887", "0.53033566", "0.5294972", "0.5288185", "0.5287084", "0.52835405", "0.52821887", "0.52752787", "0.5266266", "0.52649885", "0.52346134", "0.5232033", "0.52319056", "0.52244467", "0.52186745", "0.5197016", "0.5194152", "0.51838356", "0.5167581", "0.515941", "0.5154963", "0.5154807", "0.5143602", "0.51430273", "0.5139217", "0.5138594", "0.51373106", "0.5132698", "0.5094425", "0.50883514", "0.50880325", "0.50843066", "0.50816697", "0.5078396", "0.5078396", "0.5078396", "0.5078396", "0.5078396" ]
0.0
-1
Get the result for this query, executing it once
def result if @validate && validation_errors.any? return { "errors" => validation_errors } end @result ||= Executor.new(self, @operation_name).result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result\n\t\texecute unless @result\n\t\treturn @result\n\tend", "def get_data\n\t\texecute unless @result\n\t\treturn get_data_from_result(@result)\n\tend", "def result_for_query(query)\n results_for_query(query).first\n end", "def fetch\n @result = Result.new(data, :query => self)\n end", "def result\n results.first\n end", "def result\n return @result if defined?(@result)\n @search.populate_hits\n @result\n end", "def result\n meta.fetch(:result, :one)\n end", "def result\n results[0]\n end", "def result\n @result\n end", "def store_result()\n #This is a stub, used for indexing\n end", "def result\n @@result\n end", "def fetch\n\n caching_enabled = is_caching_enabled()\n if caching_enabled\n result = fetch_from_cache\n end\n\n if !caching_enabled || (caching_enabled && result == nil)\n db_return = query()\n\n result = make_result_object(db_return.columns.as_json, db_return.as_json)\n if caching_enabled\n store_in_cache result\n end\n end\n result\n end", "def result\n @result ||= run_collection_command_or_block\n end", "def results\n fetch unless @results\n @results\n end", "def result\n @result ||= calculate_result\n end", "def result\n @result ||= build\n end", "def result\n if not_already_loaded? && any_to_load?\n lazy_results.merge!(block_results)\n lazy_values.clear\n end\n lazy_results[value]\n end", "def result\n self\n end", "def result\n self\n end", "def execute\n yield ResultEnumerator.new(self)\n end", "def result \n @result\n end", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def result_set\n\t @result_set ||= plan.query_result_set(self)\n\tend", "def result\n\t\t@result\n\tend", "def next_result()\n #This is a stub, used for indexing\n end", "def results( id )\n if @db != nil\n\n end\n\n return nil\n end", "def get_result(key)\n r = results\n if r != nil\n return r.fetch(key, nil)\n end\n nil\n end", "def use_result\n store_result\n end", "def results\n send_query\n end", "def synchronize_resultset; end", "def result\n\n fields['__result__']\n end", "def result\n end", "def result\n if success?\n results = to_hash['results'] || []\n count == 1 ? results.first : results\n else\n []\n end\n end", "def getResult\n return @out\n end", "def execute\n results = ResultSet.new( @db, @statement.to_s )\n\n if block_given?\n begin\n yield results\n ensure\n results.close\n end\n else\n return results\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetDatabaseResultSet.new(resp)\n return results\n end", "def return_result_from_query?\n @this_val_where[:mode] == 'return_result'\n end", "def results\n send_query\n end", "def perform\n @result ||= Result.new(model, strategy, super)\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def result\n @result = yield\n end", "def query_return_first_value(sql, *binds)\n mysql.fetch(sql, *binds).single_value\n end", "def results\n @results ||= session.with(consistency: :strong).command(command)\n end", "def result_set\n klass.requestor.get(nil, { query: to_s })\n end", "def poll_result(id)\n query = get_query(id)\n get_query_result(query)\n end", "def fetch\n @raw_result = opts_for_cache_proxy[:raw] == true\n\n result = if refresh_cache?\n execute_find(@raw_result)\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n if cached.has_ids? && @raw_result\n self.cached # return it unmodified\n elsif cached.has_ids?\n fetch_from_cache # return a list of active records after applying options\n else # true if we have only calculated the count thus far\n execute_find(@raw_result)\n end\n else\n cached # some base type, return it unmodified\n end\n end", "def query\n return @query\n end", "def query\n return @query\n end", "def query\n return @query\n end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def query_result_set(query)\n\t result = ValueSet.new\n\t call(:query_result_set, query) do |marshalled_set|\n\t\tfor task in marshalled_set\n\t\t task = local_object(task)\n\t\t Distributed.keep.ref(task)\n\t\t result << task\n\t\tend\n\t end\n\n\t result\n\tend", "def get_operation_result\n @connection.get_operation_result\n end", "def finder_result\n @result ||= self.class.result_for(self.send(self.class.sharded_column))\n end", "def get_execution_result\n @result\n end", "def get_result(result_type) ; add_result(result_type, false) ; end", "def result\n data(\"result\")\n end", "def async_result()\n #This is a stub, used for indexing\n end", "def response\n @response ||= search.execute!\n end", "def query()\n\t\tval = self.client.sys.registry.query_value(self.hkey, self.name)\n\n\t\tif (val != nil)\n\t\t\tself.data = val.data\n\t\t\tself.type = val.type\n\t\tend\n\n\t\treturn self.data\n\tend", "def query\n print_banner\n @value = query_ask\n end", "def resultset\n @resultset ||= parse_resultset(stored_data)\n end", "def fetch\n @fetched_value\n end", "def result\n ActiveRecord::Base.connection.select_all(sql).entries\n end", "def set_result\n @result = Result.new\n end", "def first\n results.first\n end", "def process_result\n end", "def execute\n\t\tresult = execute_request(get_resultcount, @skip)\n\n\t\t@data_xml = result[0]\n\t\t@result = result[1]\n\t\treturn self\n\tend", "def results\n @results ||= with_hit.map(&:first)\n end", "def results\n @results ||= Results.new(self)\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GBDResultSet.new(resp)\n return results\n end", "def result\n query.modify(update, options)\n end", "def query(sql)\n if NB.neverblocking? && NB.reactor.running?\n send_query sql\n NB.wait(:read, IO.new(socket))\n get_result\n else\n super(sql)\n end\n end", "def get_result\n begin\n res_packet = ResultPacket.parse read\n if res_packet.field_count.to_i > 0 # result data exists\n set_state :FIELD\n return res_packet.field_count\n end\n if res_packet.field_count.nil? # LOAD DATA LOCAL INFILE\n send_local_file(res_packet.message)\n res_packet = ResultPacket.parse read\n end\n @affected_rows, @insert_id, @server_status, @warning_count, @message =\n res_packet.affected_rows, res_packet.insert_id, res_packet.server_status, res_packet.warning_count, res_packet.message\n set_state :READY\n return nil\n rescue\n set_state :READY\n raise\n end\n end", "def query(the_query, options = nil )\n raise Mysql2::Error, 2002 if @my.nil?\n\n # Default to returning values as an array, with no caching of previous results\n # This is consistent with ruby-mysql\n options ||= { as: :array, cache_rows: false }\n begin\n if @result != nil\n @result.free # Free any result we had left over from previous use.\n @result = nil\n end\n @affected_rows = 0 # incase this query crashes and burns, this will have a value.\n @result = @my.query(the_query, options)\n @affected_rows = @my.affected_rows # This is non-zero for select/insert/delete/update of rows\n if block_given?\n yield @result\n else\n return @result\n end\n rescue Mysql2::Error => e\n if @result != nil\n @result.free # Free any result we had left over from previous use.\n @result = nil\n end\n raise e\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = AvailableResultSet.new(resp)\n return results\n end", "def query\n return nil\n end", "def run(query:)\n Vidalia::log(\"SQL query text: \\\"#{query}\\\"\",:style => :debug)\n open_connection\n result = launch_query_command(query: query)\n if result.size > 0\n count = 1\n result.each do |r|\n Vidalia::log(\"SQL query result (#{count}): \\\"#{r.inspect}\\\"\",:style => :debug)\n count += 1\n end\n else\n Vidalia::log(\"SQL query: NO RESULTS FOUND\",:style => :debug)\n end\n rescue Exception => e\n raise e\n else\n return result\n ensure\n close_connection\n end", "def query(the_query)\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n begin\n if @result != nil\n @result.free # Free any result we had left over from previous use.\n @result = nil\n end\n @affected_rows = 0 # incase this query crashes and burns, this will have a value.\n @result = @my.query(the_query)\n @affected_rows = @my.affected_rows # This is non-zero for insert/delete/update of rows\n if block_given?\n yield @result\n else\n return @result\n end\n rescue Mysql::Error => e\n if @result != nil\n @result.free # Free any result we had left over from previous use.\n @result = nil\n end\n raise e\n end\n end", "def query_return_first(sql, *binds)\n mysql.fetch(sql, *binds).first\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetDocumentResultSet.new(resp)\n return results\n end", "def [](index)\n execute\n return @result[index]\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetContextResultSet.new(resp)\n return results\n end", "def prepare_result; end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def result\n operation.result\n end", "def query(query)\n result = queries([query])\n return result[query]\n end", "def fetch_row(sql)\n # Run the query\n results = query(sql)\n\n # Check result counts\n if results.count == 0\n check.critical(\"Expected to receive a single row, but result set is empty\", \"SQL: #{sql}\")\n end\n if results.count > 1\n check.critical(\"Expected to receive a single row, but result has #{results.count} lines\", \"SQL: #{sql}\")\n end\n\n # Get the first and only row\n return results.first\n end", "def apply_result\n return @apply_result\n end", "def get_one(query)\n res = get_all_by_query(query)\n return nil if res.length == 0\n res[0]\n end", "def single_result(results)\n result = results.first\n\n result.meta = results.meta\n\n result.linked_data = results.linked_data if results.respond_to? :linked_data\n\n return result\n end", "def next\n return nil unless next?\n ensure_service!\n gapi = service.job_query_results job_id, token: token\n QueryData.from_gapi gapi, service\n end", "def resultset; end", "def get_from_cache(query, ori_query, offset, sim)\n\t\t@results_cache[query].collect do |res|\n\t\t\tbuild_output(query, ori_query, res, sim, offset)\n\t\tend\n\tend", "def execute(input_set = nil)\n resp = super(input_set)\n results = GetUserResultSet.new(resp)\n return results\n end", "def response\n @response ||= begin\n Hashie::Mash.new(search.execute!)\n end\n end", "def result(uuid)\n @result[uuid]\n end", "def value(result)\n result\n end", "def query\n get_query_object\n end", "def result\n query_group.with_context do\n if primary.summarise?\n summary_result\n else\n simple_result\n end\n end\n end" ]
[ "0.7989895", "0.75469774", "0.73600304", "0.721126", "0.71226263", "0.6939527", "0.6915568", "0.6903006", "0.6810766", "0.67813563", "0.673584", "0.6719721", "0.67006934", "0.66852725", "0.6667897", "0.66523206", "0.6639016", "0.663607", "0.663607", "0.66189426", "0.66166306", "0.65993816", "0.6596898", "0.65919566", "0.65723044", "0.6558314", "0.64993685", "0.64893407", "0.6456558", "0.6448724", "0.64380616", "0.6420034", "0.6408845", "0.6407241", "0.6404342", "0.63695097", "0.6368161", "0.6359342", "0.63533264", "0.63437486", "0.63403934", "0.63350546", "0.63311577", "0.6328875", "0.6321854", "0.63094646", "0.6307611", "0.62824583", "0.62824583", "0.62824583", "0.6276036", "0.6274461", "0.6248501", "0.62349874", "0.62084556", "0.6206048", "0.61975217", "0.6190993", "0.6190342", "0.61891377", "0.617402", "0.61695296", "0.6154842", "0.6131838", "0.6116381", "0.6109435", "0.60981673", "0.6091199", "0.60462993", "0.6044663", "0.6022137", "0.60208845", "0.6016193", "0.60065156", "0.59975445", "0.5988886", "0.59870964", "0.59723943", "0.59591293", "0.5956458", "0.59548557", "0.59332526", "0.5932156", "0.5931068", "0.5929222", "0.59288317", "0.59281117", "0.5917604", "0.5917261", "0.591663", "0.59076506", "0.5901317", "0.58971167", "0.58884174", "0.58856684", "0.58724505", "0.5868525", "0.5867068", "0.58601993", "0.5858823", "0.58586144" ]
0.0
-1
Run will validate all inputs; returning on input failures, resolving declared dependencies, then delegate to the handlers call method with its valid inputs and resolved dependencies. Finally it ensure every response is a Response object.
def run(inputs = {}, container = Dry::Container.new) response = resolve_inputs(inputs) return response if response.failure? valid_inputs = response.ok resolve_dependencies(container) handler = self.new(container) result = handler.call(valid_inputs) result = create_response(result) unless response?(result) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute!\n validate_request!\n\n build_response!\n end", "def run\n @response ||= build_response catch_halt{ @handler.run }\n end", "def run\n response = nil\n @error_procs.each do |error_proc|\n result = nil\n begin\n result = error_proc.call(@exception, @context)\n rescue *STANDARD_ERROR_CLASSES => proc_exception\n @exception = proc_exception\n end\n response ||= response_from_proc(result)\n end\n response || response_from_exception(@exception)\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def run!\n before_run\n\n HANDLER_CALLS.each { |c|\n if (h = @handlers[c])\n send(c, *(h.opts)) do |obj|\n h.call(obj)\n end\n end\n }\n\n after_run\n end", "def run!\n before_run\n\n HANDLER_CALLS.each { |c|\n if (h = @handlers[c])\n send(c, *(h.opts)) do |obj|\n h.call(obj)\n end\n end\n }\n\n after_run\n end", "def perform\n\n r = validate\n return r unless r.success?\n\n process_hook\n\n end", "def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_sub_env_payloads\n return r unless r.success?\n\n success_with_data(\n {\n manager: @manager,\n client: @client,\n client_manager: @client_manager,\n sub_env_payloads: @sub_env_payloads\n })\n\n end\n\n end", "def perform\n validate_data_from_requests\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_validation_hash_details\n return r unless r.success?\n\n r = create_secure_data_acccess_token\n return r unless r.success?\n\n r = send_mail\n return r unless r.success?\n\n success_with_data({manager_validation_hash_id: @manager_validation_hash[:id]})\n\n end\n\n end", "def run\n handlers.each do |info, handler|\n matches = matches_options?(info[:type], info[:regexp])\n break if matches && handler.call(options)\n end\n end", "def execute(params = {})\n ok, values = @signature.apply(params)\n if ok\n # validation is ok, merge params and continue\n [:success, @method.bind(controller.instance).call(params.merge!(values))]\n else\n # validation is ko\n [:\"validation-ko\", values]\n end\n rescue ::Waw::Validation::KO => ex\n [:\"validation-ko\", ex.failed]\n rescue ::Waw::Validation::Error => ex\n [:\"validation-error\", ex.failed]\n end", "def validate!\n return @valid if !@valid.nil? # only need to run this once per config\n\n # ensure all user and plugin configs are applied\n self.init_procs.each(&:call)\n raise Deas::ServerRootError if self.root.nil?\n\n # validate the router\n self.router.validate!\n\n # TODO: build final middleware stack when building the rack app, not here\n # (once Sinatra is removed)\n\n # prepend the method override middleware first. This ensures that the\n # it is run before any other middleware\n self.middlewares.unshift([Rack::MethodOverride]) if self.method_override\n\n # append the show exceptions and logging middlewares next-to-last. This\n # ensures the logging and exception showing happens just before the\n # optional trailing slashes handling. It should be just before the app\n # gets the request and just after the app sends a response (except for\n # trailing slashes - this should happen inside of the show exceptions\n # and logging behavior).\n self.middlewares << [Deas::ShowExceptions] if self.show_exceptions\n self.middlewares << [\n Deas::Logging.middleware_type(self.verbose_logging),\n self.logger\n ]\n\n # optionally add the trailing slashes middleware last b/c it should\n # happen inside of show exceptions and logging. we want the behavior\n # to feel like app behavior to the rest of the middleware stack so it\n # needs to be just before the app gest the request and just after the\n # app sends a response.\n if self.router.trailing_slashes_set?\n self.middlewares << [Deas::TrailingSlashes, self.router]\n end\n\n self.middlewares.freeze\n\n @valid = true # if it made it this far, its valid!\n end", "def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n @validated = true\n end\n end", "def handler_request!\n response = Core::HandlerResponse.new(\n @req.body,\n @req.code,\n @req.header.to_hash.inspect\n )\n populate_properties! if response.request_successful? && check_request\n end", "def run(request)\n @request = request\n @response = request.response\n validate\n extract\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = set_parts\n return r unless r.success?\n\n r = validate_token\n return r unless r.success?\n\n r = fetch_client\n return r unless r.success?\n\n r = validate_client_manager\n return r unless r.success?\n\n r = set_extended_cookie_value\n return r unless r.success?\n\n success_with_data(\n extended_cookie_value: @extended_cookie_value,\n manager_id: @manager_id,\n manager_device_id: @manager_device_id,\n manager_device: @manager_device,\n manager: @manager,\n client_id: @manager[:current_client_id],\n client: @client,\n client_manager: @client_manager\n )\n\n end\n\n end", "def run!\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n end", "def call env\n return @app.call(env) unless env['rails3amf.response']\n\n # Handle each method call\n req = env['rails3amf.request']\n res = env['rails3amf.response']\n res.each_method_call req do |method, args|\n begin\n handle_method method, args, env\n rescue Exception => e\n # Log and re-raise exception\n @logger.error e.to_s+\"\\n\"+e.backtrace.join(\"\\n\")\n raise e\n end\n end\n end", "def run\n @cluster.retriable(api_name) do\n process(retriable_requests)\n\n # Stop retrying when there are no more requests to retry\n retriable_requests.empty?\n end\n\n responses\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_client_manager\n return r unless r.success?\n\n r = validate_invitee_manager_exists\n return r unless r.success?\n\n r = create_invite_token\n return r unless r.success?\n\n r = enqueue_job\n return r unless r.success?\n\n success\n\n end\n\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_manager_device\n return r unless r.success?\n\n r = create_device_verification_token\n return r unless r.success?\n\n r = send_device_verification_token\n return r unless r.success?\n\n success\n\n end\n\n end", "def call(path)\n log(path)\n\n catch(:respond) {\n body = Controller.handle(path)\n Response.current.build(body)\n }\n\n FILTER.each{|f| f.call(response)}\n response\n rescue Ramaze::Error => ex\n ex\n end", "def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.dispatch_hashset!\n \n # dispatches orders\n self.dispatch_orders!\n \n # dispatches messages\n self.handle_messages!\n \n end", "def execute(merge_requests: [])\n validate_merge_requests(merge_requests)\n\n [@valid, @invalid]\n end", "def handler\n Proc.new do |response|\n case response.code\n when 200..204\n response\n when 400\n raise Jiralicious::TransitionError.new(response.inspect)\n when 404\n raise Jiralicious::IssueNotFound.new(response.inspect)\n else\n raise Jiralicious::JiraError.new(response.inspect)\n end\n end\n end", "def call(env)\n validate(env)\n @app.call(env)\n rescue ValidateError => ex\n unprocessable_response(ex)\n end", "def dispatch(method, retype, args)\n result = self.send(\"handle_#{method}\".to_sym, args)\n result_key = Chassis.exit_after_current_dispatch ? :last_result : :result\n case retype\n when :json\n [result_key, [:raw, result.to_json]]\n when :pure\n [result_key, result]\n else\n raise \"Unknown response type: #{retype}\"\n end\n rescue Exception => e\n if e.instance_of?(SystemExit)\n exit\n elsif Chassis.exception_handler\n begin\n Chassis.exception_handler.call(e)\n rescue Exception => e2\n [:error, e2.message + \"\\n\\n\" + e2.backtrace.join(\"\\n\")]\n end\n else\n [:error, e.message + \"\\n\\n\" + e.backtrace.join(\"\\n\")]\n end\n end", "def execute\n @responses = {succeeded: [], failed: [], pending: [], succeeded_by_id: {}, requests_by_id: {}}\n @start = Time.now\n EventMachine.run do\n requests.each do |request|\n @responses[:pending] << request.process!\n if request.id\n @responses[:requests_by_id][request.id] = request\n end\n end\n\n EM::PeriodicTimer.new(0.001) do\n process_requests\n end\n end\n @responses\n end", "def call(env)\n request = Rack::Request.new(env)\n raise_exception(400) unless valid_verb?(request.request_method)\n recognize(request).each do |route, params|\n catch(:pass){ return invoke(route, params) }\n end\n rescue BadRequest, NotFound, MethodNotAllowed\n $!.call\n end", "def run(&callback)\n @serializer.run do |msg|\n debug(\"received #{msg.inspect}\")\n kind, *payload = msg\n\n case kind\n when 0\n handle_request(payload, callback)\n when 1\n handle_response(payload)\n when 2\n handle_notification(payload, callback)\n end\n end\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = fetch_logged_in_manager\n return r unless r.success?\n\n if @a_t.blank?\n\n return success_with_data({manager: @manager_obj.formatted_cache_data}) if is_logged_in_manager?\n\n return success_with_data({}, fetch_go_to)\n end\n\n r = validate_and_sanitize\n return r unless r.success?\n \n r = fetch_manager_validation_record\n return r unless r.success?\n\n r = validate_sda_token\n return r unless r.success?\n\n r = update_manager_validation_hashes_status\n return r unless r.success?\n\n if is_logged_in_manager?\n success_with_data({}, fetch_go_to)\n else\n success_with_data({})\n end\n \n end\n\n end", "def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end", "def call\n @s2cgi_page_id = self.generate_page_id\n @cgi ||= ::CGI.new\n @validate = Seasar::Validate::Context.new\n @headers = {}\n @contents = ''\n @auto_render = true\n @auto_response = true\n @tpl_stack = []\n\n raise \"unsupport request method. [#{@cgi.request_method}]\" unless ACCEPTABLE_METHODS.member?(@cgi.request_method.to_sym)\n\n self.init\n\n method_name = @cgi.request_method.downcase.to_sym\n validate_method_name = \"validate_#{method_name}\"\n\n validate_result = true\n validators = @@validators[self.class].nil? ? {} : @@validators[self.class]\n if validators.key?(:all)\n validate_result = self.instance_eval(&validators[:all])\n end\n\n if validate_result == true\n if validators.key?(method_name)\n validate_result = self.instance_eval(&validators[method_name])\n elsif self.respond_to?(validate_method_name)\n validate_result = self.method(validate_method_name).call\n end\n if validate_result == true && self.respond_to?(method_name)\n self.method(method_name).call\n end\n end\n render if @auto_render && @contents.size == 0\n if @auto_response\n self.out\n end\n end", "def run\n @run_mutex.synchronize do\n fail 'cannot run without registering services' if rpc_descs.size.zero?\n @server.start\n transition_running_state(:running)\n @run_cond.broadcast\n end\n loop_handle_server_calls\n end", "def perform\n\n begin\n\n # acquire lock and fetch the locked hooks\n fetch_hooks_to_be_processed\n\n # Process these Hooks\n process_hooks\n\n # Mark Hooks as processed\n update_status_to_processed\n\n rescue StandardError => se\n\n @hooks_to_be_processed.each do |hook|\n hook_id = hook.id\n # Skip if we already know that his hook was processed or failed\n next if @success_responses[hook_id].present? ||\n @failed_hook_to_be_ignored[hook_id].present? ||\n @failed_hook_to_be_retried[hook_id].present?\n @failed_hook_to_be_retried[hook_id] = {\n exception: {message: se.message, trace: se.backtrace}\n }\n end\n\n ensure\n\n # For hooks which failed, mark them as failed\n release_lock_and_update_status_for_non_processed_hooks\n\n # Notify Devs in case on Errors\n notify_devs\n\n success_with_data(processor_response)\n\n end\n\n end", "def handle( request )\n\t\tresponse = nil\n\n\t\t# Dispatch the request after allowing plugins to to their thing\n\t\tstatus_info = catch( :finish ) do\n\t\t\tself.log.debug \"Starting dispatch of request %p\" % [ request ]\n\n\t\t\t# Run fixup hooks on the request\n\t\t\trequest = self.fixup_request( request )\n\t\t\tself.log.debug \" done with request fixup\"\n\t\t\tresponse = self.handle_request( request )\n\t\t\tself.log.debug \" done with handler\"\n\t\t\tresponse = self.fixup_response( response )\n\t\t\tself.log.debug \" done with response fixup\"\n\n\t\t\tnil # rvalue for the catch\n\t\tend\n\n\t\t# Status response\n\t\tif status_info\n\t\t\tself.log.debug \"Preparing a status response: %p\" % [ status_info ]\n\t\t\treturn self.prepare_status_response( request, status_info )\n\t\tend\n\n\t\treturn response\n\trescue => err\n\t\tself.log.error \"%s: %s %s\" % [ err.class.name, err.message, err.backtrace.first ]\n\t\terr.backtrace[ 1..-1 ].each {|frame| self.log.debug(' ' + frame) }\n\n\t\tstatus_info = { :status => HTTP::SERVER_ERROR, :message => 'internal server error' }\n\t\treturn self.prepare_status_response( request, status_info )\n\tend", "def perform\n\n r = validate_and_sanitize\n return r unless r.success?\n\n fetch_records\n\n set_api_response_data\n\n success_with_data(@api_response_data)\n end", "def control\n @responses = build_params.map { |request_params| lookup(request_params) }\n end", "def call\n begin\n yield && result.success!\n rescue => e\n Rails.logger.info \"Error when execute service #{e.inspect}\"\n result.failed!\n end\n end", "def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n fetch_valid_test_events\n\n return error_with_identifier('could_not_proceed',\n 'cm_ws_t_p_1', [],\n 'There are no events for the applied filters') if @valid_events.values.length == 0\n\n enqueue_events\n\n success_with_data(service_response_data)\n end", "def call\n @called = true\n handleResponse @stubs\n end", "def call env #:nodoc:\n return @app.call(env) unless should_handle?(env)\n\n # Wrap request and response\n env['rack.input'].rewind\n env['rack-amf.request'] = RocketAMF::Envelope.new.populate_from_stream(env['rack.input'].read)\n env['rack-amf.response'] = RocketAMF::Envelope.new\n\n # Call handle on \"inheriting\" class\n handle env\n\n # Calculate length and return response\n response = env['rack-amf.response'].to_s\n [200, {\"Content-Type\" => APPLICATION_AMF, 'Content-Length' => response.length.to_s}, [response]]\n end", "def run_error_checks\r\n @error_checkers.each { |e| e.call(self) }\r\n end", "def call!\n # Get all adapters, inclusive of the ones listed above, and iterate\n # over them.\n configured_adapters.each do |adapter|\n # Instantiate a new instance of the adapter given the current data.\n a = adapter.new(@data, options)\n\n # If this particular adapter has a +finalize+ method (see below),\n # keep a record of its existence so we can call it later.\n @_finalize_adapters << adapter if a.respond_to?(:finalize)\n\n # Call the +call+ method in order to manipulate the response.\n @data = a.call\n end\n\n # Return the final response.\n @data\n end", "def process\n\t\t\tunless @fiber.alive? and @running\n\t\t\t\t# if the fiber has completed, then we succeeded\n\t\t\t\tself.succeed()\n\t\t\t\treturn\n\t\t\tend\n\t\t\t\n\t\t\t# do another run\n\t\t\trequest = @testreq.toRequest\n\t\t\trequest.errback { |r| self.handleResponse(r) }\n\t\t\trequest.callback { |r| self.handleResponse(r) }\n\t\tend", "def process\n klass.new(request).process\n end", "def execute!\n stack = InternalMiddleware.batch_stack(self)\n format_response(stack.call(middleware_env))\n end", "def perform!\n options_key = request_method == :get ? :query : :form\n resp = self.class.public_send(request_method, uri.to_s,{ options_key => options })\n Response.new(api_key, resp.code, resp.body, resp.parsed_response,\n resp.headers).validate!\n end", "def invoke\n res = catch(:halt) { yield }\n res = [res] if Fixnum === res || String === res\n if Array === res && Fixnum === res.first\n res = res.dup\n status(res.shift)\n body(res.pop)\n headers(*res)\n elsif res.respond_to? :each\n body res\n end\n nil # avoid double setting the same response tuple twice\n end", "def run inputs = {}\n inputs.merge!(self.options)\n output_inputs(inputs)\n run_step_names = run_steps inputs\n puts \"running steps: #{run_step_names.join(\", \")}\"\n missing = missing_step_inputs inputs\n unless missing.empty?\n output_missing(missing)\n return\n end\n results = []\n @steps.each do |step|\n puts \"step: #{step.name}\"\n step_output = step.outputs_given inputs\n if run_step_names.include? step.name\n results << step.call_run_block(inputs,step_output)\n inputs.merge! step_output\n else\n inputs.merge! step_output\n end\n end\n results\n end", "def execute(inputs)\n inject(inputs) do |obj, middleware|\n middleware.call(*obj)\n end\n end", "def validate\n errors.clear\n self.class.validator.invoke self\n end", "def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end", "def call(env)\n request = Rack::Request.new env\n\n return @app.call env unless request.path_info == @path\n\n begin\n timeout @max do\n results = {}\n\n @checks.values.each do |check|\n begin\n timeout check.timeout do\n results[check.name] = check.call\n end\n rescue StandardError => e\n results[check.name] = e\n end\n end\n\n failed = results.values.any? { |v| failure? v }\n http_status = failed ? 503 : 200\n text_status = failed ? \"failures\" : \"ok\"\n\n data = {\n :now => Time.now.to_i.to_s,\n :status => text_status\n }\n\n results.each do |name, value|\n\n # The unnnamed/default check doesn't contribute data.\n next if name.nil?\n\n if failure? value\n\n # If a check fails its name is added to a `failures` array.\n # If the check failed because it timed out, its name is\n # added to a `timeouts` array instead.\n\n key = timeout?(value) ? :timeouts : :failures\n (data[key] ||= []) << name\n\n elsif value\n\n # If the check passed and returned a value, the stringified\n # version of the value is returned under the `name` key.\n\n data[name] = value.to_s\n end\n end\n\n [http_status, HEADERS.dup, [JSON.generate(data)]]\n end\n\n rescue Exception => ex\n\n # Something catastrophic happened. We can't even run the checks\n # and render a JSON response. Fall back on a pre-rendered string\n # and interpolate the current epoch time.\n\n now = Time.now.to_i.to_s\n [500, HEADERS.dup, ['{\"status\":\"failures\",\"now\":\"' + now + '\"}']]\n end\n end", "def set_automated_validation\n (self.methods - Object.methods).each do |method|\n params_index = method(method).parameters.map{|ar| ar[1]}.index(:params)\n body_index = method(method).parameters.map{|ar| ar[1]}.index(:body)\n\n define_singleton_method(method) do |*args, &block|\n validate Docker::API::InvalidParameter, Docker::API::VALID_PARAMS[\"#{self.class.name}\"][\"#{method}\"], (args[params_index] || {}) if params_index\n validate Docker::API::InvalidRequestBody, Docker::API::VALID_BODY[\"#{self.class.name}\"][\"#{method}\"], (args[body_index] || {}) if body_index\n super(*args,&block)\n end\n end\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = fetch_token_details\n return r unless r.success?\n\n r = fetch_sub_env_payloads\n return r unless r.success?\n\n r = fetch_goto\n return r unless r.success?\n \n r = fetch_default_price_points\n return r unless r.success?\n\n r = fetch_stake_currency_details\n return r unless r.success?\n\n @sign_message = {\n wallet_association: GlobalConstant::MessageToSign.wallet_association\n }\n\n api_response_data = {\n token: @token,\n sign_messages: @sign_message,\n client_manager: @client_manager,\n manager: @manager,\n price_points: @price_points,\n sub_env_payloads: @sub_env_payload_data,\n all_stake_currencies: @all_stake_currencies\n }\n\n if @token[:stake_currency_id].present?\n api_response_data[:stake_currencies] = @stake_currencies\n end\n\n success_with_data(api_response_data)\n\n end\n\n end", "def run\n log.info(\"Running...\")\n result = run_internal()\n log.info(\"Success! #{result.message}\")\n return result\n end", "def results\n return error if error?\n response if response?\n end", "def call(env)\n @s2cgi_page_id = self.generate_page_id\n @page_id = @s2cgi_page_id\n @env = env\n self.request = ::Rack::Request.new(env)\n self.response = ::Rack::Response.new\n @validate = Seasar::Validate::Context.new\n @tpl_stack = []\n @auto_render = true\n\n unless ::Rack::MethodOverride::HTTP_METHODS.member?(@request.request_method)\n raise \"unsupport request method. [#{@env['rack.methodoverride.original_method']} -> #{@request.request_method}]\"\n end\n\n self.init\n method_name = @request.request_method.downcase.to_sym\n validate_method_name = \"validate_#{method_name}\"\n\n validate_result = true\n validators = @@validators[self.class].nil? ? {} : @@validators[self.class]\n if validators.key?(:all)\n validate_result = self.instance_eval(&validators[:all])\n end\n\n if validate_result == true\n if validators.key?(method_name)\n validate_result = self.instance_eval(&validators[method_name])\n elsif self.respond_to?(validate_method_name)\n validate_result = self.method(validate_method_name).call\n end\n if validate_result == true && self.respond_to?(method_name)\n self.method(method_name).call\n end\n end\n\n render if @auto_render && @response.body.size == 0 && @response.status == 200\n return self.out\n end", "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex\n raise CityGridExceptions::RequestError.new req_for_airbrake, ex\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response\n # catch responses not in new response format\n elsif response[\"errors\"]\n #pp \"[gem] An error in the old response format was caught. Raising a general response error...\"\n raise CityGridExceptions::ResponseError.new req_for_airbrake, response[\"errors\"], response\n\n # Parse and handle new response codes \n elsif (response[\"response\"] && response[\"response\"][\"code\"] != \"SUCCESS\") && \n (response[\"response\"] && response[\"response\"][\"code\"] != 200) && \n (response[\"response\"] && response[\"response\"][\"code\"] != 400) \n error_code = response[\"response\"][\"code\"]\n #pp \"[gem] The response was contained in the first level of the response hash. Below:\"\n #pp response\n #pp \"found error code: #{error_code}\"\n #pp \"****************************************************************************\"\n raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response[\"response\"][\"message\"].to_s #+ \" \" + CityGridExceptions.print_superclasses(error_code)\n # if the response is a nested hash/nested hash containing arrays\n elsif response[\"totalNumEntries\"] && response[\"response\"].nil?\n #pp \"[gem] now parsing a response with multiple entries: #{response}\"\n error_code = parse_multiple_responses(response)\n #pp \"the error code that came back is #{error_code}\"\n if error_code.nil? || error_code == []\n #pp \"[gem] passing over this for now\"\n return CityGrid::API::Response.new response # pass over for now\n elsif error_code[0] == \"SUCCESS\" || error_code[0] == 200 || error_code[0] == 400\n return CityGrid::API::Response.new response\n else \n #pp \"[gem] we found an error and it was #{error_code[1]}\"\n raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + \" \"# + CityGridExceptions.print_superclasses(error_code[0])\n end\n else\n return CityGrid::API::Response.new response\n end\n rescue => ex\n pp \"The gem threw an error: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate_and_sanitize\n return r unless r.success?\n\n r = fetch_client_manager\n return r unless r.success?\n\n r = fetch_manager_to_be_updated\n return r unless r.success?\n\n r = validate_client_manager_privilege\n return r unless r.success?\n\n r = update_client_manager\n return r unless r.success?\n\n success_with_data({\n result_type: result_type,\n result_type => [\n @to_update_client_manager.formatted_cache_data\n ],\n managers: {\n @manager_to_be_updated_obj.id => @manager_to_be_updated_obj.formatted_cache_data\n }\n })\n\n end\n\n end", "def handle\n runner = Runner.build(contents)\n runner.run\n self.result = runner.result\n save\n end", "def send\n if valid_input?\n @service.send\n @errors = @service.errors if @service.errors.present?\n end\n end", "def response!\n return response if !response.errors?\n\n raise response.to_exception\n end", "def callback_phase\n raw_response = request.params.symbolize_keys[:SAMLResponse]\n raise OneLogin::RubySaml::ValidationError.new(\"SAML response missing\") unless raw_response\n\n with_settings do |settings|\n # Handle the response.\n handle_response(raw_response, settings) do\n # yield the response to the omniauth controller.\n super\n end\n end\n rescue OneLogin::RubySaml::ValidationError\n fail!(:invalid_response, $!)\n end", "def run\n case\n when settings['pipe']\n process_pipe\n when settings.rest.size > 0\n settings.rest.each do |path|\n process_file(path)\n end\n else\n process_stdin\n end\n exit(0)\n end", "def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end", "def execute()\n\n error_handling = @parameters[\"error_handling\"]\n error_message = nil\n entry_id = nil\n\n # If preinitialize fail then stop execution and rasie or return error\n if (@error.to_s.empty?)\n begin\n # Create the entry using the ArsModels form setup the first time this\n # handler is executed. The :field_values parameter takes a Hash of field\n # names to value mappings (which was built in the #initialize method). The\n # :fields parameter is an optional Array of field values to return with the\n # entry. By default (when the :fields parameter is omitted), all field\n # values are returned. For large forms, the performance gained by\n # specifying a smaller subset of fields can be significant.\n \t@field_values = JSON.parse(@parameters['field_values'])\n \tputs(format_hash(\"Field Values:\", @field_values)) if @debug_logging_enabled\n\n entry = get_remedy_form(@parameters['form']).create_entry!(\n :field_values => @field_values,\n :fields => []\n )\n\n entry_id = entry.id\n rescue Exception => error\n error_message = error.inspect\n raise error if error_handling == \"Raise Error\"\n end\n else\n error_message = @error\n raise @error if error_handling == \"Raise Error\"\n end\n\n # Return the results\n <<-RESULTS\n <results>\n <result name=\"Handler Error Message\">#{escape(error_message)}</result>\n <result name=\"Entry Id\">#{escape(entry_id)}</result>\n </results>\n RESULTS\n end", "def dispatch_responders\n self.full_response, self.responder_ids = try_responding_in_full\n end", "def run(req, res)\n end", "def process\n raise RequestValidationError unless validate\n\n @roles = get_roles\n @user = get_or_create_user\n @resource = get_resource\n @assignment = get_assignment\n @space = get_space\n @space_user = get_or_create_space_user\n\n register\n self\n end", "def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end", "def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n create_email_service_api_call_hook\n\n success\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate_and_sanitize\n return r unless r.success?\n\n r = fetch_staking_currency_id\n return r unless r.success?\n\n r = insert_update_token_details\n return r unless r.success?\n\n r = delete_old_addresses\n return r unless r.success?\n\n r = create_api_credentials\n return r unless r.success?\n\n r = fetch_token_details\n return r unless r.success?\n\n r = fetch_stake_currency_details\n return r unless r.success?\n\n success_with_data({\n token: @token,\n stake_currencies: @stake_currencies\n })\n\n end\n\n end", "def run\n checks.each(&:run)\n end", "def call(medicare_request)\n request_xml = yield convert_to_xml(medicare_request)\n _validation_result = yield validate_xml(request_xml)\n Success(request_xml)\n end", "def execute_api_calls_and_evalute_responses\n apple_store_response.valid? ? evaluate_apple_lookup_api_call : apple_store_response.error\n end", "def call(env)\n env[\"rack.errors\"] = StringIO.new # Send Rack errors nowhere fast!\n begin\n setup(env)\n begin\n route = Mack::Routes.retrieve(self.request)\n if route[:redirect_to]\n # because the route is specified to be a redirect, let's do that:\n redirect_to(route)\n else\n # set these in case we need them for handling errors:\n @original_controller = route[:controller]\n @original_action = route[:action]\n run_controller(route)\n end\n # return teardown\n rescue Exception => e\n # There was an exception, let's see if there's a handler for this error in routes:\n route = Mack::Routes.retrieve_from_error(e.class)\n unless route.nil?\n self.request.params[:original_controller] = @original_controller\n self.request.params[:original_action] = @original_action\n # There is a handler, let's try running that:\n run_controller(route, e)\n else\n # If we can't find the resource, or there's no route, let's check the public directory:\n case e\n when Mack::Errors::ResourceNotFound, Mack::Errors::UndefinedRoute\n return try_to_find_resource(env, e)\n else\n # Re-raise the exception\n raise e\n end\n end\n # return teardown\n end\n # Capture all the Exceptions for this call:\n rescue Exception => e\n Mack.logger.error e\n case e\n when Mack::Errors::ResourceNotFound, Mack::Errors::UndefinedRoute\n handle_error(404, 'Page Not Found!', e)\n # If it's any other type of exception render the 500.html page:\n else\n handle_error(500, 'Server Error!', e)\n end\n # return teardown\n ensure\n teardown\n end\n return self.response.finish\n end", "def results\n return error if error?\n return response if response?\n end", "def execute(options = {})\n \n ah = argument_hash.clone\n ah.store(:data, data) if data\n\n begin\n unless class_name.classify.constantize.send(method_name.to_sym, ah)\n self.status = STATUS_ERROR\n self.error_message = \"called method returned false\"\n end\n rescue Exception => e\n self.status = STATUS_ERROR\n self.error_message = \"class or method does not exist\" + e.to_s\n end\n \n # If we have an error, do not run anything in this group (halt the chain)\n if error?\n self.status = STATUS_SKIPPED if skip_on_error\n else\n self.status = STATUS_COMPLETED\n self.data = nil unless !!options[:keep_data]\n end\n end", "def run\n event_list = @next_events\n @next_events = []\n\n handlers = @handlers.select { |o| group_enabled?(o.group) }\n\n event_list.each do |ev|\n handlers.each { |o| o.call(ev) if o.match?(ev) }\n end\n end", "def perform\n r = validate\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n r = fetch_and_validate_admin\n return r unless r.success?\n\n fetch_admins\n\n set_api_response_data\n\n success_with_data(@api_response_data)\n end", "def call(env)\n notify_request_handlers(env)\n request = env.dup\n app.call(env).on_complete do |env|\n notify_response_handlers(request, env)\n end\n end", "def call( env )\n resource_request = RESTRack::ResourceRequest.new( :request => Rack::Request.new(env) )\n unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:PRE_PROCESSOR_DISABLED) and RESTRack::CONFIG[:PRE_PROCESSOR_DISABLED])\n @request_hook.pre_processor(resource_request)\n end\n response = RESTRack::Response.new(resource_request)\n unless resource_request.requires_async_defer\n unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:POST_PROCESSOR_DISABLED) and RESTRack::CONFIG[:POST_PROCESSOR_DISABLED])\n @request_hook.post_processor(response)\n end\n env['async.callback'].call response.output\n end\n AsyncResponse\n end", "def process(*args)\n req = Request.create self, *args\n req.apply\n req\n end", "def run\n evaluate_checks if @config.key?('checks')\n evaluate_custom if @config.key?('custom')\n evaluate_and_dispatch_events\n end", "def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end", "def call env\n return @app.call(env) unless should_handle?(env)\n\n # Wrap request and response\n env['rack.input'].rewind\n env['rails3amf.request'] = RocketAMF::Envelope.new.populate_from_stream(env['rack.input'].read)\n env['rails3amf.response'] = RocketAMF::Envelope.new\n\n # Pass up the chain to the request processor, or whatever is layered in between\n result = @app.call(env)\n\n # Calculate length and return response\n if env['rails3amf.response'].constructed?\n @logger.info \"Sending back AMF\"\n begin\n response = env['rails3amf.response'].to_s\n rescue Exception => e\n File.open('systemstackerror.log', 'a') do |file|\n file.write(\"\\n\\n\\nError occurred at #{Time.now}\")\n file.write(\"\\n\\n#{e.inspect}\")\n file.write(\"\\n\\nAMF Version: #{env['rails3amf.response'].amf_version}\".force_encoding(\"UTF-8\"))\n file.write(\"\\n\\nHeaders: #{env['rails3amf.response'].headers}\".force_encoding(\"UTF-8\"))\n file.write(\"\\n\\nMessages: #{env['rails3amf.response'].messages}\".force_encoding(\"UTF-8\"))\n file.write(\"\\n\\nrequest: #{env['rails3amf.request'].inspect}\".force_encoding(\"UTF-8\"))\n file.write(\"\\n\\nresponse: #{env['rails3amf.response'].inspect}\".force_encoding(\"UTF-8\"))\n end\n\n raise e\n end\n\n @logger.info \"Responding\"\n return [200, {\"Content-Type\" => Mime::AMF.to_s, 'Content-Length' => response.length.to_s}, [response]]\n else\n return result\n end\n end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate_and_sanitize\n return r unless r.success?\n\n r = fetch_and_set_token_id\n return r unless r.success?\n\n r = direct_request_to_saas_api\n return r unless r.success?\n\n success_with_data(@api_response_data)\n\n end\n end", "def execute_handlers\n @@handlers.each { |handler| handler.execute }\n end", "def call(env, *args)\n\n hook_into_callback_chain(env, *args)\n\n downstream_resp = @app.call(env)\n\n if final_response?(downstream_resp)\n status, headers, body = downstream_resp\n post_process(env, status, headers, body, *args)\n else\n return Goliath::Connection::AsyncResponse\n end\n end", "def start\n receive(IO.new(3), IO.new(4)) do |f|\n f.when([:call, Array]) do |args|\n method = args[0]\n retype = args[1]\n args = args[2..-1]\n f.send! self.dispatch(method, retype, args)\n exit if Chassis.exit_after_current_dispatch\n f.receive_loop\n end\n \n f.when(:config) do\n f.send! [:result, self.config]\n f.receive_loop\n end\n \n f.when(:api) do\n f.send! [:result, self.api]\n f.receive_loop\n end\n \n f.when(:ping) do\n f.send! :pong\n f.receive_loop\n end\n \n f.when(:quit) do\n exit(0)\n end\n end\n end", "def call\n catch(:abort) do\n calculators.each do |calculator|\n my_result = catch(:invalid_inputs) do\n perform_calculation_using(calculator)\n end\n throw :abort, self if my_result.final_decision? || !my_result.valid?\n end\n end\n self\n end", "def call(env)\n aroundware = new_aroundware(env)\n\n aroundware_resp = aroundware.pre_process\n\n hook_into_callback_chain(env, aroundware)\n\n downstream_resp = @app.call(env)\n\n # if downstream resp is final, pass it to the aroundware; it will invoke\n # the callback chain at its leisure. Our response is *always* async.\n if final_response?(downstream_resp)\n aroundware.call(downstream_resp)\n end\n return Goliath::Connection::AsyncResponse\n end", "def run\n raise NotImplementedError, 'Services must implement #run'\n end", "def call(*params)\n new(:raise_on_invalid => true).run(*params).last\n end", "def proceed(raise_errors = true)\n # Empty requests?\n if requests.empty?\n if raise_errors\n fail ::ArgumentError, 'At least one message is required!'\n else\n return false\n end\n end\n\n # Headers\n options = { headers: batch_headers, url: self.class.batch_notification_url, method: :post }\n\n # Create array!\n options[:payload] = { channels: requests.map { |i| i.to_json(true)[:payload] } }.to_json\n\n # Send\n RestClient::Request.execute(options) do |response, request, result, &block|\n begin\n case response.code\n when 200, 201\n Response::Batch.new response, options\n when 301, 302, 307\n response.follow_redirection(request, result, &block)\n when 400\n fail Error::InvalidAttributes, response\n when 401\n fail Error::UnauthorizedRequest, response\n when 404\n fail Error::ChannelNotFound, response\n else\n fail Error::InvalidReturn, response\n end\n rescue => e\n if raise_errors\n raise e\n else\n false\n end\n end\n end # RestClient\n end" ]
[ "0.6401441", "0.6194236", "0.5995736", "0.5994623", "0.59863234", "0.5978597", "0.5978597", "0.5967187", "0.554513", "0.5527933", "0.54612654", "0.5442071", "0.5414022", "0.5346584", "0.53319234", "0.5307139", "0.5282684", "0.52293", "0.52106726", "0.51954174", "0.5194625", "0.5189114", "0.5188464", "0.51840943", "0.51793915", "0.517845", "0.51738614", "0.5170519", "0.5168999", "0.5164705", "0.51421744", "0.5139578", "0.5134033", "0.51242816", "0.51218814", "0.5118936", "0.5107999", "0.5107139", "0.51045316", "0.5104456", "0.50922644", "0.50750273", "0.50695026", "0.5061888", "0.5049683", "0.5041942", "0.5022761", "0.5014048", "0.50085425", "0.5005634", "0.5001751", "0.49849316", "0.49809024", "0.49785715", "0.49774715", "0.49774247", "0.4975427", "0.49712956", "0.49702358", "0.49679917", "0.49642912", "0.4960289", "0.49565738", "0.49506232", "0.49494222", "0.49435556", "0.49361137", "0.49296117", "0.49270484", "0.49243218", "0.49194977", "0.4918032", "0.49132004", "0.4903107", "0.4889564", "0.48694593", "0.48623458", "0.4860862", "0.48591006", "0.48572358", "0.48553598", "0.48551726", "0.4846974", "0.48463067", "0.48438802", "0.48378986", "0.48352304", "0.48308104", "0.48259664", "0.48253158", "0.48242298", "0.481682", "0.48083955", "0.48074973", "0.4806217", "0.48052955", "0.48019594", "0.48010647", "0.47960582", "0.47918785" ]
0.6806065
0
Getting the description of the character from the awoiaf Wiki page.
def char_description(character) html = open("https://awoiaf.westeros.org/index.php/#{character}") doc = Nokogiri::HTML(html) if doc.css("div.hatnote:first-child").empty? #|| doc.css(".mw-parser-output .hatnote:nth-child(2)").empty? description = doc.css(".mw-parser-output > p:nth-child(2)").text.gsub!(/[^A-Za-z ,.]/,'') else description = doc.css(".mw-parser-output > p:nth-child(3)").text.gsub!(/[^A-Za-z ,.]/,'') end if character == "Walder_Frey" description = doc.css(".mw-parser-output > p:nth-child(3)").text.gsub!(/[^A-Za-z ,.]/,'') end if character == "Viserys_Targaryen" description = doc.css(".mw-parser-output > p:nth-child(3)").text.gsub!(/[^A-Za-z ,.]/,'') end if character == "Tywin_Lannister" description = doc.css(".mw-parser-output > p:nth-child(2)").text.gsub!(/[^A-Za-z ,.]/,'') end description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n text_get(7, @id)\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 'Bibita'\n end", "def description\n info[\"Description\"]\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 descr\n return text_get(2, id)\n end", "def description; @text; end", "def heading\n\t\t\"Character Descriptors\"\n\tend", "def description\n response_json = @client.api_get_request('', 'tree=description')\n response_json['description']\n end", "def description\r\n\t\t\t`#{BITS::BITSADMIN} /getdescription {#{@id}}`\r\n\t\tend", "def description\n @description = PageDescription[self.description_name.to_sym] if self.description_name\n @description\n end", "def info\n\t\treturn \"\"\n\t\tp = localized_page\n\t\treturn \"\" unless p && p.content\n\t\tlogger.debug \"parsing page #{p.title}\"\n\t\t\t\n\t\t# extract the top-most section (the one before any ToC)\n\t\tc = WikiCloth::Parser.new({ :data => WikiParser::sanitize(p.content) })\n\t\tc = c.sections.first\n\t\t\n\t\tl = I18n.locale\n\t\tret = WikiParser.new({ :data => c }).to_html\n\t\t#I18n.locale = l\n\t\treturn ret\n\tend", "def display_character_blah\n \n puts \"Name: #{name}\"\n puts \"Bio: #{description}\"\n end", "def description\n @ole.Description\n end", "def description\n @ole.Description\n end", "def get_description\n @description\n end", "def description\n return nil if info.nil?\n info[:description]\n end", "def description\n\t\t\t@data[\"description\"]\n\t\tend", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "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 description\n meta['description'] || extract_description\n end", "def description\n data[:description]\n end", "def description\n data[:description]\n end", "def description\n @description ||= (\n ld = LessonDescription.find_by_schoolday_and_lesson(@schoolday, @lesson)\n ld && ld.description\n )\n end", "def description\n return @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @gapi[\"description\"]\n end", "def description\n object[\"description\"]\n end", "def description\n reading = @pinyin.empty? ? @pinyin_diacritic : @pinyin\n desc_str = \"%s %s [%s], %s\" % [@headword_trad, @headword_simp, reading, meaning_txt]\n end", "def desc\n return @desc\n end", "def character_details(character)\n puts \"\"\n puts \" Name: #{character.name}\"\n puts \" Nickname: #{character.nickname}\"\n puts \"Occupation: #{character.occupation}\"\n puts \" Status: #{character.status}\"\n puts \" Portrayed: #{character.portrayed}\"\n puts \" Image URL: #{character.img}\"\n puts \"\"\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def description\n ensure_full_data!\n @gapi[\"description\"]\n end", "def description\n node.at(\"description\").text\n end", "def desc\n\t\t\"Useful for analyzing scanned web sites later.\"\n\tend", "def description\n\n return @description\n\n end", "def description\n zombie_check\n @metadata.description(@name)\n end", "def description\n text_attribute('description')\n end", "def description\n @description ||= begin\n readme = File.read( path( 'README.txt' ) )\n md = readme.match( /== DESCRIPTION:(.+?)\\n== /m ) or\n fail( \"can't find a description section in README.txt\" )\n md[1].strip\n end\n end", "def description\n @data['description']\n end", "def description\n data['description']\n end", "def description\n @data['description']\n end", "def short_description\n description\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 desc\n\tend", "def desc\n\tend", "def get_description(n)\n @description_xpath[n].text\n end", "def description\n end", "def description\n fields['description']\n end", "def description\n end", "def description\n end", "def description\n self[:description]\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 description; @doc['description']; end", "def description; @doc['description']; end", "def description\n data_from_r['description']\n end", "def description\n @link.Description\n end", "def description\n \"Whois lookup\"\nend", "def long_description\n @ole.LongDescription\n end", "def description\n unescape params['x_description']\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 description\n search_by_itemprop 'description'\n end", "def describe\n @description\n end", "def describe\n @description\n end", "def page_desc(desc = '')\n base_desc = \"Admin\"\n \n final_desc = desc.empty? ? base_desc : desc\n hit(final_desc)\n end", "def character\n fetch('dumb_and_dumber.characters')\n end", "def get_description\n return @m_description\n end", "def get_description\n return @m_description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end" ]
[ "0.6682648", "0.66258216", "0.66258216", "0.65930414", "0.6577313", "0.65666497", "0.6555209", "0.6518555", "0.6463491", "0.6460054", "0.6452097", "0.63818514", "0.63511336", "0.6347177", "0.6339787", "0.6339787", "0.631929", "0.6305004", "0.6283876", "0.6206441", "0.6206441", "0.6169371", "0.6167724", "0.61650634", "0.61650634", "0.6159612", "0.61567515", "0.6148428", "0.6148428", "0.6148428", "0.6148428", "0.61294353", "0.61269987", "0.61254364", "0.6123409", "0.61216086", "0.6119646", "0.6119646", "0.6105127", "0.61023486", "0.60987616", "0.6093701", "0.60732234", "0.60664", "0.6054792", "0.605349", "0.60452235", "0.60425144", "0.6039087", "0.6027875", "0.60223836", "0.60223836", "0.60143644", "0.60141534", "0.60104895", "0.60071284", "0.60071284", "0.60027474", "0.59996325", "0.5994028", "0.5994028", "0.59722733", "0.5957393", "0.5957224", "0.5955882", "0.5950837", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.5946614", "0.59422344", "0.59376836", "0.59376836", "0.5936599", "0.5926491", "0.5919763", "0.5919763", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621", "0.5914621" ]
0.74901074
0
Checking to see if the character is still alive in the series by scraping the gameofthrones fandom site.
def char_alive?(user, result, character) html = open("https://gameofthrones.fandom.com/wiki/#{character}") doc = Nokogiri::HTML(html) words = doc.css(".pi-item .pi-font a").text.split /(?=[A-Z])/ if words.include?("Alive") puts "You are still alive!" else death = doc.css("div[data-source='Death'] .pi-font").text.split /(?=[A-Z])/ puts "You died in #{death.join(' ').gsub(/ +/, ' ')}" end end_menu(user, result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checks_passed?\n if blacklisted_wifi?\n puts \"Blacklisted Network; Won't go online\"\n return false\n end\n\n # we don't want to spam himawari's site more than once every 10 minutes while running on a schedule\n return false if by_schedule && now.min % 10 != 1\n\n if `find #{data_path} -name \\\"t_*.png\\\"`.length.positive?\n puts 'Another himawari process is still downloading/processing files.\\n' \\\n '(There are tiles (t_*.png) in the `data` folder.) Quitting w/o overlapping.'\n return false\n end\n\n unless internet_connection?\n puts \"Not online? Can't reach #{HIMAWARI_URL}\"\n return false\n end\n true\n end", "def check_for_a_bomb\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking?\n return true\n end\n end\n return false\n end", "def game_over?\n alive_robots.count == 1\n end", "def have_double_wild_battle?\r\n return false if $PokemonTemp.forceSingleBattle\r\n return false if pbInSafari?\r\n return true if $PokemonGlobal.partner\r\n return false if $Trainer.able_pokemon_count <= 1\r\n return true if $game_player.pbTerrainTag.double_wild_encounters && rand(100) < 30\r\n return false\r\n end", "def isAlive()\n if @hp > 0\n return true\n else\n return false\n end\n end", "def is_alive?\n @alive = false if Dates.is_greatter(@last_wash, @limit_wash)\n @alive = false if Dates.is_greatter(@last_food, @limit_food)\n return @alive\n end", "def isAlive?\n time_to_die=@Date_of_death\n actual_time=Chronic.parse(\"now\")\n if actual_time > time_to_die \n puts \"Votre tama est mort\"\n return false\n else\n puts \"Votre tama est vivant\"\n return true\n end\n end", "def simulateUntilDeath\n @round_num = 0\n starting_elves = @characters.filter { |c| c.type == \"E\"}.length\n until gameOver?\n @round_num += 1\n puts \"round: #{@round_num}\"\n self.round\n # End game if an elf dies\n # puts @characters.filter { |c| c.type == \"E\"}\n if @characters.filter { |c| c.type == \"E\"}.length != starting_elves\n puts \"Elf death @ round #{@round_num} hp #{@elf_attack}\"\n return [@round_num, totalHP, false]\n end\n end\n return [@round_num, totalHP, true ]\n end", "def alive?() end", "def game_over?\n alive_players = @players.select {|player| player.alive? == true }\n if alive_players.length > 1\n false\n else\n true\n end\n end", "def alive?()\n\n @hunger_counter < @hunger_limit\n end", "def game_over?\n alive_players.count == 1\n end", "def online?\n\n require 'open-uri'\n\n begin\n open('http://www.openwfe.org')\n true\n rescue SocketError => se\n false\n end\n end", "def alive?\n return true if ws && ts\n return false\n end", "def scrapable?\n min_interval = 5 * 60\n its_too_early = false\n if !self.last_scraped.nil? then\n its_too_early = (Time.now - self.last_scraped.to_time) <= min_interval\n end\n !its_too_early && !self.queued\n end", "def online?\n Browser.get(url).code != 0\n end", "def win?\n sleep(3)\n check_points\n end", "def scraped?\n !url.blank?\n end", "def guessing?\n ! page.has_content?(\"Your Results\")\n end", "def attack?\n if rand(@danger_level) > 3\n report_action 'attacking!'\n sleep 7\n return true\n else \n report_action 'not attacking....'\n sleep 1\n return false\n end\n end", "def alive?\n begin\n alive_check!\n return true\n rescue\n return false\n end\n end", "def is_still_ongoing?\n if player1.life_point>0 #&& enemies_in_sight.size>0\n true\n else\n false\n end\n end", "def is_still_ongoing?\n number_of_enemies_alive = 0\n if @human_player.life_points > 0\n if @enemies.each.life_points > 0\n number_of_enemies_alive += 1\n end\n end\n if number_of_enemies_alive > 0\n return true\n else\n return false\n end\n end", "def alive?\n expires_on > Time.now\n end", "def come_alive?(live_neighbors)\n live_neighbors == 3\nend", "def alive?\n @hp > 0\n end", "def fangraphs_odds\n\t\tmatchupgame=Game.new\n\t\tgamedate=matchupgame.parsegamestring(self.gid)[:year].to_s+\"-\"+matchupgame.parsegamestring(self.gid)[:month].to_s+\"-\"+matchupgame.parsegamestring(self.gid)[:day].to_s\n\t\turl=\"https://www.fangraphs.com/livescoreboard.aspx?date=\"+gamedate\n\t\tdoc=Nokogiri::HTML(open(url))\n\t\t\n\t\tawayt=matchupgame.parsegamestring(self.gid)[:awayt]\n\t\thomet=Matchup.fangraphTeamList[matchupgame.parsegamestring(self.gid)[:homet]]\n\t\tputs awayt.to_s\n\tend", "def tired\t\n\tif $hours_asleep >= 8 then\n\t $hours_asleep = 0\n \t\treturn false\n \telse\n \t\t$hours_asleep += 1\n \t\treturn true\n \tend \t\t\nend", "def alive?\n cur_health > 0\n end", "def is_alive?\n @life_points <= 0\n end", "def alive_robots\n @robots.select {|r| not r.dead? }\n end", "def detect_injury \n @last_hit = time unless events['got_hit'].empty? \n if @last_hit and time - @last_hit < 4\n say('hit')\n @turn_speed = @FAST_TURN \n elsif @last_hit and (time - @last_hit < 10)\n say('not hit')\n @turn_speed = rand(1...@NORMAL_TURN) \n end \n end", "def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return false\n end", "def alive?\n !cst.nil? && !x_security_token.nil?\n end", "def game_over?\n if $board.has_value?(\"none\") == false then\n puts \"No more turns available\"\n return true\n else\n return false\n end\n end", "def new_born\n !alive && neighbours_living.count == 3\n end", "def is_still_ongoing?\n return @human_player.life_points > 0 && @enemies.length > 0 ? true : false\n end", "def is_offline(fqdn)\n cmd = \"/usr/sbin/cibadmin --query --xpath \\\"//node_state[@uname='#{fqdn}']\\\" | grep -q 'crmd=\\\"online\\\"'\"\n exec(cmd,random(5,10)) > 0\n end", "def check_for_dickheads\n # Defaced the site on 16th Sep 2008\n if !/^122\\.109\\..*/.match(request.remote_addr).nil? ||\n # Probably the same person as above.\n !/^124\\.190\\..*/.match(request.remote_addr).nil? \n # Spammed the site on the 18th Sep 2008, probably same person as above\n # Site resolves to http://youhide.com\n !/^208\\.99\\..*/.match(request.remote_addr).nil?\n redirect_to \"http://www.google.com/search?q=how+not+to+be+a+fucktard\"\n end\n end", "def alive?\n !@dead\n end", "def attack?\n true\n end", "def any_enemy_alive?\n i = 0\n while i < $Enemies.length \n if $Enemies[i].alive\n return true\n break\n end\n i += 1\n end\n ### if no enemy is alive, return false\n return false\n end", "def won?\n @game.started? && !detectives_won? && detectives_cannot_move?\n end", "def check?\n king_attacked?\n end", "def dead?()\n\t\tnot alive?()\n\tend", "def check_online?\n url = @record.fulltext_link[:url]\n # SFX URLs observed in the wild: owens.mit.edu/sfx_local,\n # sfx.mit.edu/sfx_local, library.mit.edu/?func=service-sfx\n url.present? && (\n @record.fulltext_link[:label] == 'Check SFX for availability'\n )\n end", "def encounter_possible_here?\r\n return true if $PokemonGlobal.surfing\r\n terrain_tag = $game_map.terrain_tag($game_player.x, $game_player.y)\r\n return false if terrain_tag.ice\r\n return true if has_cave_encounters? # i.e. this map is a cave\r\n return true if has_land_encounters? && terrain_tag.land_wild_encounters\r\n return false\r\n end", "def hail?\n return false if $game_temp.in_battle && ::BattleEngine.state[:air_lock]\n return current_weather == 4\n end", "def alive?()\n\t\tamount_of( :deuterium ) > 0\n\tend", "def the_game\n# adding an additional until statement after in_city seems to have fixed the crash\n# this does, however, mean the player can only soft quit from the camp. Fair enough for now.\n gameon = true \n\n until !$in_camp do\n camp\n end\n\n until !$in_forest do\n \tforest\n end\n\n until !$in_boss do\n boss\n end\n\n until !$at_gate do\n gate\n end\n\n until !$in_city do\n city\n end\n\n# my dirty little fix.\n until !gameon\n the_game\n end\n\nend", "def random_encounter\n narrate(\"an enemy appears!\")\n a = Fight.new(@player, @enemy_list.sample)\n if a.now\n here\n else\n\n #here is where u die\n STDIN.getch\n puts\n puts \"There is only one god and his name is Death. And there is only one thing we say to Death: Not today.\"\n \n STDIN.getch\n puts\n\n\n start = Startup.new()\n start.start\n end\n end", "def name_should_exist\n\t agent = Mechanize.new { |agent| agent.user_agent_alias = \"Windows Chrome\" }\n searchPage = agent.get('http://www.lolking.net/')\n\t#search for player with the user name keyword\n\tsearchBox = searchPage.forms.first\n\tsearchBox['name'] = name\n\tresultPage = searchBox.submit\n\tresultBody = resultPage.body\n\tresult_doc = Nokogiri::HTML(resultBody)\n\n\trank = result_doc.xpath(\"//li[contains(@class, 'featured')]/div[3]/div[1]\").text.strip\n \t if rank.length == 0\n \t errors.add(:name, \"Error: We could not find a North America summoner with the name #{name}\")\n \t end\n end", "def expect_game_to_be_over\n expect(page).to have_content(\"Your Results\")\n end", "def is_available(page)\n\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n\n return !page.nil? \n\nend", "def is_available(page)\n\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n\n return !page.nil? \n\nend", "def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end", "def find_alive(players)\n alive = []\n players.each do |player|\n alive << player if player[:is_shot] == false\n end\n alive.length\nend", "def player_won?\n unless @display_content.include?(\"_\")\n puts \"You found the correct word!\"\n true\n end\n end", "def check_end_of_game\n return has_this_player_won?(COMPUTER) ? COMPUTER : (has_this_player_won?(HUMAN) ? HUMAN : false)\n end", "def is_still_ongoing?\n\t\tif @enemies.length > 0 && @human_player.life_points > 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def check_site\n\t\t\tpage = @agent.get(@page[:url])\n\t\t\traise \"got redirected on #{@page[:name]}\" if redirect?\n\n\t\t\tdoc = Nokogiri::HTML(page.parser.to_s)\n\t\t\tnodes_with_euros = doc.search(\"//text()[contains(.,'€')]\")\n\t\t\tcontainers_array = []\n\t\t\traise \"no euros found #{@page[:name]}\" if nodes_with_euros == []\n\n\t\t\t# Previous version was with ruby, now xpath, less code. \n\t\t\tcontainers_array = nodes_with_euros.collect { |node| node.ancestors(\"//table | //div\").first } unless @page[:search_string]\n\n\t\t\tif @page[:search_string]\n\t\t\t\t#remove escapes\n\t\t\t\t@page[:search_string].gsub!(/\\\\/) { ''}\n\t\t\t\tcontainers_array << doc.search(\"//text()[contains(.,#{@page[:search_string]})]\").first\n\t\t\tend\n\n\t\t\t#Nodeset is an array, but doesn't act like one, really annoying.\n\t\t\tcontainers_nodeset = Nokogiri::XML::NodeSet.new(doc)\n\t\t\tcontainers_freqs = containers_array.inject(Hash.new(0)) { |h,v| h[v] += 1; h}\n\t\t\t\n\t\t\t# Refactored from double block\n\t\t\tcontainers_nodeset = containers_freqs.collect { |node,freq| freq > 1 ? node : nil }\n\t\t\tcontainers_nodeset.uniq!\n\t\t\traise \"no hits found in #{@page[:name]}\" if (containers_nodeset.empty? || containers_nodeset == [nil])\n\n\t\t\twrite_to_file(containers_nodeset)\n\t\t\t\n\t\trescue Timeout::Error => e\n\t\t\t# Only occures when site is down or script runs too often. So we try again once, then bail\n\t\t\tretry if @retry\n\t\t\t@retry = false\n\t\t\traise\n\t\trescue => e\n\t\t\thandle_me(e)\n\t\tend", "def check_if_your_league_pop_up_is_dispalyed\n\n page.should have_content(read_file_content(YOUR_LEAGUES))\n sleep(THREAD_SLEEP_1)\n\n end", "def is_alive?\n if @health > 0\n return true\n else\n return false\n end\n\n end", "def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend", "def p1Alive #weather player is alive or not\r\n p1Life = true\r\n end", "def off_cooldown?\n return !(@last_attack + @cooldown > Graphics.frame_count)\n end", "def off_cooldown?\n return !(@last_attack + @cooldown > Graphics.frame_count)\n end", "def is_sunk? \n if @life > 0\n return false\n else\n return true\n end\n end", "def is_still_going?\n if ((gamer.life_points > 0) && (@enemies.size > 0))\n \treturn true\n else\n \treturn false\n end\n end", "def alive?\n\t\ttrue\n\tend", "def alive?\n\t\ttrue\n\tend", "def is_alive\n @health > 0\n end", "def is_alive\n @health > 0\n end", "def check\r\n res = inject(Rex::Text.rand_text_alpha(1))\r\n\r\n if res.code = \"200\" && res.headers['set-cookie'] =~ /JSESSIONID/\r\n Exploit::CheckCode::Appears\r\n else\r\n Exploit::CheckCode::Safe\r\n end\r\n end", "def game_over?\n game_over = false\n safe_hotel_count = 0\n self.game_hotels.each do |hotel|\n if hotel.chain_size >= 41\n game_over = true\n elsif hotel.chain_size >= 11\n safe_hotel_count = safe_hotel_count + 1\n end\n end\n if safe_hotel_count == 7 || game_over == true\n winner = end_game_scoring\n return winner\n else\n return false\n end\n end", "def main_game\n # Add the following information :\n my_game = 'Street_fighter_V'\n my_style = 'combat'\n # End\n row_max = 2\n\n url = my_url_game(my_game)\n browser = Watir::Browser.new :chrome, scrapping_options\n scrap_game(url, browser, my_game, my_style, row_max)\n row_max += 100\nend", "def scrape_finished?\n guidance_urls.for_scraping.all?(&:scrape_finished?)\n end", "def game_over?\n # puts\n # p @frames.size\n # p @frames[9].last if @frames.size >= 10\n # p @frames[10].last if @frames.size >= 11\n # game_over =\n @frames.size == 10 && !(@frames[9].last =~ /[X\\/]/) ||\n @frames.size == 11 && (@frames[9].last == '/' ||\n (@frames[9].last == 'X' && @frames[10].last != 'X')) ||\n @frames.size == 12 && @frames[9].last == 'X' && @frames[10].last == 'X'\n # p \" game_over: #{game_over}\"\n # game_over\n end", "def can_fight?\n @position && !dead?\n end", "def dead? \n if (timer <= 0.0) \n return true\n else \n return false\n end\n end", "def game_over?\n return false unless @previous_piece\n\n previous_color = @previous_piece.color == :white ? :black : :white\n no_legal_moves_captures?(previous_color)\n end", "def game_over?\n players_found_phrase = @states.select { |s| s.found_phrase }\n if players_found_phrase.size == 1\n @renderer.output \"We have a winner! #{players_found_phrase.first.player.name} found the phrase!\"\n return true \n elsif players_found_phrase.size > 1\n drawn_player_names = players_found_phrase.map { |s| s.player.name }\n @renderer.output \"We have a draw between #{drawn_player_names.join(' and ')}\"\n return true\n else\n dead_players = @states.select { |s| s.incorrect_guesses.count >= Gallows.stages.count - 1 }\n if dead_players.count > 0\n dead_player_names = dead_players.map { |s| s.player.name }\n @renderer.output \"#{dead_player_names.join(' and ')} is dead.\"\n if dead_players.count == @states.count\n @renderer.output \"It's a draw, all players are dead.\"\n else\n surviving_players = @states.select { |s| dead_players.index(s).nil? }\n surviving_player_names = surviving_players.map { |s| s.player.name }\n @renderer.output \"We have a winner! #{surviving_player_names.join(' and ')} survived longer!\"\n end\n return true\n end\n end\n return false\n end", "def stalemate?\n\t\tpieces = @board.board.select { |square, piece| piece.class != String && piece.white == @player.white }\n\t\tperi = [-17,-15,-10,-9,-8,-7,-6,-1,1,6,7,8,9,10,15,17]\n\t\tpieces.each do |from, piece|\n\t\t\tperi.each do |to|\n\t\t\t\tif piece.legal_move?(from, calc_move(from, to)) && (square(calc_move(from, to)) == \" \" || square(calc_move(from, to)).white != @player.white)\n\t\t\t\t\tunless getting_into_check?(from, calc_move(from, to))\n\t\t\t\t\t\tif (piece.class == Pieces::Pawn && square(calc_move(from, to)) == \" \") || piece.class == Pieces::King\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telsif piece.class == Pieces::Knight && from[1] != to[1]\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telsif piece.class != Pieces::Pawn && piece.legal_list(from, calc_move(from, to)).all? { |t| square(t) == \" \" }\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif piece.class == Pieces::Pawn && [7,9].any? { |t| calc_move(from, t) == to } && piece.white\n\t\t\t\t\treturn false\n\t\t\t\telsif piece.class == Pieces::Pawn && [-7,-9].any? { |t| calc_move(from, t) == to } && !piece.white\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tunless check?(@board.board)\n\t\t\t@stalemate = true\n\t\t\treturn true\n\t\tend\n\tend", "def cpu_attempt\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET # full send\n @state[:result] = game_result\n update_game_phase(GAME_OVER)\n return true\n elsif token_placed # make sure token was placed before force delete\n board_remove_token(c)\n end\n end\n false\n end", "def fight(zombies, humans=1)\n if rand < ZOMBIFICATION_CHANCE\n false\n else\n true\n end\n end", "def game_tied?\n if @number_of_turns == 9\n true\n else\n false\n end\n end", "def game_over\n remaining_player.count == 1\n end", "def game_over?\n return true if victory? || (@turns == 12)\n false\n end", "def can_expedite?\n seconds.count >= seconds_for_expedition\n end", "def alive?\n @alive\n end", "def stay_alive?(live_neighbors)\n live_neighbors == 2 || live_neighbors == 3\nend", "def is_available(page)\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n return !page.nil? \nend", "def is_available(page)\n # Todo: Return true if the page is available for scraping Development Applications. Return false otherwise\n return !page.nil? \nend", "def computer_opens_game\n @avail_moves.length == 8 && @depth == 1 ? true : false\n end", "def alive?\n\t\tif self.hitpoints > 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def check_faint\n if $PokemonGlobal.surfing==true || $PokemonGlobal.bicycle==true\n else\n if $Trainer.party[0].hp<=0 \n $game_variables[Current_Following_Variable]=0 \n remove_sprite\n elsif $Trainer.party[0].hp>0 && !$Trainer.party[0].egg?\n end \n end\nend", "def handlePossibleAccident\n return false unless rand < @driver.accident\n\n @lastSpeed = @nextSpeed = Velocity::Zero\n @fixTime = World.time + RepairTime\n @bodyEnd = @bodyStart - @length\n @totalAccidents += 1\n\n true\n end", "def wait_for_freelancer_page_visible\n sleep 15\n end", "def test_live_cell_with_no_neighbors_dies\n refute @life.will_live?(true, 0)\n end", "def see_ball?\n \tball.notSeenLongTime() < 5\n end" ]
[ "0.57888335", "0.5785615", "0.5683552", "0.5643582", "0.5605951", "0.5599776", "0.5587042", "0.5574685", "0.5573726", "0.557045", "0.55326396", "0.5531032", "0.5499714", "0.5486322", "0.5474931", "0.546841", "0.5452214", "0.54515773", "0.54392844", "0.5418807", "0.538266", "0.5381192", "0.5376404", "0.5364615", "0.5355921", "0.5313402", "0.5274345", "0.52700347", "0.5255433", "0.5249269", "0.52482194", "0.52445036", "0.5237557", "0.52361673", "0.5228302", "0.522785", "0.52237844", "0.52228916", "0.521466", "0.5192766", "0.51849777", "0.5178896", "0.5156582", "0.51565355", "0.5153755", "0.5148057", "0.5138184", "0.51363707", "0.5135808", "0.51352066", "0.5131151", "0.51245373", "0.51221156", "0.51208866", "0.51208866", "0.5118417", "0.5116898", "0.51158196", "0.51042503", "0.51035625", "0.51008016", "0.507992", "0.5072233", "0.5069206", "0.5062839", "0.5060414", "0.5060414", "0.5057916", "0.5055112", "0.5051172", "0.5051172", "0.5042306", "0.5042306", "0.50416404", "0.50372285", "0.5036142", "0.50360036", "0.5033052", "0.5031731", "0.50316554", "0.5025367", "0.50252527", "0.50230163", "0.5022498", "0.5019463", "0.50179887", "0.5017229", "0.5016834", "0.50121915", "0.5000486", "0.49995187", "0.4996939", "0.4996939", "0.4995858", "0.4988278", "0.49869353", "0.49815887", "0.49796557", "0.4976049", "0.49650306" ]
0.7387033
0
GET /dependences GET /dependences.json
def index @dependences = Dependence.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dependencies = Dependency.all\n end", "def dependents(options: {})\n\n Collection.new(parse(client.get(\"/tasks/#{gid}/dependents\", options: options)), type: self.class, client: client)\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def depends\n return @depends if @depends\n\n deps = survey.dependencies.includes({:dependency_conditions => {:question => :answers}})\n\n resps = self.responses.includes(:answer)\n\n # gather if the dependencies are met in a hash\n @depends = deps.all.reduce({}) do |mem, v|\n mem[v.id] = v.is_met? self, resps\n mem\n end\n end", "def dependencies\n []\n end", "def body\n do_cached_with(key: \"evss_dependents_retrieve_#{@user.uuid}\") do\n raw_response = EVSS::Dependents::Service.new(@user).retrieve\n EVSS::Dependents::RetrieveInfoResponse.new(raw_response.status, raw_response)\n end.body\n end", "def go_list_deps\n args = [\"-deps\"]\n args << \"-mod=vendor\" if config.dig(\"go\", \"mod\") == \"vendor\"\n\n # the CLI command returns packages in a pretty-printed JSON format but\n # not separated by commas. this gsub adds commas after all non-indented\n # \"}\" that close root level objects.\n # (?!\\z) uses negative lookahead to not match the final \"}\"\n deps = package_info_command(*args).gsub(/^}(?!\\z)$/m, \"},\")\n JSON.parse(\"[#{deps}]\")\n end", "def dependencies\n []\n end", "def dependents(resource)\n tree_from_vertex(resource).keys\n end", "def get_dependencies\n @dependencies\n end", "def dependencies\n []\n end", "def dependencies\n @dependencies.values\n end", "def dependencies_for(specification)\n []\n end", "def dependencies\n @dependencies\n end", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def load_dependencies\n result = zh_client.dependencies(repo_name)\n\n result[\"dependencies\"].each do |hash|\n blocking = add_or_find(hash[\"blocking\"])\n blocked = add_or_find(hash[\"blocked\"])\n\n add_edge(blocked, blocking)\n end\n end", "def getDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getDeps(csproj) \r\n end\r\n return deps.uniq\r\nend", "def get_dependencies(_fidl, _interaction_types, _project_dependencies)\n # noop\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= {}\n end", "def request_dependencies\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def dependencies\n @dependencies.collect { |name, dependency| dependency }\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def find_all(req)\n res = []\n\n return res unless @remote\n\n if @to_fetch.include?(req.name)\n prefetch_now\n end\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number], @prerelease\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def validateDependencies\n params[:dependencies].split(\"&\").each do |dependency|\n dependency_values = dependency.split(\"=\")\n versions = Version.where(:part_name => dependency_values[0])\n\n if versions.empty?\n render :text => \"Part: #{dependency_values[0]} does not exist.\", status: 400\n return\n else\n part = versions.where(:version => dependency_values[1]).first\n if part.nil?\n render :text => \"Part: #{dependency_values[0]} with version: #{dependency_values[1]} does not exist\", status: 400\n return\n end\n end\n end\n\n render :nothing => true, status: 200\n end", "def dependency_versions(args = {}, &bl)\n versions = {}\n args = {:recursive => true, :dev_deps => true, :versions => versions}.merge(args)\n deps.each do |dep|\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge!(gem.versions(args, &bl))\n end\n versions\n end", "def add_depend_list\n list = ''\n if @depedencies.nil? or @depedencies.size == 0\n list = ''\n elsif @depedencies.class == String\n list = \"=> [:#{@depedencies}] \"\n elsif @depedencies.class == Array\n list = '=> [ '\n need_comma = false\n for element in @depedencies\n list = list + ', ' if need_comma\n list = list + \":#{element}\"\n @log.info \" - dependent from : #{element}\"\n need_comma = true\n end\n list = list + ' ] '\n else\n @log.fatal { \"Cannot parse dependencies [#{@depedencies}]\" }; exit\n end\n return list\n end", "def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end", "def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end", "def dependencies\n EMPTY_SET\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def dependencies(include_parent = false)\n []\n end", "def request_dependencies \n attrib_needed! :content, true if recipe_page_needed?\n from_gleaning = Gleaning.tracked_attributes & needed_attributes\n if from_gleaning.present?\n build_gleaning if !gleaning\n gleaning.request_attributes *from_gleaning\n end\n from_mercury = MercuryResult.tracked_attributes & needed_attributes\n if from_mercury.present?\n # Translate from our needed attributes to those provided by mercury_result\n build_mercury_result if !mercury_result\n mercury_result.request_attributes *from_mercury\n end\n end", "def dependencies_for(specification)\n specification.dependencies\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def get_dep_names(data)\n return unless data.key?(\"dependencies\")\n\n data['dependencies'].each do |name, dep_info|\n @deps[name] = {}\n get_dep_names(dep_info) if dep_info['dependencies']\n end\n end", "def dependencies_for(specification)\n specification.dependencies(@cache, @resolver_ui)\n end", "def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n end", "def contingents\n ExtensionDependency.includes(extension_version: :extension)\n .where(extension_id: id)\n .sort_by do |cd|\n [\n cd.extension_version.extension.name,\n Semverse::Version.new(SemverNormalizer.call(cd.extension_version.version))\n ]\n end\n end", "def deps_response(base, env={})\n @semaphore.synchronize do\n refresh(env)\n base = Pathname.new(base)\n unless @deps[base]\n response = @deps[base] ||= Rack::Response.new\n response.write \"// Dynamic Deps by Closure Script\\n\"\n @files.sort{|a,b|(a[1][:path]||'')<=>(b[1][:path]||'')}.each do |filename, dep|\n if dep[:path]\n path = Pathname.new(dep[:path]).relative_path_from(base)\n path = \"#{path}?#{dep[:mtime].to_i}\"\n response.write \"goog.addDependency(#{path.dump}, #{dep[:provide].inspect}, #{dep[:require].inspect});\\n\"\n end\n end\n response.headers['Content-Type'] = 'application/javascript'\n response.headers['Cache-Control'] = \"max-age=#{[1,@dwell.floor].max}, private, must-revalidate\"\n response.headers['Last-Modified'] = Time.now.httpdate\n end\n mod_since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']) rescue nil\n if mod_since == Time.httpdate(@deps[base].headers['Last-Modified'])\n Rack::Response.new [], 304 # Not Modified\n else\n @deps[base]\n end\n end\n end", "def dependencies\n self.config.depends || []\n end", "def dependencies( *args )\n names = args # note: for now assume all args are just names\n # e.g. 'pluto-models', 'pluto-update', etc.\n deps = @versions.select do |rec| names.include?( rec[0] ) end\n .map do |rec| [rec[0], rec[1]] end\n\n ## todo/fix: throw exception if dependency is missing!\n ## names.size == deps.size\n puts \"names.size == deps.size #{names.size} == #{deps.size}\"\n deps\n end", "def external_dep;\treturn @json_data['external_dep'];\tend", "def search\n request_params = prepare_search_params\n if request_params[:packages].empty?\n return render json: {\n messeage: 'please provide us with packages to provide you with dependencies',\n },\n status: 200\n end\n\n operating_system = OperatingSystem.find_by(\n name: request_params[:operating_system][:name],\n vendor: request_params[:operating_system][:vendor],\n bits: request_params[:operating_system][:bits],\n )\n package_manager = operating_system.package_manager if operating_system\n\n packages = []\n request_params[:packages].each do |package|\n package_name = package[:name]\n package_version = package[:version]\n\n packages << Package.find_by(name: package_name, version: package_version)\n end\n\n if packages.empty?\n return render json: {\n messeage: \"sorry we haven't any data about your gems\",\n },\n status: 404\n end\n\n packages_dependencies = []\n packages.compact.each do |package|\n packages_dependencies <<\n { package_name: package[:name], package_dependencies: package.package_dependencies }\n end\n\n system_dependencies = []\n packages_dependencies.compact.each do |package|\n dependencies = []\n package[:package_dependencies].each do |p|\n dependencies = PackageSystemDependency.where(\n package: p, operating_system: operating_system,\n ).map(&:system_dependency)\n end\n system_dependencies << {\n package_name: package[:package_name],\n system_dependencies: dependencies,\n }\n end\n\n render json: { packages: system_dependencies, package_manager: package_manager }, status: 200\n end", "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def dependencies\n manager.dependencies\n end", "def extract_dependancy(component)\n bower_file = File.join(component, BOWERJSON)\n\n if(!File.exist?(bower_file))\n logger.warn \"no #{BOWERJSON} file found for #{component}\"\n return\n end\n\n bower_file = JSON.parse(File.read(bower_file))\n if(!bower_file.has_key?('main'))\n logger.warn \"No main section found for #{component}\"\n return\n end\n\n files_ = bower_file['main']\n files = files_.is_a?(Array) ? files_ : [files_]\n\n {\n :name => bower_file['name'],\n :files => files\n }\n end", "def dependencies(&block)\n deps = ::OSGi::Dependencies.new(project)\n deps.read\n deps.dependencies + deps.projects\n end", "def get_versions\r\n versions_nodes = BankNodestructure.version_gather(params[:subject], params[:grade])\r\n render json: versions_nodes.to_json\r\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def fetch_dependency_remote_specs(gem_names, &blk)\n Bundler.ui.debug \"Query Gemcutter Dependency Endpoint API: #{gem_names.join(' ')}\"\n uri = URI.parse(\"#{@remote_uri}api/v1/dependencies?gems=#{gem_names.join(\",\")}\")\n marshalled_deps = fetch(uri)\n gem_list = Marshal.load(marshalled_deps)\n\n spec_list = gem_list.map do |s|\n [s[:name], Gem::Version.new(s[:number]), s[:platform]]\n end\n deps_list = gem_list.map do |s|\n s[:dependencies].collect {|d| d.first }\n end.flatten.uniq\n\n [spec_list, deps_list]\n end", "def dependency name, version, type = :runtime\n raise \"Unknown dependency type: #{type}\" unless\n [:runtime, :dev, :development, :developer].include? type\n\n ary = if type == :runtime then\n extra_deps\n else\n extra_dev_deps\n end\n\n ary << [name, version]\n end", "def dependency_versions(args = {}, &bl)\n versions = args[:versions] || {}\n check_deps = args[:dev] ? dev_deps : deps\n\n check_deps.each do |dep|\n unless versions.key?(dep.name)\n begin\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge! gem.versions(args, &bl)\n rescue\n unknown = Polisher::VersionChecker.unknown_version(:all, dep.name, &bl)\n versions.merge! dep.name => unknown\n end\n end\n\n args[:versions] = versions\n end\n\n versions\n end", "def dependencies(path)\r\n deps = []\r\n open(path) do |file|\r\n deps = file.read.scan(/ [^\\s|\\\\]+/).collect { |s| s.strip }\r\n end\r\n deps.reject!{|s| s.include?(\"/opt\") || s.include?(\"/usr\") || s.include?(\"include/boost\")}\r\n deps\r\nend", "def lookup_dependencies(cookbook, checked = {})\n Berkshelf.log.debug \" Looking up dependencies for #{cookbook}\"\n\n dependencies = []\n\n lockfile.graph.find(cookbook).dependencies.each do |name, _|\n next if checked[name]\n\n # break cyclic graphs\n checked[name] = true\n\n # this is your standard depth-first tree traversal with the deps first...\n dependencies += lookup_dependencies(name, checked)\n # ..then the node itself\n dependencies << name\n end\n dependencies\n end", "def dependency_versions(args = {}, &bl)\n versions = args[:versions] || {}\n check_deps = args[:dev] ? dev_deps : deps\n\n check_deps.each do |dep|\n unless versions.key?(dep.name)\n begin\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge! gem.versions(args, &bl)\n rescue\n unknown = Polisher::VersionChecker.unknown_version(:all, dep.name, &bl)\n versions.merge! dep.name => unknown\n end\n end\n\n args[:versions] = versions\n end\n\n versions\n end", "def get_concept_required_edges\n concept = @course.topicconcepts.concepts.where(id: params[:id]).first\n if !concept.nil?\n required_concept_edges = concept.concept_edge_required_concepts\n respond_to do |format|\n format.json { render :json => { :current_concept => concept, :dependencies => required_concept_edges.map { |e| { concept_edge_id: e.id, required_concept_name: e.required_concept.name} }}} \n end\n else\n raise \"Concept id is invalid\"\n end\n end", "def prefetch reqs\n return unless @remote\n names = reqs.map { |r| r.dependency.name }\n needed = names - @data.keys\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n loaded = []\n\n Marshal.load(str).each do |ver|\n name = ver[:name]\n\n @data[name] << ver\n loaded << name\n end\n\n (needed - loaded).each do |missing|\n @data[missing] = []\n end\n end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def request_dependencies \n # If we haven't persisted, then the page_ref has no connection back\n page_ref.recipes << self unless persisted? || page_ref.recipes.to_a.find { |r| r == self }\n page_ref.request_attributes *(needed_attributes & [ :picurl, :title, :description ]) # Those to be got from PageRef\n end", "def core_fetch_dependencies(deps, verbose)\n deps.each do |pkg_name, pkg_version|\n core_fetch_dependency pkg_name, pkg_version, :runtime, verbose\n end\n end", "def get_dependencies_from_path(metadata_path)\n metadata = JSON.parse(File.read(metadata_path), symbolize_names: true)\n get_dependencies_from_metadata(metadata)\n end", "def enumerate_dependencies\n json = JSON.parse(project_assets_file)\n nuget_packages_dir = json[\"project\"][\"restore\"][\"packagesPath\"]\n json[\"targets\"].each_with_object({}) do |(_, target), dependencies|\n target.each do |reference_key, reference|\n # Ignore project references\n next unless reference[\"type\"] == \"package\"\n package_id_parts = reference_key.partition(\"/\")\n name = package_id_parts[0]\n version = package_id_parts[-1]\n id = \"#{name}-#{version}\"\n\n # Already know this package from another target\n next if dependencies.key?(id)\n\n path = File.join(nuget_packages_dir, json[\"libraries\"][reference_key][\"path\"])\n dependencies[id] = NuGetDependency.new(\n name: id,\n version: version,\n path: path,\n metadata: {\n \"type\" => NuGet.type,\n \"name\" => name\n }\n )\n end\n end.values\n end", "def dependencies(options = {})\n # backward compatibility\n options = { :scopes => options } if Array === options\n\n # support symbols, but don't fidget with nil\n options[:scopes] = (options[:scopes] || SCOPES_WE_USE).map { |s| s.to_s if s }\n\n # try to cache dependencies also\n @depends_for_scopes ||= {}\n unless depends = @depends_for_scopes[options]\n declared = project['dependencies'].first['dependency'] rescue nil\n depends = (declared || [])\n depends = depends.reject { |dep| value_of(dep['optional']) =~ /true/ } unless options[:optional]\n depends = depends.map { |dep|\n spec = pom_to_hash(dep, properties)\n apply = managed(spec)\n spec = apply.merge(spec) if apply\n\n next if options[:exclusions] && options[:exclusions].any? { |ex| dep['groupId'] == ex['groupId'] && dep['artifactId'] == ex['artifactId'] }\n\n # calculate transitive dependencies\n if options[:scopes].include?(spec[:scope])\n spec.delete(:scope)\n\n exclusions = dep['exclusions'].first['exclusion'] rescue nil\n transitive_deps = POM.load(spec).dependencies(:exclusions => exclusions, :scopes => (options[:scopes_transitive] || SCOPES_TRANSITIVE) ) rescue []\n\n [Artifact.to_spec(spec)] + transitive_deps\n end\n }.flatten.compact #.uniq_by{|spec| art = spec.split(':'); \"#{art[0]}:#{art[1]}\"}\n @depends_for_scopes[options] = depends\n end\n depends\n end", "def getWcfDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getWcfDeps(csproj) \r\n end\r\n return deps.uniq\r\nend", "def dependencies\n cached_dependencies\n .reject { |d| ignored?(d) }\n .each { |d| add_additional_terms_from_configuration(d) }\n end", "def dependency_list\n @target.dependencies.map(&:display_name)\n end", "def dependencies(resource)\n # Cache the reversal graph, because it's somewhat expensive\n # to create.\n unless defined? @reversal and @reversal\n @reversal = reversal\n end\n # Strangely, it's significantly faster to search a reversed\n # tree in the :out direction than to search a normal tree\n # in the :in direction.\n @reversal.tree_from_vertex(resource, :out).keys\n end", "def required_dependencies\n dependencies - optional_dependencies\n end", "def check_dependencies\n ok = true\n\n @config.each_pair { |type, values|\n next if !values.instance_of?(Array)\n _shortclass, cfg_name, _cfg_plural, _classname = MU::Cloud.getResourceNames(type, false)\n next if !cfg_name\n values.each { |resource|\n next if !resource.kind_of?(Hash) or resource[\"dependencies\"].nil?\n addme = []\n deleteme = []\n\n resource[\"dependencies\"].each { |dependency|\n dependency[\"their_phase\"] ||= dependency[\"phase\"]\n dependency.delete(\"phase\")\n dependency[\"my_phase\"] ||= dependency[\"no_create_wait\"] ? \"groom\" : \"create\"\n dependency.delete(\"no_create_wait\")\n # make sure the thing we depend on really exists\n sibling = haveLitterMate?(dependency['name'], dependency['type'])\n if !sibling\n MU.log \"Missing dependency: #{type}{#{resource['name']}} needs #{cfg_name}{#{dependency['name']}}\", MU::ERR\n ok = false\n next\n end\n\n # Fudge dependency declarations to quash virtual_names that we know\n # are extraneous. Note that wee can't do all virtual names here; we\n # have no way to guess which of a collection of resources is the\n # real correct one.\n if sibling['virtual_name'] == dependency['name']\n real_resources = []\n found_exact = false\n resource[\"dependencies\"].each { |dep_again|\n if dep_again['type'] == dependency['type'] and sibling['name'] == dep_again['name']\n dependency['name'] = sibling['name']\n found_exact = true\n break\n end\n }\n if !found_exact\n all_siblings = haveLitterMate?(dependency['name'], dependency['type'], has_multiple: true)\n if all_siblings.size > 0\n all_siblings.each { |s|\n newguy = dependency.clone\n newguy['name'] = s['name']\n addme << newguy\n }\n deleteme << dependency\n MU.log \"Expanding dependency which maps to virtual resources to all matching real resources\", MU::NOTICE, details: { sibling['virtual_name'] => addme }\n next\n end\n end\n end\n\n if dependency['their_phase'] == \"groom\"\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['their_phase'] != \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n\n # Check for a circular relationship that will lead to a deadlock\n # when creating resource. This only goes one layer deep, and does\n # not consider groom-phase deadlocks.\n if dependency['their_phase'] == \"groom\" or\n dependency['my_phase'] == \"groom\" or (\n !MU::Cloud.resourceClass(sibling['cloud'], type).deps_wait_on_my_creation and\n !MU::Cloud.resourceClass(resource['cloud'], type).waits_on_parent_completion\n )\n next\n end\n\n if sibling['dependencies']\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['my_phase'] == \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n }\n resource[\"dependencies\"].reject! { |dep| deleteme.include?(dep) }\n resource[\"dependencies\"].concat(addme)\n resource[\"dependencies\"].uniq!\n\n }\n }\n\n ok\n end", "def dependencies(recurse: true)\n return @dependencies if @dependencies\n depends = yaml['depends']\n if depends.nil? || depends.empty?\n @dependencies = nil\n else\n @dependencies = depends.map do |name, dependency|\n reader = StackFileLoader.for(dependency['stack'], self)\n deps = { 'name' => name, 'stack' => reader.source, 'variables' => dependency.fetch('variables', Hash.new) }\n if recurse\n child_deps = reader.dependencies\n deps['depends'] = child_deps unless child_deps.nil?\n end\n deps\n end\n end\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def index\n @st_has_deps = StHasDep.all\n end", "def index\n @genre_dependencies = GenreDependency.all\n end", "def dependents_for(job)\n if !@dependencies[job] or @dependencies[job].empty?\n []\n else\n recursive_dependencies = @dependencies[job].map{ |klass| dependents_for(klass) }\n (@dependencies[job] + recursive_dependencies).flatten.uniq\n end\n end", "def get_dependency(name, constraint)\n @dependencies.fetch(Graph.dependency_key(name, constraint), nil)\n end", "def vendor(dependencies)\n return nil if dependencies.nil? || dependencies.empty?\n @dep_list = Resolver.resolve(dependencies, @cache, @cwd, @backend)\n end", "def dependencies(name)\n dependencies = []\n submodule = submodule(name)\n if submodule.has_key?(:dependencies)\n submodule[:dependencies].each do |dependency|\n dependencies << dependency\n dependencies << dependencies(dependency)\n end\n end\n\n dependencies.flatten.uniq.sort\n end", "def dependency_params\n params.require(:dependency).permit(:dependent_id, :depended_id)\n end", "def dependencies\n @dependencies ||= Set.new\n end", "def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def requirements\n @use_case = UseCase.find(params[:id])\n @project = @use_case.project\n @requirements = @use_case.requirements\n respond_to do |format|\n format.html \n end\n end", "def fetch_development_dependencies # :nodoc:\n end", "def find_dependencies(source, graph, reverse)\n if reverse\n UI.puts \"What depends on #{source}?\"\n graph = graph.reverse\n else\n UI.puts \"What does #{source} depend on?\"\n end\n\n tree = graph.bfs_search_tree_from(source)\n graph = graph.vertices_filtered_by { |v| tree.has_vertex? v }\n sorted_dependencies = graph.vertices.sort\n sorted_dependencies.delete(source)\n\n if sorted_dependencies.empty?\n UI.puts 'Nothing'\n else\n sorted_dependencies.each { |dependency| UI.puts dependency }\n end\n\n File.open(@to_yaml, 'w') { |file| file.write(sorted_dependencies.to_s) } if @to_yaml\n File.open(@to_dot, 'w') { |file| file.write(graph.to_dot_graph.to_s) } if @to_dot\n end", "def dependency_paths\n @dependency_paths ||= []\n end", "def dependencies(recurse: true)\n return @dependencies if @dependencies\n if depends.nil? || depends.empty?\n @dependencies = nil\n else\n @dependencies = depends.map do |name, dependency|\n loader = StackFileLoader.for(dependency['stack'], self)\n deps = { 'name' => name, 'stack' => loader.source, 'variables' => dependency.fetch('variables', Hash.new) }\n if recurse\n child_deps = loader.dependencies\n deps['depends'] = child_deps unless child_deps.nil?\n end\n deps\n end\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def dependencies\n node.output[carrier].keys\n end", "def find_all req\n res = []\n\n name = req.dependency.name\n\n @all[name].each do |uri, n|\n if req.dependency.match? n then\n res << Gem::DependencyResolver::IndexSpecification.new(\n self, n.name, n.version, uri, n.platform)\n end\n end\n\n res\n end", "def printEffectDep\r\n effectDep=\"\\n\"\r\n effectDepArray = Array.new\r\n buffer = \"\"\r\n @effectIds.each do\r\n |effectId|\r\n effect = SWUI::Effect.find_by.effect_name(effectId).first\r\n unless effect.nil?\r\n buffer = effect.dependencies\r\n unless buffer.nil?\r\n buffer.split(\"\\n\").each do\r\n |dependence|\r\n if (!effectDepArray.include?(dependence)) then\r\n effectDepArray.push dependence\r\n effectDep << \"#{dependence}\\n\"\r\n end\r\n end\r\n end\r\n end\r\n end\r\n return effectDep\r\n end", "def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def dependencies_for_job(dependents)\n if dependents.is_a? Symbol\n # Referring to another stage (eg :publishers)\n dependents_for_stage(dependents)\n elsif dependents.is_a? Array\n # Referring to an array of dependencies (eg [:publishers, Publisher2])\n dependencies_from_array(dependents)\n else\n # Referring to another job (eg Publisher1)\n [dependents] + dependents_for(dependents)\n end\n end" ]
[ "0.6282729", "0.60833704", "0.59941137", "0.5974323", "0.59449285", "0.59378165", "0.59243274", "0.5912404", "0.58951056", "0.5886674", "0.5882696", "0.5862524", "0.5808963", "0.580879", "0.57879496", "0.57823074", "0.57759726", "0.5769148", "0.5765001", "0.5753374", "0.57489234", "0.57462394", "0.5732012", "0.5719378", "0.5719378", "0.5719378", "0.5719378", "0.56723505", "0.566325", "0.5628784", "0.5624622", "0.5606956", "0.56035537", "0.5593641", "0.5577798", "0.5577798", "0.5577798", "0.55750126", "0.55649996", "0.55490065", "0.5545943", "0.5519754", "0.5515969", "0.54925716", "0.5486643", "0.54855394", "0.5469523", "0.54579", "0.5451229", "0.543632", "0.542367", "0.5407673", "0.5407576", "0.54017025", "0.5400966", "0.5398868", "0.53981555", "0.53885806", "0.53885293", "0.5384275", "0.53715366", "0.5362355", "0.5355776", "0.5349437", "0.53472203", "0.53472203", "0.53472203", "0.5338402", "0.53380525", "0.5328763", "0.5307124", "0.52993673", "0.52981806", "0.5293058", "0.5290675", "0.5284659", "0.52812874", "0.5276344", "0.52660394", "0.52601296", "0.5240484", "0.5231976", "0.5228771", "0.5221427", "0.5221309", "0.52142584", "0.5212782", "0.5212228", "0.52105635", "0.5208141", "0.52068627", "0.5204947", "0.5201724", "0.51995516", "0.5196609", "0.51935303", "0.51813656", "0.51807386", "0.5178524", "0.5177915" ]
0.6963232
0
GET /dependences/1 GET /dependences/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dependences = Dependence.all\n end", "def index\n @dependencies = Dependency.all\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end", "def body\n do_cached_with(key: \"evss_dependents_retrieve_#{@user.uuid}\") do\n raw_response = EVSS::Dependents::Service.new(@user).retrieve\n EVSS::Dependents::RetrieveInfoResponse.new(raw_response.status, raw_response)\n end.body\n end", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def external_dep;\treturn @json_data['external_dep'];\tend", "def deps_response(base, env={})\n @semaphore.synchronize do\n refresh(env)\n base = Pathname.new(base)\n unless @deps[base]\n response = @deps[base] ||= Rack::Response.new\n response.write \"// Dynamic Deps by Closure Script\\n\"\n @files.sort{|a,b|(a[1][:path]||'')<=>(b[1][:path]||'')}.each do |filename, dep|\n if dep[:path]\n path = Pathname.new(dep[:path]).relative_path_from(base)\n path = \"#{path}?#{dep[:mtime].to_i}\"\n response.write \"goog.addDependency(#{path.dump}, #{dep[:provide].inspect}, #{dep[:require].inspect});\\n\"\n end\n end\n response.headers['Content-Type'] = 'application/javascript'\n response.headers['Cache-Control'] = \"max-age=#{[1,@dwell.floor].max}, private, must-revalidate\"\n response.headers['Last-Modified'] = Time.now.httpdate\n end\n mod_since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']) rescue nil\n if mod_since == Time.httpdate(@deps[base].headers['Last-Modified'])\n Rack::Response.new [], 304 # Not Modified\n else\n @deps[base]\n end\n end\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n render json: @compromise\n end", "def validateDependencies\n params[:dependencies].split(\"&\").each do |dependency|\n dependency_values = dependency.split(\"=\")\n versions = Version.where(:part_name => dependency_values[0])\n\n if versions.empty?\n render :text => \"Part: #{dependency_values[0]} does not exist.\", status: 400\n return\n else\n part = versions.where(:version => dependency_values[1]).first\n if part.nil?\n render :text => \"Part: #{dependency_values[0]} with version: #{dependency_values[1]} does not exist\", status: 400\n return\n end\n end\n end\n\n render :nothing => true, status: 200\n end", "def dependency name, version, type = :runtime\n raise \"Unknown dependency type: #{type}\" unless\n [:runtime, :dev, :development, :developer].include? type\n\n ary = if type == :runtime then\n extra_deps\n else\n extra_dev_deps\n end\n\n ary << [name, version]\n end", "def create\n @dependency = Dependency.new(dependency_params)\n\n respond_to do |format|\n if @dependency.save\n format.html { redirect_to @dependency, notice: 'Dependency was successfully created.' }\n format.json { render :show, status: :created, location: @dependency }\n else\n format.html { render :new }\n format.json { render json: @dependency.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_dependencies\n end", "def dependents(options: {})\n\n Collection.new(parse(client.get(\"/tasks/#{gid}/dependents\", options: options)), type: self.class, client: client)\n end", "def extract_dependancy(component)\n bower_file = File.join(component, BOWERJSON)\n\n if(!File.exist?(bower_file))\n logger.warn \"no #{BOWERJSON} file found for #{component}\"\n return\n end\n\n bower_file = JSON.parse(File.read(bower_file))\n if(!bower_file.has_key?('main'))\n logger.warn \"No main section found for #{component}\"\n return\n end\n\n files_ = bower_file['main']\n files = files_.is_a?(Array) ? files_ : [files_]\n\n {\n :name => bower_file['name'],\n :files => files\n }\n end", "def show\n @version = Version.find(params[:id])\n @versionconfig= @version.version_configurations.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def repo1\n addons = Addon.where(\"lower(repos.name) = ?\", params[:repo_name].downcase)\n render json: to_v1_repo_hashes(addons)\n end", "def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end", "def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def go_list_deps\n args = [\"-deps\"]\n args << \"-mod=vendor\" if config.dig(\"go\", \"mod\") == \"vendor\"\n\n # the CLI command returns packages in a pretty-printed JSON format but\n # not separated by commas. this gsub adds commas after all non-indented\n # \"}\" that close root level objects.\n # (?!\\z) uses negative lookahead to not match the final \"}\"\n deps = package_info_command(*args).gsub(/^}(?!\\z)$/m, \"},\")\n JSON.parse(\"[#{deps}]\")\n end", "def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n end", "def show\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromise }\n end\n end", "def get_dependencies(_fidl, _interaction_types, _project_dependencies)\n # noop\n end", "def requirements\n @use_case = UseCase.find(params[:id])\n @project = @use_case.project\n @requirements = @use_case.requirements\n respond_to do |format|\n format.html \n end\n end", "def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end", "def find_all(req)\n res = []\n\n return res unless @remote\n\n if @to_fetch.include?(req.name)\n prefetch_now\n end\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number], @prerelease\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def get_architect_dependencytracking_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking ...\"\n end\n \n \n # verify the required parameter 'name' is set\n fail ArgumentError, \"Missing the required parameter 'name' when calling ArchitectApi.get_architect_dependencytracking\" if name.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'name'] = name\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if opts[:'object_type']\n query_params[:'consumedResources'] = opts[:'consumed_resources'] if opts[:'consumed_resources']\n query_params[:'consumingResources'] = opts[:'consuming_resources'] if opts[:'consuming_resources']\n query_params[:'consumedResourceType'] = @api_client.build_collection_param(opts[:'consumed_resource_type'], :multi) if opts[:'consumed_resource_type']\n query_params[:'consumingResourceType'] = @api_client.build_collection_param(opts[:'consuming_resource_type'], :multi) if opts[:'consuming_resource_type']\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 \n auth_names = ['PureCloud Auth']\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 => 'DependencyObjectEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_architect_dependencytracking_with_http_info(name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking ...\"\n end\n \n \n # verify the required parameter 'name' is set\n fail ArgumentError, \"Missing the required parameter 'name' when calling ArchitectApi.get_architect_dependencytracking\" if name.nil?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'name'] = name\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if opts[:'object_type']\n query_params[:'consumedResources'] = opts[:'consumed_resources'] if opts[:'consumed_resources']\n query_params[:'consumingResources'] = opts[:'consuming_resources'] if opts[:'consuming_resources']\n query_params[:'consumedResourceType'] = @api_client.build_collection_param(opts[:'consumed_resource_type'], :multi) if opts[:'consumed_resource_type']\n query_params[:'consumingResourceType'] = @api_client.build_collection_param(opts[:'consuming_resource_type'], :multi) if opts[:'consuming_resource_type']\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyObjectEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_version\n response = self.class.get(\"/service/#{$service_id}/version/#{$service_version}\", {\n headers: {\"Fastly-Key\" => $key}\n })\n end", "def get_dependency(name, constraint)\n @dependencies.fetch(Graph.dependency_key(name, constraint), nil)\n end", "def retrieve_dependency(dependencies, key)\n raise ArgumentError, \"dependency #{key} is not found\" unless dependencies.key?(key)\n\n dependencies[key]\n end", "def show\n @dependent_relationship = DependentRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependent_relationship }\n end\n end", "def get_concept_required_edges\n concept = @course.topicconcepts.concepts.where(id: params[:id]).first\n if !concept.nil?\n required_concept_edges = concept.concept_edge_required_concepts\n respond_to do |format|\n format.json { render :json => { :current_concept => concept, :dependencies => required_concept_edges.map { |e| { concept_edge_id: e.id, required_concept_name: e.required_concept.name} }}} \n end\n else\n raise \"Concept id is invalid\"\n end\n end", "def get_dependencies\n @dependencies\n end", "def find_all req\n res = []\n\n return res unless @remote\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::Resolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def dependencies_for(specification)\n []\n end", "def set_dependence\n @dependence = Dependence.find(params[:id])\n end", "def dependencies\n []\n end", "def dependent\n Dependent.find_by(id: self.dependent_id)\n end", "def search\n request_params = prepare_search_params\n if request_params[:packages].empty?\n return render json: {\n messeage: 'please provide us with packages to provide you with dependencies',\n },\n status: 200\n end\n\n operating_system = OperatingSystem.find_by(\n name: request_params[:operating_system][:name],\n vendor: request_params[:operating_system][:vendor],\n bits: request_params[:operating_system][:bits],\n )\n package_manager = operating_system.package_manager if operating_system\n\n packages = []\n request_params[:packages].each do |package|\n package_name = package[:name]\n package_version = package[:version]\n\n packages << Package.find_by(name: package_name, version: package_version)\n end\n\n if packages.empty?\n return render json: {\n messeage: \"sorry we haven't any data about your gems\",\n },\n status: 404\n end\n\n packages_dependencies = []\n packages.compact.each do |package|\n packages_dependencies <<\n { package_name: package[:name], package_dependencies: package.package_dependencies }\n end\n\n system_dependencies = []\n packages_dependencies.compact.each do |package|\n dependencies = []\n package[:package_dependencies].each do |p|\n dependencies = PackageSystemDependency.where(\n package: p, operating_system: operating_system,\n ).map(&:system_dependency)\n end\n system_dependencies << {\n package_name: package[:package_name],\n system_dependencies: dependencies,\n }\n end\n\n render json: { packages: system_dependencies, package_manager: package_manager }, status: 200\n end", "def depends\n return @depends if @depends\n\n deps = survey.dependencies.includes({:dependency_conditions => {:question => :answers}})\n\n resps = self.responses.includes(:answer)\n\n # gather if the dependencies are met in a hash\n @depends = deps.all.reduce({}) do |mem, v|\n mem[v.id] = v.is_met? self, resps\n mem\n end\n end", "def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def dependency_params\n params.require(:dependency).permit(:dependent_id, :depended_id)\n end", "def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end", "def getDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getDeps(csproj) \r\n end\r\n return deps.uniq\r\nend", "def prefetch reqs\n return unless @remote\n names = reqs.map { |r| r.dependency.name }\n needed = names - @data.keys\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n loaded = []\n\n Marshal.load(str).each do |ver|\n name = ver[:name]\n\n @data[name] << ver\n loaded << name\n end\n\n (needed - loaded).each do |missing|\n @data[missing] = []\n end\n end", "def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def dependencies\n []\n end", "def dependencies( *args )\n names = args # note: for now assume all args are just names\n # e.g. 'pluto-models', 'pluto-update', etc.\n deps = @versions.select do |rec| names.include?( rec[0] ) end\n .map do |rec| [rec[0], rec[1]] end\n\n ## todo/fix: throw exception if dependency is missing!\n ## names.size == deps.size\n puts \"names.size == deps.size #{names.size} == #{deps.size}\"\n deps\n end", "def update\n respond_to do |format|\n if @dependency.update(dependency_params)\n format.html { redirect_to @dependency, notice: 'Dependency was successfully updated.' }\n format.json { render :show, status: :ok, location: @dependency }\n else\n format.html { render :edit }\n format.json { render json: @dependency.errors, status: :unprocessable_entity }\n end\n end\n end", "def package_dependency_params\n data = params.require(:package_dependency).permit(\n first_package: %i(name version),\n second_package: %i(name version),\n )\n\n first_package = Package.find_by(name: data[:first_package][:name],\n version: data[:first_package][:version],)\n second_package = Package.find_by(name: data[:second_package][:name],\n version: data[:second_package][:version],)\n\n {\n first_package_id: first_package.id,\n second_package_id: second_package.id,\n }\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def get_architect_dependencytracking_types_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_types ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\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 \n auth_names = ['PureCloud Auth']\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 => 'DependencyTypeEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_types\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_versions\r\n versions_nodes = BankNodestructure.version_gather(params[:subject], params[:grade])\r\n render json: versions_nodes.to_json\r\n end", "def request_dependencies \n attrib_needed! :content, true if recipe_page_needed?\n from_gleaning = Gleaning.tracked_attributes & needed_attributes\n if from_gleaning.present?\n build_gleaning if !gleaning\n gleaning.request_attributes *from_gleaning\n end\n from_mercury = MercuryResult.tracked_attributes & needed_attributes\n if from_mercury.present?\n # Translate from our needed attributes to those provided by mercury_result\n build_mercury_result if !mercury_result\n mercury_result.request_attributes *from_mercury\n end\n end", "def get_architect_dependencytracking_build_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_build ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/build\".sub('{format}','json')\n\n # query parameters\n query_params = {}\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_build\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def dependencies\n []\n end", "def create\n @dependence = Dependence.new(dependence_params)\n\n respond_to do |format|\n if @dependence.save\n format.html { redirect_to @dependence, notice: 'Dependence was successfully created.' }\n format.json { render :show, status: :created, location: @dependence }\n else\n format.html { render :new }\n format.json { render json: @dependence.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def request_dependencies \n # If we haven't persisted, then the page_ref has no connection back\n page_ref.recipes << self unless persisted? || page_ref.recipes.to_a.find { |r| r == self }\n page_ref.request_attributes *(needed_attributes & [ :picurl, :title, :description ]) # Those to be got from PageRef\n end", "def dependency_versions(args = {}, &bl)\n versions = {}\n args = {:recursive => true, :dev_deps => true, :versions => versions}.merge(args)\n deps.each do |dep|\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge!(gem.versions(args, &bl))\n end\n versions\n end", "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def dependencies\n @dependencies\n end", "def set_dependency\n @dependency = Dependency.find(params[:id])\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_architect_dependencytracking_build_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_build ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/build\".sub('{format}','json')\n\n # query parameters\n query_params = {}\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 \n auth_names = ['PureCloud Auth']\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 => 'DependencyStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_build\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def dependencies_for(specification)\n specification.dependencies(@cache, @resolver_ui)\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def dependency\n @dependency ||= Bundler.load.gems.find { |dep| dep.name == @name }\n end", "def dependents(resource)\n tree_from_vertex(resource).keys\n end", "def requirement\n @dependency.requirement\n end", "def depend_on(dependant, env = environment.name, requirement = nil)\n fail('Dependant cannot be nil') if dependant.nil? || dependant.eql?('')\n fail('Environment cannot be nil') if env.nil? || env.eql?('')\n dep = if dependant == :all\n if env == :all\n Stacks::Dependencies::MultiServiceDependency.new(self,\n Stacks::Dependencies::AllKubernetesSelector.new(requirement),\n requirement)\n else\n fail('Selection by a specific environment not yet support for :all dependency')\n end\n elsif dependant.is_a?(Array)\n selectors = dependant.map { |d| Stacks::Dependencies::ServiceSelector.new(d, env) }\n Stacks::Dependencies::SingleServiceDependency.new(self,\n Stacks::Dependencies::MultiSelector.new(selectors),\n requirement)\n else\n Stacks::Dependencies::SingleServiceDependency.new(self,\n Stacks::Dependencies::ServiceSelector.new(dependant, env),\n requirement)\n end\n\n @depends_on << dep unless @depends_on.include? dep\n end", "def dependencies\n @dependencies ||= []\n end", "def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end", "def versions(name) # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + name\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n lines(str).each do |ver|\n number, platform, dependencies, requirements = parse_gem(ver)\n\n platform ||= \"ruby\"\n dependencies = dependencies.map {|dep_name, reqs| [dep_name, reqs.join(\", \")] }\n requirements = requirements.map {|req_name, reqs| [req_name.to_sym, reqs] }.to_h\n\n @data[name] << { name: name, number: number, platform: platform, dependencies: dependencies, requirements: requirements }\n end\n\n @data[name]\n end", "def contingents\n ExtensionDependency.includes(extension_version: :extension)\n .where(extension_id: id)\n .sort_by do |cd|\n [\n cd.extension_version.extension.name,\n Semverse::Version.new(SemverNormalizer.call(cd.extension_version.version))\n ]\n end\n end", "def fetch_specification(name, version)\n url = host + \"/quick/#{Configuration.marshal_identifier}\" \\\n \"/#{name}-#{version}.gemspec.rz\"\n\n http_get(url).body\n end", "def load_dependencies\n result = zh_client.dependencies(repo_name)\n\n result[\"dependencies\"].each do |hash|\n blocking = add_or_find(hash[\"blocking\"])\n blocked = add_or_find(hash[\"blocked\"])\n\n add_edge(blocked, blocking)\n end\n end", "def index\n @independents = @member.independents\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @independents }\n end\n end", "def index\n @genre_dependencies = GenreDependency.all\n end", "def get_dependencies_from_path(metadata_path)\n metadata = JSON.parse(File.read(metadata_path), symbolize_names: true)\n get_dependencies_from_metadata(metadata)\n end", "def index\n response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end", "def get_architect_dependencytracking_type_with_http_info(type_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_architect_dependencytracking_type ...\"\n end\n \n \n # verify the required parameter 'type_id' is set\n fail ArgumentError, \"Missing the required parameter 'type_id' when calling ArchitectApi.get_architect_dependencytracking_type\" if type_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/types/{typeId}\".sub('{format}','json').sub('{' + 'typeId' + '}', type_id.to_s)\n\n # query parameters\n query_params = {}\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DependencyType')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#get_architect_dependencytracking_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def print_hoespec_dependencies( deps )\n\t\tdeps.each_key do |dep|\n\t\t\t$stderr.puts \"self.dependency '%s', '%s'\" % [ dep.name, dep.version.to_s ]\n\t\tend\n\tend", "def dependencies\n @dependencies.values\n end", "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def dependencies\n @dependencies ||= {}\n end", "def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end", "def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end", "def fetch_dependency_remote_specs(gem_names, &blk)\n Bundler.ui.debug \"Query Gemcutter Dependency Endpoint API: #{gem_names.join(' ')}\"\n uri = URI.parse(\"#{@remote_uri}api/v1/dependencies?gems=#{gem_names.join(\",\")}\")\n marshalled_deps = fetch(uri)\n gem_list = Marshal.load(marshalled_deps)\n\n spec_list = gem_list.map do |s|\n [s[:name], Gem::Version.new(s[:number]), s[:platform]]\n end\n deps_list = gem_list.map do |s|\n s[:dependencies].collect {|d| d.first }\n end.flatten.uniq\n\n [spec_list, deps_list]\n end", "def destroy\n @dependence.destroy\n respond_to do |format|\n format.html { redirect_to dependences_url, notice: 'Dependence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @st_has_deps = StHasDep.all\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_dep_names(data)\n return unless data.key?(\"dependencies\")\n\n data['dependencies'].each do |name, dep_info|\n @deps[name] = {}\n get_dep_names(dep_info) if dep_info['dependencies']\n end\n end", "def json_get(path, params={})\n json_request(:get, path, params)\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def index\n @vdocs_requirements = @contract.vdocs_requirements.order(\"code\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vdocs_requirements }\n end\n end", "def dependencies_for(specification)\n specification.dependencies\n end" ]
[ "0.67252254", "0.6272436", "0.61390907", "0.61349386", "0.58568966", "0.56583935", "0.5623044", "0.5592996", "0.55657125", "0.5530453", "0.5511917", "0.55063176", "0.54625285", "0.54616165", "0.5455603", "0.54492867", "0.54349375", "0.54132295", "0.5410608", "0.54065967", "0.53957766", "0.5394717", "0.53780395", "0.53681076", "0.53619105", "0.5351896", "0.5348078", "0.53265506", "0.5326059", "0.5326059", "0.5322308", "0.53173655", "0.5299698", "0.52937025", "0.5290734", "0.5286308", "0.52845204", "0.5282853", "0.528104", "0.52766865", "0.5267342", "0.5257217", "0.5256352", "0.5255997", "0.524369", "0.5232317", "0.5230282", "0.5222085", "0.5217364", "0.5206646", "0.5205481", "0.52026343", "0.5193367", "0.51895046", "0.51821196", "0.5178301", "0.5175932", "0.5171928", "0.5164695", "0.51543075", "0.51444507", "0.51385576", "0.5132368", "0.51320165", "0.51232976", "0.5113777", "0.5111853", "0.5107331", "0.51050335", "0.5103013", "0.50987256", "0.509078", "0.5087789", "0.5086229", "0.5085987", "0.5084818", "0.5084205", "0.5079325", "0.50773335", "0.5075432", "0.50718427", "0.5067795", "0.50604695", "0.5056168", "0.5052121", "0.50513285", "0.5050856", "0.5048057", "0.50467294", "0.50440514", "0.5035823", "0.50331604", "0.5022897", "0.50123477", "0.5011492", "0.5011492", "0.500759", "0.50047493", "0.4998378", "0.4994139", "0.49844134" ]
0.0
-1
POST /dependences POST /dependences.json
def create @dependence = Dependence.new(dependence_params) respond_to do |format| if @dependence.save format.html { redirect_to @dependence, notice: 'Dependence was successfully created.' } format.json { render :show, status: :created, location: @dependence } else format.html { render :new } format.json { render json: @dependence.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @dependency = Dependency.new(dependency_params)\n\n respond_to do |format|\n if @dependency.save\n format.html { redirect_to @dependency, notice: 'Dependency was successfully created.' }\n format.json { render :show, status: :created, location: @dependency }\n else\n format.html { render :new }\n format.json { render json: @dependency.errors, status: :unprocessable_entity }\n end\n end\n end", "def dependency_params\n params.require(:dependency).permit(:dependent_id, :depended_id)\n end", "def add_dependents(dependents: required(\"dependents\"), options: {}, **data)\n with_params = data.merge(dependents: dependents).reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.post(\"/tasks/#{gid}/addDependents\", body: with_params, options: options)), type: self.class, client: client)\n end", "def dependence_params\n params.require(:dependence).permit(:name, :description, :state)\n end", "def service_dependance_params\n params.require(:service_dependance).permit(:depending_id, :service_id)\n end", "def create_dependancies\n create_course_plan()\n end", "def index\n @dependences = Dependence.all\n end", "def request_dependencies\n end", "def request_dependencies \n # If we haven't persisted, then the page_ref has no connection back\n page_ref.recipes << self unless persisted? || page_ref.recipes.to_a.find { |r| r == self }\n page_ref.request_attributes *(needed_attributes & [ :picurl, :title, :description ]) # Those to be got from PageRef\n end", "def validateDependencies\n params[:dependencies].split(\"&\").each do |dependency|\n dependency_values = dependency.split(\"=\")\n versions = Version.where(:part_name => dependency_values[0])\n\n if versions.empty?\n render :text => \"Part: #{dependency_values[0]} does not exist.\", status: 400\n return\n else\n part = versions.where(:version => dependency_values[1]).first\n if part.nil?\n render :text => \"Part: #{dependency_values[0]} with version: #{dependency_values[1]} does not exist\", status: 400\n return\n end\n end\n end\n\n render :nothing => true, status: 200\n end", "def add_dependent_entities\n (NUM_DEPENDENT_FORM_ENTITIES - @resource.creators.length).times do\n @resource.creators.build\n end\n (NUM_DEPENDENT_FORM_ENTITIES - @resource.extents.length).times do\n @resource.extents.build\n end\n (NUM_DEPENDENT_FORM_ENTITIES - @resource.resource_dates.length).times do\n @resource.resource_dates.build\n end\n (NUM_DEPENDENT_FORM_ENTITIES - @resource.resource_notes.length).times do\n @resource.resource_notes.build\n end\n (NUM_DEPENDENT_FORM_ENTITIES - @resource.subjects.length).times do\n @resource.subjects.build\n end\n end", "def add_dependent obj\n $log.debug \" ADDING DEPENDE #{obj}\"\n @dependents ||= []\n @dependents << obj\n end", "def add_depend_list\n list = ''\n if @depedencies.nil? or @depedencies.size == 0\n list = ''\n elsif @depedencies.class == String\n list = \"=> [:#{@depedencies}] \"\n elsif @depedencies.class == Array\n list = '=> [ '\n need_comma = false\n for element in @depedencies\n list = list + ', ' if need_comma\n list = list + \":#{element}\"\n @log.info \" - dependent from : #{element}\"\n need_comma = true\n end\n list = list + ' ] '\n else\n @log.fatal { \"Cannot parse dependencies [#{@depedencies}]\" }; exit\n end\n return list\n end", "def create_dependencies(con)\n @resolving_dependencies = true\n dependencies.each do |_, d|\n fail CircularDependencyError.new(name, d.name) if d.resolving_dependencies\n d.create_dependencies(con)\n d.create_or_update!(con)\n end\n @resolving_dependencies = false\n end", "def depends\n return @depends if @depends\n\n deps = survey.dependencies.includes({:dependency_conditions => {:question => :answers}})\n\n resps = self.responses.includes(:answer)\n\n # gather if the dependencies are met in a hash\n @depends = deps.all.reduce({}) do |mem, v|\n mem[v.id] = v.is_met? self, resps\n mem\n end\n end", "def create\n @genre_dependency = GenreDependency.new(genre_dependency_params)\n\n respond_to do |format|\n if @genre_dependency.save\n format.html { redirect_to @genre_dependency, notice: 'Genre dependency was successfully created.' }\n format.json { render :show, status: :created, location: @genre_dependency }\n else\n format.html { render :new }\n format.json { render json: @genre_dependency.errors, status: :unprocessable_entity }\n end\n end\n end", "def dependencies_for_job(dependents)\n if dependents.is_a? Symbol\n # Referring to another stage (eg :publishers)\n dependents_for_stage(dependents)\n elsif dependents.is_a? Array\n # Referring to an array of dependencies (eg [:publishers, Publisher2])\n dependencies_from_array(dependents)\n else\n # Referring to another job (eg Publisher1)\n [dependents] + dependents_for(dependents)\n end\n end", "def depends_on(*depends)\n @depends = depends.dup\n\n # Increment dependent references\n @depends.each { |b| b.ref }\n end", "def check_dependencies\n ok = true\n\n @config.each_pair { |type, values|\n next if !values.instance_of?(Array)\n _shortclass, cfg_name, _cfg_plural, _classname = MU::Cloud.getResourceNames(type, false)\n next if !cfg_name\n values.each { |resource|\n next if !resource.kind_of?(Hash) or resource[\"dependencies\"].nil?\n addme = []\n deleteme = []\n\n resource[\"dependencies\"].each { |dependency|\n dependency[\"their_phase\"] ||= dependency[\"phase\"]\n dependency.delete(\"phase\")\n dependency[\"my_phase\"] ||= dependency[\"no_create_wait\"] ? \"groom\" : \"create\"\n dependency.delete(\"no_create_wait\")\n # make sure the thing we depend on really exists\n sibling = haveLitterMate?(dependency['name'], dependency['type'])\n if !sibling\n MU.log \"Missing dependency: #{type}{#{resource['name']}} needs #{cfg_name}{#{dependency['name']}}\", MU::ERR\n ok = false\n next\n end\n\n # Fudge dependency declarations to quash virtual_names that we know\n # are extraneous. Note that wee can't do all virtual names here; we\n # have no way to guess which of a collection of resources is the\n # real correct one.\n if sibling['virtual_name'] == dependency['name']\n real_resources = []\n found_exact = false\n resource[\"dependencies\"].each { |dep_again|\n if dep_again['type'] == dependency['type'] and sibling['name'] == dep_again['name']\n dependency['name'] = sibling['name']\n found_exact = true\n break\n end\n }\n if !found_exact\n all_siblings = haveLitterMate?(dependency['name'], dependency['type'], has_multiple: true)\n if all_siblings.size > 0\n all_siblings.each { |s|\n newguy = dependency.clone\n newguy['name'] = s['name']\n addme << newguy\n }\n deleteme << dependency\n MU.log \"Expanding dependency which maps to virtual resources to all matching real resources\", MU::NOTICE, details: { sibling['virtual_name'] => addme }\n next\n end\n end\n end\n\n if dependency['their_phase'] == \"groom\"\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['their_phase'] != \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n\n # Check for a circular relationship that will lead to a deadlock\n # when creating resource. This only goes one layer deep, and does\n # not consider groom-phase deadlocks.\n if dependency['their_phase'] == \"groom\" or\n dependency['my_phase'] == \"groom\" or (\n !MU::Cloud.resourceClass(sibling['cloud'], type).deps_wait_on_my_creation and\n !MU::Cloud.resourceClass(resource['cloud'], type).waits_on_parent_completion\n )\n next\n end\n\n if sibling['dependencies']\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['my_phase'] == \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n }\n resource[\"dependencies\"].reject! { |dep| deleteme.include?(dep) }\n resource[\"dependencies\"].concat(addme)\n resource[\"dependencies\"].uniq!\n\n }\n }\n\n ok\n end", "def dependencies_for(specification)\n []\n end", "def package_dependency_params\n data = params.require(:package_dependency).permit(\n first_package: %i(name version),\n second_package: %i(name version),\n )\n\n first_package = Package.find_by(name: data[:first_package][:name],\n version: data[:first_package][:version],)\n second_package = Package.find_by(name: data[:second_package][:name],\n version: data[:second_package][:version],)\n\n {\n first_package_id: first_package.id,\n second_package_id: second_package.id,\n }\n end", "def destroy\n @dependence.destroy\n respond_to do |format|\n format.html { redirect_to dependences_url, notice: 'Dependence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_dependents(dependents: required(\"dependents\"), options: {}, **data)\n with_params = data.merge(dependents: dependents).reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.post(\"/tasks/#{gid}/removeDependents\", body: with_params, options: options)), type: self.class, client: client)\n end", "def request_dependencies \n attrib_needed! :content, true if recipe_page_needed?\n from_gleaning = Gleaning.tracked_attributes & needed_attributes\n if from_gleaning.present?\n build_gleaning if !gleaning\n gleaning.request_attributes *from_gleaning\n end\n from_mercury = MercuryResult.tracked_attributes & needed_attributes\n if from_mercury.present?\n # Translate from our needed attributes to those provided by mercury_result\n build_mercury_result if !mercury_result\n mercury_result.request_attributes *from_mercury\n end\n end", "def depends(name)\n @dependencies << name unless @dependencies.include?(name)\n end", "def dependents(options: {})\n\n Collection.new(parse(client.get(\"/tasks/#{gid}/dependents\", options: options)), type: self.class, client: client)\n end", "def ensure_dependences_script\n fname = dependences_scriptname\n return if fname.exist?\n fname.dirname.mkpath\n fname.open('w')\n end", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\n end", "def add_dep file, deps\r\n @flat_depends[file] = deps\r\n end", "def merge_dependencies(data)\n data['dependencies'].each do |dep|\n add_dependency(dep['name'], dep['version_requirement'], dep['repository'])\n end\n\n # Clear dependencies so @data dependencies are not overwritten\n data.delete 'dependencies'\n end", "def add_dependencies(dependencies: required(\"dependencies\"), options: {}, **data)\n with_params = data.merge(dependencies: dependencies).reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.post(\"/tasks/#{gid}/addDependencies\", body: with_params, options: options)), type: self.class, client: client)\n end", "def diffeq_depends_on()\n unless @diffeq_deps\n my_deps = depends_on # calculate @depends_on\n\n d1_name = Variable.derivative_of_name(@name)\n my_d1 = @parent.variable_by_name(d1_name)\n d1_deps = my_d1.depends_on\n\n @diffeq_deps = my_deps | d1_deps\n end\n @diffeq_deps\n end", "def deploy_api(name, rev, env, path)\n post(\"/apis/#{name}/revisions/#{rev}/deployments\", {:action => 'deploy', :env => env, :basepath => path})\n end", "def builddepends\n # Handle the requires\n self.class.relationship_params.collect do |klass|\n if param = @parameters[klass.name]\n param.to_edges\n end\n end.flatten.reject { |r| r.nil? }\n end", "def set_dependence\n @dependence = Dependence.find(params[:id])\n end", "def get_dep_names(data)\n return unless data.key?(\"dependencies\")\n\n data['dependencies'].each do |name, dep_info|\n @deps[name] = {}\n get_dep_names(dep_info) if dep_info['dependencies']\n end\n end", "def test_provision_dependent_packages\n\n stub_api.expect{ |agent, op, params|\n params[:command] == \"get_bundle.rb\"\n }.returns(JsonResponse.new(\"success\")).times(2)\n\n @cmd.bundle = \"test_bundle_with_dep\"\n Bixby::Provisioning.new.provision(@agent, @cmd)\n\n assert_api_requests\n end", "def depends_on=(value)\n @depends_on = value\n end", "def deps_response(base, env={})\n @semaphore.synchronize do\n refresh(env)\n base = Pathname.new(base)\n unless @deps[base]\n response = @deps[base] ||= Rack::Response.new\n response.write \"// Dynamic Deps by Closure Script\\n\"\n @files.sort{|a,b|(a[1][:path]||'')<=>(b[1][:path]||'')}.each do |filename, dep|\n if dep[:path]\n path = Pathname.new(dep[:path]).relative_path_from(base)\n path = \"#{path}?#{dep[:mtime].to_i}\"\n response.write \"goog.addDependency(#{path.dump}, #{dep[:provide].inspect}, #{dep[:require].inspect});\\n\"\n end\n end\n response.headers['Content-Type'] = 'application/javascript'\n response.headers['Cache-Control'] = \"max-age=#{[1,@dwell.floor].max}, private, must-revalidate\"\n response.headers['Last-Modified'] = Time.now.httpdate\n end\n mod_since = Time.httpdate(env['HTTP_IF_MODIFIED_SINCE']) rescue nil\n if mod_since == Time.httpdate(@deps[base].headers['Last-Modified'])\n Rack::Response.new [], 304 # Not Modified\n else\n @deps[base]\n end\n end\n end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def create\n @dependent_relationship = DependentRelationship.new(params[:dependent_relationship])\n\n respond_to do |format|\n if @dependent_relationship.save\n format.html { redirect_to @dependent_relationship, notice: 'Dependent relationship was successfully created.' }\n format.json { render json: @dependent_relationship, status: :created, location: @dependent_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dependent_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def dependencies( *args )\n names = args # note: for now assume all args are just names\n # e.g. 'pluto-models', 'pluto-update', etc.\n deps = @versions.select do |rec| names.include?( rec[0] ) end\n .map do |rec| [rec[0], rec[1]] end\n\n ## todo/fix: throw exception if dependency is missing!\n ## names.size == deps.size\n puts \"names.size == deps.size #{names.size} == #{deps.size}\"\n deps\n end", "def depend(location, type, *args)\n deps = fetch(:dependencies, {})\n deps[location] ||= {}\n deps[location][type] ||= []\n deps[location][type] << args\n set :dependencies, deps\n end", "def add_dependency(job)\n Jobs::DependentJob.transaction { \n # d =Jobs::DependentJobDependency.create(:job=>self, :prereq=>job)\n self.dependencies << job\n self.save!\n }\n end", "def declared_dependencies(ast)\n raise_unless_xpath!(ast)\n deps = ast.xpath(%q{//command[ident/@value='depends']/\n descendant::args_add/descendant::tstring_content[1]})\n # handle quoted word arrays\n var_ref = ast.xpath(%q{//command[ident/@value='depends']/\n descendant::var_ref/ident})\n unless var_ref.empty?\n deps += ast.xpath(%Q{//block_var/params/ident#{var_ref.first['value']}/\n ancestor::method_add_block/call/descendant::tstring_content})\n end\n deps.map{|dep| dep['value']}\n end", "def require_nested_dependencies_for(possibility_set)\n nested_dependencies = dependencies_for(possibility_set.latest_version)\n debug(depth) { \"Requiring nested dependencies (#{nested_dependencies.join(', ')})\" }\n nested_dependencies.each do |d|\n activated.add_child_vertex(name_for(d), nil, [name_for(possibility_set.latest_version)], d)\n parent_index = states.size - 1\n parents = @parents_of[d]\n parents << parent_index if parents.empty?\n end\n\n push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?)\n end", "def create\n @vdocs_requirement = VdocsRequirement.new(params[:vdocs_requirement])\n\n respond_to do |format|\n if @contract.vdocs_requirements << @vdocs_requirement\n flash[:notice] = 'VDocsRequirement was successfully created.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { render :xml => @vdocs_requirement, :status => :created, :location => @vdocs_requirement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vdocs_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dependencia = Dependencia.new(dependencia_params)\n\n respond_to do |format|\n if @dependencia.save\n logger.info { params }\n format.html { redirect_to @dependencia, notice: 'Dependencia se creo correctamente.' }\n format.json { render json: @dependencia, status: :created, location: @dependencia }\n format.js {\n if params.has_key?(\"listado\")\n @listado=true\n else\n @listado = false\n end\n }\n else\n @organismo = Organismo.all\n format.html { render action: \"new\" }\n format.json { render json: @dependencia.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def depend(location, type, *args)\n deps = fetch(:dependencies, {})\n deps[location] ||= {}\n deps[location][type] ||= []\n deps[location][type] << args\n set :dependencies, deps\n end", "def depend(location, type, *args)\n deps = fetch(:dependencies, {})\n deps[location] ||= {}\n deps[location][type] ||= []\n deps[location][type] << args\n set :dependencies, deps\n end", "def create_dependency_graph\n service_types.map do |key, i|\n i.service_producers.map do |j|\n j.factory.machine.depends.each do |k|\n binding.pry unless service_types[k.name]\n service_types[k.name].join(i)\n end\n j.factory.machine.requires.each do |k|\n binding.pry unless service_types[k.name]\n i.join(service_types[k.name])\n end\n end\n end\n end", "def create\n @line = Line.new(params[:line])\n @line.budget_id = params[:budget_id]\n @budget = @line.budget\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully created.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def dependencies\n []\n end", "def dependencies\n []\n end", "def dependency name, version, type = :runtime\n raise \"Unknown dependency type: #{type}\" unless\n [:runtime, :dev, :development, :developer].include? type\n\n ary = if type == :runtime then\n extra_deps\n else\n extra_dev_deps\n end\n\n ary << [name, version]\n end", "def post_architect_dependencytracking_build_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.post_architect_dependencytracking_build ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/build\".sub('{format}','json')\n\n # query parameters\n query_params = {}\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 \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#post_architect_dependencytracking_build\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend", "def depend_on(dependant, env = environment.name, requirement = nil)\n fail('Dependant cannot be nil') if dependant.nil? || dependant.eql?('')\n fail('Environment cannot be nil') if env.nil? || env.eql?('')\n dep = if dependant == :all\n if env == :all\n Stacks::Dependencies::MultiServiceDependency.new(self,\n Stacks::Dependencies::AllKubernetesSelector.new(requirement),\n requirement)\n else\n fail('Selection by a specific environment not yet support for :all dependency')\n end\n elsif dependant.is_a?(Array)\n selectors = dependant.map { |d| Stacks::Dependencies::ServiceSelector.new(d, env) }\n Stacks::Dependencies::SingleServiceDependency.new(self,\n Stacks::Dependencies::MultiSelector.new(selectors),\n requirement)\n else\n Stacks::Dependencies::SingleServiceDependency.new(self,\n Stacks::Dependencies::ServiceSelector.new(dependant, env),\n requirement)\n end\n\n @depends_on << dep unless @depends_on.include? dep\n end", "def create\n @demand = Demand.new(demand_params)\n # byebug\n authorize @demand\n # @demand.competences.build(demand_params[:competence_ids])\n respond_to do |format|\n if @demand.save\n @demand.competence_ids = params[:demand][:competence_ids].first.split(',')\n @demand.criterion_ids = params[:demand][:criterion_ids].first.split(',')\n format.html { redirect_to @demand, notice: 'Demand was successfully created.' }\n format.json { render :show, status: :created, location: @demand }\n format.js\n else\n format.html { render :new }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def dependencies\n []\n end", "def install_dependencies(spec)\n di = Gem::DependencyInstaller.new\n\n spec.development_dependencies.each do |dep|\n unless source_index.search(dep).last\n if config[\"install_development_dependencies\"]\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n if ask_yes_no(\"Install development dependency #{dep.name} (#{dep.requirement})?\")\n say \"Installing test dependency #{dep.name} (#{dep.requirement})\"\n di.install(dep) \n else\n alert_error \"Failed to install dependencies required to run tests. Aborting.\"\n raise Gem::TestError\n end\n end\n end\n end\n end", "def add_dependency(path, dependency); end", "def dep(dep_hash)\n dependencies << dep_hash\n end", "def depends *syms\n syms.each { |sym| raise ArgumentError, \"unknown option '#{sym}'\" unless @specs[sym] }\n @constraints << [:depends, syms]\n end", "def destroy\n @dependency.destroy\n respond_to do |format|\n format.html { redirect_to dependencies_url, notice: 'Dependency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def dependencies\n @dependencies ||= []\n end", "def create\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @operation = Operation.new(params[:operation])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.save\n if @model\n @operation.dependent.models << @model\n format.html { redirect_to user_model_path(@model.user, @model), notice: 'Operation was successfully created.' }\n else\n format.html { redirect_to root_path, notice: 'Operation was successfully created.' }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def add_dependencies(dependent, source)\n source.each do |dependency|\n dependents = @dependencies.fetch(dependency, [])\n # some fields may point at the same dependency,\n # to avoid duplicate validation the dependency\n # becomes the pointer to any dependent fields\n # e.g., dependency => [ dependent, dependent, ... ]\n @dependencies[dependency] = dependents.push(dependent)\n end\n end", "def dependencies\n @dependencies ||= {}\n end", "def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend", "def post_architect_dependencytracking_build_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.post_architect_dependencytracking_build ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/architect/dependencytracking/build\".sub('{format}','json')\n\n # query parameters\n query_params = {}\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 \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ArchitectApi#post_architect_dependencytracking_build\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @dependency.update(dependency_params)\n format.html { redirect_to @dependency, notice: 'Dependency was successfully updated.' }\n format.json { render :show, status: :ok, location: @dependency }\n else\n format.html { render :edit }\n format.json { render json: @dependency.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dependencies = Dependency.all\n end", "def depends(name, constraint = \">= 0\")\n if name.nil?\n raise ArgumentError, \"A name must be specified. You gave: #{args}.\"\n end\n\n dependency = Dependency.new(self, name, constraint)\n add_dependency(dependency)\n\n self\n end", "def update(dependencies)\n reset_dependencies!\n\n dependencies.each { |dependency| append(dependency) }\n save\n end", "def load_dependencies\n result = zh_client.dependencies(repo_name)\n\n result[\"dependencies\"].each do |hash|\n blocking = add_or_find(hash[\"blocking\"])\n blocked = add_or_find(hash[\"blocked\"])\n\n add_edge(blocked, blocking)\n end\n end", "def refresh_dependents(options = {}); end", "def write_depends\r\n @source_files.each { |file|\r\n depends = []\r\n flatten_depends depends, file\r\n @flat_depends[file] = depends\r\n }\r\n FileUtils.mkdir_p File.dirname(@file)\r\n File.open(@file, 'w') { |f|\r\n @flat_depends.each { |src, deps|\r\n f << \"add_dep '#{src}', [\"\r\n if deps and not deps.empty?\r\n f << \"'#{deps.join(\"', '\")}'\" end\r\n f << \"]\\n\"\r\n }\r\n f << \"\\n\"\r\n }\r\n end", "def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def dependencies_for(specification)\n specification.dependencies\n end", "def create\n @st_has_dep = StHasDep.new(st_has_dep_params)\n\n respond_to do |format|\n if @st_has_dep.save\n format.html { redirect_to @st_has_dep, notice: 'St has dep was successfully created.' }\n format.json { render :show, status: :created, location: @st_has_dep }\n else\n format.html { render :new }\n format.json { render json: @st_has_dep.errors, status: :unprocessable_entity }\n end\n end\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n @dependencies ||= []\n end", "def dependencies\n EMPTY_SET\n end", "def dep(parent,child=nil)\n deps[parent]\n\n if child\n deps[child]\n deps[parent] << child\n end\n end", "def required_by(dependency, dependent_name)\n dependencies_by_requirer_name[dependent_name] ||= []\n dependencies_by_requirer_name[dependent_name] << dependency\n dependencies << dependency\n\n if acceptable_versions.empty?\n message = \"Unable to satisfy the following requirements:\\n\\n\"\n dependencies_by_requirer_name.each do |name, dependencies|\n dependencies.each do |dep|\n message << \"- `#{dep}` required by `#{name}`\\n\"\n end\n end\n raise Informative, message\n end\n end", "def create\n version_attributes = params.require(:version).permit(:id, :file, :file_file_name, :version, :uploaded_by, :reason)\n @document = Document.find(params[:document_id])\n @document.versions << Version.create(version_attributes)\n render :json => @document, :include => [:versions]\n end", "def add_dependent(parent_to_dependent_hash)\n registration = parent_to_dependent_hash.keys.first\n dependent = parent_to_dependent_hash.values.first\n dependents_for(registration) << dependent\n end", "def set_dependency\n @dependency = Dependency.find(params[:id])\n end", "def dependencies=(_arg0); end", "def dependencies_from_array(dependents)\n # Referring to an array of dependents\n # Can be a mixed array (eg [:publishers, Publisher2])\n dependents.inject([]) do |klasses, dependent|\n if dependent.is_a? Symbol\n # Referring to an array of stages (eg [:publishers, :emailers])\n klasses << dependents_for_stage(dependent)\n else\n # Referring to an array of jobs (eg [Publisher1, Publisher2])\n klasses << [dependent] + dependents_for(dependent)\n end\n end.flatten.uniq\n end", "def dependent; end", "def dependent; end" ]
[ "0.64044064", "0.63350475", "0.6292813", "0.60891604", "0.5951529", "0.58912903", "0.5664114", "0.5624033", "0.55461735", "0.5545093", "0.5450989", "0.54363513", "0.5417349", "0.53924245", "0.5355601", "0.53362", "0.5328065", "0.5320065", "0.5274545", "0.52613074", "0.52523464", "0.52469844", "0.52317286", "0.5223948", "0.5211256", "0.52103084", "0.51829135", "0.518185", "0.516906", "0.51476216", "0.5134008", "0.5132449", "0.511725", "0.51171786", "0.51102996", "0.5086414", "0.50633055", "0.50385654", "0.5030198", "0.50275826", "0.5025854", "0.5025854", "0.5025854", "0.50211525", "0.5018145", "0.5015778", "0.5015511", "0.501144", "0.500785", "0.49958587", "0.49931464", "0.4991118", "0.4991118", "0.49880314", "0.497045", "0.4968872", "0.49619395", "0.4957123", "0.4952782", "0.4940537", "0.4937893", "0.49334046", "0.49230015", "0.491709", "0.49170357", "0.49077114", "0.49022275", "0.48946744", "0.4890794", "0.48882696", "0.4881922", "0.48818624", "0.4876891", "0.48767936", "0.4874955", "0.48610827", "0.4859987", "0.48587272", "0.48537293", "0.48526156", "0.48420095", "0.48395643", "0.48345232", "0.48309663", "0.48293683", "0.48262134", "0.4826212", "0.4826212", "0.4826212", "0.4826212", "0.4824296", "0.4820988", "0.4819404", "0.4804515", "0.48040044", "0.47970104", "0.47961083", "0.47956967", "0.47923136", "0.47923136" ]
0.6279234
3
PATCH/PUT /dependences/1 PATCH/PUT /dependences/1.json
def update respond_to do |format| if @dependence.update(dependence_params) format.html { redirect_to @dependence, notice: 'Dependence was successfully updated.' } format.json { render :show, status: :ok, location: @dependence } else format.html { render :edit } format.json { render json: @dependence.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @dependency.update(dependency_params)\n format.html { redirect_to @dependency, notice: 'Dependency was successfully updated.' }\n format.json { render :show, status: :ok, location: @dependency }\n else\n format.html { render :edit }\n format.json { render json: @dependency.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @dependencia = Dependencia.find(params[:id])\n\n respond_to do |format|\n if @dependencia.update_attributes(dependencia_params)\n format.html { redirect_to @dependencia, notice: 'Dependencia se actualizo correctamente.' }\n format.json { head :no_content }\n format.js{}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dependencia.errors, status: :unprocessable_entity }\n format.js{}\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def patch!\n request! :patch\n end", "def update\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n\t@contract = @vdocs_requirement.contract\n\n respond_to do |format|\n if @vdocs_requirement.update_attributes(params[:vdocs_requirement])\n flash[:notice] = 'VdocsRequirement was successfully updated.'\n format.html { redirect_to(@vdocs_requirement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vdocs_requirement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\n end", "def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n # { 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 respond_to do |format|\n if @requirement.update(requirement_params)\n format.html { redirect_to requirements_path, notice: \"Requisito (#{@requirement.name}) atualizado com sucesso!\" }\n format.json { render :show, status: :ok, location: @requirement }\n else\n format.html { render :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update *reqs\n fire :updating, :updated do\n @environments |= @sandbox.environments\n @options.merge! reqs.pop if Hash === reqs.last\n @requirement = Gem::Requirement.new reqs unless reqs.empty?\n end\n\n self\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def patch\n end", "def update\n @compromise = Compromise.find(params[:id])\n\n if @compromise.update(compromise_params)\n Notification.delete_all([\"compromise_id = ?\", @compromise.id])\n create_for_each_notification_type(@compromise)\n head :no_content\n else\n render json: @compromise.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @req.update(req_params)\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :ok, location: @req }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dependencies = args[:dependencies] if args.key?(:dependencies)\n @has_dependencies = args[:has_dependencies] if args.key?(:has_dependencies)\n @version = args[:version] if args.key?(:version)\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @st_has_dep.update(st_has_dep_params)\n format.html { redirect_to @st_has_dep, notice: 'St has dep was successfully updated.' }\n format.json { render :show, status: :ok, location: @st_has_dep }\n else\n format.html { render :edit }\n format.json { render json: @st_has_dep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requirement.update_attributes(requirement_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def replace_version_constraint(content, filename)\n parsed_manifest = TomlRB.parse(content)\n\n FileParsers::Rust::Cargo::DEPENDENCY_TYPES.each do |type|\n next unless (req = parsed_manifest.dig(type, dependency.name))\n updated_req = temporary_requirement_for_resolution(filename)\n\n if req.is_a?(Hash)\n parsed_manifest[type][dependency.name][\"version\"] = updated_req\n else\n parsed_manifest[type][dependency.name] = updated_req\n end\n end\n\n TomlRB.dump(parsed_manifest)\n end", "def update\n @dependent_relationship = DependentRelationship.find(params[:id])\n\n respond_to do |format|\n if @dependent_relationship.update_attributes(params[:dependent_relationship])\n format.html { redirect_to @dependent_relationship, notice: 'Dependent relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dependent_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deployment.update(deployment_params)\n services_params(@deployment).each do |service_name, version_name|\n version = Version.find_by(name: version_name)\n @deployment.versions << version if version\n end\n @deployment.save\n format.html { redirect_to @deployment, notice: 'Deployment was successfully updated.' }\n format.json { render :show, status: :ok, location: @deployment }\n else\n format.html { render :edit }\n format.json { render json: @deployment.errors, status: :unprocessable_entity }\n end\n end\n end", "def dependency(code, artifacts, target_version, options = {})\n desc \"Update the #{code} dependencies in build.yaml\"\n command(:\"patch_#{code}_dep\") do |app|\n patch_versions(app, artifacts, target_version, options)\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def patch_artifact(name, dependencies, target_version, options = {})\n command(:\"patch_#{name}_version\") do |app|\n patch_versions(app, dependencies, target_version, options)\n end\n end", "def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_model dataset_id, model_id, patched_model_gapi, etag = nil\n patch_with_backoff = false\n options = { skip_deserialization: true }\n if etag\n options[:header] = { \"If-Match\" => etag }\n # The patch with etag operation is considered idempotent\n patch_with_backoff = true\n end\n execute backoff: patch_with_backoff do\n json_txt = service.patch_model @project, dataset_id, model_id, patched_model_gapi, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.js {\n @contracts = @component.contracts unless @component.nil?\n @contracts = @project.contracts if @component.nil?\n }\n format.html { redirect_to([@project, @contract], :notice => 'Contract was successfully updated.') }\n format.xml { head :ok }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n params[:requirement][:industry_ids] ||= []\n if params['Submit_for_Approval']\n @requirement.status = 'Submitted'\n end\n if params[:requirement][:status] == \"Rejected\"\n Requirement.destroy(params[:id])\n redirect_to requirements_path\n else\n respond_to do |format|\n if @requirement.update_attributes(params[:requirement])\n if (params['Submit_for_Approval']) and (@requirement.status != 'Submitted')\n flash[:error] = 'Could not submit requirement for approval'\n end\n format.html { redirect_to @requirement, notice: 'Requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def update_package_json_resolutions(package_json_content:, new_req:,\n dependency:, old_req:)\n dep = dependency\n resolutions =\n JSON.parse(package_json_content).fetch(\"resolutions\", {}).\n reject { |_, v| v != old_req && v != dep.previous_version }.\n select { |k, _| k == dep.name || k.end_with?(\"/#{dep.name}\") }\n\n return package_json_content unless resolutions.any?\n\n content = package_json_content\n resolutions.each do |_, resolution|\n original_line = declaration_line(\n dependency_name: dep.name,\n dependency_req: { requirement: resolution },\n content: content\n )\n\n new_resolution = resolution == old_req ? new_req : dep.version\n\n replacement_line = replacement_declaration_line(\n original_line: original_line,\n old_req: { requirement: resolution },\n new_req: { requirement: new_resolution }\n )\n\n content = content.gsub(original_line, replacement_line)\n end\n content\n end", "def update\n @order = Order.find(params[:id])\n\n @order.line_bundles.destroy_all\n\n params[:bundles].each_value do |bundle|\n @order.line_bundles.build(bundle) if bundle[:quantity].to_i > 0\n end\n\n form_buttons do\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update(path)\n output { patch(path, params) }\n end", "def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requirement.update(requirement_params)\n format.html { redirect_to @requirement, notice: 'Requirement was successfully updated.' }\n format.json { render :show, status: :ok, location: @requirement }\n else\n format.html { render :edit }\n format.json { render json: @requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @requirement.update(requirement_params)\n render :show, status: :ok, location: @requirement\n else\n render json: @requirement.errors, status: :unprocessable_entity\n end\n end", "def update\n @client_need = ClientNeed.find(params[:id])\n\n respond_to do |format|\n if @client_need.update_attributes(params[:client_need])\n format.html { redirect_to @client_need, notice: 'Client need was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def patch(path, opts = {}, &block)\n request(:patch, path, opts, &block)\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def updated_gemfile_requirement(req)\n return req unless latest_resolvable_version\n return req if existing_version && no_change_in_version?\n return req if !existing_version && new_version_satisfies?(req)\n\n requirements =\n req[:requirement].split(\",\").map { |r| Gem::Requirement.new(r) }\n\n new_req =\n if requirements.any?(&:exact?)\n \"= #{latest_resolvable_version}\"\n elsif requirements.any? { |r| r.to_s.start_with?(\"~>\") }\n tw_req = requirements.find { |r| r.to_s.start_with?(\"~>\") }\n update_twiddle_version(tw_req, latest_resolvable_version).to_s\n else\n update_gemfile_range(requirements).map(&:to_s).join(\", \")\n end\n\n req.merge(requirement: new_req)\n end", "def refresh_dependents(options = {}); end", "def update(dependencies)\n reset_dependencies!\n\n dependencies.each { |dependency| append(dependency) }\n save\n end", "def update\n @constraint = Constraint.find(params[:id])\n\n respond_to do |format|\n if @constraint.update_attributes(params[:constraint])\n format.html { redirect_to @constraint, notice: 'Constraint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_requests(force = false)\n requests = []\n # get the URI path for this object.\n uri = self.uri_path\n\n # generate the request to update the object (PUT)\n if attribute_changes? || force\n # if it's new, then we should call :post for creating the object.\n method = new? ? :post : :put\n r = Request.new(method, uri, body: attribute_updates)\n r.tag = object_id\n requests << r\n end\n\n # if the object is not new, then we can also add all the relational changes\n # we need to perform.\n if @id.present? && relation_changes?\n relation_change_operations.each do |ops|\n next if ops.empty?\n r = Request.new(:put, uri, body: ops)\n r.tag = object_id\n requests << r\n end\n end\n requests\n end", "def service_dependance_params\n params.require(:service_dependance).permit(:depending_id, :service_id)\n end", "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n\n execute_request('PATCH') do |uri, headers|\n HTTP.http_client.patch(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end", "def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n @program = Program.find(params[:program_id])\n @chef_resource = ChefResource.find(params[:chef_id])\n if params[:condition] == \"delete\"\n respond_to do |format|\n if @chef_resource.update_attributes(:status => \"delete\", :priority => nil)\n ProgramsSubject.where(:program_id => @program.id).update_all(:was_updated => true)\n ProgramsSubject.where(:program_id => @program.id, :state => \"none\").update_all(:state => \"update\")\n format.html { redirect_to edit_program_path(@program), :flash => { :success => \"Action was successfully changed to delete.\" } }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_program_path(@program), :flash => { :danger => \"Action was error when change to delete.\" } }\n format.json { head :no_content }\n end\n end\n else\n respond_to do |format|\n priority = 0\n if !@program.chef_resources.where(status: \"install\").last.nil?\n priority = @program.chef_resources.where(status: \"install\").last.priority\n end\n if @chef_resource.update_attributes(:status => \"install\", :priority => priority + 1)\n ProgramsSubject.where(:program_id => @program.id).update_all(:was_updated => true)\n ProgramsSubject.where(:program_id => @program.id, :state => \"none\").update_all(:state => \"update\")\n format.html { redirect_to edit_program_path(@program), :flash => { :success => \"Action was successfully changed to install.\" } }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_program_path(@program), :flash => { :danger => \"Action was error when change to install.\" } }\n format.json { head :no_content }\n end\n end\n end # if params[:chef_id] == \"remove\"\n end", "def patch; end", "def patch; end", "def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n \n=======\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @event_requirement = EventRequirement.find(params[:id])\n\n if @event_requirement.update(event_requirement_params)\n head :no_content\n else\n render json: @event_requirement.errors, status: :unprocessable_entity\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @requirement = Requirement.find(params[:id])\n\n respond_to do |format|\n if @requirement.update_attributes(params[:requirement])\n format.html { redirect_to(@requirement, :notice => 'Requirement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @requirement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @constraint.update(constraint_params)\n format.html { redirect_to @constraint, notice: 'Constraint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @constraint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def dependency_params\n params.require(:dependency).permit(:dependent_id, :depended_id)\n end", "def patch(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Patch.new(uri.request_uri)\n set_authorisation_header(request)\n request.set_form_data(data)\n\n response = https_client(uri).request(request)\n end", "def update\n @order = Order.find(params[:id])\n sns = params[:order][:serial_numbers_attributes] || {}\n @order.editing = true\n @client = Client.find_by_id(@order.client_id)\n @bill = Bill.find_by_id((@order.bill_id))\n @render = \"#{@order.product_type.downcase}_fields\"\n @product = @order.product_type.downcase.pluralize\n respond_to do |format|\n if @order.update_attributes(params[:order])\n total_due = 0\n @order.parts.each do |part|\n total_due = part.cost + total_due\n end\n @order.client_needs.each do |client_need|\n total_due = client_need.cost + total_due\n end\n @order.update_attribute(:total_due, total_due)\n Progress.create(:short_description => @order.short_description, :full_description => @order.full_description, :user_id => current_user.id, :order_id => @order.id, :branch_id => @order.branch_id) \n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_with_http_info(bundle_symbolic_name, action, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BundleApi.modify ...\"\n end\n # verify the required parameter 'bundle_symbolic_name' is set\n fail ArgumentError, \"Missing the required parameter 'bundle_symbolic_name' when calling BundleApi.modify\" if bundle_symbolic_name.nil?\n # verify the required parameter 'action' is set\n fail ArgumentError, \"Missing the required parameter 'action' when calling BundleApi.modify\" if action.nil?\n # verify enum value\n unless ['start', 'stop', 'update', 'refresh', 'uninstall'].include?(action)\n fail ArgumentError, \"invalid value for 'action', must be one of start, stop, update, refresh, uninstall\"\n end\n # resource path\n local_var_path = \"/bundles/{bundleSymbolicName}\".sub('{format}','json').sub('{' + 'bundleSymbolicName' + '}', bundle_symbolic_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = []\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/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"action\"] = action\n\n # http body (model)\n post_body = nil\n auth_names = ['basic']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BundleState')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BundleApi#modify\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @client_org_orderable = ClientOrgOrderable.find(params[:id])\n\n respond_to do |format|\n if @client_org_orderable.update_attributes(params[:client_org_orderable])\n format.html { redirect_to @client_org_orderable, notice: 'Client org orderable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_org_orderable.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(operation, path, value)\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n @client.response_handler(response)\n end", "def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @composer = Composer.find(params[:id])\n\n respond_to do |format|\n if @composer.update_attributes(params[:composer])\n format.html { redirect_to @composer, notice: 'Composer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @composer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_request.update(budget_request_params)\n budget_request = BudgetRequest.find_by(id: @budget_request.id)\n budget_request.update_attribute(:state, BudgetRequest.state.finished)\n format.html {redirect_to edit_budget_request_path, notice: 'Pedido de Cotización actualizada.'}\n format.json {render :show, status: :ok, location: @order}\n else\n format.html { render :edit }\n format.json { render json: @budget_request.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6390631", "0.6224466", "0.61112934", "0.6054959", "0.57782483", "0.5775834", "0.57725656", "0.57609737", "0.5743465", "0.5743465", "0.57022905", "0.56478083", "0.56073374", "0.5593561", "0.5573444", "0.5565894", "0.5545862", "0.55452067", "0.5525841", "0.55212086", "0.5492165", "0.5485059", "0.5473515", "0.54611844", "0.54592174", "0.5458651", "0.5449692", "0.5412114", "0.54036045", "0.53972507", "0.5393012", "0.5392451", "0.5382296", "0.538138", "0.5373677", "0.5372454", "0.53694606", "0.53547066", "0.53547066", "0.53356653", "0.53284353", "0.5326257", "0.5318674", "0.5316742", "0.53113717", "0.53038096", "0.5291218", "0.52786577", "0.52782923", "0.52774006", "0.52762854", "0.5276244", "0.52747166", "0.5274132", "0.527318", "0.52661663", "0.5265914", "0.5265783", "0.5256051", "0.5253925", "0.52510685", "0.52510685", "0.525007", "0.525007", "0.5245302", "0.5235753", "0.5229195", "0.5216974", "0.5216636", "0.5214154", "0.5206007", "0.51992387", "0.519247", "0.51910007", "0.51862025", "0.5183124", "0.5183124", "0.5182741", "0.5168539", "0.5166047", "0.5160621", "0.51567763", "0.51508003", "0.5142433", "0.5141565", "0.5132041", "0.51315314", "0.51253206", "0.51253206", "0.5125144", "0.5123585", "0.512152", "0.5120899", "0.51195943", "0.51169497", "0.5115129", "0.5108106", "0.5106891", "0.5105814", "0.5103988" ]
0.59566593
4
DELETE /dependences/1 DELETE /dependences/1.json
def destroy @dependence.destroy respond_to do |format| format.html { redirect_to dependences_url, notice: 'Dependence was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dependency.destroy\n respond_to do |format|\n format.html { redirect_to dependencies_url, notice: 'Dependency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dependencia = Dependencia.find(params[:id])\n begin\n @dependencia.destroy\n rescue ActiveRecord::DeleteRestrictionError => e\n flash[:error]=\"No se pudo eliminar porque otros dependen de el\\n(#{e})\"\n end\n respond_to do |format|\n format.html { redirect_to dependencias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @st_has_dep.destroy\n respond_to do |format|\n format.html { redirect_to st_has_deps_url, notice: 'St has dep was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n bef_delete = Before::Delete.new\n respond_to do |format|\n if bef_delete.child_of_relation(@cliente, :lotes)\n format.json { render json: \"Algunos lotes dependen de este cliente. No se puede eliminar.\", status: :conflict }\n else\n @cliente.destroy\n format.json { render json: {message: \"Cliente eliminado con éxito\"} }\n end\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @version = Version.find(params[:id])\n @version.destroy_if_no_dependents\n respond_to do |format|\n unless @version\n foramt.html {redirect_to admin_versions_url, notice: \"Version destroyed\"}\n else\n format.html {redirect_to admin_versions_url, alert: \"Has dependent records\"}\n end\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n self.class.delete(\"evss_dependents_retrieve_#{@user.uuid}\")\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def destroy\n @dependent_relationship = DependentRelationship.find(params[:id])\n @dependent_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to dependent_relationships_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @independent = @member.independents.find(params[:id])\n @independent.destroy\n\n respond_to do |format|\n format.html { redirect_to(member_independents_url(@member)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end", "def destroy\n @stu_has_dep.destroy\n respond_to do |format|\n format.html { redirect_to stu_has_deps_url, notice: 'Stu has dep was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @genre_dependency.destroy\n respond_to do |format|\n format.html { redirect_to genre_dependencies_url, notice: 'Genre dependency was successfully destroyed.' }\n format.json { head :no_content }\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 delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @client_need = ClientNeed.find(params[:id])\n @client_need.destroy\n\n respond_to do |format|\n format.html { redirect_to client_needs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requirement = Requirement.find(params[:id])\n @requirement.destroy(:force)\n\n respond_to do |format|\n format.html { redirect_to(requirements_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def delete\n request(:delete)\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n head :no_content\n end", "def destroy\n @client_org_orderable = ClientOrgOrderable.find(params[:id])\n @client_org_orderable.destroy\n\n respond_to do |format|\n format.html { redirect_to client_org_orderables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @chronicle = Chronicle.find(params[:id])\n @chronicle.destroy\n\n respond_to do |format|\n format.html { redirect_to library_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def destroy\n @funding_requirement.destroy\n respond_to do |format|\n format.html { redirect_to funding_requirements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n respond_to do |format|\n format.html { redirect_to compromises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vdocs_requirement = VdocsRequirement.find(params[:id])\n @vdocs_requirement.destroy\n\n respond_to do |format|\n format.html { redirect_to(vdocs_requirements_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def delete_version( doc_id:, version: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :delete, \"#{url_for_base doc_id}/#{version}\", params, :json\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to recursos_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reparacion = Reparacion.find(params[:id])\n if @reparacion.destroy\n message = \"Reparación eliminada correctamente\"\n else\n message = \"Reparación No eliminada, contiene dependencias\"\n end\n\n respond_to do |format|\n format.html { redirect_to reparaciones_url, :notice => message }\n format.json { head :no_content }\n end \n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def destroy\n repo = assets_repo\n repo.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to v_assets_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def delete_dependencies\n raise 'Not implemented'\n end", "def destroy\n @constraint = Constraint.find(params[:id])\n @constraint.destroy\n\n respond_to do |format|\n format.html { redirect_to constraints_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @orderable_concept = OrderableConcept.find(params[:id])\n @orderable_concept.destroy\n\n respond_to do |format|\n format.html { redirect_to orderable_concepts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end", "def destroy\n @version.destroy\n respond_to do |format|\n format.html { redirect_to alfred_module_url(@a_module), notice: 'Version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def destroy\n @author.destroy\n rescue ActiveRecord::InvalidForeignKey\n render json: {\n error: 'Cannot delete Author with dependents'\n }, status: :unprocessable_entity\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requirement.destroy\n respond_to do |format|\n format.html { redirect_to requirements_url, notice: 'Requirement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @requirement.destroy\n respond_to do |format|\n format.html { redirect_to requirements_url, notice: 'Requirement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_api_revision(name, rev)\n delete(\"/apis/#{name}/revision/#{rev}\")\n end", "def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7124551", "0.6988", "0.69567114", "0.65602773", "0.65151024", "0.64572155", "0.64501333", "0.6430625", "0.6378849", "0.63708097", "0.63564163", "0.6339734", "0.63146865", "0.630427", "0.62699413", "0.62500405", "0.6242513", "0.6217482", "0.62140095", "0.62140095", "0.62140095", "0.62140095", "0.6213954", "0.6211278", "0.62067485", "0.6203071", "0.6166914", "0.61506635", "0.61483985", "0.6145221", "0.61446416", "0.6138731", "0.6089891", "0.60859555", "0.6085782", "0.6085049", "0.6081522", "0.60793775", "0.6078698", "0.6064276", "0.6053518", "0.6050031", "0.60479206", "0.6047519", "0.60458773", "0.60327876", "0.6020834", "0.6009058", "0.6007869", "0.59981763", "0.59936094", "0.59915006", "0.59743863", "0.5962373", "0.5960862", "0.5954338", "0.5952548", "0.5950249", "0.5949156", "0.59489965", "0.5946915", "0.5942983", "0.5942983", "0.5942983", "0.5937277", "0.5934582", "0.5929244", "0.5928489", "0.59262747", "0.59262747", "0.59262747", "0.59262747", "0.59262747", "0.59262747", "0.59262747", "0.5925098", "0.5924046", "0.59203035", "0.5915017", "0.5914345", "0.5910954", "0.5910433", "0.59101033", "0.59081435", "0.59011877", "0.59003556", "0.589937", "0.589937", "0.58955836", "0.58917266", "0.58897656", "0.5889605", "0.588896", "0.5884143", "0.5883062", "0.588103", "0.588103", "0.58792794", "0.5877372", "0.587351" ]
0.71797246
0
Use callbacks to share common setup or constraints between actions.
def set_dependence @dependence = Dependence.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 dependence_params params.require(:dependence).permit(:name, :description, :state) 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
create a new listing
def create @listing = Listing.new(listing_params) @listing.save render json: @listing redirect_to listings_path # redirect to home page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n # allow user to create a new todo item\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def new\n @listing = Listing.new\n end", "def create\n\t\t@listing = Listing.create(params_listing)\n\t\t@listing.user = current_user\n\t\tif @listing.save\n\t\t\tredirect_to @listing\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def quick_create\n @client = (current_user && current_user.has_role?('admin', 'staff')) ? Client.find(params[:client_id]) : current_user\n @listing = params[:id] ? Listing.find(params[:id]) : @client.listings.build(:title => params[:title], :storage_types => 'self storage')\n \n if (@listing.new_record? ? @listing.save(false) : @listing.update_attribute(:title, params[:title]))\n render :json => { :success => true, :data => { :listing_id => @listing.id } }\n else\n render :json => { :success => false, :data => model_errors(@listing) }\n end\n end", "def create\n #debugger\n #TODO: DELETE ALL\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # enables the user to create a todo item to be stored on the root page\n @listing = Listing.new(listing_params)\n # checks if the new todo item that was created saves\n # if the new todo saves \n if @listing.save\n # then it will redirect you back to the root page with the new todo item added to the list\n redirect_to listings_path\n else\n # else (does not save) it will render the new Action again\n render 'new'\n end\n end", "def create_listing(label, opts = {})\n options = default_options.merge(PROFILES.fetch(label.to_s, {})).merge(opts)\n\n listing = BwRex::Listings.new(options)\n listing.price_advertise_as = \"$ #{options[:price]}\"\n listing.inbound_unique_id = label\n\n parameters = options.merge(address).merge(listing: listing)\n session = BwRex::PublishNewListingSession.new(parameters)\n session.listing_subcategory(SUBCATEGORY)\n session.listing_advert(body: \"Summary\\r\\nHighlights\\n*First item\\n*Second item\")\n session.listing_image(PHOTO)\n\n session.run\n end", "def create\n # First find the company name (:company_name)\n if listing_params.has_key?(:company_name)\n c_name = listing_params[:company_name]\n company = Company.find_or_create_by(name: c_name)\n listing_params[:company_id] = company.id\n listing_params.delete(:company_name)\n @listing = Listing.new({\n company_id: company.id,\n description: listing_params[:description],\n deadline: listing_params[:deadline],\n job_title: listing_params[:job_title],\n url: listing_params[:url]\n })\n else\n @listing = Listing.new({\n description: listing_params[:description],\n deadline: listing_params[:deadline],\n job_title: listing_params[:job_title],\n url: listing_params[:url]\n })\n end\n\n if @listing.save\n render :show, status: :created, location: @listing\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(params[:listing])\n\n respond_to do |format|\n if @listing.save\n flash[:notice] = 'Listing was successfully created.'\n format.html { redirect_to(@listing) }\n format.xml { render :xml => @listing, :status => :created, :location => @listing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(params[:listing])\n\n respond_to do |format|\n if @listing.save\n flash[:notice] = 'Listing was successfully created.'\n format.html { redirect_to(@listing) }\n format.xml { render :xml => @listing, :status => :created, :location => @listing }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @listing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listing }\n else\n format.html { render action: 'new' }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(params[:listing])\n @listing.urls.append params[:url]\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render json: @listing, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_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 new\n @product_listing = ProductListing.new\n \n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = SaleListing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Sale listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user = current_user\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n respond_to do |format|\n if @listing.save!\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def createItem(title, description, date)\n new_item = List.new\n new_item.title = title\n new_item.description = description\n new_item.save\n new_item.date = date\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user = current_user\n if @listing.save\n redirect_to @listing, notice: 'Listing was successfully created.'\n else\n render :new\n end\n end", "def create\n @listing = Listing.new\n @users = User.all\n @currentuser = User.find(session[:user_id]).id\n end", "def create\n\n # Associate user id with creating a listing \n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: \"Listing was successfully created.\" }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# create a new listing and save it immediately. Assign it to guest, with a status of \"draft\"\n\t\t\n\t\t# if the user is singed in, attach the user_id to the params...\n\t\tif user_signed_in?\n\t\t\tparams[:listing][:user_id] = current_user.id\n\t\tend\n\t\t\n\t\t# if the user isn't signed in, create a temp user? FIXME really think about this...\n\t\t\n\t\t\n\t\t\n\t\t@listing = Listing.new(params[:listing]) \n\t\t# save it to db\n\t\t# TODO add validation that it has to have a price ID, on record creation. So the view doesn't break.\n\t\t\n\t\t# @image = Image.new\n\t\t\n\t\t\n\t\t# on success, redirect to listing\n\t\t# if @listing.save\n\t\t# \t\t\tredirect_to \"/detail/@listing.id\"\n\t\t# \t\telse\n\t\t# \t\t\tredirect_to \"/\"\n\t\t# \t\tend\n\t\t#on failure... \n\t\t\n\t\t# redirect_to \"/listings/detail/:id\"\n\t\t\n\t\t# process the file upload...\n\t\t\n\t\t\n\t\t\n\t\trespond_to do |format| \n\t\t\tif @listing.save\n\t\t\t format.html { redirect_to(\"/listings/detail/#{@listing.id}\",\n\t\t\t :notice => 'Listing was successfully created.') }\n\t\t\t format.xml { render :xml => @listing,\n\t\t\t :status => :created, :location => @listing }\n\t\t\t else\n\t\t\t format.html { render :action => \"new\" }\n\t\t\t format.xml { render :xml => @listing.errors,\n\t\t\t :status => :unprocessable_entity }\n\t\t\t end\n\t\tend\n\tend", "def create\n @listing = current_profile.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing_info = @listing.build_listing_info params[:listing_info]\n \n respond_to do |format|\n if @listing_info.save\n flash[:notice] = 'ListingInfo was successfully created.'\n format.html { redirect_to :action=>'edit'}\n format.xml { render :xml => @listing_info, :status => :created, :location => @listing_info }\n else\n format.html { render :action => \"new\", :layout => \"main\" }\n format.xml { render :xml => @listing_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @listing = current_user.listings.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end", "def create\n @listing = Listing.new\n @listing.model_id = params[:model_id]\n @listing.photo_url = params[:photo_url]\n\n @listing.category_id = params[:category_id]\n\n if @listing.save\n redirect_to listings_url\n else\n render 'new'\n end\n end", "def create\n @listing = Listing.new(listing_params)\n @user = current_user\n @listing.user = @user\n if @listing.save\n redirect_to listing_path(@listing)\n else\n render :new\n end\n end", "def create\n @listing = current_user.listings.new(listing_params)\n if @listing.save! \n redirect_to '/listings'\n else\n render 'new'\n end\n end", "def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end", "def create\n @listing = @commoner.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \r\n current_user.readings.create(:listing_id => params[:listing_id])\r\n respond_to do |format|\r\n #need to call create on a listing to increment counter\n format.xml { head :ok }\r\n end\r\n \n end", "def create\n @listitem = Listitem.new(listitem_params)\n\n if @todolist.listitems << @listitem\n render :show, status: :created, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end", "def create\n Listing.transaction do\n if params[:old_listing_id]\n # Destroy old listing that user restarted on\n current_user.listings.where(id: params[:old_listing_id]).each { |l| l.really_destroy! }\n end\n\n unless @listing = current_user.listing_in_progress\n @listing = Listing.new(user_id: current_user.id, step: steps.first)\n @listing.save!(validate: false)\n else\n flash[:notice] = t('listing.build.exists') if @listing.step.to_sym != steps.first\n end\n\n redirect_to wizard_path(@listing.step.to_sym, listing_id: @listing.id)\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to listing_path(@listing), notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n # post_to_slack(@listing.id)\n # update_categories\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n run List::Create do |result|\n return redirect_to lists_path\n end\n render cell(List::Cell::New, @form), layout: true\n end", "def create\n @listing = Listing.new(listing_params)\n @listing.user_id = current_user.id\n\n authorize! :create, @listing\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.create(item_params)\n @items = List.find(item_params[:list_id]).items.order(\"id ASC\")\n @list_id = item_params[:list_id]\n end", "def create\n @listing = current_user.listings.build(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = current_user.listings.build(listing_param)\n @listing.form_part = @listing.listing_offer\n render 'new'\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @listing }\n end\n end", "def create\n @list_item = ListItem.new(list_item_params)\n\n if @list_item.save\n redirect_to @list_item, notice: 'List item was successfully created.' \n else\n render action: 'new' \n end\n end", "def create\n @listing = current_user.listings.new(listing_params)\n # @listing.status = 1\n if @listing.save\n redirect_to @listing\n else\n render :new\n end\n end", "def create\n lip = list_item_params list_type_id: params[:list_type_id]\n new_item = current_user.list_items.create(lip)\n respond_with new_item\n end", "def new\n add_breadcrumb I18n.t('integral.breadcrumbs.new'), :new_backend_list_path\n @list = List.new\n end", "def new\n @order = Order.new\n @listing = Listing.find(params[:listing_id])\n # Find the id of the listing you want to buy in the url\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json => @listing }\n end\n end", "def create\n @listing = Listing.new(listing_params)\n\n # check that the product has a print_image already created\n if @listing.product.print_image.file.nil?\n @listing.errors.add(:create, \"Product must have a print_image to create a listing\")\n render json: @listing.errors, status: :unprocessable_entity and return\n end\n\n current_user.listings << @listing\n\n if @listing.save\n store = Store.find(listing_params[:store_id])\n adapter = store.get_adapter\n @listing.external_id = adapter.list_product(@listing)\n @listing.printer_sku = @listing.sku\n Rails.logger.debug \"----------start------\"\n Rails.logger.debug @listing.inspect\n Rails.logger.debug \"----------start------\"\n\n if @listing.save\n render json: @listing, status: :created\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n else\n render json: @listing.errors, status: :unprocessable_entity\n end\n end", "def create\n @detail = @listing.details.new(params[:detail])\n\n respond_to do |format|\n if @detail.save\n flash[:notice] = 'Detail was successfully created.'\n format.html { redirect_to(listing_detail_url(@listing, @detail)) }\n format.xml { render :xml => @detail, :status => :created, :location => [@listing, @detail] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @detail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n if params[:category_id].nil?\n format.html { render :new }\n end\n @listing = Listing.new(listing_params)\n @listing.poster_id = current_user.id\n @listing.category_id = params[:category_id]\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n return error_status(true, :cannot_create_listitem) unless (ListItem.can_be_created_by(@logged_user, @list))\n \n @list_item = @list.list_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @list_item }\n end\n end", "def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end", "def listing\n @listing = Listing.find(params[:listing_id])\n end", "def create\n\n @list_item = @list.list_items.create!(list_item_params)\n #@list_item = @list.list_items.create!(params[:list_item])\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tasklisting = Tasklisting.new(tasklisting_params)\n\n respond_to do |format|\n if @tasklisting.save\n format.html { redirect_to @tasklisting, notice: 'Tasklisting was successfully created.' }\n format.json { render :show, status: :created, location: @tasklisting }\n else\n format.html { render :new }\n format.json { render json: @tasklisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @business_listing = BusinessListing.new(business_listing_params)\n\n respond_to do |format|\n if @business_listing.save\n format.html { redirect_to @business_listing, notice: 'Business listing was successfully created.' }\n format.json { render :show, status: :created, location: @business_listing }\n else\n format.html { render :new }\n format.json { render json: @business_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing_type = ListingType.new(params[:listing_type])\n\n respond_to do |format|\n if @listing_type.save\n flash[:notice] = 'ListingType was successfully created.'\n format.html { redirect_to(admin_listing_type_url(@listing_type)) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n # byebug\n @building = Building.find(listing_params[:building_id])\n @listing = Listing.new(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to [@building, @listing], notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def create\n @list_item = ListItem.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to @list_item, notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing }\n end\n end", "def create\n @slisting = Slisting.new(slisting_params)\n\n respond_to do |format|\n if @slisting.save\n format.html { redirect_to @slisting, notice: 'Slisting was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slisting }\n else\n format.html { render action: 'new' }\n format.json { render json: @slisting.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_listing(listing)\n template_name = \"new-listing\"\n template_content = []\n message = {\n to: [{email: \"agsilver85@gmail.com\"}],\n subject: \"New listing: #{listing.name}\",\n merge_vars: [\n {rcpt: \"agsilver85@gmail.com\",\n vars: [\n {name: \"LISTING_NAME\", content: listing.name}\n ]\n }\n ]\n }\n mandrill_client.messages.send_template template_name, template_content, message\n end", "def create_listing\n success = false\n # Create draft listing and update product with id and state\n listing = Etsy::Api::Listing.new\n response = listing.create_draft(@product.etsy_wrapped_title, @product.etsy_wrapped_description, @product.price.to_f, @product.tag_list[0..12].join(', '))\n\n @listing_id = response['listing_id']\n url = response['url']\n @product.update(\n etsy_listing_id: @listing_id,\n etsy_listing_state: 'draft_created',\n etsy_listing_url: url\n )\n\n # Add sku to the listing and update state\n listing.add_sku(@product.product_code, @product.price.to_f)\n\n @product.update(\n etsy_listing_state: 'sku_added',\n etsy_updated_at: Time.now\n )\n\n # Add pdf and update product state\n response = Etsy::Api::ListingFile.new(listing_id: @listing_id).add_pdf\n\n # Store the listing_file_id for later access, should I need to delete the listing file.\n @product.update(\n etsy_listing_file_id: response['listing_file_id'],\n etsy_listing_state: 'pdf_added'\n )\n\n # Add images to the listing and update product state\n @product.images.order(position: :asc).limit(10).each { |image| add_image(image) }\n @product.update(etsy_listing_state: 'images_added')\n\n # Activate the listing and update product state and etsy timestamps\n response = listing.activate\n\n time = Time.now\n @product.update(\n etsy_listing_state: 'published',\n etsy_created_at: time,\n etsy_updated_at: time,\n etsy_listing_url: response['url']\n )\n success = true\n rescue StandardError => e\n message = \"Etsy::Client#create_listing Product #{@product.id}: #{e.message}\"\n Rails.logger.error(message)\n ExceptionNotifier.notify_exception(e, data: { message: })\n ensure\n success\n end", "def new\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_item }\n end\n end", "def create\n # @profile_id = current_user.profile.id\n # @profile_name = current_user.profile.first_name\n @listing = current_user.profile.listings.create(listing_params)\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_listing\n id = params[:id]\n @listing = Listing.find(id)\n end", "def create\n @thing_list = ThingList.new(params[:thing_list])\n\n respond_to do |format|\n if @thing_list.save\n format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully created.') }\n format.xml { render :xml => @thing_list, :status => :created, :location => @thing_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @thing_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sales_listing = SalesListing.new(params[:sales_listing])\n\n # using uncached results provide better performance, might be due to smaller data set\n @listing_statuses = ListingStatus.find(:all, :select => \"id, description\", :order => \"description\")\n @items = Item.all_cached_item_to_list\n # Cache clearing block: item_id, user_id, listing_id\n SalesListing.clear_saleslisting_block(nil, current_user[:id], nil)\n SalesListing.clear_saleslisting_block(@sales_listing.item_id, current_user[:id], nil)\n SalesListing.clear_saleslisting_block(nil, nil, params[:id])\n respond_to do |format|\n if @sales_listing.save\n format.html { redirect_to(sales_listings_path, :notice => 'Sales listing was successfully created.') }\n format.xml { render :xml => @sales_listing, :status => :created, :location => @sales_listing }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sales_listing.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n # @listing = Listing.create(user_id: current_user.id, shop_id: current_user.cart.shop_id, status: 1, total: current_user.cart.total)\n # CartProduct.where(current_user.cart.id).each do |cart_product|\n # ListingsProduct.create(listing_id: @listing.id, product_id: cart_product.id)\n # end\n end", "def set_listing\n @listing = Listing.find(params[\"id\"])\n end", "def new\n @listingcategory = ListingCategory.new\n end", "def new_listing(address:, post_code:, photo:)\n Property.create(address: address, post_code: post_code, photo: photo, uid: @uid)\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 # @listing = Listing.new(listing_params)\n @listing = current_user.listings.build(listing_params)\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render :show, status: :created, location: @listing }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @listing.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\n @listing = current_user.listings.build(listing_params)\n @listing.save\n redirect_to @listing\n end", "def create\n @spot_listing = current_user.spot_listings.build(params[:spot_listing])\n @spot_listing.completed = false\n respond_to do |format|\n if @spot_listing.save\n format.html { redirect_to user_dashboard_url, notice: 'Your listing has been successfully created' }\n format.json { render json: @spot_listing, status: :created, location: @spot_listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot_listing.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: '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 @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 new\n @listing_type = ListingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n @listing = Listing.new(listing_params)\n if @listing.save\n create_images if params[:images]\n flash[:notice] = 'Listing was successfully created.'\n end\n respond_with(@listing)\n end", "def set_listing\n @listing = Listing.find(params[:id])\n\n end", "def listing_params\n params.require(:listing).permit(:name, :content)\n end", "def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\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 new\n @listing = Listing.new\n model = Model.find_by_id(params[:model_id])\n @listing.model_id = model.id\n @listing.photo_url = model.photo_url\n @listing.manufacturer_id = model.manufacturer_id\n @listing.category_id = model.category_id\n end", "def create\n @tech_listing = TechListing.new(tech_listing_params)\n\n respond_to do |format|\n if @tech_listing.save\n format.html { redirect_to @tech_listing, notice: 'Tech listing was successfully created.' }\n format.json { render :show, status: :created, location: @tech_listing }\n else\n format.html { render :new }\n format.json { render json: @tech_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\t@listing = Listing.new\n\t\t@address = Address.find(params[:address_id])\n\tend" ]
[ "0.75198406", "0.7462081", "0.7462081", "0.7462081", "0.7462081", "0.7412452", "0.741167", "0.73827076", "0.7351366", "0.73413545", "0.7224459", "0.719841", "0.7191148", "0.7191148", "0.71910566", "0.71910566", "0.7113601", "0.69330555", "0.69318336", "0.69288546", "0.69276196", "0.6917061", "0.6915086", "0.6895545", "0.68281466", "0.68087935", "0.6786797", "0.67692596", "0.6755248", "0.6754116", "0.67392355", "0.67328", "0.67301136", "0.67242634", "0.67136246", "0.6710582", "0.669247", "0.6691613", "0.66889554", "0.66716", "0.66713333", "0.6667818", "0.6665769", "0.66541404", "0.6653765", "0.664741", "0.66438633", "0.663838", "0.663838", "0.663838", "0.66300094", "0.6617623", "0.66165835", "0.6595527", "0.6591858", "0.6588472", "0.65828013", "0.65753454", "0.6574377", "0.6563423", "0.6554843", "0.6554259", "0.6551247", "0.6540818", "0.6540796", "0.65401876", "0.65299153", "0.6529006", "0.65121025", "0.6508694", "0.6507388", "0.65054137", "0.6502764", "0.65020066", "0.64994454", "0.64953274", "0.6492812", "0.6489528", "0.6482634", "0.64803094", "0.64793825", "0.64760756", "0.647295", "0.6470224", "0.64698154", "0.6468525", "0.64675725", "0.645963", "0.6448932", "0.64476514", "0.6436834", "0.6436407", "0.6432666", "0.643162", "0.64187366", "0.6418234", "0.64164305", "0.6414214", "0.64057773", "0.64034593" ]
0.68771195
24
State transition tables end reduce 0 omitted
def _reduce_1(val, _values, result) self.lexer.lex_state = :expr_beg result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions; end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end", "def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "def finished_states\n states - transitive_states\n end", "def end_transition\n nil\n end", "def transition_at; end", "def transition_at; end", "def rest\n @state -= 1 if @state > 2\n @state += 1 if @state < 2\n end", "def closure!\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\nadd_transition(s0, s1, \"\")\nadd_transition(s1, s0, \"\")\nset_start(s0)\nset_final(s1, true)\nend", "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end", "def compute_unreachable_states\n queue = [starting_state].to_set\n transitions = self.each_transition.to_a.dup\n\n done_something = true\n while done_something\n done_something = false\n transitions.delete_if do |from, _, to|\n if queue.include?(from)\n queue << to\n done_something = true\n end\n end\n end\n\n transitions.map(&:first).to_set\n end", "def final_state(state)\n final_states(state)\n end", "def states; end", "def rest\n if @state > 2\n @state -= 1\n elsif @state < 2\n @state += 1\n end\n end", "def state_on_table_game_end\n @log.debug(\"Net_state: change to state state_on_table_game_end\")\n @network_state = :state_on_table_game_end\n make_state_change_ntfy(:ntfy_state_on_table_game_end)\n end", "def times_walked_to(state); end", "def finish\n transition_to(:successful) unless transition_to(:waiting_funds)\n end", "def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @original_state.size && @second_index + 1 >= @original_state.size\n @operation = :nop\n end\n else\n if @first_index + 1 < @original_state.size\n @first_index += 1\n else\n @first_index = 0\n @operation = @operation == :fill ? :empty : :pour\n end\n end\n end", "def get_lambda_transitions(state)\n transitions = []\n @lambda_table[state].each.with_index do |value, index|\n if value == 1\n transitions << index\n end\n end\n return transitions\n end", "def exit!\n map = @transition_map\n map.each do |type, events_to_transition_arrays|\n events_to_transition_arrays.each do |event, transitions|\n transitions.each(&:unarm)\n end\n end\n\n @exit_actions.each do |exit_action|\n exit_action.call(@state_machine)\n end\n @state_machine.current_state = nil\n end", "def state_anim\n states.each do |state|\n return state.state_anim if state.state_anim > 0\n end\n return 0\n end", "def completeTable(mach)\n\t\tfiltered = {}\n\t\ttable = mach.to_table\n\n\t\t# for each state in the machine\n\t\tmach.states.each_with_index do |s, index|\n\t\t\t# for each rule at a given state\n\t\t\ts.state.each do |lhs, rules|\n\t\t\t\trules.each_with_index do |rule, offset|\n\t\t\t\t\t# tryRuleInState\n\t\t\t\t\tnext unless rule.last == @marker\n\n\t\t\t\t\tfollow_set(lhs).each do |sym|\n\t\t\t\t\t\t# assertEntry\n\t\t\t\t\t\traise ShiftReductConflictError unless table[index][sym].nil?\n\t\t\t\t\t\ttable[index][sym] = \"#{lhs},#{offset}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\t# AssertEntry[StartState, Goalsymbol, accept_symbol]\n\t\traise ShiftReductConflictError unless table[0][@goal].nil?\n\t\ttable[0][@goal] = \"accept\"\n\n\t\treturn table\n\tend", "def setup_rem_state\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n c = @acts[2] || 100\n c = c/100.0 if c.integer?\n if area_flag\n target_array.each do |t|\n if chance(c)\n t.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(t)\n end\n end\n return\n end\n return unless target\n if chance(c)\n target.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(target)\n end\n end", "def union!(f1)\n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\tadd_transition(temp, f1.start, \"\")\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| set_final(x, false) \n\t\tadd_transition(x, temp, \"\") }\n\t\tset_final(temp)\n\t\tf1.final.keys.sort.each { |x| add_transition(x, temp, \"\") }\n\t\tf1.transition.keys.each { |v1| \n f1.transition[v1].keys.each { |v2| \n add_transition(v1, v2, f1.get_transition(v1,v2))\n }\n }\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "def failed_states\n states - success_states - transitive_states\n end", "def finished!\n Mua::State::Transition.new(state: self.terminal_states[0])\n end", "def reward(state, _action, _next_state)\n state == :stop ? 0 : grid[state[0]][state[1]]\n end", "def after_transition(*args, &block); end", "def states\n is = (0...grid.size).to_a\n js = (0...grid.first.size).to_a\n is.product(js).select { |i, j| grid[i][j] } + [:stop]\n end", "def execute\n mark_states\n @nfa = {\n :initial => 0,\n :final => @final_states,\n :symbols => @symbols,\n :states => (0..@last_state),\n :transitions => @transitions\n }\n end", "def update_state_effects\n @state_poptimer[0] += 1 unless primary_state_ani.nil?\n if @state_poptimer[0] == 30\n @animation_id = primary_state_ani\n @animation_id = 0 if @animation_id.nil?\n elsif @state_poptimer[0] == 180\n @state_poptimer[0] = 0\n end\n update_state_action_steps \n end", "def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend", "def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end", "def done?(state)\n state[:position][0][0] == 0\n end", "def start_transition\n nil\n end", "def transition_probability(state, action, next_state)\n if state == :stop || terminii.member?(state)\n action == :stop && next_state == :stop ? 1 : 0\n else\n # agent usually succeeds in moving forward, but sometimes it ends up\n # moving left or right\n move = case action\n when '^' then [['^', 0.8], ['<', 0.1], ['>', 0.1]]\n when '>' then [['>', 0.8], ['^', 0.1], ['v', 0.1]]\n when 'v' then [['v', 0.8], ['<', 0.1], ['>', 0.1]]\n when '<' then [['<', 0.8], ['^', 0.1], ['v', 0.1]]\n end\n move.map do |m, pr|\n m_state = [state[0] + MOVES[m][0], state[1] + MOVES[m][1]]\n m_state = state unless states.member?(m_state) # stay in bounds\n pr if m_state == next_state\n end.compact.inject(:+) || 0\n end\n end", "def transitions\n [\n {:parked => :idling, :on => :ignite},\n {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}\n # ...\n ]\n end", "def extract_valid_transitions\r\n transitions_in_model=Array.new\r\n \t\tself.adjacency_matrix.each_key do |a_state|\r\n\t\t\t if self.adjacency_matrix[a_state].length == 0\r\n\t\t\t \t\t\t # Ignore if no actions, as this is not a transition, just a dead end\r\n else\r\n \t self.adjacency_matrix[a_state].each do |a_transition|\r\n \t transitions_in_model.push a_transition\r\n \tend # end each \t\r\n end # end else\r\n end # end each key\r\n\r\n return transitions_in_model\r\n end", "def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam_broken = 0\n # TODO: toss up the correct error light\n end\n end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def phase; end", "def transitions(curr_state = nil, **)\n curr_state = state_value(curr_state)\n next_states = state_table.dig(curr_state, :next)\n Array.wrap(next_states).compact_blank\n end", "def transitions\n @transitions ||= {}\n end", "def final_states(*states)\n @subject.final_states = states\n end", "def states\n\t[:shelf,:in_use,:borrowed,:misplaced,:lost]\nend", "def get_transition(v1,x)\nif has_state?(v1)\n@transition[v1][x]\nelse\nnil\nend\nend", "def converge(state) ; end", "def unflag_row_deltas\n tables.each(&:unflag_row_deltas)\n end", "def free\n @state.sum do |row|\n row.count { |square| square == FREE }\n end\n end", "def states\n states = Set.new([@initial_state])\n @transitions.each { |k,v| states += v.values }\n states\n end", "def main_end\r\n super\r\n # Execute transition\r\n Graphics.transition(40)\r\n # Prepare for transition\r\n Graphics.freeze\r\n # If battle test\r\n if $BTEST\r\n $scene = nil\r\n end\r\n end", "def transitions(year); end", "def transitions(year); end", "def state\n active = 0\n my_nodes.each do |n|\n # any node that's error or unknown will cause the whole state to be in the other state\n if n.state < 0 \n return ERROR\n elsif n.state > 0 \n active+=1\n elsif n.state == nil\n return UNKNOWN\n end\n end\n # if all the nodes fall through the tests above then the snapshot is ready or active\n return (active == 0 ? ACTIVE : TRANSITION)\n end", "def flag_row_deltas\n tables.each(&:flag_row_deltas)\n end", "def transition_time\n end", "def state\n super\n table :cs_rep, ['ident'], ['payload']\n table :cs_meter, ['ident'], ['payload']\n scratch :rmg_can_store, ['ident'], ['payload']\n end", "def succ() end", "def succ() end", "def succ() end", "def state_transitions\n StateTransition.where(record_id: id, record_type: self.class.to_s).order(id: :desc)\n end", "def execState\n findNextState\n current_state = @state_list[@state][@transition]\n\n @transition = eval \"#{@state}\"\n @history.push @state\n\n @finished = @state == :finish\n end", "def transitions\n @transitions ||= []\n end", "def update_transitions\n from_states.each do |from|\n if (value = machine.transitions[name][from])\n machine.transitions[name][from] = [value, map[from]].flatten\n else\n machine.transitions[name][from] = map[from] || ANY_STATE\n end\n end\n end", "def transition(offset_id, timestamp_value); end", "def start_level\n # clear transition layer\n clear_temporary\n end", "def expand_transition_table(row)\n (row - @transition_table.size + 1).times do |r|\n @transition_table << {}\n end\n end", "def rollback\n each {|transition| transition.rollback}\n end", "def transitions\n @transitions ||= @internal_struct[:transitions] || {}\n end", "def state_removed! statemachine\n transitions_changed!\n end", "def generate_state_transiton(state_transtion={})\n if state_transtion == {}\n # default setting is like EC\n states = [\n {state_id: 0, state_name: 'top_page_view', item_type: :no_item, request: '/'},\n {state_id: 1, state_name: 'list_page_view', item_type: :many, request: '/list'},\n {state_id: 2, state_name: 'detail_page_view', item_type: :one, request: '/item'},\n {state_id: 3, state_name: 'item_purchase', item_type: :one, request: '/purchace'}\n ]\n \n start_state = [0]\n\n taranstion = [\n # probability is 0.6 if user transit from top(id:0) to list(id:1) page.\n # transition restrict by item is none.\n {from: 0, to: 1, probability: 0.6, dependent_item: false},\n\n # probability is 0.4 if user transit from list(id:1) to detail(id:2) page\n # \"to state\" item should be choosed \"from state\" items.\n {from: 1, to: 2, probability: 0.4, dependent_item: true},\n \n # probability is 0.2 if user transit from detatil(id:2) to purchase(id:3) page\n # \"to state\" item should be choosed \"from state\" items.\n # after transition to state '3', automatically transition to state \"0\"\n {from: 2, to: 3, probability: 0.2, dependent_item: true, auto_transiton: 0}\n ]\n @start_state, @transitions = start_state, taranstion\n else\n @start_state = state_transtion[:start_state]\n @transitions = state_transtion[:transitions]\n states = state_transtion[:states]\n end\n # convert states\n states_hash = {}\n states.each do |state|\n states_hash[state[:state_id]] = state\n end\n @states = states_hash\n\n # generate auto transiton\n @transitions.each do |transition|\n if transition[:auto_transiton]\n @auto_transiton[transition[:to]] = transition[:auto_transiton]\n end\n end\n end", "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n end", "def go_sub(num)\n @state = @states[num]\n end", "def reducer; end", "def setup_rem_state\n return unless PONY::ERRNO::check_sequence(current_act)\n current_action_targets.each do |target|\n state_id = @acts[1]\n chance = @acts[2] || 100\n chance = chance / 100.0 if c.integer?\n target.remove_state(state_id) if rand < chance\n end\n end", "def states\n no_set_states + set_bonuses\n end", "def exit_state\n end", "def rollback\n each { |transition| transition.rollback }\n end", "def reduziere_lebendige_transitionen(lebendig)\n # Prüfe alle Transitionen\n lebendig.transitionen.each do |t|\n # Überspringe t, sofern Übergänge zu t laufen\n next if lebendig.fluss.values.join(', ').include?(t)\n\n # t kommt im Vorbereich mindestens einer Stelle vor\n next unless lebendig.fluss.key?(t)\n\n # Da wir vorher alle Transitionen übersprungen haben, die keinen leeren Vorbereich haben,\n # sind ab hier alle Transitionen lebendig.\n\n # Entferne jede Stelle im Nachbereich von t, mitsamt Übergängen\n lebendig.fluss[t].each do |s|\n lebendig.reduziere_knoten(s)\n end\n\n # Entferne die lebendige Transition t\n lebendig.reduziere_knoten(t)\n\n # Fürs Protokoll\n puts(\"Lebendige Transitionen reduziert!\")\n end\nend", "def derive_offsets(transitions, offsets); end", "def derive_offsets(transitions, offsets); end", "def force_final_state\r\n @final_state = true\r\n end", "def update_sm_with_actions\r\n puts_debug \"Update StateMachine with actions:\"\r\n puts_debug @state_machine.adjacency_matrix\r\n @state_machine.adjacency_matrix.values.each do |trans_array|\r\n trans_array.each do |transition|\r\n puts_debug transition.action\r\n \r\n define_action transition.action\r\n end # each transition\r\n end # each trans array \r\n end", "def dump_table(type = :state, indent_width = 2, indent_level = 2)\r\n # edge_labels = friendly_edge_labels << \" Other\" # I suspect this line is ruining the code.\r\n edge_labels = get_edge_labels << \" Other\"\r\n node_names = get_node_names\r\n \r\n s = \"#{ind(indent_level)}@#{type}_table = \" +\r\n ((type == :action) ? \"\\n#{ind(indent_level+1)}\\# ERROR = 0; MACHINE_ACCEPT = 1; HALT_RETURN = 2\" : \"\") +\r\n \"\\n#{ind(indent_level+1)}#\"\r\n edge_labels.each do |label|\r\n s += sprintf(\"%#{WIDTH+1}s\", label_friendly(label))\r\n end\r\n s += \"\\n#{ind(indent_level+1)}\"\r\n \r\n node_names.each_with_index do |node,ii|\r\n on_last_node = (ii == node_names.size-1)\r\n is_accept = !@accept_states[node].nil?\r\n s += ((ii==0) ? \"[\" : \" \") + \"[\"\r\n \r\n edge_labels.each_with_index do |edge,jj|\r\n on_last_edge = (jj == edge_labels.size-1)\r\n if(@graph_hash[node].nil?||\r\n @graph_hash[node][edge].nil?||@graph_hash[node][edge][0].nil?)\r\n sdest = \"-1\"\r\n adest = ((is_accept) ? HALT_RETURN.to_s : ERROR.to_s)\r\n if(!accept_states[node].nil?)\r\n ldest = ((is_accept) ? (lookup_codes.find_index(accept_states[node]).to_i).to_s : \"0\")\r\n else\r\n ldest = \"0\"\r\n end\r\n else\r\n sdest = graph_hash[node][edge].to_s\r\n adest = MACHINE_ACCEPT.to_s # MA if NON-ACCEPT state\r\n ldest = \"0\"\r\n end\r\n case type\r\n when :state\r\n s += sprintf(\"%#{WIDTH}s\", sdest) + \r\n ((!on_last_edge) ? \",\" \\\r\n : \"]\" + ((!on_last_node) ? \",\" \\\r\n : \"]\" ) + \" \\# #{node}#{(is_accept ? \" ACCEPT\":\"\")}\\n#{ind(indent_level+1)}\")\r\n when :action\r\n s += sprintf(\"%#{WIDTH}s\", adest) + \r\n (!on_last_edge ? \",\" \\\r\n : \"]\" + (!on_last_node ? \",\" \\\r\n : \"]\" ) + \" \\# #{node}#{(is_accept ? \" ACCEPT\" : \"\")}\\n#{ind(indent_level+1)}\")\r\n when :lookup\r\n s += sprintf(\"%#{WIDTH}s\", ldest) + \r\n (!on_last_edge ? \",\" \\\r\n : \"]\" + (!on_last_node ? \",\" \\\r\n : \"]\" ) + \" \\# #{node}#{(is_accept ? \" #{@accept_states[node]}\" : \"\")}\\n#{ind(indent_level+1)}\")\r\n end\r\n end\r\n end\r\n s.rstrip\r\n end", "def next states\n raise \"Must be implemented by subclass\"\n end", "def transition\n newMap = []\n for x in 0...@map.length do\n for y in 0...@map[x].length do\n if !newMap[x]\n newMap[x] = []\n end\n if !newMap[x][y]\n newMap[x][y] = @map[x][y]\n end\n numAlive = neighbors(x, y).reduce(0) { |a, c| c == 1 ? a + 1 : a }\n if numAlive < 2\n newMap[x][y] = 0 # death by under population\n elsif numAlive > 3\n newMap[x][y] = 0 # death by over population\n elsif @map[x][y] == 0 and numAlive == 3\n newMap[x][y] = 1 # alive by reproduction\n end\n end\n end\n @map = newMap\n end", "def next_state\n newstate = state_transition_out\n newiteration = @iteration\n if [:day, :signup].include?(@state)\n newiteration = @iteration + 1\n end\n @state = newstate\n @iteration = newiteration\n #state_transition_in\n @state\n end", "def emit_finish_mutations\n finish = node.finish\n #emit_self(negative_infinity, finish)\n emit_self(nan, finish)\n end", "def generate_initial_state\n @state.each_with_index do |row, row_index|\n end\n end", "def final?\n @transitions.empty?\n end", "def steps_before_repeat_state_naive\n\t\t# state = {}\n\t\tsteps = 0\n\t\torig = @moons_pos.to_s\n\t\tzero_vel = [0, 0, 0]\n\t\tstarting_time = Time.now\n\t\tp @moons_pos\n\t\twhile (42)\n\t\t\tsleep(1)\n\t\t\t# state.has_key?(@moons_pos.to_s) ? break : state[@moons_pos.to_s] = true\n\n\t\t\tapply_gravity_to_velocity\n\t\t\tapply_velocity_to_position\n\t\t\tsteps += 1\n\t\t\tp @moons_pos\n\t\t\tbreak if velocity(:io) == zero_vel && @moons_pos.to_s == orig\n\t\tend\n\t\tsteps\n\tend", "def resetStates()\r\n @players.each do |player|\r\n if(player.money > 0)\r\n player.state = \"fine\"\r\n else\r\n player.state = \"broke\"\r\n end\r\n end\r\n end", "def actions(state)\n if state == :stop || terminii.member?(state)\n [:stop]\n else\n MOVES.keys\n end\n end" ]
[ "0.64042956", "0.6064393", "0.60386634", "0.6007729", "0.5946686", "0.59351325", "0.59351325", "0.5909589", "0.58873314", "0.58676314", "0.58676314", "0.57807076", "0.5779571", "0.5710219", "0.56961817", "0.5655912", "0.55736065", "0.55026084", "0.54936284", "0.5481873", "0.5438249", "0.5409715", "0.5403657", "0.5375035", "0.5353606", "0.5353463", "0.5348177", "0.5342463", "0.5341549", "0.5316064", "0.5311208", "0.53055745", "0.53051555", "0.52858603", "0.527972", "0.52724856", "0.5271459", "0.5267875", "0.5256976", "0.52524394", "0.52235377", "0.52235377", "0.52235377", "0.52235377", "0.52235377", "0.52235377", "0.52235377", "0.52235377", "0.52161413", "0.52023757", "0.5194032", "0.51610833", "0.515993", "0.5158976", "0.51530755", "0.51404214", "0.51395154", "0.51342064", "0.51177794", "0.510656", "0.510656", "0.51036125", "0.50729126", "0.50688297", "0.50653076", "0.506288", "0.506288", "0.506288", "0.50624055", "0.5061938", "0.505782", "0.5055675", "0.50532365", "0.5044276", "0.50338036", "0.5032605", "0.502155", "0.5016229", "0.5014718", "0.50023186", "0.49948356", "0.49934676", "0.49767", "0.49704567", "0.4968285", "0.49624747", "0.4961586", "0.49610332", "0.49610332", "0.4958078", "0.49576372", "0.494714", "0.49357703", "0.4929767", "0.4925796", "0.492318", "0.4921991", "0.49218357", "0.4919685", "0.49154374", "0.49153164" ]
0.0
-1
reduce 4 omitted reduce 5 omitted
def _reduce_6(val, _values, result) result = self.block_append val[0], val[2] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_23(val, _values, result); end", "def _reduce_45(val, _values, result); end", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_50(val, _values, result); end", "def _reduce_50(val, _values, result); end", "def _reduce_455(val, _values, result); end", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_21(val, _values, result); end", "def _reduce_47(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def reduce!(n)\n loop do\n # pp n\n next if explode!(n)\n next if split!(n)\n # pp n\n return\n end\nend", "def _reduce_17(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_476(val, _values, result); end", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_34(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_9(val, _values, result); end", "def _reduce_9(val, _values, result); end", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_378(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_470(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_526(val, _values, result); end", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_135(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_684(val, _values, result); end", "def _reduce_695(val, _values, result); end", "def _reduce_28(val, _values, result); end", "def _reduce_334(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_53(val, _values, result); end", "def _reduce_53(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_359(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_555(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_555(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_545(val, _values, result); end", "def _reduce_545(val, _values, result); end", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_18(val, _values, result); end", "def _reduce_18(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_736(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend" ]
[ "0.6742373", "0.65648335", "0.654707", "0.654707", "0.6541003", "0.6525085", "0.6525085", "0.6521839", "0.6508959", "0.64965284", "0.64932734", "0.6476861", "0.6471889", "0.64710945", "0.64710945", "0.64671123", "0.6461539", "0.64605373", "0.6456827", "0.6451995", "0.6449653", "0.6437442", "0.643444", "0.6434145", "0.6432356", "0.64280754", "0.64120615", "0.64120615", "0.6409935", "0.6408665", "0.6406377", "0.6405751", "0.6405598", "0.63999504", "0.63991666", "0.63982546", "0.63921523", "0.63918954", "0.6390246", "0.6374805", "0.63706094", "0.63706094", "0.63671315", "0.63651574", "0.63590723", "0.6357158", "0.6350102", "0.6348788", "0.6348047", "0.634291", "0.6339414", "0.6339414", "0.6338949", "0.6338949", "0.63385665", "0.63385665", "0.63374716", "0.63374716", "0.6319882", "0.63113767", "0.63097304", "0.6307315", "0.6306676", "0.6301478", "0.6276223", "0.62723964", "0.62711376", "0.6268602", "0.62621194", "0.62486184", "0.62486184", "0.6245725", "0.6245725", "0.6245364", "0.6242648", "0.6242648", "0.6239719", "0.6236475", "0.6231861", "0.6230676", "0.6227989", "0.6227989", "0.62269855", "0.62269855", "0.6226534", "0.6226534", "0.62263364", "0.6222334", "0.6221759", "0.6221759", "0.62191397", "0.62191397", "0.6216194", "0.62145525", "0.620927", "0.620927", "0.6202218", "0.6202218", "0.61996084", "0.6196687", "0.61869746" ]
0.0
-1
reduce 13 omitted reduce 14 omitted
def _reduce_15(val, _values, result) result = self.block_append val[0], val[2] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_13(val, _values, result); end", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_17(val, _values, result); end", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_18(val, _values, result); end", "def _reduce_18(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_314(val, _values, result); end", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_34(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_23(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_367(val, _values, result); end", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_28(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_21(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_9(val, _values, result); end", "def _reduce_9(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_385(val, _values, result); end", "def _reduce_53(val, _values, result); end", "def _reduce_53(val, _values, result); end", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_37(val, _values, result); end", "def _reduce_37(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_357(val, _values, result); end", "def _reduce_378(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_634(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend" ]
[ "0.71051943", "0.66943073", "0.66871536", "0.666146", "0.6659532", "0.6659532", "0.6639964", "0.6634204", "0.6625384", "0.6612673", "0.6612673", "0.6604862", "0.660372", "0.660372", "0.6600507", "0.65962356", "0.6593521", "0.656864", "0.656864", "0.6563033", "0.65618736", "0.65600264", "0.6555513", "0.6555176", "0.65494746", "0.65436697", "0.6541409", "0.6541409", "0.6531993", "0.6531993", "0.6520409", "0.6517456", "0.6515164", "0.6515164", "0.6513593", "0.6512408", "0.6511412", "0.65085405", "0.6505977", "0.6503642", "0.6500263", "0.649432", "0.6493082", "0.6482647", "0.6481028", "0.6480555", "0.64804244", "0.6479243", "0.6476836", "0.64738464", "0.64738464", "0.64709663", "0.6469945", "0.6469793", "0.6468427", "0.6466605", "0.6466309", "0.64644104", "0.64602786", "0.6457817", "0.6456136", "0.64501905", "0.64485383", "0.64485383", "0.64474875", "0.6445973", "0.6445973", "0.64383024", "0.6435431", "0.6429446", "0.6423992", "0.64198583", "0.64140326", "0.6410312", "0.6410312", "0.6408448", "0.6408202", "0.6407998", "0.6407229", "0.6407229", "0.6401955", "0.6401698", "0.6397954", "0.6397954", "0.639602", "0.639602", "0.6392406", "0.6392406", "0.63895476", "0.6382317", "0.6377527", "0.6376824", "0.6376609", "0.6376609", "0.63763946", "0.6376318", "0.63734907", "0.63734907", "0.63734907", "0.637127", "0.637127" ]
0.0
-1
reduce 50 omitted reduce 51 omitted reduce 52 omitted
def _reduce_53(val, _values, result) result = new_call val[0], val[2].to_sym, val[3] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_50(val, _values, result); end", "def _reduce_50(val, _values, result); end", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_695(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_470(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_53(val, _values, result); end", "def _reduce_53(val, _values, result); end", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_34(val, _values, result); end", "def _reduce_684(val, _values, result); end", "def _reduce_704(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_476(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_45(val, _values, result); end", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_23(val, _values, result); end", "def _reduce_21(val, _values, result); end", "def _reduce_710(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_37(val, _values, result); end", "def _reduce_37(val, _values, result); end", "def _reduce_17(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_28(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_455(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_686(val, _values, result); end", "def _reduce_280(val, _values, result); end", "def _reduce_280(val, _values, result); end", "def _reduce_480(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end" ]
[ "0.7231666", "0.7231666", "0.705069", "0.698978", "0.69892716", "0.6960059", "0.6960059", "0.6946955", "0.6946955", "0.6919635", "0.6919635", "0.6895957", "0.68615067", "0.68517286", "0.68404305", "0.6838037", "0.6820792", "0.68158424", "0.6803077", "0.6796269", "0.678944", "0.678944", "0.6783678", "0.67699164", "0.6763673", "0.6762398", "0.6760468", "0.67590594", "0.6750173", "0.6741948", "0.6741948", "0.6729614", "0.6729614", "0.6725742", "0.6725742", "0.6725364", "0.6725364", "0.67249024", "0.672408", "0.67218107", "0.67217094", "0.67197055", "0.67107314", "0.6710384", "0.6708062", "0.6707514", "0.6706919", "0.67063", "0.6706169", "0.6703183", "0.6702948", "0.6702948", "0.6697727", "0.6693197", "0.66790485", "0.6674746", "0.6674746", "0.6674594", "0.6672105", "0.66693485", "0.6668622", "0.6649363", "0.66462666", "0.6645858", "0.6639609", "0.6636995", "0.66271085", "0.6624292", "0.6623385", "0.6623363", "0.6619777", "0.6611749", "0.6609265", "0.6606694", "0.65959185", "0.6588637", "0.6588637", "0.6583779", "0.65790904", "0.65790117", "0.6577247", "0.6576632", "0.6573832", "0.6573832", "0.65735054", "0.65727085", "0.65619504", "0.65569836", "0.65567374", "0.65538746", "0.65538746", "0.6553301", "0.6552293", "0.65450656", "0.65450656", "0.6541808", "0.65401095", "0.65401095", "0.65368766", "0.65363574", "0.65363574" ]
0.0
-1
reduce 112 omitted reduce 113 omitted reduce 114 omitted
def _reduce_115(val, _values, result) lexer.lex_state = :expr_end result = val[0] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_312(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_704(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_47(val, _values, result); end", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_634(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_402(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_34(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_728(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_23(val, _values, result); end", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_526(val, _values, result); end", "def _reduce_314(val, _values, result); end" ]
[ "0.72261244", "0.7170795", "0.71659356", "0.7153915", "0.7153915", "0.7145793", "0.71369666", "0.7093935", "0.7092436", "0.70770705", "0.70655614", "0.7050231", "0.7045222", "0.7037273", "0.7025315", "0.7024112", "0.69941646", "0.69941646", "0.69867796", "0.6986567", "0.6981594", "0.69739753", "0.69662976", "0.69594175", "0.6953541", "0.69519186", "0.69498557", "0.6946884", "0.6942736", "0.6942736", "0.6934885", "0.6932316", "0.6926726", "0.6916208", "0.69160515", "0.6915634", "0.6915634", "0.6908451", "0.68996274", "0.6890081", "0.6890081", "0.6880206", "0.6873567", "0.68663996", "0.68648064", "0.68602955", "0.6853156", "0.6852142", "0.6851949", "0.6851949", "0.6849363", "0.68490374", "0.6847798", "0.6846501", "0.68424743", "0.68363327", "0.683242", "0.683242", "0.68320096", "0.6813972", "0.68115455", "0.68096286", "0.68066293", "0.68062925", "0.68044037", "0.6802923", "0.67982876", "0.6798192", "0.67939353", "0.6788425", "0.6782746", "0.6782746", "0.6782266", "0.6781322", "0.6781322", "0.6780343", "0.6780343", "0.67787546", "0.67783844", "0.67783844", "0.6772364", "0.6769162", "0.6769162", "0.67684996", "0.6763307", "0.6757213", "0.6757168", "0.67552835", "0.67552835", "0.67552835", "0.67533195", "0.6753012", "0.675101", "0.675101", "0.67449975", "0.6744171", "0.6744171", "0.67428464", "0.67428464", "0.6739469", "0.6738593" ]
0.0
-1
reduce 117 omitted reduce 118 omitted
def _reduce_119(val, _values, result) result = s(:lit, val[0].to_sym) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_526(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_23(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_34(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_21(val, _values, result); end", "def _reduce_637(val, _values, result); end", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_669(val, _values, result); end", "def _reduce_707(val, _values, result); end", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_135(val, _values, result); end", "def _reduce_135(val, _values, result); end" ]
[ "0.75232965", "0.7501169", "0.74861604", "0.74763745", "0.74594957", "0.7454648", "0.7454648", "0.7452275", "0.7448948", "0.74446094", "0.7437094", "0.74164826", "0.74164826", "0.7414841", "0.7404361", "0.7404354", "0.7397454", "0.73704857", "0.7363599", "0.7361894", "0.7360042", "0.7357585", "0.73558444", "0.73501956", "0.73501956", "0.7341269", "0.73402685", "0.73382956", "0.7326889", "0.7320015", "0.73137677", "0.7313235", "0.73059887", "0.7303196", "0.73011374", "0.7294324", "0.72908795", "0.72908795", "0.7284767", "0.72787696", "0.72787696", "0.72775036", "0.7272294", "0.7272294", "0.72709215", "0.72709215", "0.7270369", "0.72703683", "0.72690517", "0.72642136", "0.72636056", "0.7259995", "0.7259995", "0.725956", "0.72549045", "0.7243624", "0.7243624", "0.72356457", "0.723481", "0.72323686", "0.7229649", "0.72262925", "0.72244287", "0.7215312", "0.72138774", "0.7210802", "0.72095376", "0.72028524", "0.72028524", "0.72003436", "0.7198223", "0.7198223", "0.7197761", "0.7197761", "0.7193978", "0.7192251", "0.7183338", "0.7179945", "0.71765554", "0.71752846", "0.7174782", "0.7173139", "0.71725935", "0.7164483", "0.7164483", "0.71628565", "0.7160085", "0.7159188", "0.7157864", "0.7157864", "0.7157387", "0.71560574", "0.7155836", "0.7153936", "0.7153061", "0.7149044", "0.71486557", "0.71486557", "0.7144154", "0.7142763", "0.7142763" ]
0.0
-1
reduce 124 omitted reduce 125 omitted reduce 126 omitted reduce 127 omitted reduce 128 omitted reduce 129 omitted reduce 130 omitted reduce 131 omitted reduce 132 omitted reduce 133 omitted reduce 134 omitted reduce 135 omitted reduce 136 omitted reduce 137 omitted reduce 138 omitted reduce 139 omitted reduce 140 omitted reduce 141 omitted reduce 142 omitted reduce 143 omitted reduce 144 omitted reduce 145 omitted reduce 146 omitted reduce 147 omitted reduce 148 omitted reduce 149 omitted reduce 150 omitted reduce 151 omitted reduce 152 omitted reduce 153 omitted reduce 154 omitted reduce 155 omitted reduce 156 omitted reduce 157 omitted reduce 158 omitted reduce 159 omitted reduce 160 omitted reduce 161 omitted reduce 162 omitted reduce 163 omitted reduce 164 omitted reduce 165 omitted reduce 166 omitted reduce 167 omitted reduce 168 omitted reduce 169 omitted reduce 170 omitted reduce 171 omitted reduce 172 omitted reduce 173 omitted reduce 174 omitted reduce 175 omitted reduce 176 omitted reduce 177 omitted reduce 178 omitted reduce 179 omitted reduce 180 omitted reduce 181 omitted reduce 182 omitted reduce 183 omitted reduce 184 omitted reduce 185 omitted reduce 186 omitted reduce 187 omitted reduce 188 omitted reduce 189 omitted reduce 190 omitted reduce 191 omitted reduce 192 omitted reduce 193 omitted reduce 194 omitted
def _reduce_195(val, _values, result) result = new_assign val[0], val[2] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_646(val, _values, result)\n yyerrok\n result\nend", "def _reduce_646(val, _values, result)\n yyerrok\n result\nend", "def _reduce_646(val, _values, result)\n yyerrok\n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_641(val, _values, result)\n yyerrok\n result\nend", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_516(val, _values, result)\n yyerrok \n result\nend", "def _reduce_516(val, _values, result)\n yyerrok \n result\nend", "def _reduce_781(val, _values, result)\n yyerrok\n result\nend", "def _reduce_623(val, _values, result)\n yyerrok \n result\nend", "def test_reduce\n assert_equal('12Assign4BuzzAssign78AssignBuzz11Assign1314AssignBuzz',\n @ab.reduce { |acc, res| acc + res })\n end", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_574(val, _values, result)\n yyerrok \n result\nend", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_642(val, _values, result)\n yyerrok\n result\nend", "def _reduce_642(val, _values, result)\n yyerrok\n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_652(val, _values, result)\n yyerrok\n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_643(val, _values, result)\n yyerrok\n result\nend", "def _reduce_643(val, _values, result)\n yyerrok\n result\nend", "def _reduce_643(val, _values, result)\n yyerrok\n result\nend", "def _reduce_619(val, _values, result)\n yyerrok \n result\nend", "def _reduce_619(val, _values, result)\n yyerrok \n result\nend", "def _reduce_619(val, _values, result)\n yyerrok \n result\nend", "def _reduce_619(val, _values, result)\n yyerrok \n result\nend", "def _reduce_619(val, _values, result)\n yyerrok \n result\nend", "def _reduce_617(val, _values, result)\n yyerrok \n result\nend", "def _reduce_617(val, _values, result)\n yyerrok \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_635(val, _values, result)\n yyerrok\n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_784(val, _values, result)\n yyerrok\n result\nend", "def _reduce_577(val, _values, result)\n yyerrok \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_262(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_711(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_752(val, _values, result)\n yyerrok\n result\nend", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_625(val, _values, result)\n yyerrok \n result\nend", "def _reduce_625(val, _values, result)\n yyerrok \n result\nend", "def _reduce_515(val, _values, result)\n yyerrok \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_618(val, _values, result)\n yyerrok \n result\nend", "def _reduce_618(val, _values, result)\n yyerrok \n result\nend", "def _reduce_618(val, _values, result)\n yyerrok \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_740(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_651(val, _values, result)\n yyerrok\n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_271(val, _values, result); end" ]
[ "0.6616578", "0.66102123", "0.6526495", "0.6508312", "0.65080327", "0.6476919", "0.64315206", "0.642066", "0.6405221", "0.6398721", "0.6385419", "0.6385419", "0.6379499", "0.6367299", "0.6358225", "0.63544124", "0.63018304", "0.63018304", "0.63018304", "0.63018304", "0.6294298", "0.6294298", "0.6291384", "0.6291384", "0.6291384", "0.6274679", "0.62671804", "0.62671804", "0.62627435", "0.62600446", "0.62516755", "0.62513065", "0.62513065", "0.6239264", "0.6239127", "0.6239127", "0.6239127", "0.623577", "0.6232824", "0.6228356", "0.62078214", "0.6206962", "0.6200644", "0.6200644", "0.6178297", "0.6178293", "0.61752236", "0.61733353", "0.6167487", "0.6164404", "0.6164404", "0.615618", "0.61543965", "0.61536944", "0.61536944", "0.6140522", "0.61393833", "0.6137669", "0.6130383", "0.6128109", "0.6128109", "0.6128109", "0.6123297", "0.6123297", "0.6123297", "0.6123297", "0.6123297", "0.6121606", "0.6121606", "0.61211586", "0.6121154", "0.61172754", "0.61160594", "0.61160594", "0.6109681", "0.61092204", "0.61055994", "0.61055654", "0.6105069", "0.6103509", "0.61031795", "0.6101796", "0.6098804", "0.60951215", "0.6090894", "0.6090894", "0.60864514", "0.6084695", "0.6073468", "0.60709244", "0.60709244", "0.60709244", "0.60701627", "0.60701627", "0.60692364", "0.6068325", "0.60648406", "0.6061229", "0.60603887", "0.60538256", "0.6051124" ]
0.0
-1
reduce 245 omitted reduce 246 omitted
def _reduce_247(val, _values, result) result = val[0] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_460(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_476(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_457(val, _values, result); end", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_555(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_455(val, _values, result); end", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_314(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_565(val, _values, result); end", "def _reduce_565(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_480(val, _values, result); end", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_744(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_240(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_312(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_248(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_248(val, _values, result)\n result = val[0]\n \n result\nend", "def _reduce_637(val, _values, result); end", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_334(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_280(val, _values, result); end", "def _reduce_280(val, _values, result); end", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_545(val, _values, result); end", "def _reduce_545(val, _values, result); end" ]
[ "0.7197583", "0.7119136", "0.7119136", "0.7059211", "0.703871", "0.70321167", "0.70061857", "0.70061857", "0.6989519", "0.6969411", "0.69565684", "0.69565684", "0.6954753", "0.6954753", "0.69323236", "0.69178504", "0.69175476", "0.69124126", "0.6895392", "0.6888817", "0.6881344", "0.6879359", "0.6874975", "0.6874615", "0.6874615", "0.6872014", "0.68683946", "0.6864443", "0.6864443", "0.68611026", "0.68607414", "0.68526876", "0.6852339", "0.68442917", "0.6844088", "0.6838986", "0.6837493", "0.6837493", "0.68264186", "0.6824293", "0.68235576", "0.6823175", "0.6822605", "0.6821573", "0.68161976", "0.6813691", "0.6802884", "0.68005824", "0.68005824", "0.67983085", "0.67952836", "0.67947245", "0.6789984", "0.6789984", "0.6788698", "0.67879766", "0.6784507", "0.6783952", "0.67803943", "0.6780229", "0.677249", "0.67713535", "0.6770705", "0.67623407", "0.67602634", "0.6756897", "0.6756897", "0.6756792", "0.6755847", "0.67519695", "0.67519695", "0.6750327", "0.6750327", "0.6749397", "0.6742268", "0.6738519", "0.6733857", "0.6732506", "0.6732435", "0.673019", "0.67281187", "0.6727955", "0.6727955", "0.67236614", "0.67236614", "0.6715125", "0.6714355", "0.67123884", "0.6709485", "0.67064947", "0.67041785", "0.67041785", "0.6703903", "0.6694551", "0.6693651", "0.6693651", "0.6689443", "0.66891485", "0.66886455", "0.66865075", "0.66865075" ]
0.0
-1
reduce 271 omitted reduce 272 omitted reduce 273 omitted reduce 274 omitted reduce 275 omitted reduce 276 omitted reduce 277 omitted reduce 278 omitted reduce 279 omitted reduce 280 omitted
def _reduce_281(val, _values, result) result = new_call nil, val[0].to_sym result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_385(val, _values, result)\n @context.in_argdef = false\n \n result\nend", "def _reduce_728(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_336(val, _values, result); end", "def _reduce_336(val, _values, result); end", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_684(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_736(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_385(val, _values, result)\n @context.in_argdef = false\n\n result\nend", "def _reduce_699(val, _values, result); end", "def _reduce_237(val, _values, result)\n result = []\n \n result\nend", "def _reduce_263(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_263(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_263(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_263(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_263(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_374(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_710(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_262(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_280(val, _values, result); end", "def _reduce_280(val, _values, result); end", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_367(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_299(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_476(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_686(val, _values, result)\n result = [ @builder.kwnilarg(val[0], val[1]) ]\n\n result\nend", "def _reduce_357(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_265(val, _values, result)\n result = args val\n\n result\nend", "def _reduce_265(val, _values, result)\n result = args val\n\n result\nend" ]
[ "0.69745237", "0.69344467", "0.6848337", "0.6848337", "0.6845225", "0.68212914", "0.68208015", "0.68128026", "0.6781618", "0.67804587", "0.6769622", "0.6763261", "0.6740749", "0.67387", "0.67387", "0.6730542", "0.6723775", "0.6723775", "0.6721119", "0.67136776", "0.6705349", "0.66931695", "0.6685326", "0.6669959", "0.66685665", "0.6651004", "0.6649956", "0.66432655", "0.66352534", "0.66261816", "0.6624017", "0.6624017", "0.66146064", "0.6605056", "0.6585784", "0.6583915", "0.65661603", "0.65628004", "0.6558146", "0.6558146", "0.6540021", "0.6536709", "0.65339667", "0.65278715", "0.6487876", "0.648507", "0.6484872", "0.64809483", "0.647037", "0.647037", "0.6467405", "0.6467405", "0.64626044", "0.6456286", "0.6445546", "0.6441124", "0.6441124", "0.6421511", "0.6420625", "0.64195114", "0.6417135", "0.6415281", "0.64123785", "0.64109635", "0.64109635", "0.64099246", "0.6409088", "0.64083815", "0.6408321", "0.64064574", "0.64064574", "0.64064574", "0.64064574", "0.64064574", "0.6406052", "0.6404617", "0.6399866", "0.6399866", "0.6393223", "0.6393194", "0.639307", "0.6388821", "0.6387859", "0.6387129", "0.6387129", "0.636997", "0.63690823", "0.63680184", "0.63531786", "0.6351155", "0.63471615", "0.6341434", "0.63408494", "0.63404846", "0.63389045", "0.63309306", "0.63309306", "0.6330521", "0.6326969", "0.6325048", "0.6325048" ]
0.0
-1
reduce 337 omitted reduce 338 omitted reduce 339 omitted reduce 340 omitted reduce 341 omitted reduce 342 omitted reduce 343 omitted reduce 344 omitted reduce 345 omitted reduce 346 omitted reduce 347 omitted reduce 348 omitted reduce 349 omitted reduce 350 omitted reduce 351 omitted reduce 352 omitted reduce 353 omitted
def _reduce_354(val, _values, result) result = s(:if, val[1], val[3], val[4]) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_367(val, _values, result); end", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_50(val, _values, result); end", "def _reduce_50(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_34(val, _values, result); end", "def _reduce_728(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_695(val, _values, result); end", "def _reduce_374(val, _values, result); end", "def _reduce_237(val, _values, result)\n result = []\n \n result\nend", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_345(val, _values, result)\n result = []\n \n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_704(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend" ]
[ "0.7302384", "0.7271871", "0.7251981", "0.72448146", "0.7236824", "0.7234191", "0.7220784", "0.7203808", "0.71949077", "0.7174049", "0.7170608", "0.7170608", "0.71532893", "0.71523434", "0.7146084", "0.7132896", "0.7131156", "0.71279335", "0.7125316", "0.7122396", "0.7117376", "0.7117376", "0.7112077", "0.7104894", "0.7104894", "0.7096284", "0.7096053", "0.7077503", "0.707627", "0.7074613", "0.70675355", "0.7065129", "0.7061961", "0.7054594", "0.7046527", "0.70452344", "0.7043174", "0.7043174", "0.704091", "0.7038615", "0.703819", "0.703819", "0.7037338", "0.7030361", "0.7030263", "0.70192504", "0.70192504", "0.7017071", "0.7017071", "0.7008117", "0.70053947", "0.69997525", "0.69946903", "0.6994626", "0.6986999", "0.6986193", "0.69859654", "0.6982198", "0.6971279", "0.6964233", "0.6964233", "0.6964233", "0.6962898", "0.69598496", "0.6959823", "0.6959823", "0.694979", "0.69442", "0.6937036", "0.6937036", "0.6933992", "0.69321185", "0.69304097", "0.69296205", "0.69296205", "0.69218874", "0.6913217", "0.6913217", "0.6913217", "0.6913217", "0.6909325", "0.6909325", "0.69027984", "0.6902101", "0.69019884", "0.68927056", "0.68927056", "0.6892668", "0.68895024", "0.68849427", "0.68849427", "0.6882827", "0.6881401", "0.6876007", "0.68748766", "0.68748766", "0.6873127", "0.6872045", "0.6871112", "0.6867211", "0.6863789" ]
0.0
-1
reduce 435 omitted reduce 436 omitted
def _reduce_437(val, _values, result) _, klasses, var, _, body, rest = val klasses ||= s(:array) klasses << new_assign(var, s(:gvar, :"$!")) if var result = new_resbody(klasses, body) result << rest if rest # UGH, rewritten above result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_476(val, _values, result); end", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_704(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_455(val, _values, result); end", "def _reduce_697(val, _values, result); end", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_34(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_686(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_637(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_470(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_466(val, _values, result); end", "def _reduce_334(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_736(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_744(val, _values, result); end", "def _reduce_23(val, _values, result); end", "def _reduce_336(val, _values, result); end", "def _reduce_336(val, _values, result); end", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_699(val, _values, result); end", "def _reduce_314(val, _values, result); end", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end" ]
[ "0.7493616", "0.74461585", "0.7432118", "0.7417895", "0.74140906", "0.7410223", "0.73852074", "0.73852074", "0.73734444", "0.73727995", "0.7368928", "0.7368928", "0.7368682", "0.7364385", "0.7362744", "0.7362744", "0.7362077", "0.73469955", "0.73256177", "0.73253495", "0.7310767", "0.7308513", "0.73063457", "0.72878", "0.72841495", "0.7281306", "0.72809285", "0.7277865", "0.7268281", "0.72675276", "0.7267079", "0.7256236", "0.72533536", "0.72493726", "0.7247691", "0.72476345", "0.72476345", "0.72429454", "0.7236568", "0.7234722", "0.7234722", "0.7234186", "0.72337985", "0.7230598", "0.7224881", "0.72246855", "0.72239536", "0.72148424", "0.7208012", "0.71977454", "0.71945107", "0.7192031", "0.7191429", "0.7190799", "0.7190405", "0.7190147", "0.7190147", "0.71900004", "0.71798867", "0.7178572", "0.71779084", "0.7174074", "0.7174074", "0.71735233", "0.7164431", "0.7162071", "0.7162071", "0.71595585", "0.71595585", "0.7157711", "0.7156063", "0.7155964", "0.7153382", "0.7147446", "0.71469134", "0.7143075", "0.7142956", "0.7142584", "0.71320367", "0.7128841", "0.7128841", "0.7126526", "0.7122295", "0.7122295", "0.7118457", "0.7117602", "0.7116939", "0.7116939", "0.7114845", "0.71144265", "0.71144265", "0.7111991", "0.7108891", "0.7105712", "0.7105712", "0.7101494", "0.7101198", "0.70944035", "0.70927644", "0.70921403", "0.70921403" ]
0.0
-1
reduce 440 omitted reduce 441 omitted
def _reduce_442(val, _values, result) result = val[1] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_402(val, _values, result); end", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_476(val, _values, result); end", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_470(val, _values, result); end", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_455(val, _values, result); end", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_385(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_394(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_526(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_460(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_314(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_466(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_135(val, _values, result); end", "def _reduce_135(val, _values, result); end", "def _reduce_480(val, _values, result); end", "def _reduce_697(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_367(val, _values, result); end", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_334(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_45(val, _values, result); end", "def _reduce_34(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_641(val, _values, result)\n yyerrok\n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend" ]
[ "0.721731", "0.7207867", "0.7207867", "0.71946424", "0.71946424", "0.71691567", "0.7132406", "0.71301144", "0.7117591", "0.71081376", "0.7101896", "0.70869297", "0.7084891", "0.7081589", "0.7076122", "0.7068256", "0.70642483", "0.7060014", "0.7045039", "0.70378476", "0.7034433", "0.703257", "0.7031882", "0.70232606", "0.7019215", "0.7015817", "0.70116466", "0.7011375", "0.70039827", "0.69999504", "0.6996794", "0.6996794", "0.69965607", "0.699578", "0.6995131", "0.6993009", "0.6993009", "0.6992275", "0.69881827", "0.6987099", "0.6987099", "0.6979917", "0.6979917", "0.69785094", "0.6974281", "0.696963", "0.69640857", "0.69639665", "0.69596756", "0.69561696", "0.69542384", "0.69532794", "0.69532794", "0.6953011", "0.6953011", "0.6952863", "0.69516283", "0.69483626", "0.6946438", "0.6945371", "0.69394565", "0.69317776", "0.69317776", "0.6928248", "0.6927391", "0.6927391", "0.6926023", "0.69228977", "0.6921643", "0.6918536", "0.6914839", "0.6912469", "0.6906813", "0.6903503", "0.6901766", "0.6901766", "0.6901672", "0.6899983", "0.6894451", "0.6892276", "0.68900865", "0.68889225", "0.68859524", "0.68859005", "0.6884978", "0.68842566", "0.687912", "0.68755", "0.68755", "0.6873413", "0.68714213", "0.68711627", "0.68711627", "0.68709636", "0.687081", "0.68695456", "0.68693936", "0.68661183", "0.6864597", "0.68549997", "0.6854827" ]
0.0
-1
reduce 492 omitted reduce 493 omitted reduce 494 omitted reduce 495 omitted
def _reduce_496(val, _values, result) lexer.lex_state = :expr_end result = val[1] result ||= s(:str, "") case result[0] when :dstr then result[0] = :dsym when :str then result = s(:lit, result.last.to_sym) when :evstr then result = s(:dsym, "", result) else debug20 26, val, result end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_476(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_466(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_699(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_385(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_669(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result); end", "def _reduce_707(val, _values, result); end", "def _reduce_470(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_637(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_34(val, _values, result); end", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_334(val, _values, result); end", "def _reduce_367(val, _values, result); end", "def _reduce_336(val, _values, result); end", "def _reduce_336(val, _values, result); end", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_277(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_710(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_394(val, _values, result); end", "def _reduce_92(val, _values, result); end", "def _reduce_92(val, _values, result); end" ]
[ "0.75097454", "0.7456488", "0.7453151", "0.7452182", "0.74509937", "0.7449296", "0.7429766", "0.7429766", "0.7377436", "0.7362899", "0.7362899", "0.7348039", "0.73479766", "0.73470247", "0.7342043", "0.7338333", "0.73360884", "0.7334733", "0.73183364", "0.73132885", "0.73106515", "0.7294695", "0.7290837", "0.7290837", "0.7288042", "0.728095", "0.72712123", "0.7270285", "0.7270285", "0.72687393", "0.7267156", "0.72644657", "0.72644657", "0.72570485", "0.72570485", "0.72567594", "0.72508204", "0.7247565", "0.72453994", "0.7245063", "0.7244248", "0.72337836", "0.7233772", "0.7230325", "0.7228708", "0.72204214", "0.7214393", "0.7212687", "0.7210953", "0.7206796", "0.720587", "0.7203355", "0.7203355", "0.71985805", "0.71985805", "0.7198107", "0.7197131", "0.71967316", "0.7193887", "0.7193887", "0.71839345", "0.71830344", "0.7182476", "0.7182126", "0.71794087", "0.7178629", "0.7178629", "0.71739703", "0.71658796", "0.71616423", "0.71579254", "0.7155599", "0.71542317", "0.71521336", "0.714746", "0.71472335", "0.7146867", "0.7139473", "0.7139473", "0.71291983", "0.71278304", "0.71260685", "0.71260685", "0.7124445", "0.7121881", "0.7114848", "0.71136314", "0.7113557", "0.7113557", "0.7110847", "0.71065825", "0.71065825", "0.71064353", "0.71064353", "0.7102193", "0.7100642", "0.70990795", "0.7098614", "0.70976853", "0.70918846", "0.70918846" ]
0.0
-1
reduce 499 omitted reduce 500 omitted reduce 501 omitted reduce 502 omitted reduce 503 omitted reduce 504 omitted reduce 505 omitted reduce 506 omitted reduce 507 omitted
def _reduce_508(val, _values, result) result = s(:nil) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_502(val, _values, result); end", "def _reduce_502(val, _values, result); end", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_400(val, _values, result); end", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_599(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_299(val, _values, result); end", "def _reduce_476(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_500(val, _values, result)\n result = [val[0]]\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_409(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_301(val, _values, result); end", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_740(val, _values, result); end", "def _reduce_740(val, _values, result); end", "def _reduce_535(val, _values, result); end", "def _reduce_535(val, _values, result); end", "def _reduce_686(val, _values, result); end", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result); end", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_402(val, _values, result); end", "def _reduce_695(val, _values, result); end", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_470(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_394(val, _values, result); end", "def _reduce_725(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_706(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_707(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_137(val, _values, result); end", "def _reduce_734(val, _values, result); end", "def _reduce_411(val, _values, result); end", "def _reduce_710(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_419(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_744(val, _values, result); end", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_53(val, _values, result); end", "def _reduce_53(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_728(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_701(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_374(val, _values, result); end" ]
[ "0.73070264", "0.73070264", "0.7209698", "0.6852134", "0.6849404", "0.68453383", "0.6807395", "0.6803921", "0.67729086", "0.67563933", "0.67563933", "0.67313653", "0.67259413", "0.6720832", "0.6714344", "0.67038786", "0.6702849", "0.66887444", "0.66887444", "0.66871655", "0.66838616", "0.6679708", "0.66696304", "0.66586155", "0.66551685", "0.66551685", "0.665458", "0.66492575", "0.66460377", "0.66290206", "0.6623649", "0.66201526", "0.6614262", "0.6614186", "0.6614122", "0.6614122", "0.66023624", "0.66023624", "0.6599674", "0.6599073", "0.6599073", "0.6596075", "0.6596075", "0.6592684", "0.65892744", "0.65868545", "0.65787816", "0.65783495", "0.65753824", "0.65684766", "0.656341", "0.6561502", "0.65607285", "0.65544033", "0.6552259", "0.6552065", "0.65471154", "0.65452987", "0.65420866", "0.65402156", "0.65379703", "0.6536172", "0.65330213", "0.6530225", "0.6527902", "0.65275913", "0.65275913", "0.6524676", "0.6519532", "0.6519532", "0.65154445", "0.6511877", "0.6510831", "0.65089095", "0.6504273", "0.6503486", "0.6499161", "0.6494975", "0.64946914", "0.6490708", "0.6490181", "0.64748544", "0.64681816", "0.64681816", "0.6467701", "0.64672804", "0.6466235", "0.6466235", "0.6464278", "0.6464278", "0.64636534", "0.6462569", "0.6462566", "0.6462566", "0.646194", "0.646194", "0.6461758", "0.6461758", "0.645151", "0.6450736", "0.6448854" ]
0.0
-1
reduce 554 omitted reduce 555 omitted
def _reduce_556(val, _values, result) result = val[1] result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_47(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_697(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_669(val, _values, result); end", "def _reduce_455(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_476(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_637(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_466(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_470(val, _values, result); end", "def _reduce_411(val, _values, result); end", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_312(val, _values, result); end", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_23(val, _values, result); end", "def _reduce_744(val, _values, result); end", "def _reduce_667(val, _values, result); end", "def _reduce_736(val, _values, result); end", "def _reduce_707(val, _values, result); end", "def _reduce_34(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_385(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_706(val, _values, result); end" ]
[ "0.7639912", "0.7624237", "0.76109076", "0.7593957", "0.75898474", "0.7565212", "0.7564991", "0.75638", "0.75493157", "0.7546152", "0.7531048", "0.7525904", "0.7525904", "0.75245637", "0.75129205", "0.7506199", "0.7503602", "0.7497428", "0.74846476", "0.7484332", "0.74837697", "0.74810743", "0.74787664", "0.74787664", "0.7469833", "0.7469833", "0.7464874", "0.74632823", "0.7451478", "0.74467206", "0.744438", "0.7441035", "0.74343425", "0.74333215", "0.7427233", "0.7425916", "0.7408946", "0.7407391", "0.740287", "0.74014765", "0.7395911", "0.73935765", "0.7392315", "0.7391589", "0.7391541", "0.7383426", "0.7383368", "0.7383368", "0.73824227", "0.7381799", "0.7381799", "0.73768663", "0.7372272", "0.73679656", "0.736745", "0.736745", "0.7360051", "0.7358903", "0.73572797", "0.73572797", "0.7353916", "0.7341368", "0.7341219", "0.73378664", "0.73378664", "0.73337096", "0.7330916", "0.7329483", "0.73287845", "0.7327564", "0.7327235", "0.7327235", "0.732666", "0.73246366", "0.73226655", "0.7321575", "0.7318548", "0.731672", "0.7314465", "0.7312473", "0.7312473", "0.7312416", "0.7312199", "0.7310569", "0.7300789", "0.7299511", "0.72943664", "0.72876924", "0.7285757", "0.7285757", "0.7282932", "0.72829276", "0.7280568", "0.7277402", "0.7276911", "0.72724897", "0.7269357", "0.72688544", "0.7264829", "0.7264829", "0.72641605" ]
0.0
-1
reduce 568 omitted reduce 569 omitted
def _reduce_570(val, _values, result) result = :"**#{val[1]}" result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_526(val, _values, result); end", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_699(val, _values, result); end", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_669(val, _values, result); end", "def _reduce_707(val, _values, result); end", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_736(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_417(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_470(val, _values, result); end", "def _reduce_466(val, _values, result); end", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_699(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_637(val, _values, result); end" ]
[ "0.75575966", "0.7545057", "0.75303096", "0.7526122", "0.75243783", "0.7501205", "0.7498465", "0.74536043", "0.7431872", "0.74164504", "0.7407575", "0.7400734", "0.73968315", "0.7394537", "0.7394537", "0.7391179", "0.738703", "0.738703", "0.7379894", "0.7379049", "0.73724675", "0.737042", "0.73667777", "0.73606896", "0.73550314", "0.733315", "0.7324406", "0.7324406", "0.73234004", "0.7322652", "0.73217845", "0.7320603", "0.7317265", "0.73161775", "0.731231", "0.7308792", "0.7303987", "0.7295537", "0.72674745", "0.7260835", "0.726052", "0.72603965", "0.72597206", "0.72536963", "0.7243471", "0.7237877", "0.7236816", "0.7229859", "0.72287387", "0.72287387", "0.7227482", "0.7227464", "0.7227464", "0.7227373", "0.7227373", "0.72264934", "0.72247016", "0.7223966", "0.7219862", "0.7218605", "0.72179395", "0.7212055", "0.720835", "0.720835", "0.7208076", "0.7208076", "0.7207785", "0.7206958", "0.7203235", "0.7200464", "0.71869683", "0.7186644", "0.71815497", "0.7178686", "0.7175799", "0.71743953", "0.7169417", "0.71672356", "0.71652496", "0.7160546", "0.7159191", "0.7149131", "0.71471786", "0.7141858", "0.7141858", "0.71408623", "0.7140601", "0.7140601", "0.71372855", "0.71344435", "0.71344435", "0.71341693", "0.71341693", "0.71338373", "0.7132955", "0.7132534", "0.7132534", "0.7132534", "0.7132534", "0.7130758", "0.71299696" ]
0.0
-1
reduce 578 omitted reduce 579 omitted
def _reduce_580(val, _values, result) # TODO: differs from parse.y - needs tests name = val[1].to_sym self.assignable name result = :"*#{name}" result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_634(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_47(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_669(val, _values, result); end", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_476(val, _values, result); end", "def _reduce_707(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_411(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_466(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result); end", "def _reduce_470(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_637(val, _values, result); end", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_455(val, _values, result); end", "def _reduce_706(val, _values, result); end", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_385(val, _values, result); end", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend" ]
[ "0.7599051", "0.75874794", "0.75836533", "0.75740296", "0.7572463", "0.75642824", "0.752806", "0.75032425", "0.7493244", "0.74769664", "0.7473332", "0.7473332", "0.747073", "0.7463626", "0.74627143", "0.7450868", "0.7450868", "0.74423456", "0.7436391", "0.7431159", "0.7431159", "0.7427651", "0.742371", "0.7417933", "0.7416343", "0.74132895", "0.74119425", "0.74081445", "0.74013466", "0.7397952", "0.7393821", "0.7389767", "0.7388609", "0.7376449", "0.736717", "0.7366549", "0.7366549", "0.736189", "0.7356911", "0.73551494", "0.73533225", "0.735107", "0.73418903", "0.7332741", "0.7328217", "0.7321335", "0.73196954", "0.73169714", "0.73148143", "0.73116016", "0.73114145", "0.7310173", "0.7310173", "0.730988", "0.730988", "0.73093253", "0.7308519", "0.73066115", "0.73066115", "0.73025995", "0.73025995", "0.72970206", "0.72970206", "0.7295405", "0.7295165", "0.7292852", "0.72924966", "0.7292416", "0.72800535", "0.7272896", "0.7258558", "0.7257465", "0.72558385", "0.72549343", "0.72501475", "0.72461534", "0.7243203", "0.72384006", "0.7229333", "0.72282505", "0.72282505", "0.72280914", "0.7227662", "0.7225275", "0.7225275", "0.72241956", "0.7222249", "0.7222249", "0.72209805", "0.7219086", "0.7216282", "0.7211577", "0.7211577", "0.7207386", "0.7200447", "0.7196866", "0.7196362", "0.71927226", "0.7190843", "0.71906775", "0.7187655" ]
0.0
-1
reduce 582 omitted reduce 583 omitted
def _reduce_584(val, _values, result) identifier = val[1].to_sym self.env[identifier] = :lvar result = "&#{identifier}".to_sym result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_464(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_271(val, _values, result); end", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_697(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_634(val, _values, result); end", "def _reduce_13(val, _values, result); end", "def _reduce_686(val, _values, result); end", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_603(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_494(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_277(val, _values, result); end", "def _reduce_277(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_704(val, _values, result); end", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_699(val, _values, result); end", "def _reduce_312(val, _values, result); end", "def _reduce_669(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_417(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_707(val, _values, result); end", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_385(val, _values, result); end", "def _reduce_642(val, _values, result)\n yyerrok\n result\nend", "def _reduce_642(val, _values, result)\n yyerrok\n result\nend", "def _reduce_586(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_594(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_268(val, _values, result); end" ]
[ "0.765219", "0.7616411", "0.75855094", "0.7566106", "0.7554131", "0.75505245", "0.7540417", "0.7539315", "0.75309104", "0.7521423", "0.75186825", "0.75186825", "0.75089955", "0.74809426", "0.74774647", "0.74774647", "0.7470855", "0.74699783", "0.74690396", "0.74625146", "0.746196", "0.7461471", "0.7449735", "0.7443054", "0.7433054", "0.7426285", "0.7425955", "0.7420754", "0.74150693", "0.74144554", "0.74144554", "0.741005", "0.740262", "0.7400955", "0.74002755", "0.73880935", "0.7383585", "0.7383585", "0.7376593", "0.7374384", "0.7371015", "0.7371015", "0.73707026", "0.73637503", "0.73566747", "0.7356015", "0.7354092", "0.7347474", "0.73434556", "0.7335459", "0.733534", "0.733534", "0.7328795", "0.73260903", "0.73248345", "0.73247373", "0.7321397", "0.7321397", "0.73206717", "0.7319263", "0.73187345", "0.7317093", "0.7310779", "0.73014003", "0.73014003", "0.7298988", "0.7298928", "0.72974765", "0.72974765", "0.7294434", "0.729184", "0.729184", "0.7291708", "0.72900593", "0.7289677", "0.72892386", "0.7279765", "0.7277908", "0.7277908", "0.72745734", "0.72745734", "0.72745734", "0.72745734", "0.7270008", "0.72697127", "0.72697127", "0.72691697", "0.7267214", "0.72611827", "0.725438", "0.72494656", "0.72494656", "0.724898", "0.72481203", "0.72481203", "0.72477543", "0.7245941", "0.72422963", "0.72415555", "0.7237979", "0.7236917" ]
0.0
-1
reduce 599 omitted reduce 600 omitted reduce 601 omitted reduce 602 omitted reduce 603 omitted reduce 604 omitted reduce 605 omitted reduce 606 omitted reduce 607 omitted reduce 608 omitted reduce 609 omitted reduce 610 omitted reduce 611 omitted reduce 612 omitted reduce 613 omitted reduce 614 omitted reduce 615 omitted reduce 616 omitted reduce 617 omitted reduce 618 omitted reduce 619 omitted reduce 620 omitted reduce 621 omitted
def _reduce_622(val, _values, result) yyerrok result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_50(val, _values, result); end", "def _reduce_50(val, _values, result); end", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_69(val, _values, result); end", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_512(val, _values, result); end", "def _reduce_512(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_695(val, _values, result); end", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "def _reduce_699(val, _values, result); end", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_697(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "def _reduce_9(val, _values, result); end", "def _reduce_9(val, _values, result); end", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_686(val, _values, result); end", "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_363(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_369(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_728(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_367(val, _values, result); end", "def _reduce_634(val, _values, result); end", "def _reduce_23(val, _values, result); end", "def _reduce_669(val, _values, result); end" ]
[ "0.7408907", "0.7345242", "0.7305247", "0.7295564", "0.724144", "0.72382057", "0.72326", "0.7221786", "0.71949935", "0.7176622", "0.7176622", "0.7173267", "0.7169518", "0.7157755", "0.7150136", "0.71356404", "0.7134896", "0.71301156", "0.71276844", "0.7123717", "0.71201277", "0.7108873", "0.71017736", "0.70884955", "0.70845175", "0.7080099", "0.70762944", "0.70699096", "0.70695734", "0.7050048", "0.7047192", "0.70359623", "0.70353335", "0.70353335", "0.70333624", "0.70333624", "0.7030007", "0.7022907", "0.70209086", "0.7018956", "0.70140296", "0.7012854", "0.7012854", "0.70107114", "0.70107114", "0.7002059", "0.69983697", "0.6997276", "0.69955283", "0.69955283", "0.6986393", "0.6986393", "0.6980441", "0.6979594", "0.69741946", "0.69741946", "0.6962797", "0.69570893", "0.69570893", "0.6952882", "0.69402945", "0.69398767", "0.6934217", "0.6933488", "0.6929274", "0.69290245", "0.69290245", "0.69290245", "0.69257563", "0.69236773", "0.6921065", "0.69189423", "0.6917689", "0.6917689", "0.6906074", "0.6906074", "0.6906074", "0.6906074", "0.6904319", "0.6896758", "0.68937767", "0.6893646", "0.6893646", "0.6887701", "0.6887701", "0.6886789", "0.6879818", "0.68770945", "0.68759584", "0.6872573", "0.6872573", "0.6868099", "0.6864363", "0.6864363", "0.68572164", "0.6856532", "0.6842465", "0.6840065", "0.6838692", "0.6833747", "0.6833387" ]
0.0
-1
reduce 623 omitted reduce 624 omitted
def _reduce_625(val, _values, result) yyerrok result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_555(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_548(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_556(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_715(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_464(val, _values, result); end", "def _reduce_604(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_545(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_263(val, _values, result); end", "def _reduce_263(val, _values, result); end", "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_554(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_634(val, _values, result); end", "def _reduce_69(val, _values, result); end", "def _reduce_744(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_528(val, _values, result); end", "def _reduce_528(val, _values, result); end", "def _reduce_234(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_76(val, _values, result); end", "def _reduce_76(val, _values, result); end", "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "def _reduce_363(val, _values, result); end", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_526(val, _values, result); end", "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_13(val, _values, result); end", "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_704(val, _values, result); end", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_576(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_312(val, _values, result); end", "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_363(val, _values, result)\n result = val[1]\n \n result\nend", "def _reduce_603(val, _values, result); end", "def _reduce_603(val, _values, result); end", "def _reduce_23(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_72(val, _values, result); end", "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_684(val, _values, result); end", "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "def _reduce_683(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_47(val, _values, result); end", "def _reduce_697(val, _values, result); end", "def _reduce_637(val, _values, result); end", "def _reduce_455(val, _values, result); end", "def _reduce_476(val, _values, result); end", "def _reduce_686(val, _values, result); end", "def _reduce_378(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_216(val, _values, result)\n result = []\n\n result\nend", "def _reduce_561(val, _values, result); end", "def _reduce_561(val, _values, result); end", "def _reduce_699(val, _values, result); end", "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_669(val, _values, result); end", "def _reduce_736(val, _values, result); end", "def _reduce_363(val, _values, result)\n result = val[1]\n\n result\nend", "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "def _reduce_706(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_268(val, _values, result); end", "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_367(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_211(val, _values, result); end", "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "def _reduce_411(val, _values, result); end", "def _reduce_667(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_240(val, _values, result); end", "def _reduce_21(val, _values, result); end", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_579(val, _values, result)\n _, margs, _ = val\n\n result = margs\n\n result\nend", "def _reduce_34(val, _values, result); end", "def _reduce_470(val, _values, result); end" ]
[ "0.73625827", "0.7355341", "0.7353996", "0.7340223", "0.7313028", "0.7277766", "0.72613597", "0.72607875", "0.7251472", "0.72353256", "0.72184694", "0.72163934", "0.72160876", "0.72160876", "0.72157085", "0.7202236", "0.72007257", "0.71992266", "0.71928775", "0.71748614", "0.71630776", "0.715843", "0.7152796", "0.71519995", "0.71457213", "0.7141", "0.7136833", "0.71322364", "0.71322364", "0.71144664", "0.71060807", "0.71052915", "0.7099191", "0.70966136", "0.7090108", "0.7086045", "0.7086045", "0.7085792", "0.70807034", "0.70807034", "0.70712095", "0.706889", "0.70629203", "0.70606375", "0.7053417", "0.705227", "0.70514405", "0.7047489", "0.70469844", "0.703758", "0.7036117", "0.7031465", "0.7031465", "0.7028411", "0.702113", "0.7009362", "0.700493", "0.700493", "0.700493", "0.7003107", "0.7003107", "0.6998888", "0.6998757", "0.6992618", "0.6988011", "0.6984366", "0.69841504", "0.69746", "0.6964754", "0.6951715", "0.6950516", "0.6949682", "0.69496125", "0.6949261", "0.6947619", "0.6946505", "0.6946505", "0.6937681", "0.6936914", "0.6936436", "0.6933358", "0.6930418", "0.6930405", "0.692692", "0.6915854", "0.69149274", "0.69149274", "0.69139576", "0.69108367", "0.69066256", "0.69066256", "0.6904297", "0.6899975", "0.6896237", "0.68939835", "0.68939835", "0.6892689", "0.68925345", "0.68925345", "0.6890798", "0.68881106" ]
0.0
-1
before_filter :validate_password, :only => ['edit','update','destroy'], :unless => is_admin?(User.find(params[:id])) GET /users GET /users.json
def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render json: @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end", "def filter_user_is_admin\n # We aren't going to redirect on this one. Since it's an admin interface it's pretty sensitive so \n # we're going to give a \"not found\" response (security through obscurity anyone?)\n unless( user_is_admin)\n respond_to do |wants|\n wants.atom { head 404}\n wants.atomsvc { head 404}\n wants.html do\n render :file => \"#{RAILS_ROOT}/public/404.html\", :status => 404\n end\n end\n end\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def admin_auth\n user = User.find_by(id: params[:user_id])\n if ! user\n \trender json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n return\n end \n if user.is? :admin\n render json: {}, status: 201\n else\n render json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n end \n end", "def is_admin\n if current_user.user_type != 1001\n render json: {data: \"you must login as admin...!\" , meta: {status: false} } , status: 401\n end\nend", "def user_params\n admin_access? && admin_user_filter || normal_user_filter\n end", "def index # ☑️ will get all users\n if current_user.admin == true \n render json: User.all\n else \n render json: {message: \"Authorized access denied. Admin status: #{current_user.admin}\"} \n end\n end", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def admin\n check_admin_without_render(current_user)\n @users = User.find(:all, :order => \"updated_at\", :conditions => [\"junk is NOT NULL\", ])\n end", "def show\n @user = User.find(params[:id])\n if !(current_user.isAdmin? or current_user == @user) \n redirect_to home_path, notice: \"Unauthorized!\"\n return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def require_admin_or_correct_user\n @user = User.find(params[:id])\n flash[:error] = \"Access Denied\"\n redirect_to(root_url) unless (current_user.id == @user.id || is_admin?)\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def authenticate_admin!\n render_404 unless current_user.try(:admin?) && current_user\n end", "def index\n @users = User.all.order(\"id\")\n @users = @users.where(is_admin: params[:is_admin]) if params.key?(:is_admin)\n render json: @users\n end", "def edit\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end", "def require_admin_or_self\n unless current_user.admin? || current_user == User.find(params[:id])\n flash[:notice] = \"You must be an admin to access this page\"\n redirect_to users_path\n return false\n end\n end", "def correct_user\n @user = User.find(params[:id])\n #render :json => { :updated? => false, :status => 200, :message => \"You are not allowed edit other users.\" } unless @user == current_user\n redirect_to(root_url) unless @user == current_user\n end", "def check_if_admin\n unless current_user.is_admin?\n render json: {\"errors\" => [\"Inaccessible Resource\"]},\n status: :unauthorized\n return\n end\n end", "def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end", "def update\n @user = User.find(params[:id])\n if current_user.admin? && params[:password].present?\n @user.password = params[:password]\n end\n if @user != current_user && !current_user.admin?\n render json: ['Not authorized for that action'], status: :unauthorized\n elsif @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def before_filter\n if current_user\n true\n end\n end", "def edit_admin\n @user = User.find_by_id(params[:id])\n @users = User.all.page(params[:page]).per(10)\n\n unless @user\n render :file => \"#{Rails.root}/public/404.html\", :status => 404, :layout => false\n end\n end", "def show\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def correсt_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user?(@user) or is_admin?)\n\n end", "def show\n if !current_user.isAdmin? and current_user.id != @user.id\n redirect_to user_path(current_user.id)\n end\n end", "def verify_admin\n unless current_user.admin? or params[:id].to_i == current_user.id\n redirect_to users_path, :alert => 'You are unauthorized to do that.'\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(users_path,:notice =>'Accés non autorisé') unless( current_user?(@user)|| current_user.is_admin?)\n end", "def require_no_user(options = {})\n self.before_filter options do |controller|\n controller.send(:require_no_user)\n end\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def show\n if @oeuser.id.to_i == params[:id].to_i\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n else\n flash[:error] = \"Restricted Access, You need to be Admin\"\n redirect_to root_url\n end\n end", "def show\n if current_user\n @user = User.find(params[:id])\n if (current_user.username == 'Administrator')||(current_user.username == @user.username)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n\telse\n \tredirect_to root_url, :notice => 'Uwaga! Nie masz uprawnie&#324;!'\n \tend\n else\n redirect_to :login, :notice => 'Informacja! Zaloguj si&#281; aby obejrze&#263;!'\n end\n end", "def set_user\n @user = User.find(params[:id])\n\n # only admins can CRUD non-regular users\n return if (@user.role == 'USER') || (current_user.role == 'ADMIN')\n render json: { error: 'Not allowed' }, status: :unauthorized\n end", "def show\n\tif(filters)\n\t\tif(!session[:user_id])\n\t\t\tflash[:error] = \"Acceso denegado\"\n\t\t\tredirect_to home_path\n\t\t\treturn\n\t\tend\n\t\tif(!User.find(session[:user_id]).admin || !User.find(session[:user_id]).active)\n\t\t\tflash[:error] = \"Acceso denegado\"\n\t\t\tredirect_to home_path\n\t\t\treturn\n\t\tend\n\tend\n @user = User.find(params[:id])\n\n\tflash[:active_tab] = \"admin\"\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n @isAdmin = current_user.admin_rights\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def correct_or_admin_user\n @user = User.find(params[:id]) \n unless current_user?(@user) || admin_user?\n redirect_to(login_url)\n end\n end", "def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend", "def update\n @user = User.find(params[:id])\n @profile = Profile.find @user.profile.id\n\n if @user.mooveit? && !params[:is_admin].nil?\n @user.role = Role.find_by_name Role::ADMIN_ROLE\n end\n\n if @user.admin? && params[:is_admin].nil?\n @user.role = Role.find_by_name Role::MOOVEIT_ROLE\n end\n\n\n respond_to do |format|\n if @user.update_without_password(params[:user]) && @profile.update_attributes(params[:profile])\n #format.html { redirect_to @user, notice: 'User was successfully updated.' }\n #format.json { head :no_content }\n @users = User.all\n format.js { render action: \"index\" }\n else\n #format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_user\n redirect_to(login_path) unless current_user.is_admin?\n end", "def user_is_admin\n redirect_to root_path unless current_user && current_user.is_admin?\n end", "def index\n # Shut up I know this is stupid\n @users = User.all\n unless user_signed_in? and current_user.is_admin?\n redirect_to root_path, notice: \"Log in first\"\n end\n end", "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end", "def edit\n\t @user = User.find(params[:id])\n\t redirect_to root_path unless current_user.is_admin? or @user == current_user\n\tend", "def show\n @user = User.find(params[:id])\n unless current_user.admin?\n unless @user == current_user\n redirect_to :back, :alert => \"Access denied.\"\n end\n end\n end", "def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end", "def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer (cgahan@ideeinc.com)...\"\n\tend", "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 admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_admin)\n end", "def only_authorize_admin!\n authorize!(is?(:admin))\n end", "def filter_users\n allowed_keys=[\"email\", \"admin\"]\n filtering_keys=allowed_keys & params.keys\n filtering_keys.each {|key| filter_by_key(key)}\n end", "def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end", "def edit\n #similar to the NEW action, but instead of create a empty user, we will find a user by its id and than\n # send its params to the partial form, so the params can be edited. Please note the partial form\n # for details, as the column admin can be edited only buy logged users with admin privileges.\n #@user variable will be used in the partial form, when submitted goes to UPDATE action.\n @user = User.find(params[:id])\n #only admin can edit other users information, so we first check if the user is admin.\n unless current_user.admin?\n #if the user is not admin it can edit only its own information, so we redirect to edit its own information\n unless @user.id == current_user.id\n redirect_to edit_user_path (current_user)\n end\n end\n end", "def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end", "def edit_user\n redirect_to(root_url) unless current_user.edit?\n end", "def authorize\n return_unauthorized unless current_user && current_user.can_modify_user?(params[:id])\n end", "def update\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n #return render :text => params\n @user = User.find(params[:user][:id])\n if @user.update_attributes(params[:user])\n redirect_to :action => 'index'\n else\n render 'edit'\n end\n else \n redirect_to '/'\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def authenticate_admin\n user = User.where(\"email = ? AND password = ?\", params[:user_email], params[:user_password]).first\n if user.api_key != 'RF70F4yyqXEzdMgklqKQLAtt'\n render json:{'error': 'You are credntials are authorized to access user'}, status: :unprocessable_entity\n end\n rescue\n render json:{'error': 'You are not admin to access user'}, status: :unprocessable_entity\n end", "def edit\n if !(current_user.id == @user.id || is_admin?)\n indicate_illegal_request I18n.t('users.not-your-account')\n end\n end", "def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end", "def disable_admin\n if current_user.admin?\n user = User.find(params[:id])\n user.update_attribute(\"admin\", false)\n redirect_to \"/users\"\n else\n redirect_to \"/home\"\n flash[:warning] = \"Only admins can perform that action.\"\n end\n end", "def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end", "def require_admin\n deny_wrong_user if !admin?\n end", "def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end", "def is_admin?\n @user = User.find(params[:id])\n if !current_user.admin?\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user && current_user.admin?\n end", "def edit\n redirect_to new_lost_password_url unless @user\n end", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def admin_user\n redirect_to('/') unless current_user.isadmin?\n end", "def is_admin\n render status: :unauthorized unless current_user.admin\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n \n end", "def correct_user\n @admin = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@admin)\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def update_visibility\n respond_to do |wants|\n wants.json {\n user = ::User.find_for_authentication(:email => params['email'])\n \n if !user.nil? && user.valid_password?(params['password']) && user.admin?\n json, status = change_visibility_from_params\n render json: json.to_json, status: status\n else\n render json: { error: 'unauthorized' }.to_json, status: :unauthorized\n end\n }\n end\n end", "def show\n if @user.admin?\n @user = User.find(params[:id])\n end\n end", "def admin_user\n unless current_user.admin?\n format.json {render json: 'Bad credentials', status: 401}\n end\n end", "def redirect_non_users(id = params[:user_id])\n not_authorized(\"User not found.\") if id && !User.exists?(id)\n end", "def verify_admin\n render_401 unless current_user.is_admin?\n end", "def show\n respond_to do |format|\n if (current_user.is_admin?)\n @user = current_org.users.find(params[:id])\n format.html\n else\n if (current_user.id != params[:id].to_i)\n format.html { redirect_to user_path(current_user.id) }\n else\n @user = current_user\n format.html\n end\n end\n end\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def require_user\n if current_user && !current_user.admin?\n redirect_to logout_path\n return false\n end\n\n unless current_user\n redirect_to login_path\n return false\n end\n end", "def check_user_rights\n if( params[:id] && !admin_authorized? )\n @bundle = Bundle.find(params[:id])\n if( ! @bundle.public )\n if( @bundle.created_by_user_id != @user.id )\n \t\t\t\trender :action => \"not_allowed\" \n end\n end\n end\n end", "def index\n @user = User.find(params[:user_id])\n @conditions = @user.conditions\n\n if current_user.id == @user.id\n\t\t\trender action: :index\n\t\telse\n\t\t\trender file: 'public/denied'\n\t\tend\n end", "def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end", "def admin_user\n redirect_to(root_url) unless correct_user.admin? \n end", "def admin_required\n session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin\n end", "def edit\n @user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(@user)\n end", "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless !@user.admin? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? \n end", "def admin?\n if !ALLOWED_USERS.include? current_user.email\n redirect_to root_path\n end\n end", "def index\n return permission_denied unless \\\n (params[:id].to_s == @current_user.id.to_s) || \n (params[:email].to_s == @current_user.email.to_s)\n\n @users = User.where(params.permit(:id, :email))\n\n if @users\n render status: :ok,\n json: @users.as_json\n else\n render status: :not_found,\n json: {\n error: \"Users not found\"\n }\n end\n end", "def admin_user\n \t\tredirect_to(root_url) unless current_user.admin?\n \tend", "def check_admin\n return redirect_to user_dashboard_path unless current_user.is_admin?\n end", "def index\n #if is_admin?\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 # else \n # redirect_to :root\n # end\n end", "def update_admin\n @user = User.find_by_id(params[:id])\n if @user.blank?\n render :file => \"#{Rails.root}/public/404.html\", :status => 404, :layout => false\n else\n @user.update_attributes(params[:user])\n @user.errors.full_messages.blank? ? flash.now[:success] = \"Le profil a été mis à jour.\" : false\n @users = User.all.page(params[:page]).per(10)\n render :edit_admin, id: @user.id\n end\n end" ]
[ "0.73334926", "0.69194674", "0.68577206", "0.66831225", "0.66797537", "0.6679477", "0.66706556", "0.66619486", "0.66526407", "0.6649092", "0.66412044", "0.6609014", "0.65936595", "0.659035", "0.6571135", "0.6564993", "0.65550196", "0.6552278", "0.65502024", "0.6504417", "0.6502196", "0.6490118", "0.64875096", "0.6485996", "0.6480573", "0.64783853", "0.6473578", "0.6465419", "0.6453773", "0.6429113", "0.6422753", "0.6418505", "0.64094996", "0.6390155", "0.6376907", "0.63749397", "0.6368693", "0.6351103", "0.6344938", "0.63336825", "0.63330895", "0.6325507", "0.6319221", "0.6305138", "0.6298921", "0.62906367", "0.62872684", "0.62734437", "0.62662154", "0.6266044", "0.625891", "0.62485385", "0.62412864", "0.6239279", "0.6236377", "0.62305653", "0.622721", "0.6222982", "0.6222655", "0.621693", "0.62149465", "0.6212091", "0.6211591", "0.62001675", "0.61941546", "0.61924803", "0.6189441", "0.61808074", "0.617824", "0.6176348", "0.6167507", "0.61609757", "0.61594945", "0.61561054", "0.61552787", "0.6152721", "0.6150084", "0.6149713", "0.614894", "0.6148627", "0.6141038", "0.6140136", "0.6139765", "0.6139741", "0.61394924", "0.613593", "0.613447", "0.6133112", "0.6133062", "0.612972", "0.6127404", "0.6125307", "0.61249924", "0.61245966", "0.61172646", "0.6116189", "0.6111596", "0.6109631", "0.6103684", "0.61032367", "0.6102694" ]
0.0
-1
GET /users/1 GET /users/1.json
def show @user = User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @user } 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 user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\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 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 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 @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end" ]
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.72222257", "0.72165024", "0.72137505", "0.72096044", "0.71930283", "0.7182953", "0.7182144", "0.7182144", "0.7180289", "0.71750754", "0.7173851", "0.71640617", "0.71636444", "0.71453786", "0.7145053", "0.7129776", "0.71256554", "0.71160513", "0.7095665", "0.70941204", "0.70772994", "0.7070785", "0.7070607", "0.7063351", "0.70552826", "0.7025071", "0.7014598", "0.70047677", "0.6998373", "0.69910055", "0.6984177", "0.6979766", "0.6972448", "0.6972228", "0.6968384", "0.69666255", "0.6956339", "0.69506294", "0.6945614", "0.6943135", "0.69351804", "0.6932212", "0.6932212", "0.6932212", "0.6932212", "0.6927094", "0.69255126", "0.6925136", "0.6917375", "0.6907744", "0.68947464", "0.6882589", "0.6875701", "0.68749416", "0.68633634", "0.6861618", "0.6858055", "0.6855495", "0.68530583", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.6849599", "0.6847195", "0.6847074", "0.6847074" ]
0.0
-1
GET /users/new GET /users/new.json
def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end", "def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.8287397", "0.8169197", "0.8155916", "0.80483407", "0.8022376", "0.8021751", "0.8009459", "0.7950995", "0.793078", "0.793078", "0.7873476", "0.7873476", "0.7873476" ]
0.7860956
92
POST /users POST /users.json
def create @user = User.new(params[:user]) respond_to do |format| if @user.save flash.keep[:success] = 'User was successfully Created.' flash.keep[:notice] = 'A confirmation email has been sent to your email box. Click on the confirmation link to complete registration.' format.html { redirect_to login_path } #format.json { render json: @user, status: :created, location: @user } else format.html { render action: "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
PUT /users/1 PUT /users/1.json
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash.keep[:success] = 'User was successfully updated.' format.html { redirect_to @user } format.json { head :no_content } else format.html { redirect_to action: "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: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.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 put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\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.find_by(id: params[:id])\n user.update(user_params)\n render json: user\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.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 user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "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 # byebug\n user.update(user_params)\n\n render json: user\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 update\n user = find_user\n user.update!(user_params)\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_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\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 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\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 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 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(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\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 \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 = 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 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 @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\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\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 @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, 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 @user.update(user_params)\n render json: @current_user\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\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.update(user_params_update)\n json_response(@user)\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 if @user.update(user_params)\n render json: @user, status: :ok, location: @user\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_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_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 render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\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 = 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.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 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 @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\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 @current_user.update(user_params)\n render json: @current_user\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 = 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 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 @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 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 edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\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.update(user_params)\n respond_with @user\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 @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 @user = User.find(params[:id])\n authorize @user\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\t\tif @user.update(users_params)\n \t\tjson_response(@user, \"User Update Successfully.\")\n \telse\n \t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n \tend\n\tend", "def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\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 { 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(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def update!(options: {})\n\t\t\tuser = User.perform_request User.api_url(\"users/#{id}\"), :put, options, true\n\n\t\t\tif user\n\t\t\t\toptions.each do |key, value|\n\t\t\t\t\tself.send(\"#{key}=\", user['data'][\"#{key}\"])\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\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\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 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_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "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_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend", "def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_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_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 update_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.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.update(params[:user])\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.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 @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\n if @user.update(user_params)\n render json: @user, status: :ok, location: api_application_user_path(@application,@user)\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\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 = 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 api_v11_users_user_name_put_with_http_info(user_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_user_name_put ...\"\n end\n \n # verify the required parameter 'user_name' is set\n fail \"Missing the required parameter 'user_name' when calling api_v11_users_user_name_put\" if user_name.nil?\n \n # resource path\n path = \"/api/v11/users/{userName}\".sub('{format}','json').sub('{' + 'userName' + '}', user_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_users_user_name_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend", "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\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 flash[:notice] = \"User #{@user.username} successfully updated!\"\n format.html { redirect_to @user }\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 authorize! :update, user\n if user.update_attributes(user_params)\n render :json => {:ok => true, :message => 'successful updated'}, :head => :no_content\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end" ]
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.67703044", "0.6763487", "0.6761313", "0.6761313", "0.67482305", "0.67473894", "0.6713073", "0.6703807", "0.6693307", "0.66886777", "0.66886777", "0.66646844", "0.66617274", "0.66572624", "0.6653578", "0.66406506", "0.6625279", "0.66213304", "0.66192704", "0.6614916", "0.6612626", "0.6604333", "0.65851104", "0.65851104", "0.65785134", "0.65615654", "0.65518224", "0.65518224", "0.6549094", "0.6530534", "0.6530534", "0.65275174", "0.6523527", "0.6520384", "0.6520384", "0.6516204", "0.65145653", "0.65104014", "0.6504922", "0.6499594", "0.64987266", "0.64906204", "0.64810187", "0.64798295", "0.64702576", "0.64496434", "0.6436427", "0.6433962", "0.64330167", "0.6428237", "0.6406415", "0.6402615", "0.6399288", "0.63881207", "0.63877773", "0.6353986", "0.63537806", "0.633806", "0.63360107", "0.6334851", "0.632672", "0.63260114", "0.63179153", "0.63173646", "0.6317282", "0.6316377", "0.6316055", "0.63120025", "0.6293317", "0.62857985", "0.6282219", "0.6280316", "0.6264061", "0.62624925", "0.625522", "0.62549126", "0.62547195", "0.625327", "0.625269", "0.6252329", "0.6245382" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy flash.keep[:success] = 'User was successfully destroyed.' flash.keep[:warn] = 'You will not be able to login using the deleted account' respond_to do |format| format.html { redirect_to users_url } 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
Check active state condition id : skill ID
def skill_state_on(id) if Skill_State_On[id]['include'] != nil for i in Skill_State[id]['include'] return true if @state.include?(i) end end if Skill_State[id]['set'] != nil for i in Skill_State[id]['set'] return false unless @state.include?(i) end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def won?\n @state.id == 14\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def check_current_status(id, model)\n status = model.find(id)\n status.is_active? ? \"Deactivate\" : \"Activate\"\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return true\n end\n return false \n end", "def attack_skill_id\r\n return 1\r\n end", "def active?; status == :active; end", "def skill_state_off(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return false if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return true unless @state.include?(i)\n end\n return false\n end\n return true\n end", "def active?\r\n\t\tself.patient_status.patient_status_id == 1.0\r\n\tend", "def active?(id)\n existing = find_by_id(id)\n existing && existing.token.nil?\n end", "def check_for_active_game\n # TODO\n end", "def activate\r\n @quest = @kingdom.quests.find(params[:id])\r\n \r\n if @kingdom.quests.where(quest_status: '1').size > 16\r\n flash[:notice] = 'A kingdom can have only 16 active quests at a time.'\r\n elsif @quest.reqs.size == 0\r\n flash[:notice] = \"Quest must have at least one requirement in order to be activated\"\r\n else\r\n @quest.quest_status = SpecialCode.get_code('quest_status','active')\r\n quest_status_change_update\r\n end\r\n redirect_to :action => 'index', :page => params[:page]\r\n end", "def active?\n status == 'active'\n end", "def check\n desired_state = load_state(:desired)\n begin\n current_state = load_state(:current) \n rescue ArgumentError => e\n return desired_state[\"data\"]\n end\n\n item_id = @node[\"effective\"][\"state\"][@state_name][\"desired\"]\n e = Effective.new(current_state[\"data\"], desired_state[\"data\"])\n desired_state[\"conditions\"].each do |condition_name, condition_opts|\n e.condition(condition_name, generate_condition_lambda(condition_opts[\"query\"], condition_opts[\"attribute\"], item_id))\n end\n result, why = e.check(\"or\", desired_state[\"retry_count\"], desired_state[\"random_wait\"])\n return result\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def state_active?(state)\n @states[state][1]\n end", "def active?\n self.status == \"Active\"\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n (status == ACTIVE)\n end", "def active?(options = {})\n self.class.active(options).ids.include? id\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def skill?\n return (@kind == ACTSkill)\n end", "def active?\n return true if status == 'active'\n\n false\n end", "def enemy_has_state?(id, s_id)\n # get enemies\n enemies = get_enemies(id)\n # return result\n return (enemies.any? {|e| e.states.include?(s_id)})\n end", "def skill_var(id)\n for var in Skill_Var[id]\n return true if eval(\"$game_variables[#{var[0]}] #{var[1]}\")\n end\n return false \n end", "def active?\n status == 'active'\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def active?\n status == STATUS[:active]\n end", "def get_active_state( section , params )\n \n if section == ADMIN_SECTION[:create_employee] \n if selected_create_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n if section == ADMIN_SECTION[:all_employees] or section == ADMIN_SECTION[:edit_employee]\n if selected_all_employees_tab?(params) or \n selected_edit_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n end", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def on_hold?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review On-Hold'\").id\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def active?\n\t\t\tstate == 'active'\n\t\tend", "def update_clinician_status\n binding.pry\n #(region.eql? \"India\") && (speciality.eql? \"dentist\")\n if region == \"India\" && speciality != \"dentist\"\n self.status = \"active\"\n end\n return nil\n end", "def check_status\n #binding.pry #TODO: set date_activated/ date_inactive\n return\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def IsActive=(arg0)", "def IsActive=(arg0)", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def active?\n ['active', 'trialing'].include?(status)\n end", "def activite?(id)\n self.activites.each do | act |\n return true if act.id == id\n end\n return false\n end", "def is_active?\n \tself.status.to_sym == :active\n end", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def game_state(game_id)\n\n end", "def active?\n status == 'active'\n end", "def active?(lcr_id)\n if lcrprov = Lcrprovider.find(:first, :conditions => \"provider_id = #{self.id} AND lcr_id = #{lcr_id.to_i}\")\n return lcrprov.active\n else\n return nil\n end\n end", "def past_step_1?\n status_is_active?(\"base_details\")\n end", "def has_active_interview?\n self.interviews.where(:status=>1).present?\nend", "def active_wish?(wish_log, wish, wish_by)\n return wish_log.status == \"ACTIVE\" ? wish.status == \"ACTIVE\" ? wish_by.status == \"ACTIVE\" ? true : false : false : false\n end", "def is_tutoring?\n self.student_requests.where(status: \"active\").exists?\n end", "def any_active_game\n games.where(\"status = 1\").any?\n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def chain_skill_restriction?(skill)\r\r\n #return false unless actor?\r\r\n return false unless $game_party.in_battle\r\r\n return false unless skill.chain_only\r\r\n return false if (self.state?(90) || self.state?(288)) && skill.is_spell?\r\r\n return !@active_chain_enabled\r\r\n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def set_state_check\n @state_check = StateCheck.find(params[:id])\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def if_condition\n \n @profile = Profile.find(params[:id])\n\n if @profile.state_id\n @show_state = State.find(@profile.state_id).name\n else\n @show_state = 'n/a'\n end\n \n if @profile.city\n @show_city = @profile.city\n else\n @show_city = 'n/a'\n end\n \n end", "def on_hold?\n status == :inactive\n end", "def call_status\n job = Job.find(params[:job_id])\n if !job.expert_id.blank? or !job.expert_id.nil?\n render :json=> {:success => false }\n else\n if params[:accept]\n job.update_attributes(:status => \"completed\", :expert_id => params[:expert_id])\n elsif params[:end]\n job.update_attributes(:status => \"active\")\n end\n end\n end", "def is_active(user)\n user.status_id != 0\n end", "def active?\n\t \tstatus.to_s == 'active'\n\tend", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def denied_hipaa_code_active_indicator\n rcc_log.debug \"Obtaining HIPAA code active indicator.\"\n if @denied_hipaa_code_record.present?\n rcc_log.debug \"HIPAA Code Active Indicator: #{@denied_hipaa_code_record.active_indicator}, having ID : #{@denied_hipaa_code_record.id}\"\n @denied_hipaa_code_record.active_indicator\n end\n end", "def active?\n !self.trial_over? or self.paid?\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 hooks_completed(hook)\n execute_sql_query(\n \"select status from state where state_flag like '%#{hook}_%'\"\n ).each do |status|\n return false if status[0].to_i.zero?\n end\n true\n end", "def isActive? \n return true\n end", "def active_code?( code )\n find :first, :conditions => { :code => code }\n end", "def invisible_testSuccess(c, ci, cv, state)\n @state[COMMITMENT].any? {|terms| terms.size == 4 and terms[0] == c and terms[1] == ci}\nend", "def is_active?\n\t\tactive\n\tend", "def active_code?(code)\n find :first, :conditions => {:code => code}\n end", "def skill_sw_off(id)\n if Skill_Sw_Off[id]['include'] != nil\n for i in Skill_Sw_Off[id]['include']\n return true if $game_switches[i] == false\n end\n end\n if Skill_Sw_Off[id]['set'] != nil\n for i in Skill_Sw_Off[id]['set']\n return false unless $game_switches[i] == false\n end\n return true\n end\n return false \n end", "def active?\n\t\t\treturn account_life_cycle_status == ACTIVE \n\t\tend", "def check_status \n return self.status == :open_hotel_block\n end", "def inactive?\n self.status == \"Inactive\"\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def active?\n active\n end", "def activate_status_2(electionId)\n @election = Election.find(electionId) \n @result = true\n @election.proposals.each do |proposal|\n if proposal.options.length == 0\n @result = false\n break\n end\n end\n @result\n end", "def set_status\n\t @id=params[:id]\n\t @state = State.find(@id)\n\t @status = @state.status\n if @status == true\n @state.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @state.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to states_path\n end", "def skill_sp(id)\n if Skill_Sp[id]['integer'] != nil\n return true if eval(\"self.sp #{Skill_Sp[id]['integer']}\")\n end\n if Skill_Sp[id]['rate'] != nil\n return true if eval(\"(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}\")\n end\n return false \n end", "def approved?\n state == 'approved'\n end", "def is_active?\n is_active\n end", "def is_active?\n is_active\n end", "def review_complete?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review Completed'\").id\n end", "def active?\n ACTIVE_STATUSES.include?(self.status.to_sym)\n end", "def current_state\n if self.steps.where(state: 'reproved').exists?\n 'reproved'\n elsif self.steps.pluck(:state).uniq == ['approved']\n 'approved'\n else\n 'waiting'\n end\n end", "def state_resist?(state_id)\r\n state_resist_set.include?(state_id)\r\n end", "def set_skill_level\n @skill_level = SkillLevel.find(params[:id])\n end", "def item_choice?\r\n @item_choice_variable_id > 0\r\n end", "def active?\n active\n end", "def active?\r\n self.team.active?\r\n end", "def has_state?(v)\n@state[v]\nend", "def state\r\n\t\t\t`#{BITS::BITSADMIN} /getstate {#{@id}}`\r\n\t\tend", "def active_status\n\tif active\n\t return \"active\"\n\tend\n\treturn \"inactive\"\n end" ]
[ "0.63264453", "0.61316097", "0.610519", "0.6038598", "0.59788126", "0.5957334", "0.59418553", "0.58565557", "0.58250123", "0.58119106", "0.5799493", "0.5785257", "0.5733393", "0.565602", "0.5633138", "0.56328356", "0.5630677", "0.56222636", "0.5603394", "0.5603394", "0.5595397", "0.5583269", "0.55625105", "0.5558659", "0.55577594", "0.5549214", "0.55412257", "0.55371135", "0.5513034", "0.5511045", "0.54974484", "0.5482482", "0.54791826", "0.5468807", "0.5446807", "0.5442452", "0.54280484", "0.5422612", "0.5422612", "0.5417095", "0.54100907", "0.54002625", "0.5391182", "0.5388915", "0.53872865", "0.53796875", "0.53659844", "0.53650093", "0.53583676", "0.5356987", "0.53426105", "0.5341835", "0.53342766", "0.53341883", "0.5320426", "0.5320097", "0.5317952", "0.53114474", "0.5307924", "0.53033847", "0.5285907", "0.5280129", "0.5276931", "0.527419", "0.5271124", "0.5267384", "0.52551216", "0.5254787", "0.52485895", "0.5240356", "0.5228114", "0.5222444", "0.52203184", "0.5216324", "0.5209914", "0.5209402", "0.5206911", "0.52014357", "0.5196651", "0.51934534", "0.51934534", "0.51934534", "0.51934534", "0.5189613", "0.5189281", "0.5174775", "0.5170062", "0.51696056", "0.51696056", "0.5164978", "0.5164904", "0.5150934", "0.5136487", "0.5133703", "0.51331514", "0.5128577", "0.5121259", "0.51161414", "0.51154095", "0.51107085" ]
0.68436116
0
Check inactive state condition id : skill ID
def skill_state_off(id) if Skill_State_On[id]['include'] != nil for i in Skill_State[id]['include'] return false if @state.include?(i) end end if Skill_State[id]['set'] != nil for i in Skill_State[id]['set'] return true unless @state.include?(i) end return false end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n return true\n end\n return false\n end", "def inactive?\n self.status == \"Inactive\"\n end", "def guard_skill_id\r\n return 2\r\n end", "def on_hold?\n status == :inactive\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def inactive?\n\t\t\treturn account_life_cycle_status == INACTIVE \n\t\tend", "def inactive_user(user_id)\n\tUserMission.find_by(user_id: user_id) ? false : true\nend", "def inactive?\n (status == INACTIVE)\n end", "def check_current_status(id, model)\n status = model.find(id)\n status.is_active? ? \"Deactivate\" : \"Activate\"\n end", "def skill_sw_off(id)\n if Skill_Sw_Off[id]['include'] != nil\n for i in Skill_Sw_Off[id]['include']\n return true if $game_switches[i] == false\n end\n end\n if Skill_Sw_Off[id]['set'] != nil\n for i in Skill_Sw_Off[id]['set']\n return false unless $game_switches[i] == false\n end\n return true\n end\n return false \n end", "def won?\n @state.id == 14\n end", "def inactive\n end", "def check_for_active_game\n # TODO\n end", "def attack_skill_id\r\n return 1\r\n end", "def inactive?\n !active?\n end", "def inactive?\n not active?\n end", "def inactive_user?\n self.status == \"Inactive\"\n end", "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return true\n end\n return false \n end", "def active?(id)\n existing = find_by_id(id)\n existing && existing.token.nil?\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def active?; status == :active; end", "def check_status\n #binding.pry #TODO: set date_activated/ date_inactive\n return\n end", "def inactive?\n !active?\n end", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def make_inactive\n self.status = \"I\"\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_busy?\n @battler && (BusyPhases - [:collapse]).any? do |phase|\n phase == @battler.battle_phase\n end && !@battler.finish || (@battler && @battler.moving?)\n end", "def inactive?\n !self.active?\n end", "def inactive?\n @recurrence.busy_count >= 3\n end", "def active?\n !inactive\n end", "def enemy_has_state?(id, s_id)\n # get enemies\n enemies = get_enemies(id)\n # return result\n return (enemies.any? {|e| e.states.include?(s_id)})\n end", "def inactive!\n self.update_attribute(:status, INACTIVE)\n end", "def inactive_status?\n status.type.abbreviation == 'inactive' rescue false\n end", "def chain_skill_restriction?(skill)\r\r\n #return false unless actor?\r\r\n return false unless $game_party.in_battle\r\r\n return false unless skill.chain_only\r\r\n return false if (self.state?(90) || self.state?(288)) && skill.is_spell?\r\r\n return !@active_chain_enabled\r\r\n end", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def on_hold?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review On-Hold'\").id\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def active?\r\n\t\tself.patient_status.patient_status_id == 1.0\r\n\tend", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def update_clinician_status\n binding.pry\n #(region.eql? \"India\") && (speciality.eql? \"dentist\")\n if region == \"India\" && speciality != \"dentist\"\n self.status = \"active\"\n end\n return nil\n end", "def denied_hipaa_code_active_indicator\n rcc_log.debug \"Obtaining HIPAA code active indicator.\"\n if @denied_hipaa_code_record.present?\n rcc_log.debug \"HIPAA Code Active Indicator: #{@denied_hipaa_code_record.active_indicator}, having ID : #{@denied_hipaa_code_record.id}\"\n @denied_hipaa_code_record.active_indicator\n end\n end", "def became_inactive?\n active_changed? && !active\n end", "def set_active_inactive\n to_set_inactive = (EvaluationTemplate.where.not(id: self.id)).\n where(active: true).where(quarter_id: self.quarter_id)\n if self.active?\n to_set_inactive.each { |t| t.update_attributes(active: false) }\n end\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def inactive!\n @active.update { |_| false }\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def active?\n !self.trial_over? or self.paid?\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def is_active(user)\n user.status_id != 0\n end", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def mark_inactive(quarter = Quarter.current_quarter.next)\n update_attribute(:inactive, true)\n update_attribute(:next_active_quarter_id, quarter.id) # if next_active_quarter.nil?\n end", "def check\n desired_state = load_state(:desired)\n begin\n current_state = load_state(:current) \n rescue ArgumentError => e\n return desired_state[\"data\"]\n end\n\n item_id = @node[\"effective\"][\"state\"][@state_name][\"desired\"]\n e = Effective.new(current_state[\"data\"], desired_state[\"data\"])\n desired_state[\"conditions\"].each do |condition_name, condition_opts|\n e.condition(condition_name, generate_condition_lambda(condition_opts[\"query\"], condition_opts[\"attribute\"], item_id))\n end\n result, why = e.check(\"or\", desired_state[\"retry_count\"], desired_state[\"random_wait\"])\n return result\n end", "def active?\n return true if status == 'active'\n\n false\n end", "def IsActive=(arg0)", "def IsActive=(arg0)", "def inactive?\n return false unless self.checked_out?\n return false if self.hidden\n (Date.today - self.checked_out_at.to_date) >= 7\n end", "def active?\n status == 'active'\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n (status == ACTIVE)\n end", "def active?\n self.status == \"Active\"\n end", "def inactive?\n last_active < 1.minute.ago rescue true\n end", "def skill_busy?\n (@enemy_sprites + @actor_sprites).any? do |sprite|\n sprite.skill_busy?\n end\n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def active?\n\t\tstatus == STATUSES[2]\n\tend", "def bypass_inactive_disable\n @attributes[:bypass_inactive_disable]\n end", "def inactivate\n self.status = \"Inactive\"\n end", "def fetch_inactive_items_of(account_id)\n fetch_items_of(account_id.to_i).select {|s| !s.is_active? }\n end", "def hooks_completed(hook)\n execute_sql_query(\n \"select status from state where state_flag like '%#{hook}_%'\"\n ).each do |status|\n return false if status[0].to_i.zero?\n end\n true\n end", "def guard_usable?\r\n usable?($data_skills[guard_skill_id])\r\n end", "def check_status \n return self.status == :open_hotel_block\n end", "def skill_var(id)\n for var in Skill_Var[id]\n return true if eval(\"$game_variables[#{var[0]}] #{var[1]}\")\n end\n return false \n end", "def cant_counter_skill(current)\n return (not skill_can_use?(current)) if current.numeric?\n for skill_id in current\n return false if skill_can_use?(skill_id)\n end\n return true\n end", "def active?\n\t\t\treturn account_life_cycle_status == ACTIVE \n\t\tend", "def idle?\n @state == :idle\n end", "def game_state(game_id)\n\n end", "def active?\n status == 'active'\n end", "def active?\n status == STATUS[:active]\n end", "def has_active_interview?\n self.interviews.where(:status=>1).present?\nend", "def any_active_game\n games.where(\"status = 1\").any?\n end", "def state_active?(state)\n @states[state][1]\n end", "def is_tutoring?\n self.student_requests.where(status: \"active\").exists?\n end", "def state_guard?(state_id)\n return false\n end", "def call_status\n job = Job.find(params[:job_id])\n if !job.expert_id.blank? or !job.expert_id.nil?\n render :json=> {:success => false }\n else\n if params[:accept]\n job.update_attributes(:status => \"completed\", :expert_id => params[:expert_id])\n elsif params[:end]\n job.update_attributes(:status => \"active\")\n end\n end\n end", "def check_cant_IA(pkmn)\n return true unless pkmn\n return true if pkmn.dead?\n #>Attaque forcée\n if(pkmn.battle_effect.has_forced_attack?)\n _stack_add_attack(\n skill_index: pkmn.battle_effect.get_forced_attack(pkmn),\n target_position: pkmn.battle_effect.get_forced_position,\n launcher: pkmn\n )\n #@results.push([0,pkmn.battle_effect.get_forced_attack(pkmn),\n #-pkmn.battle_effect.get_forced_position-1,pkmn])\n return true\n #>Si lutte car pas de skills viable\n elsif(BattleEngine::_lutte?(pkmn))\n _stack_add_attack(target_position: rand($game_temp.vs_type), launcher: pkmn)\n #@results.push([0,nil,-rand($game_temp.vs_type)-1,pkmn])\n return true\n elsif(pkmn.battle_effect.has_encore_effect?)\n _stack_add_attack(\n skill_index: pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n target_list: util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),\n launcher: pkmn\n )\n #@results.push([0,pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n #util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),pkmn])\n return true\n end\n return false\n end", "def is_audited_state_for(model, options = {})\n\n belongs_to model, touch: true\n\n # validations & double checks\n # make sure that these attributes are present\n validates :hmd_id, presence: true\n validates :state, presence: true\n end", "def get_active_state( section , params )\n \n if section == ADMIN_SECTION[:create_employee] \n if selected_create_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n if section == ADMIN_SECTION[:all_employees] or section == ADMIN_SECTION[:edit_employee]\n if selected_all_employees_tab?(params) or \n selected_edit_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def alert_check\n if current_user.role_id == 4\n @alert_check = Homework.last.id\n @notif_id = current_user.notification_id\n if @alert_check > @notif_id\n @alert = true\n # if @clicked \n # current_user.update_attribute(:notification_id, @alert_check)\n # @clicked = false\n # end \n else \n @alert = false\n end\n else\n# if statement below to ensure that new users do not get error because they do not have any assignments assigned to them.\n if current_user.notification_id != 0 \n @alert_check = Assignment.where(user_id: current_user.id).last.id\n\n @notif_id = current_user.notification_id\n if @alert_check > @notif_id\n @alert = true\n # if @clicked \n # current_user.update_attribute(:notification_id, @alert_check)\n # @clicked = false\n # end \n else \n @alert = false\n end\n end \n end\n end", "def active?\n self.inactive_date && Time.now < self.inactive_date\n end", "def active?\n !canceled?\n end", "def isActive? \n return true\n end", "def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end", "def inactive_access?(count = 7)\n !active_access?(count)\n end", "def skill?\n return (@kind == ACTSkill)\n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def past_step_1?\n status_is_active?(\"base_details\")\n end", "def is_active?\n \tself.status.to_sym == :active\n end", "def activate\r\n @quest = @kingdom.quests.find(params[:id])\r\n \r\n if @kingdom.quests.where(quest_status: '1').size > 16\r\n flash[:notice] = 'A kingdom can have only 16 active quests at a time.'\r\n elsif @quest.reqs.size == 0\r\n flash[:notice] = \"Quest must have at least one requirement in order to be activated\"\r\n else\r\n @quest.quest_status = SpecialCode.get_code('quest_status','active')\r\n quest_status_change_update\r\n end\r\n redirect_to :action => 'index', :page => params[:page]\r\n end" ]
[ "0.64750046", "0.6253902", "0.6251744", "0.6189769", "0.60342383", "0.6016555", "0.598371", "0.59776497", "0.5961252", "0.59382606", "0.59132606", "0.5871623", "0.58465505", "0.58208114", "0.58152235", "0.5798878", "0.5773359", "0.5750117", "0.5748668", "0.57402015", "0.5729312", "0.5723948", "0.5718844", "0.5716401", "0.5716386", "0.57108164", "0.56939846", "0.5679759", "0.5675006", "0.5662225", "0.56265116", "0.55463415", "0.5540147", "0.55213296", "0.54881793", "0.5484265", "0.5477833", "0.54675955", "0.54495037", "0.5448521", "0.5434167", "0.5408909", "0.5402379", "0.5402098", "0.54010606", "0.5399168", "0.5396848", "0.5391378", "0.53904057", "0.5389207", "0.53888917", "0.53853405", "0.53731793", "0.53680843", "0.53612196", "0.53612196", "0.5360193", "0.5353254", "0.5323351", "0.5323351", "0.5321982", "0.5321622", "0.5320307", "0.5308952", "0.5304463", "0.53039956", "0.5298848", "0.52919173", "0.52828205", "0.5276849", "0.5259305", "0.5257372", "0.5256477", "0.5253099", "0.5238416", "0.52267", "0.52230966", "0.5218859", "0.52084523", "0.52063036", "0.5203608", "0.5199114", "0.519667", "0.5188237", "0.5185064", "0.5183936", "0.51825136", "0.51778287", "0.51677185", "0.5158991", "0.51508236", "0.51464295", "0.5144513", "0.51444906", "0.5131573", "0.51310337", "0.51251817", "0.51227117", "0.5114225", "0.51107043" ]
0.66303855
0
Check active swithc condition id : skill ID
def skill_sw_on(id) if Skill_Sw_On[id]['include'] != nil for i in Skill_Sw_On[id]['include'] return true if $game_switches[i] end end if Skill_Sw_On[id]['set'] != nil for i in Skill_Sw_On[id]['set'] return false unless $game_switches[i] end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def skill?\n return (@kind == ACTSkill)\n end", "def skill_sp(id)\n if Skill_Sp[id]['integer'] != nil\n return true if eval(\"self.sp #{Skill_Sp[id]['integer']}\")\n end\n if Skill_Sp[id]['rate'] != nil\n return true if eval(\"(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}\")\n end\n return false \n end", "def skill_sw_off(id)\n if Skill_Sw_Off[id]['include'] != nil\n for i in Skill_Sw_Off[id]['include']\n return true if $game_switches[i] == false\n end\n end\n if Skill_Sw_Off[id]['set'] != nil\n for i in Skill_Sw_Off[id]['set']\n return false unless $game_switches[i] == false\n end\n return true\n end\n return false \n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n return true\n end\n return false\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def skill_var(id)\n for var in Skill_Var[id]\n return true if eval(\"$game_variables[#{var[0]}] #{var[1]}\")\n end\n return false \n end", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def test_supportSkill\n f = SkillFilter.new(\"support\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 29\n end", "def activate\r\n @quest = @kingdom.quests.find(params[:id])\r\n \r\n if @kingdom.quests.where(quest_status: '1').size > 16\r\n flash[:notice] = 'A kingdom can have only 16 active quests at a time.'\r\n elsif @quest.reqs.size == 0\r\n flash[:notice] = \"Quest must have at least one requirement in order to be activated\"\r\n else\r\n @quest.quest_status = SpecialCode.get_code('quest_status','active')\r\n quest_status_change_update\r\n end\r\n redirect_to :action => 'index', :page => params[:page]\r\n end", "def enable?(skill)\n return @actor.skill_can_use?(skill)\n end", "def key_skill; end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end", "def set_my_condition\n @my_condition = MyCondition.find(params[:id])\n end", "def special_skill(launcher, target, skill)\n case skill.symbol\n when :s_counter #Riposte & co\n if skill.id == 64 and (count = target.skill_category_amount(1)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n elsif skill.id == 243 and (count = target.skill_category_amount(2)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n else\n @IA_Info[:other_factor] = rand * 0.7\n end\n else\n return false\n end\n return true\n end", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n @enemy.water_magic >= @skill.water_cost &&\n @enemy.earth_magic >= @skill.earth_cost &&\n @enemy.wind_magic >= @skill.wind_cost )\n #@enemy.light_magic >= @skill.light_cost &&\n #@enemy.dark_magic >= @skill.dark_cost )\n \n self.tone.set(0, 30, 0)\n else\n self.tone.set(70, 0, 0)\n end\n else\n self.tone.set(0, 0, 70)\n end\n end\n end", "def chain_skill_restriction?(skill)\r\r\n #return false unless actor?\r\r\n return false unless $game_party.in_battle\r\r\n return false unless skill.chain_only\r\r\n return false if (self.state?(90) || self.state?(288)) && skill.is_spell?\r\r\n return !@active_chain_enabled\r\r\n end", "def check_current_status(id, model)\n status = model.find(id)\n status.is_active? ? \"Deactivate\" : \"Activate\"\n end", "def set_skill\n @skill = @project.skills.find(params[:skillId])\n end", "def proficiency_for(skill)\n SkillsUser.find_by_user_id_and_skill_id(self.id, skill.id).skill_level\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end", "def cant_counter_skill(current)\n return (not skill_can_use?(current)) if current.numeric?\n for skill_id in current\n return false if skill_can_use?(skill_id)\n end\n return true\n end", "def update_skill\n # continue input update if skill should be used\n return false if !self.check_skill_condition?\n # if skill not usable or skill use process not executed and no selection\n if $game_player.battler.skill == 0 ||\n !$game_player.use_skill($data_skills[$game_player.battler.skill]) &&\n $game_temp.select_data == nil\n # play buzzer, can't use\n $game_system.se_play($data_system.buzzer_se)\n end\n # stop input update\n return true\n end", "def set_desired_skill\n @desired_skill = DesiredSkill.find(params[:id])\n end", "def phase3_command_skill\r\n # Set action\r\n @active_battler.current_action.kind = 1\r\n # Start skill selection\r\n start_skill_select\r\n end", "def test_attackSkill\n f = SkillFilter.new(\"attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 44\n end", "def update_phase3_skill_select\n # Make skill window visible\n @skill_window.visible = true\n # Update skill window\n @skill_window.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End skill selection\n end_skill_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the skill window\n @skill = @skill_window.skill\n # If it can't be used\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.skill_id = @skill.id\n # Make skill window invisible\n @skill_window.visible = false\n # If effect scope is single enemy\n if @skill.scope == 1\n # Start enemy selection\n start_enemy_select\n # If effect scope is single ally\n elsif @skill.scope == 3 or @skill.scope == 5\n # Start actor selection\n start_actor_select\n # If effect scope is not single\n else\n # End skill selection\n end_skill_select\n # Go to command input for next actor\n phase3_next_actor\n end\n return\n end\n end", "def counter_skills_id\n [data_battler.counter_skill]\n end", "def check_for_active_game\n # TODO\n end", "def update_phase3_skill_select\r\n # Make skill window visible\r\n @skill_window.visible = true\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End skill selection\r\n end_skill_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the skill window\r\n @skill = @skill_window.skill\r\n # If it can't be used\r\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.skill_id = @skill.id\r\n # Make skill window invisible\r\n @skill_window.visible = false\r\n @skill_window.active = false\r\n # If effect scope is single enemy\r\n if @skill.scope == 1\r\n # Start enemy selection\r\n start_enemy_select\r\n # If effect scope is single ally\r\n elsif @skill.scope == 3 or @skill.scope == 5\r\n # Start actor selection\r\n start_actor_select\r\n # If effect scope is not single\r\n else\r\n # End skill selection\r\n end_skill_select\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n return\r\n end\r\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end", "def current_qc_inspection\n return if authorise_for_web(program_name(params[:id]),'edit')== false\n qc_current_inspection = ActiveRecord::Base.connection.select_one(\"select * from qc_current_inspections\n where user_id = #{session[:user_id].id}\n and qc_inspection_type_code = '#{params[:id]}'\")\n if qc_current_inspection.nil? || qc_current_inspection.qc_inspection_id.nil?\n redirect_to_index(\"'You have not yet captured an inspection for #{params[:id]}'\", \"''\")\n else\n @qc_inspection = QcInspection.find(qc_current_inspection.qc_inspection_id)\n params[:id_value] = @qc_inspection.qc_inspection_type.qc_inspection_type_code\n params[:id] = @qc_inspection.id\n edit_qc_inspection\n end\n end", "def set_skill\n @skill = @character.skills.find(params[:id])\n end", "def set_skill\n @skill = policy_scope(Skill).find(params[:id])\n authorize(@skill)\n end", "def active_wish?(wish_log, wish, wish_by)\n return wish_log.status == \"ACTIVE\" ? wish.status == \"ACTIVE\" ? wish_by.status == \"ACTIVE\" ? true : false : false : false\n end", "def set_skill_level\n @skill_level = SkillLevel.find(params[:id])\n end", "def set_win_condition\n @win_condition = WinCondition.find(params[:id])\n end", "def is_tutoring?\n self.student_requests.where(status: \"active\").exists?\n end", "def get_condition\n @condition\n end", "def create\n # 検証。同一スキルカテゴリIDかつ同一スキル名を持っている場合はエラー\n @exist = Skill.where(skill_category_id: skill_params[:skill_category_id]).where(skill_name: skill_params[:skill_name])\n\n @skill = Skill.new(skill_params)\n @skill.has_learning_level=true\n \n logger.debug(\"skill\")\n logger.debug(@skill)\n\n if @exist.present? \n render json:{errors: 'already exists.', status: :unprocessable_entity }\n else\n if @skill.save\n render json:{skill: @skill}\n else\n render json:{errors: @skill.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def set_current_skill\n @current_skill = CurrentSkill.find(params[:id])\n end", "def class_condition_met?(action)\n cls = self.class\n return true unless cls\n learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }\n return true unless learning\n return false if self.level < learning.level\n return true\n end", "def current_qc_business_context_search\n return if authorise_for_web(program_name(params[:id]),'create')== false\n session[:qc_inspection_type_code] = params[:id]\n qc_current_inspection = ActiveRecord::Base.connection.select_one(\"select * from qc_current_inspections\n where user_id = #{session[:user_id].id}\n and qc_inspection_type_code = '#{params[:id]}'\")\n if qc_current_inspection.nil? || qc_current_inspection.qc_business_context_query.nil?\n redirect_to_index(\"'You have not yet captured an inspection for #{params[:id]}'\", \"''\")\n else\n dm_session[:search_engine_query_definition] = qc_current_inspection.qc_business_context_query\n session[:columns_list] = YAML.load(qc_current_inspection.columns_list)\n submit_business_context_search\n end\n end", "def set_myskill\n @myskill = Myskill.find(params[:id])\n end", "def set_counter_condition(user, damage, skill = nil)\n if self.actor?\n set_counter(user, damage, skill, 'Actor')\n set_counter(user, damage, skill, 'Skill')\n set_counter(user, damage, skill, 'Armor')\n set_counter(user, damage, skill, 'Weapon')\n else\n set_counter(user, damage, skill, 'Enemy')\n end\n set_counter(user, damage, skill, 'State')\n return if @valid_counters.empty?\n self.counter_action = @valid_counters[rand(@valid_counters.size)]\n end", "def delete_check\n if Skill.where(id:params[:id]).blank?\n render json: {result: 'couldnt process delete request'} #dont give extra failure info security-wise\n else\n @skill = Skill.find(params[:id])\n end\n end", "def teaching_level(level) \n services = self.services\n if !services.blank?\n services.each do |s|\n if s.level_id = level\n return true\n end\n end \n end \n return false \n end", "def set_skill\n @skill = Skill.all.find(params[:id])\n end", "def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end", "def skill_cost_payable?(skill)\r\n tp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill)\r\n end", "def set_s_skill\n @s_skill = SSkill.find(params[:id])\n end", "def active?(cas)\n results = []\n \n get_experiments(cas).each do |exp|\n \n results << result(exp[:assay])\n end\n \n if results.size >0 \n positive = results.count {|statement| statement[:result].to_s.include?(\"POSITIVE\") == true}\n negative = results.count {|statement| statement[:result].to_s.include?(\"NEGATIVE\") == true}\n noconclusion = results.count {|statement| statement[:result].to_s.include?(\"NO CONCLUSION\") == true }\n\n if(positive >= negative)\n return \"ACTIVE\"\n elsif(negative > positive)\n return \"INACTIVE\"\n elsif(negative == 0 && positive == 0 && noconclusion != 0)\n return \"INACTIVE\"\n else\n return \"?\"\n end\n\n end\n \n end", "def update_clinician_status\n binding.pry\n #(region.eql? \"India\") && (speciality.eql? \"dentist\")\n if region == \"India\" && speciality != \"dentist\"\n self.status = \"active\"\n end\n return nil\n end", "def set_buildskill\n @buildskill = Buildskill.find(params[:id])\n end", "def valid_skill_levels\n %w[beginner intermediate expert]\n end", "def blue_magic_skills\n @skills.select { |id| $data_skills[id].blue_magic }\n end", "def adventuring() skill(:adventuring) end", "def won?\n @state.id == 14\n end", "def alert_check\n if current_user.role_id == 4\n @alert_check = Homework.last.id\n @notif_id = current_user.notification_id\n if @alert_check > @notif_id\n @alert = true\n # if @clicked \n # current_user.update_attribute(:notification_id, @alert_check)\n # @clicked = false\n # end \n else \n @alert = false\n end\n else\n# if statement below to ensure that new users do not get error because they do not have any assignments assigned to them.\n if current_user.notification_id != 0 \n @alert_check = Assignment.where(user_id: current_user.id).last.id\n\n @notif_id = current_user.notification_id\n if @alert_check > @notif_id\n @alert = true\n # if @clicked \n # current_user.update_attribute(:notification_id, @alert_check)\n # @clicked = false\n # end \n else \n @alert = false\n end\n end \n end\n end", "def check_product\n #nhan ID va kiem tra\n @product=Product.find(1)\n respond_to do |format|\n if @product.instock_quality >= ??#cho nhan so luong\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def is_cuffed?\n return weapon_id == 33\n end", "def get_new_skills(level)\n self.skills.select do |skill|\n skill.min_level == level\n end\n end", "def skill_type_sealed?(stype_id)\r\n features_set(FEATURE_STYPE_SEAL).include?(stype_id)\r\n end", "def is_switchable\n return selected_skill != nil && selected_skill.is_a?(RPG::Skill)\n end", "def condition(identifier)\n ->(e) { e[\"HTTP_X_COND#{identifier}\"] == 'true' }\nend", "def set_skill\n @skill = Skill.find_by_id(params[:id])\n end", "def guard_usable?\r\n usable?($data_skills[guard_skill_id])\r\n end", "def set_health_condition\n @health_condition = HealthCondition.find(params[:id])\n end", "def skill_effect_physical_hit_result(skill)\r\n # If physical attack has power other than 0\r\n if skill.power != 0 and skill.atk_f > 0\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Return True\r\n return true\r\n end\r\n # Return False\r\n return false\r\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def check\n desired_state = load_state(:desired)\n begin\n current_state = load_state(:current) \n rescue ArgumentError => e\n return desired_state[\"data\"]\n end\n\n item_id = @node[\"effective\"][\"state\"][@state_name][\"desired\"]\n e = Effective.new(current_state[\"data\"], desired_state[\"data\"])\n desired_state[\"conditions\"].each do |condition_name, condition_opts|\n e.condition(condition_name, generate_condition_lambda(condition_opts[\"query\"], condition_opts[\"attribute\"], item_id))\n end\n result, why = e.check(\"or\", desired_state[\"retry_count\"], desired_state[\"random_wait\"])\n return result\n end", "def skill_cost_payable?(skill)\n tp >= skill_tp_cost(skill) && mp >= skill_mp_cost(skill)\n end", "def set_opening_skill\n @opening_skill = OpeningSkill.find(params[:id])\n end", "def set_app_condition\n @app_condition = AppCondition.find(params[:id])\n end", "def find_skills\n @user = User.find(params[:id])\n @user_skill = UserSkill.where(\"user_id = @user.id\")\n end", "def get_micr_condition\n @facility.details[:micr_line_info] && @facility_output_config.grouping == 'By Payer'\n end", "def skill_hp(id)\n if Skill_Hp[id]['integer'] != nil\n return true if eval(\"self.hp #{Skill_Hp[id]['integer']}\")\n end\n if Skill_Hp[id]['rate'] != nil\n return true if eval(\"(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}\")\n end\n return false\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end" ]
[ "0.65793777", "0.62702954", "0.6269415", "0.61987203", "0.59673107", "0.5870263", "0.5865037", "0.5766478", "0.57550406", "0.5745022", "0.57190704", "0.57019264", "0.56955755", "0.56949335", "0.55814713", "0.5574198", "0.5557739", "0.5557588", "0.5540415", "0.5540138", "0.55098546", "0.54899627", "0.5445724", "0.5437357", "0.541813", "0.5408862", "0.5398664", "0.538851", "0.53846973", "0.53802997", "0.53734785", "0.53601056", "0.5351546", "0.53468746", "0.5312536", "0.5305422", "0.529558", "0.5291385", "0.52848935", "0.5279394", "0.5277329", "0.5270161", "0.52699685", "0.52573293", "0.5231806", "0.5223094", "0.52168155", "0.52129185", "0.52078354", "0.51998436", "0.5193515", "0.5186412", "0.5182173", "0.5175751", "0.5166871", "0.5166333", "0.51602685", "0.51598245", "0.51567084", "0.51560456", "0.51510406", "0.5141346", "0.5138718", "0.51335543", "0.51247764", "0.5114401", "0.5108536", "0.5108409", "0.51065034", "0.5096015", "0.50882953", "0.5082647", "0.5082348", "0.5080673", "0.5076507", "0.50730133", "0.50710255", "0.5071005", "0.5068833", "0.50683814", "0.5049246", "0.50419503", "0.5040807", "0.5040704", "0.5040244", "0.5040244", "0.5040244", "0.5040244", "0.5039715", "0.50396484", "0.5039116", "0.5034401", "0.5030823", "0.5025714", "0.50252795", "0.50213695", "0.50213695", "0.50213695", "0.50213695", "0.50213695" ]
0.66491723
0
Check inactive swithc condition id : skill ID
def skill_sw_off(id) if Skill_Sw_Off[id]['include'] != nil for i in Skill_Sw_Off[id]['include'] return true if $game_switches[i] == false end end if Skill_Sw_Off[id]['set'] != nil for i in Skill_Sw_Off[id]['set'] return false unless $game_switches[i] == false end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return true\n end\n return false \n end", "def guard_skill_id\r\n return 2\r\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def skill_state_off(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return false if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return true unless @state.include?(i)\n end\n return false\n end\n return true\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def skill_busy?\n @battler && (BusyPhases - [:collapse]).any? do |phase|\n phase == @battler.battle_phase\n end && !@battler.finish || (@battler && @battler.moving?)\n end", "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n return true\n end\n return false\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def inactive?\n self.status == \"Inactive\"\n end", "def check_current_status(id, model)\n status = model.find(id)\n status.is_active? ? \"Deactivate\" : \"Activate\"\n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def check_for_active_game\n # TODO\n end", "def cant_counter_skill(current)\n return (not skill_can_use?(current)) if current.numeric?\n for skill_id in current\n return false if skill_can_use?(skill_id)\n end\n return true\n end", "def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n @enemy.water_magic >= @skill.water_cost &&\n @enemy.earth_magic >= @skill.earth_cost &&\n @enemy.wind_magic >= @skill.wind_cost )\n #@enemy.light_magic >= @skill.light_cost &&\n #@enemy.dark_magic >= @skill.dark_cost )\n \n self.tone.set(0, 30, 0)\n else\n self.tone.set(70, 0, 0)\n end\n else\n self.tone.set(0, 0, 70)\n end\n end\n end", "def on_hold?\n status == :inactive\n end", "def chain_skill_restriction?(skill)\r\r\n #return false unless actor?\r\r\n return false unless $game_party.in_battle\r\r\n return false unless skill.chain_only\r\r\n return false if (self.state?(90) || self.state?(288)) && skill.is_spell?\r\r\n return !@active_chain_enabled\r\r\n end", "def inactive_user(user_id)\n\tUserMission.find_by(user_id: user_id) ? false : true\nend", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def check_status\n #binding.pry #TODO: set date_activated/ date_inactive\n return\n end", "def update_skill\n # continue input update if skill should be used\n return false if !self.check_skill_condition?\n # if skill not usable or skill use process not executed and no selection\n if $game_player.battler.skill == 0 ||\n !$game_player.use_skill($data_skills[$game_player.battler.skill]) &&\n $game_temp.select_data == nil\n # play buzzer, can't use\n $game_system.se_play($data_system.buzzer_se)\n end\n # stop input update\n return true\n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def skill?\n return (@kind == ACTSkill)\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end", "def inactive?\n (status == INACTIVE)\n end", "def update_clinician_status\n binding.pry\n #(region.eql? \"India\") && (speciality.eql? \"dentist\")\n if region == \"India\" && speciality != \"dentist\"\n self.status = \"active\"\n end\n return nil\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end", "def skill_effect_setup\r\n self.critical = false\r\n end", "def skill_sp(id)\n if Skill_Sp[id]['integer'] != nil\n return true if eval(\"self.sp #{Skill_Sp[id]['integer']}\")\n end\n if Skill_Sp[id]['rate'] != nil\n return true if eval(\"(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}\")\n end\n return false \n end", "def inactive?\n\t\t\treturn account_life_cycle_status == INACTIVE \n\t\tend", "def skill_var(id)\n for var in Skill_Var[id]\n return true if eval(\"$game_variables[#{var[0]}] #{var[1]}\")\n end\n return false \n end", "def disabled_sub_command?\r\n # If Skill Selected\r\n if @command_window.command == SDK::Scene_Commands::Scene_Menu::Skill\r\n # If this actor's action limit is 2 or more\r\n if $game_party.actors[@status_window.index].restriction >= 2\r\n return true\r\n end\r\n end\r\n return false\r\n end", "def active?\n !self.trial_over? or self.paid?\n end", "def test_supportSkill\n f = SkillFilter.new(\"support\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 29\n end", "def set_counter_condition(user, damage, skill = nil)\n if self.actor?\n set_counter(user, damage, skill, 'Actor')\n set_counter(user, damage, skill, 'Skill')\n set_counter(user, damage, skill, 'Armor')\n set_counter(user, damage, skill, 'Weapon')\n else\n set_counter(user, damage, skill, 'Enemy')\n end\n set_counter(user, damage, skill, 'State')\n return if @valid_counters.empty?\n self.counter_action = @valid_counters[rand(@valid_counters.size)]\n end", "def enable?(skill)\n return @actor.skill_can_use?(skill)\n end", "def is_tutoring?\n self.student_requests.where(status: \"active\").exists?\n end", "def inactive\n end", "def alert_check\n if current_user.role_id == 4\n @alert_check = Homework.last.id\n @notif_id = current_user.notification_id\n if @alert_check > @notif_id\n @alert = true\n # if @clicked \n # current_user.update_attribute(:notification_id, @alert_check)\n # @clicked = false\n # end \n else \n @alert = false\n end\n else\n# if statement below to ensure that new users do not get error because they do not have any assignments assigned to them.\n if current_user.notification_id != 0 \n @alert_check = Assignment.where(user_id: current_user.id).last.id\n\n @notif_id = current_user.notification_id\n if @alert_check > @notif_id\n @alert = true\n # if @clicked \n # current_user.update_attribute(:notification_id, @alert_check)\n # @clicked = false\n # end \n else \n @alert = false\n end\n end \n end\n end", "def skill_busy?\n (@enemy_sprites + @actor_sprites).any? do |sprite|\n sprite.skill_busy?\n end\n end", "def valid_skill_levels\n %w[beginner intermediate expert]\n end", "def guard_usable?\r\n usable?($data_skills[guard_skill_id])\r\n end", "def class_condition_met?(action)\n cls = self.class\n return true unless cls\n learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }\n return true unless learning\n return false if self.level < learning.level\n return true\n end", "def test_attackSkill\n f = SkillFilter.new(\"attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 44\n end", "def active?; status == :active; end", "def key_skill; end", "def active_wish?(wish_log, wish, wish_by)\n return wish_log.status == \"ACTIVE\" ? wish.status == \"ACTIVE\" ? wish_by.status == \"ACTIVE\" ? true : false : false : false\n end", "def inactive?\n @recurrence.busy_count >= 3\n end", "def ignore_skill_guard?\n !note[TSBS::IgnoreSkillGuard].nil?\n end", "def ignore_skill_guard?\n !note[TSBS::IgnoreSkillGuard].nil?\n end", "def inactive_user?\n self.status == \"Inactive\"\n end", "def check_new_skills\n last_skills = skills\n self.class.learnings.each do |learning|\n learn_skill(learning.skill_id) if can_learn_skill?(learning)\n end\n display_learn_skills(skills - last_skills)\n end", "def won?\n @state.id == 14\n end", "def on_hold?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Review On-Hold'\").id\n end", "def check_cant_IA(pkmn)\n return true unless pkmn\n return true if pkmn.dead?\n #>Attaque forcée\n if(pkmn.battle_effect.has_forced_attack?)\n _stack_add_attack(\n skill_index: pkmn.battle_effect.get_forced_attack(pkmn),\n target_position: pkmn.battle_effect.get_forced_position,\n launcher: pkmn\n )\n #@results.push([0,pkmn.battle_effect.get_forced_attack(pkmn),\n #-pkmn.battle_effect.get_forced_position-1,pkmn])\n return true\n #>Si lutte car pas de skills viable\n elsif(BattleEngine::_lutte?(pkmn))\n _stack_add_attack(target_position: rand($game_temp.vs_type), launcher: pkmn)\n #@results.push([0,nil,-rand($game_temp.vs_type)-1,pkmn])\n return true\n elsif(pkmn.battle_effect.has_encore_effect?)\n _stack_add_attack(\n skill_index: pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n target_list: util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),\n launcher: pkmn\n )\n #@results.push([0,pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n #util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),pkmn])\n return true\n end\n return false\n end", "def trigger_king_rock?\n return data.status != 7\n end", "def special_skill(launcher, target, skill)\n case skill.symbol\n when :s_counter #Riposte & co\n if skill.id == 64 and (count = target.skill_category_amount(1)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n elsif skill.id == 243 and (count = target.skill_category_amount(2)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n else\n @IA_Info[:other_factor] = rand * 0.7\n end\n else\n return false\n end\n return true\n end", "def can_copy_last_years_skills?\n last_years_skills= get_last_assessment\n return false if last_years_skills.nil?\n last_years_skills.goals.skill.where.not(name: goals.skill.map(&:name)).exists?\n end", "def check_skill_guard(target, item)\n return unless @subject\n return if target == @subject\n return if @subject.friends_unit.members.include?(target)\n return if item.ignore_skill_guard?\n target.skills_guard.each do |sg|\n next if sg[1] > 0 && target.target_range(@subject) < sg[1]\n @subject.item_apply(target, sg[0])\n end\n end", "def activate\r\n @quest = @kingdom.quests.find(params[:id])\r\n \r\n if @kingdom.quests.where(quest_status: '1').size > 16\r\n flash[:notice] = 'A kingdom can have only 16 active quests at a time.'\r\n elsif @quest.reqs.size == 0\r\n flash[:notice] = \"Quest must have at least one requirement in order to be activated\"\r\n else\r\n @quest.quest_status = SpecialCode.get_code('quest_status','active')\r\n quest_status_change_update\r\n end\r\n redirect_to :action => 'index', :page => params[:page]\r\n end", "def inactive?\n !active?\n end", "def counter_skills_id\n [data_battler.counter_skill]\n end", "def check_special_skills(ch, targets, skill)\n # if Tons of Add-ons is being used\n if $tons_version != nil && $tons_version >= 6.4\n # if using absorbing skills\n if $game_system.ABSORB_HP_SP\n # set damage accumulation to 0\n damages = 0\n # if skill absorbs HP\n if SKILL_IDS_HP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.damage\n end}\n # change battler HP\n ch.battler.hp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n # if skill absorbs SP\n elsif SKILL_IDS_SP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.spdamage\n # remove damage\n target.battler.damage = nil\n # make SP damage text\n target.check_spdamage\n end}\n # change battler SP\n ch.battler.sp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n end\n end\n # if using Destructor Skill and battler should die\n if $game_system.DESTRUCTOR_SKILL && ch.battler.set_to_die\n # kill\n ch.battler.hp = 0\n end\n # if using Blus Magic Skills\n if $game_system.BLUE_MAGIC_SKILL && BLUE_MAGIC_IDS.include?(skill.id)\n # remove damage for all targets\n targets.each {|target| target.battler.damage = nil}\n # get a random target\n target = targets[rand(targets.size)]\n # try to learn\n if rand(100) < skill.hit\n # if enemy\n if target.battler.is_a?(Game_Enemy)\n # initialize array\n ids = []\n # get all skill IDs of the target\n target.battler.actions.each {|act|\n ids.push(act.skill_id) if act.kind == 1}\n # if actor\n elsif target.battler.is_a?(Game_Actor)\n # get all skill IDs of the target\n ids = target.battler.skills.clone\n end\n # if any ID exists\n if ids.size > 0\n # get skill\n newskill = $data_skills[ids[rand(ids.size)]]\n # if already knowing that skill\n if ch.battler.skills.include?(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} known\"\n else\n # learn skill\n target.battler.learn_skill(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} learned\"\n end\n else\n # no skills available\n target.battler.damage = 'None available'\n end\n else\n # not successful\n target.battler.damage = 'Miss'\n end\n end\n end\n end", "def ty_execute_action_skill\n # Check to see if the current attacker is the actor and is using a weapon that needs ammo\n if @active_battler.is_a?(Game_Actor) && TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n if TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id].is_a?(Array)\n # Check passed, so now we store the array items\n array_items = TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id]\n # Now we check each ID in array_items and compare to see if we have enough ammo\n for index in array_items\n # Check to see if the actor has enough ammo\n if $game_party.item_number($data_items[index]) >= gather_ammo_cost\n # Check cleared, gather item ID and terminate check loop\n gather_ammo_item = $data_items[index]\n break\n end\n end\n else\n gather_ammo_item = $data_items[TysAmmoRequirements::Weapons_ammo_id[@active_battler.skill_id]]\n end\n # Both checks clear, so perform Ammo adjustments\n # First we collect some end-user options, like ammo cost and ammo ID.\n gather_ammo_cost = TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n id = @active_battler.action.skill_id\n gather_ammo_item = $data_items[TysAmmoRequirements::Skill_ammo_id[id]]\n if $game_party.item_number(gather_ammo_item) >= gather_ammo_cost\n # The check cleared, so perform ammo adjustments\n # Consume Ammunition\n $game_party.lose_item(gather_ammo_item, gather_ammo_cost)\n # Display text\n text = sprintf(Vocab::ConsumeAmmo, @active_battler.name, gather_ammo_cost, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n else\n # Failed check, go into defense mode\n text = sprintf(Vocab::NoAmmo, @active_battler.name, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n # Perform a check to see if Active_Battler is a enemy and has ammo\n elsif @active_battler.is_a?(Game_Enemy) && $data_enemies[@active_battler.enemy_id].note.include?(TysAmmoRequirements::Enemy_ammo_activate_string) && TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n # Now we have to isolate the interger in the 'Note' string of the enemies\n # and then store the interger in a new local value for future use.\n enemy_ammo_cost = TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n enemy_ammo_name = TysAmmoRequirements::Enemy_ammo_name[@active_battler.enemy_id]\n # Check to see if the enemy has enough ammo to attack\n if @enemy_ammo[@enemy_attack] >= enemy_ammo_cost\n # Check cleared, remove enemy ammo.\n text = sprintf(Vocab::EnemyUsedAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @enemy_ammo[@enemy_attack] -= enemy_ammo_cost\n else\n # Check failed, put enemy in guard mode \n text = sprintf(Vocab::EnemyNoAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n end\n end", "def inactive?\n not active?\n end", "def check_phase\n if Layy_Meta.active && @turn == Turn_Enemy &&\n $game_system.acted.size >= tactics_enemies.size && !@active_battler\n then\n Layy_Meta.focus_on_character(tactics_actors.first, 8)\n end\n check_phase_mgc_lm_gtbs\n end", "def check_equip_effects(equip)\n end", "def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end", "def active?(id)\n existing = find_by_id(id)\n existing && existing.token.nil?\n end", "def denied_hipaa_code_active_indicator\n rcc_log.debug \"Obtaining HIPAA code active indicator.\"\n if @denied_hipaa_code_record.present?\n rcc_log.debug \"HIPAA Code Active Indicator: #{@denied_hipaa_code_record.active_indicator}, having ID : #{@denied_hipaa_code_record.id}\"\n @denied_hipaa_code_record.active_indicator\n end\n end", "def blue_magic_skills\n @skills.select { |id| $data_skills[id].blue_magic }\n end", "def call_status\n job = Job.find(params[:job_id])\n if !job.expert_id.blank? or !job.expert_id.nil?\n render :json=> {:success => false }\n else\n if params[:accept]\n job.update_attributes(:status => \"completed\", :expert_id => params[:expert_id])\n elsif params[:end]\n job.update_attributes(:status => \"active\")\n end\n end\n end", "def phase3_command_skill\r\n # Set action\r\n @active_battler.current_action.kind = 1\r\n # Start skill selection\r\n start_skill_select\r\n end", "def proficiency_for(skill)\n SkillsUser.find_by_user_id_and_skill_id(self.id, skill.id).skill_level\n end", "def make_inactive\n self.status = \"I\"\n end", "def skill_effect_physical_hit_result(skill)\r\n # If physical attack has power other than 0\r\n if skill.power != 0 and skill.atk_f > 0\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Return True\r\n return true\r\n end\r\n # Return False\r\n return false\r\n end", "def inactive?\n !self.active?\n end", "def skip_condition_met?\n points = encounter_points_needed\n return false if $game_party.encounter_points < points\n condition = troop.skip_condition\n return false unless condition\n params = condition.parameters\n result = false\n case params[0]\n when 0 # Switch\n result = ($game_switches[params[1]] == (params[2] == 0))\n when 1 # Variable\n value1 = $game_variables[params[1]]\n if params[2] == 0\n value2 = params[3]\n else\n value2 = $game_variables[params[3]]\n end\n case params[4]\n when 0 # value1 is equal to value2\n result = (value1 == value2)\n when 1 # value1 is greater than or equal to value2\n result = (value1 >= value2)\n when 2 # value1 is less than or equal to value2\n result = (value1 <= value2)\n when 3 # value1 is greater than value2\n result = (value1 > value2)\n when 4 # value1 is less than value2\n result = (value1 < value2)\n when 5 # value1 is not equal to value2\n result = (value1 != value2)\n end\n #when 2 # Self switch\n #if @event_id > 0\n #key = [$game_map.map_id, @event_id, params[1]]\n #result = ($game_self_switches[key] == (params[2] == 0))\n #end\n when 3 # Timer\n if $game_timer.working?\n if params[2] == 0\n result = ($game_timer.sec >= params[1])\n else\n result = ($game_timer.sec <= params[1])\n end\n end\n when 4 # Actor\n actor = $game_actors[params[1]]\n if actor\n case params[2]\n when 0 # in party\n result = ($game_party.members.include?(actor))\n when 1 # name\n result = (actor.name == params[3])\n when 2 # Class\n result = (actor.class_id == params[3])\n when 3 # Skills\n result = (actor.skill_learn?($data_skills[params[3]]))\n when 4 # Weapons\n result = (actor.weapons.include?($data_weapons[params[3]]))\n when 5 # Armors\n result = (actor.armors.include?($data_armors[params[3]]))\n when 6 # States\n result = (actor.state?(params[3]))\n end\n end\n when 5 # Enemy\n enemy = $game_troop.members[params[1]]\n if enemy\n case params[2]\n when 0 # appear\n result = (enemy.alive?)\n when 1 # state\n result = (enemy.state?(params[3]))\n end\n end\n #when 6 # Character\n #character = get_character(params[1])\n #if character\n #result = (character.direction == params[2])\n #end\n when 7 # Gold\n case params[2]\n when 0 # Greater than or equal to\n result = ($game_party.gold >= params[1])\n when 1 # Less than or equal to\n result = ($game_party.gold <= params[1])\n when 2 # Less than\n result = ($game_party.gold < params[1])\n end\n when 8 # Item\n result = $game_party.has_item?($data_items[params[1]])\n when 9 # Weapon\n result = $game_party.has_item?($data_weapons[params[1]], params[2])\n when 10 # Armor\n result = $game_party.has_item?($data_armors[params[1]], params[2])\n when 11 # Button\n result = Input.press?(params[1])\n when 12 # Script\n result = eval(params[1])\n when 13 # Vehicle\n result = ($game_player.vehicle == $game_map.vehicles[params[1]])\n end\n return result\n end", "def delete_check\n if Skill.where(id:params[:id]).blank?\n render json: {result: 'couldnt process delete request'} #dont give extra failure info security-wise\n else\n @skill = Skill.find(params[:id])\n end\n end", "def update_phase3_skill_select\n # Make skill window visible\n @skill_window.visible = true\n # Update skill window\n @skill_window.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End skill selection\n end_skill_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the skill window\n @skill = @skill_window.skill\n # If it can't be used\n if @skill == nil or not @active_battler.skill_can_use?(@skill.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.skill_id = @skill.id\n # Make skill window invisible\n @skill_window.visible = false\n # If effect scope is single enemy\n if @skill.scope == 1\n # Start enemy selection\n start_enemy_select\n # If effect scope is single ally\n elsif @skill.scope == 3 or @skill.scope == 5\n # Start actor selection\n start_actor_select\n # If effect scope is not single\n else\n # End skill selection\n end_skill_select\n # Go to command input for next actor\n phase3_next_actor\n end\n return\n end\n end", "def can_copy_last_years_skills?\n last_years_skills = get_last_assessment\n return false if last_years_skills.nil?\n last_years_skills.goals.skill.where.not(name: goals.skill.map(&:name)).exists?\n end", "def has_active_interview?\n self.interviews.where(:status=>1).present?\nend", "def active?\r\n\t\tself.patient_status.patient_status_id == 1.0\r\n\tend", "def skill_type_sealed?(stype_id)\r\n features_set(FEATURE_STYPE_SEAL).include?(stype_id)\r\n end", "def set_active_inactive\n to_set_inactive = (EvaluationTemplate.where.not(id: self.id)).\n where(active: true).where(quarter_id: self.quarter_id)\n if self.active?\n to_set_inactive.each { |t| t.update_attributes(active: false) }\n end\n end", "def mark_inactive(quarter = Quarter.current_quarter.next)\n update_attribute(:inactive, true)\n update_attribute(:next_active_quarter_id, quarter.id) # if next_active_quarter.nil?\n end", "def expert_job_details\n expert = Expert.find_by_id(params[:expert_id])\n if params[:type] == \"active\"\n @jobs = expert.jobs.where.not(status: \"completed\").where(:job_type => nil).order(\"created_at DESC\")\n else\n @jobs = expert.jobs.where(:status => \"completed\", :job_type => nil).order(\"updated_at DESC\")\n end\n end", "def check\n desired_state = load_state(:desired)\n begin\n current_state = load_state(:current) \n rescue ArgumentError => e\n return desired_state[\"data\"]\n end\n\n item_id = @node[\"effective\"][\"state\"][@state_name][\"desired\"]\n e = Effective.new(current_state[\"data\"], desired_state[\"data\"])\n desired_state[\"conditions\"].each do |condition_name, condition_opts|\n e.condition(condition_name, generate_condition_lambda(condition_opts[\"query\"], condition_opts[\"attribute\"], item_id))\n end\n result, why = e.check(\"or\", desired_state[\"retry_count\"], desired_state[\"random_wait\"])\n return result\n end", "def learn_skill(skill_id)\n if skill_id > 0 and not skill_learn?(skill_id)\n @skills.push(skill_id)\n @skills.sort!\n end\n end" ]
[ "0.6513623", "0.63832504", "0.62420905", "0.609231", "0.60493565", "0.59335893", "0.5884933", "0.58252317", "0.57625985", "0.5760204", "0.5743918", "0.57438433", "0.5717868", "0.57051104", "0.5704478", "0.5699243", "0.5688466", "0.568029", "0.5677594", "0.564959", "0.562893", "0.56226593", "0.55907595", "0.55682963", "0.55239415", "0.5508783", "0.548732", "0.5462144", "0.5455732", "0.5447009", "0.54460776", "0.54219276", "0.541812", "0.5410494", "0.5406142", "0.534639", "0.5345229", "0.534437", "0.534269", "0.5332842", "0.5323891", "0.53173316", "0.5315778", "0.53086203", "0.52988034", "0.5294537", "0.5293183", "0.52842146", "0.52829677", "0.5265452", "0.52603185", "0.5258797", "0.5257311", "0.52567625", "0.5249392", "0.5246359", "0.52461994", "0.5238363", "0.5229027", "0.5227207", "0.5227207", "0.5226178", "0.5221565", "0.52065885", "0.5203103", "0.5198041", "0.51977855", "0.519064", "0.5187463", "0.51871765", "0.5185546", "0.5178073", "0.517421", "0.5167403", "0.5164891", "0.51592374", "0.51452965", "0.5141029", "0.51133555", "0.51105046", "0.5105609", "0.50893724", "0.50855875", "0.5081867", "0.5078089", "0.50646096", "0.5054267", "0.5046803", "0.5039415", "0.50361466", "0.5035623", "0.50342745", "0.5029793", "0.50277156", "0.50263494", "0.5018464", "0.5017059", "0.50145215", "0.5012398", "0.5009745" ]
0.6482905
1
Check variable condition id : skill ID
def skill_var(id) for var in Skill_Var[id] return true if eval("$game_variables[#{var[0]}] #{var[1]}") end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def attack_skill_id\r\n return 1\r\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def skill_sp(id)\n if Skill_Sp[id]['integer'] != nil\n return true if eval(\"self.sp #{Skill_Sp[id]['integer']}\")\n end\n if Skill_Sp[id]['rate'] != nil\n return true if eval(\"(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}\")\n end\n return false \n end", "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return true\n end\n return false \n end", "def variable_exists?(id) #method\n @variables.key?(id)\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def validate_id(answer)\n id = answer.to_i #converts id to an integer value \n type = answer.class\n if type == String && answer == 'exit' || answer == 'no' || answer == ''\n exit\n elsif id < 1 || id > Job.all.size\n print_error\n sleep(0.5)\n false\n else\n id\n end\n end", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def set_my_condition\n @my_condition = MyCondition.find(params[:id])\n end", "def special_skill(launcher, target, skill)\n case skill.symbol\n when :s_counter #Riposte & co\n if skill.id == 64 and (count = target.skill_category_amount(1)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n elsif skill.id == 243 and (count = target.skill_category_amount(2)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n else\n @IA_Info[:other_factor] = rand * 0.7\n end\n else\n return false\n end\n return true\n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def set_counter_condition(user, damage, skill = nil)\n if self.actor?\n set_counter(user, damage, skill, 'Actor')\n set_counter(user, damage, skill, 'Skill')\n set_counter(user, damage, skill, 'Armor')\n set_counter(user, damage, skill, 'Weapon')\n else\n set_counter(user, damage, skill, 'Enemy')\n end\n set_counter(user, damage, skill, 'State')\n return if @valid_counters.empty?\n self.counter_action = @valid_counters[rand(@valid_counters.size)]\n end", "def skill_hp(id)\n if Skill_Hp[id]['integer'] != nil\n return true if eval(\"self.hp #{Skill_Hp[id]['integer']}\")\n end\n if Skill_Hp[id]['rate'] != nil\n return true if eval(\"(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}\")\n end\n return false\n end", "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n return true\n end\n return false\n end", "def item_choice?\r\n @item_choice_variable_id > 0\r\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def delete_check\n if Skill.where(id:params[:id]).blank?\n render json: {result: 'couldnt process delete request'} #dont give extra failure info security-wise\n else\n @skill = Skill.find(params[:id])\n end\n end", "def counter_skills_id\n [data_battler.counter_skill]\n end", "def set_skill\n @skill = @project.skills.find(params[:skillId])\n end", "def cant_counter_skill(current)\n return (not skill_can_use?(current)) if current.numeric?\n for skill_id in current\n return false if skill_can_use?(skill_id)\n end\n return true\n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def validates_ivr_variables_id\n self.type == 'var'\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def guard_usable?\r\n usable?($data_skills[guard_skill_id])\r\n end", "def create\n # 検証。同一スキルカテゴリIDかつ同一スキル名を持っている場合はエラー\n @exist = Skill.where(skill_category_id: skill_params[:skill_category_id]).where(skill_name: skill_params[:skill_name])\n\n @skill = Skill.new(skill_params)\n @skill.has_learning_level=true\n \n logger.debug(\"skill\")\n logger.debug(@skill)\n\n if @exist.present? \n render json:{errors: 'already exists.', status: :unprocessable_entity }\n else\n if @skill.save\n render json:{skill: @skill}\n else\n render json:{errors: @skill.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def check_custom_assign_ids\n skill_to_pose_hash = bat.cust_skill_pose\n if skill_to_pose_hash != nil\n pose = skill_to_pose_hash[@character.animation_id]\n if pose != nil\n @character.set_pose(pose-1)\n @character.animation_id = 0 #clear animation id since we have handled it\n end\n end\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end", "def set_desired_skill\n @desired_skill = DesiredSkill.find(params[:id])\n end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n @enemy.water_magic >= @skill.water_cost &&\n @enemy.earth_magic >= @skill.earth_cost &&\n @enemy.wind_magic >= @skill.wind_cost )\n #@enemy.light_magic >= @skill.light_cost &&\n #@enemy.dark_magic >= @skill.dark_cost )\n \n self.tone.set(0, 30, 0)\n else\n self.tone.set(70, 0, 0)\n end\n else\n self.tone.set(0, 0, 70)\n end\n end\n end", "def skill?\n return (@kind == ACTSkill)\n end", "def set_skill_level\n @skill_level = SkillLevel.find(params[:id])\n end", "def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end", "def set_buildskill\n @buildskill = Buildskill.find(params[:id])\n end", "def check(x,y,id)\n\n\t\tif (id.to_i == 1) and ((445..470).member?(x.to_i)) and ((470..550).member?(y.to_i)) then\t\n\t \t\tsession[:found] = \"true\"\n\t \t\tsave_scores(params[\"time\"],id)\n\n\t\telsif (id.to_i == 3) and ((590..625).member?(x.to_i)) and ((320..350).member?(y.to_i)) then\n\t\t\tsession[:found] = \"true\"\n\t\t\tsave_scores(params[\"time\"],id)\n\n\t\telsif (id.to_i == 2) and ((600..625).member?(x.to_i)) and ((120..150).member?(y.to_i)) then\n\t\t\tsession[:found] = \"true\"\n\t\t\tsave_scores(params[\"time\"],id)\n\t\t\n\t\telsif (id.to_i == 4) and ((385..400).member?(x.to_i)) and ((430..440).member?(y.to_i)) then\n\t\t\tsession[:found] = \"true\"\n\t\t\tsave_scores(params[\"time\"],id)\n\n\t\telse\t\t\n\t\t\tsession[:found] = \"false\"\n\t\tend\nend", "def condition(identifier)\n ->(e) { e[\"HTTP_X_COND#{identifier}\"] == 'true' }\nend", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end", "def teaching_level(level) \n services = self.services\n if !services.blank?\n services.each do |s|\n if s.level_id = level\n return true\n end\n end \n end \n return false \n end", "def learn_skill(skill_id)\n if skill_id > 0 and not skill_learn?(skill_id)\n @skills.push(skill_id)\n @skills.sort!\n end\n end", "def test_supportSkill\n f = SkillFilter.new(\"support\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 29\n end", "def set_skill\n @skill = @character.skills.find(params[:id])\n end", "def set_myskill\n @myskill = Myskill.find(params[:id])\n end", "def quest_revealed?(quest_id)\n $game_party.quests.revealed?(quest_id)\n end", "def find_question_by_id(question_id)\n question = Pairwise::Question.find question_id\n return question #if question.local_identifier == @local_identifier.to_s\n end", "def test_attackSkill\n f = SkillFilter.new(\"attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 44\n end", "def check_cant_IA(pkmn)\n return true unless pkmn\n return true if pkmn.dead?\n #>Attaque forcée\n if(pkmn.battle_effect.has_forced_attack?)\n _stack_add_attack(\n skill_index: pkmn.battle_effect.get_forced_attack(pkmn),\n target_position: pkmn.battle_effect.get_forced_position,\n launcher: pkmn\n )\n #@results.push([0,pkmn.battle_effect.get_forced_attack(pkmn),\n #-pkmn.battle_effect.get_forced_position-1,pkmn])\n return true\n #>Si lutte car pas de skills viable\n elsif(BattleEngine::_lutte?(pkmn))\n _stack_add_attack(target_position: rand($game_temp.vs_type), launcher: pkmn)\n #@results.push([0,nil,-rand($game_temp.vs_type)-1,pkmn])\n return true\n elsif(pkmn.battle_effect.has_encore_effect?)\n _stack_add_attack(\n skill_index: pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n target_list: util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),\n launcher: pkmn\n )\n #@results.push([0,pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n #util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),pkmn])\n return true\n end\n return false\n end", "def test_nameSkill\n f = SkillFilter.new(\"name\", \"Fire\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 1\n end", "def skill_sw_off(id)\n if Skill_Sw_Off[id]['include'] != nil\n for i in Skill_Sw_Off[id]['include']\n return true if $game_switches[i] == false\n end\n end\n if Skill_Sw_Off[id]['set'] != nil\n for i in Skill_Sw_Off[id]['set']\n return false unless $game_switches[i] == false\n end\n return true\n end\n return false \n end", "def objective_revealed?(quest_id, *obj)\n quest_revealed?(quest_id) && quest(quest_id).objective_status?(:revealed, *obj) \n end", "def can_copy_last_years_skills?\n last_years_skills= get_last_assessment\n return false if last_years_skills.nil?\n last_years_skills.goals.skill.where.not(name: goals.skill.map(&:name)).exists?\n end", "def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end", "def key_skill; end", "def test_var(vhash, ahash, rhash)\n v = FactoryBot.create(:validation_condition, vhash)\n a = FactoryBot.create(:answer, ahash)\n r = FactoryBot.create(:response, { answer: a, question: a.question }.merge(rhash))\n v.is_valid?(r)\n end", "def set_skill\n @skill = Skill.find_by_id(params[:id])\n end", "def set_skill\n @skill = Skill.all.find(params[:id])\n end", "def specific?\n @requirement.specific?\n end", "def specific?\n @requirement.specific?\n end", "def gift_aid?\n params['GiftAid'] == '1'\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def check_skill_guard(target, item)\n return unless @subject\n return if target == @subject\n return if @subject.friends_unit.members.include?(target)\n return if item.ignore_skill_guard?\n target.skills_guard.each do |sg|\n next if sg[1] > 0 && target.target_range(@subject) < sg[1]\n @subject.item_apply(target, sg[0])\n end\n end", "def test_ut_t4_mtv_pu_004\n pu = Pu.find(1)\n pj_id = 5\n assert_equal FALSE, pu.check_pj_belong_to_pu?(pj_id)\n end", "def hit_condition()\n #This is a stub, used for indexing\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def check_selection(id_a,id_b)\n # check system for wrong choices\n if ( id_a == false || id_b == false ) then\n puts \"Your choice is wrong!\"\n $id = 'No!'\n else\n $id = id_a + id_b.to_s\n end\nend", "def check_equip_effects(equip)\n end", "def test_var2(v_hash, a_hash, r_hash, ca_hash, cr_hash)\n ca = FactoryBot.create(:answer, ca_hash)\n FactoryBot.create(:response, cr_hash.merge(answer: ca, question: ca.question))\n v = FactoryBot.create(:validation_condition, v_hash.merge(question_id: ca.question.id, answer_id: ca.id))\n a = FactoryBot.create(:answer, a_hash)\n r = FactoryBot.create(:response, r_hash.merge(answer: a, question: a.question))\n v.is_valid?(r)\n end", "def param_id\n @item.is_a?(RPG::Weapon) ? 2 : 3\n end", "def valid_skill_levels\n %w[beginner intermediate expert]\n end", "def is_cuffed?\n return weapon_id == 33\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def test_ut_t4_mtv_pu_003\n pu = Pu.find(1)\n pj_id = 1\n assert_equal TRUE, pu.check_pj_belong_to_pu?(pj_id)\n pj_id = 3\n assert_equal FALSE, pu.check_pj_belong_to_pu?(pj_id)\n end", "def pokemon_matching_requirements?(pkmn, wanted_data)\n return pkmn.id == wanted_data[0] && pkmn.level >= wanted_data[1] &&\n pkmn.level <= wanted_data[2] && (wanted_data[3] == 0 || pkmn.gender == wanted_data[3])\n end", "def summonable?(id)\n for summon_id in Summon_Skill[id][1]\n summon = $game_actors[summon_id]\n return false if summon.dead?\n end\n for summon_id in Summon_Skill[id][1]\n return false if $game_party.summoned.include?($game_actors[summon_id])\n end\n return true\n end", "def set_skill\n @skill = policy_scope(Skill).find(params[:id])\n authorize(@skill)\n end", "def class_condition_met?(action)\n cls = self.class\n return true unless cls\n learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }\n return true unless learning\n return false if self.level < learning.level\n return true\n end", "def condition; end", "def set_learnable_skill\n @learnable_skill = LearnableSkill.find(params[:id])\n end", "def var(id) \n\n # Zkus promennou najit nejprve v locals\n variable = @variables[id]\n\n if variable == :undeclared\n\n variable = @arguments[id]\n\n # Tak to jeste zkus v argumentech\n if variable == :undeclared\n # tak to fakt neznam \n return nil,:error\n else\n write_opcode(PAS) # budu zapisovat na zasobnik argument\n write_4B(variable) # jeho id\n return nil, nil \n end\n else \n write_opcode(PLS) # budu zapisovat na zasobnik lokalni promennou\n write_4B(variable) # jeji id\n return nil, nil\n end\n\n end", "def get_condition\n @condition\n end", "def experience?(candidates)\n candidates[:years_of_experience] >= 2\nend" ]
[ "0.6881555", "0.640917", "0.6312202", "0.6262951", "0.6088578", "0.59307754", "0.585379", "0.5847933", "0.58142793", "0.5772137", "0.57471144", "0.57029593", "0.5673212", "0.5632115", "0.55788827", "0.55694836", "0.5538258", "0.55244523", "0.5510854", "0.54874116", "0.5475369", "0.54468876", "0.5422535", "0.5408281", "0.5407895", "0.539816", "0.5375782", "0.5360672", "0.5354802", "0.53335756", "0.53174305", "0.53146297", "0.5301574", "0.5287972", "0.5262772", "0.524087", "0.5238043", "0.52238715", "0.5213344", "0.521107", "0.5208584", "0.5199889", "0.5191078", "0.51899576", "0.51888895", "0.51875573", "0.5173618", "0.5173618", "0.5173618", "0.5173618", "0.51640457", "0.516148", "0.51578206", "0.5157296", "0.5146768", "0.51451933", "0.5144664", "0.51416105", "0.5140894", "0.5134752", "0.5131363", "0.51298666", "0.5120365", "0.5116646", "0.5110451", "0.5105041", "0.50988334", "0.50969654", "0.5095119", "0.50906086", "0.50906086", "0.50802225", "0.5074255", "0.50704813", "0.50681096", "0.5053746", "0.50516176", "0.50494605", "0.50489324", "0.5043306", "0.5039318", "0.5033674", "0.503224", "0.5030917", "0.5030917", "0.5030917", "0.5030917", "0.5030917", "0.5030917", "0.5030917", "0.5025899", "0.5012403", "0.50092334", "0.5008023", "0.5002094", "0.5001475", "0.49976003", "0.49855065", "0.49840906", "0.49805707" ]
0.70595515
0
Check HP condition id : skill ID
def skill_hp(id) if Skill_Hp[id]['integer'] != nil return true if eval("self.hp #{Skill_Hp[id]['integer']}") end if Skill_Hp[id]['rate'] != nil return true if eval("(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}") end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_var(id)\n for var in Skill_Var[id]\n return true if eval(\"$game_variables[#{var[0]}] #{var[1]}\")\n end\n return false \n end", "def skill_effect_physical_hit_result(skill)\r\n # If physical attack has power other than 0\r\n if skill.power != 0 and skill.atk_f > 0\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Return True\r\n return true\r\n end\r\n # Return False\r\n return false\r\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n effective |= states_plus(skill.plus_state_set)\n effective |= states_minus(skill.minus_state_set)\n # If power is 0\n if skill.power == 0\n # Set damage to an empty string\n self.damage = \"\"\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end", "def skill_sp(id)\n if Skill_Sp[id]['integer'] != nil\n return true if eval(\"self.sp #{Skill_Sp[id]['integer']}\")\n end\n if Skill_Sp[id]['rate'] != nil\n return true if eval(\"(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}\")\n end\n return false \n end", "def set_health_condition\n @health_condition = HealthCondition.find(params[:id])\n end", "def check_special_skills(ch, targets, skill)\n # if Tons of Add-ons is being used\n if $tons_version != nil && $tons_version >= 6.4\n # if using absorbing skills\n if $game_system.ABSORB_HP_SP\n # set damage accumulation to 0\n damages = 0\n # if skill absorbs HP\n if SKILL_IDS_HP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.damage\n end}\n # change battler HP\n ch.battler.hp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n # if skill absorbs SP\n elsif SKILL_IDS_SP.include?(skill.id)\n # for each target\n targets.each {|target|\n # if damage was done\n if target.battler.damage.is_a?(Numeric)\n # accumulate damage\n damages += target.battler.spdamage\n # remove damage\n target.battler.damage = nil\n # make SP damage text\n target.check_spdamage\n end}\n # change battler SP\n ch.battler.sp += damages\n # request damage sprite\n $BlizzABS.util.request_damage_sprite(ch)\n end\n end\n # if using Destructor Skill and battler should die\n if $game_system.DESTRUCTOR_SKILL && ch.battler.set_to_die\n # kill\n ch.battler.hp = 0\n end\n # if using Blus Magic Skills\n if $game_system.BLUE_MAGIC_SKILL && BLUE_MAGIC_IDS.include?(skill.id)\n # remove damage for all targets\n targets.each {|target| target.battler.damage = nil}\n # get a random target\n target = targets[rand(targets.size)]\n # try to learn\n if rand(100) < skill.hit\n # if enemy\n if target.battler.is_a?(Game_Enemy)\n # initialize array\n ids = []\n # get all skill IDs of the target\n target.battler.actions.each {|act|\n ids.push(act.skill_id) if act.kind == 1}\n # if actor\n elsif target.battler.is_a?(Game_Actor)\n # get all skill IDs of the target\n ids = target.battler.skills.clone\n end\n # if any ID exists\n if ids.size > 0\n # get skill\n newskill = $data_skills[ids[rand(ids.size)]]\n # if already knowing that skill\n if ch.battler.skills.include?(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} known\"\n else\n # learn skill\n target.battler.learn_skill(newskill.id)\n # make damage text\n target.battler.damage = \"#{newskill.name} learned\"\n end\n else\n # no skills available\n target.battler.damage = 'None available'\n end\n else\n # not successful\n target.battler.damage = 'Miss'\n end\n end\n end\n end", "def special_skill(launcher, target, skill)\n case skill.symbol\n when :s_counter #Riposte & co\n if skill.id == 64 and (count = target.skill_category_amount(1)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n elsif skill.id == 243 and (count = target.skill_category_amount(2)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n else\n @IA_Info[:other_factor] = rand * 0.7\n end\n else\n return false\n end\n return true\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return true\n end\n return false \n end", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def isSkillUsable()\n if( @enemy != nil && @skill != nil )\n if(! @skill.isOverLimit ) \n if( @enemy.fire_magic >= @skill.fire_cost &&\n @enemy.water_magic >= @skill.water_cost &&\n @enemy.earth_magic >= @skill.earth_cost &&\n @enemy.wind_magic >= @skill.wind_cost )\n #@enemy.light_magic >= @skill.light_cost &&\n #@enemy.dark_magic >= @skill.dark_cost )\n \n self.tone.set(0, 30, 0)\n else\n self.tone.set(70, 0, 0)\n end\n else\n self.tone.set(0, 0, 70)\n end\n end\n end", "def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def for_one_friend_hp0?\n # If kind = skill, and effect scope is for ally (only 0 HP)\n if @kind == 1 and [5].include?($data_skills[@skill_id].scope)\n return true\n end\n # If kind = item, and effect scope is for ally (only 0 HP)\n if @kind == 2 and [5].include?($data_items[@item_id].scope)\n return true\n end\n return false\n end", "def set_counter_condition(user, damage, skill = nil)\n if self.actor?\n set_counter(user, damage, skill, 'Actor')\n set_counter(user, damage, skill, 'Skill')\n set_counter(user, damage, skill, 'Armor')\n set_counter(user, damage, skill, 'Weapon')\n else\n set_counter(user, damage, skill, 'Enemy')\n end\n set_counter(user, damage, skill, 'State')\n return if @valid_counters.empty?\n self.counter_action = @valid_counters[rand(@valid_counters.size)]\n end", "def decide(hand)\n value(hand) >= 17 && :stand || :hit\nend", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def attack_usable?\r\n usable?($data_skills[attack_skill_id])\r\n end", "def skill_effect_damage\r\n # Substract damage from HP\r\n last_hp = self.hp\r\n self.hp -= self.damage\r\n return self.hp != last_hp\r\n end", "def check_cant_IA(pkmn)\n return true unless pkmn\n return true if pkmn.dead?\n #>Attaque forcée\n if(pkmn.battle_effect.has_forced_attack?)\n _stack_add_attack(\n skill_index: pkmn.battle_effect.get_forced_attack(pkmn),\n target_position: pkmn.battle_effect.get_forced_position,\n launcher: pkmn\n )\n #@results.push([0,pkmn.battle_effect.get_forced_attack(pkmn),\n #-pkmn.battle_effect.get_forced_position-1,pkmn])\n return true\n #>Si lutte car pas de skills viable\n elsif(BattleEngine::_lutte?(pkmn))\n _stack_add_attack(target_position: rand($game_temp.vs_type), launcher: pkmn)\n #@results.push([0,nil,-rand($game_temp.vs_type)-1,pkmn])\n return true\n elsif(pkmn.battle_effect.has_encore_effect?)\n _stack_add_attack(\n skill_index: pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n target_list: util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),\n launcher: pkmn\n )\n #@results.push([0,pkmn.skills_set.index(pkmn.battle_effect.encore_skill).to_i,\n #util_targetselection_automatic(pkmn, pkmn.battle_effect.encore_skill),pkmn])\n return true\n end\n return false\n end", "def test_attackSkill\n f = SkillFilter.new(\"attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 44\n end", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def counter_skills_id\n [data_battler.counter_skill]\n end", "def key_skill; end", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def quest(quest_id); $game_party.quests[quest_id]; end", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def learn_skill(skill_id)\n if skill_id > 0 and not skill_learn?(skill_id)\n @skills.push(skill_id)\n @skills.sort!\n end\n end", "def ty_execute_action_skill\n # Check to see if the current attacker is the actor and is using a weapon that needs ammo\n if @active_battler.is_a?(Game_Actor) && TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n if TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id].is_a?(Array)\n # Check passed, so now we store the array items\n array_items = TysAmmoRequirements::Weapons_ammo_id[@active_battler.weapon_id]\n # Now we check each ID in array_items and compare to see if we have enough ammo\n for index in array_items\n # Check to see if the actor has enough ammo\n if $game_party.item_number($data_items[index]) >= gather_ammo_cost\n # Check cleared, gather item ID and terminate check loop\n gather_ammo_item = $data_items[index]\n break\n end\n end\n else\n gather_ammo_item = $data_items[TysAmmoRequirements::Weapons_ammo_id[@active_battler.skill_id]]\n end\n # Both checks clear, so perform Ammo adjustments\n # First we collect some end-user options, like ammo cost and ammo ID.\n gather_ammo_cost = TysAmmoRequirements::Skill_ammo_cost[@active_battler.action.skill_id]\n id = @active_battler.action.skill_id\n gather_ammo_item = $data_items[TysAmmoRequirements::Skill_ammo_id[id]]\n if $game_party.item_number(gather_ammo_item) >= gather_ammo_cost\n # The check cleared, so perform ammo adjustments\n # Consume Ammunition\n $game_party.lose_item(gather_ammo_item, gather_ammo_cost)\n # Display text\n text = sprintf(Vocab::ConsumeAmmo, @active_battler.name, gather_ammo_cost, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n else\n # Failed check, go into defense mode\n text = sprintf(Vocab::NoAmmo, @active_battler.name, gather_ammo_item.name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n # Perform a check to see if Active_Battler is a enemy and has ammo\n elsif @active_battler.is_a?(Game_Enemy) && $data_enemies[@active_battler.enemy_id].note.include?(TysAmmoRequirements::Enemy_ammo_activate_string) && TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n # Now we have to isolate the interger in the 'Note' string of the enemies\n # and then store the interger in a new local value for future use.\n enemy_ammo_cost = TysAmmoRequirements::Enemy_skill_cost[@active_battler.action.skill_id]\n enemy_ammo_name = TysAmmoRequirements::Enemy_ammo_name[@active_battler.enemy_id]\n # Check to see if the enemy has enough ammo to attack\n if @enemy_ammo[@enemy_attack] >= enemy_ammo_cost\n # Check cleared, remove enemy ammo.\n text = sprintf(Vocab::EnemyUsedAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @enemy_ammo[@enemy_attack] -= enemy_ammo_cost\n else\n # Check failed, put enemy in guard mode \n text = sprintf(Vocab::EnemyNoAmmo, @active_battler.name, enemy_ammo_name)\n @message_window.add_instant_text(text)\n @active_battler.action.kind = 0\n execute_action_guard\n end\n end\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def hit_condition()\n #This is a stub, used for indexing\n end", "def is_cuffed?\n return weapon_id == 33\n end", "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n return true\n end\n return false\n end", "def champion(victorycondition) #algorythmic\n if @win_counter[\"P1\"]==victorycondition\n return @Player1\n elsif @win_counter[\"P2\"]==victorycondition\n return @Player2\n else \n return nil\n end \n end", "def find_hatchet\n HATCHET_ID.each do |id|\n weapon = character.equipment.get EquipmentConstants::WEAPON\n if weapon.id == id\n return HATCHET[id]\n end\n if character.inventory.contains id\n return HATCHET[id]\n end\n end\n return nil\nend", "def check_product\n #nhan ID va kiem tra\n @product=Product.find(1)\n respond_to do |format|\n if @product.instock_quality >= ??#cho nhan so luong\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def check_equip_effects(equip)\n end", "def set_skill_level\n @skill_level = SkillLevel.find(params[:id])\n end", "def check_on_attack(attacker,target,atk_skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Attack[name]\n error = \"Kernel.eval Error | \"+name+\" | on_attack\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end end", "def skill?\n return (@kind == ACTSkill)\n end", "def test_supportSkill\n f = SkillFilter.new(\"support\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 29\n end", "def phase3_command_skill\r\n # Set action\r\n @active_battler.current_action.kind = 1\r\n # Start skill selection\r\n start_skill_select\r\n end", "def set_skill\n @skill = @project.skills.find(params[:skillId])\n end", "def test_physicalAttackSkill\n f = SkillFilter.new(\"physical_attack\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 10\n end", "def skill?\n fail NotImplementedError\n end", "def test_healingSkill\n f = SkillFilter.new(\"healing\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 11\n end", "def make_skill_action_result\n # Gather the current Ammo Cost\n gather_ammo_cost = Ammo::Skill_ammo[@active_battler.current_action.skill_id]\n # Gather Ammo\n gather_ammo = Ammo::Range_ammo_id[@active_battler.weapon_id]\n # Check if the Actor is using a defiend skill\n if Ammo::Skill_ammo.has_key?(@active_battler.current_action.skill_id)\n # Check if Ammo is present\n if $game_party.item_number(gather_ammo) >= gather_ammo_cost\n # Sufficient Ammo, remove item\n $game_party.lose_item(gather_ammo,gather_ammo_cost)\n # Call Default Code\n syn_scene_battle_skill\n else\n # Set Window; Do Nothing\n @help_window.set_text(\"#{@active_battler.name} cannot attack due to insufficient Ammo\", 1)\n end\n # Otherwise SKip the check and call default code\n else\n syn_scene_battle_skill\n end\n end", "def check(p) #:nodoc:\n conditions_met = true\n \n if p.conditions[:>=] and sum < p.conditions[:>=]\n conditions_met = false\n end\n \n if p.conditions[:==] and p.conditions[:==] != sum\n conditions_met = false\n end\n \n if conditions_met\n results = []\n p.outcomes.each do |outcome|\n if outcome.instance_of?(Roll)\n results << outcome.roll.effects\n else\n results << outcome\n end\n end\n results\n else\n [nil]\n end\n end", "def validate_id(answer)\n id = answer.to_i #converts id to an integer value \n type = answer.class\n if type == String && answer == 'exit' || answer == 'no' || answer == ''\n exit\n elsif id < 1 || id > Job.all.size\n print_error\n sleep(0.5)\n false\n else\n id\n end\n end", "def set_skill\n @skill = @character.skills.find(params[:id])\n end", "def delete_check\n if Skill.where(id:params[:id]).blank?\n render json: {result: 'couldnt process delete request'} #dont give extra failure info security-wise\n else\n @skill = Skill.find(params[:id])\n end\n end", "def set_my_condition\n @my_condition = MyCondition.find(params[:id])\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def set_skill(skill_id)\n @kind = 1\n @skill_id = skill_id\n end", "def blue_magic_skills\n @skills.select { |id| $data_skills[id].blue_magic }\n end", "def skill_power(skillname, player, usage)\n p \"==>calc #{player.name} skill power of #{skillname} for #{usage}:\"\n skill = player.query_skill(skillname)\n if (skill == nil)\n #logger.info(\"user #{player[:id]}-#{player.ext[:name]} doesn't have skill '#{skillname}'\")\n return 1\n end\n # p = skill.power(context)\n level = skill.data[:level]\n p \"=>level=#{level} apply_attack=#{player.tmp[:apply_attack]} apply_dodge=#{player.tmp[:apply_dodge]}\"\n \n if (usage == \"attack\" && player.tmp[:apply_attack] != nil)\n level += player.tmp[:apply_attack]\n end\n \n if (usage == \"dodge\" && player.tmp[:apply_dodge] != nil)\n # level += player.tmp[:apply_dodge]\n level = level * ( (100 + player.tmp[:apply_dodge]/10 ).to_f / 100 )\n end \n \n # if (usage == \"parry\" && player.tmp[:apply_defense] != nil)\n # level += player.tmp[:apply_dodge]\n # end \n jingli_bonus = 50 + player.tmp[:jingli]/ (player.tmp[:max_jl]+1) * 50\n if (jingli_bonus > 150)\n jingli_bonus = 150\n end\n \n total_exp = calc_total_exp(player.tmp[:level])\n p \"level=#{level} jingli_bonus=#{jingli_bonus}, total exp #{total_exp}\"\n if( level<1 ) \n return (total_exp/20.0 * (jingli_bonus/10) ).to_i\n end\n\n \n p =level**3/3 \n str = player.tmp[:str]\n dext = player.tmp[:dext]\n # p \"===>#{player.tmp.inspect}\"\n \n p \"==>p=#{p}, level=#{level} str=#{str} dext=#{dext} \"\n if (usage == \"attack\" || usage == \"parry\")\n p = (p + total_exp +1) / 30 * (( str+1)/10)\n else\n p = (p + total_exp +1) / 30 * (( dext+1)/10)\n end\n \n p = p.to_i\n p \"==>skill power=#{p}\"\n \n if p <= 1\n return 1\n else\n return p\n end\n end", "def by_hp_id\n hp_id = valid_id?(params[:hp_id])\n patient_exists = false\n if @patient = Patient.find_by_hp_id(hp_id)\n patient_exists = true\n else\n @patient = Patient.new\n @patient.hp_id = hp_id\n patient_exists = @patient.save\n end\n\n respond_to do |format|\n format.html { redirect_to(@patient) }\n format.xml { head :ok }\n end\n end", "def guard_usable?\r\n usable?($data_skills[guard_skill_id])\r\n end", "def class_condition_met?(action)\n cls = self.class\n return true unless cls\n learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }\n return true unless learning\n return false if self.level < learning.level\n return true\n end", "def create\n # 検証。同一スキルカテゴリIDかつ同一スキル名を持っている場合はエラー\n @exist = Skill.where(skill_category_id: skill_params[:skill_category_id]).where(skill_name: skill_params[:skill_name])\n\n @skill = Skill.new(skill_params)\n @skill.has_learning_level=true\n \n logger.debug(\"skill\")\n logger.debug(@skill)\n\n if @exist.present? \n render json:{errors: 'already exists.', status: :unprocessable_entity }\n else\n if @skill.save\n render json:{skill: @skill}\n else\n render json:{errors: @skill.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def proficiency_for(skill)\n SkillsUser.find_by_user_id_and_skill_id(self.id, skill.id).skill_level\n end", "def skill_sw_off(id)\n if Skill_Sw_Off[id]['include'] != nil\n for i in Skill_Sw_Off[id]['include']\n return true if $game_switches[i] == false\n end\n end\n if Skill_Sw_Off[id]['set'] != nil\n for i in Skill_Sw_Off[id]['set']\n return false unless $game_switches[i] == false\n end\n return true\n end\n return false \n end", "def broken(tool_condition) #allow the tool class to be use through the parameter\n if @item_health == 0 && tool_condition.tool_health == 0 #when both health reach 0 at the same time\n puts \"Both #{@item_name} and #{tool_condition.tool_name} break at the same time!\"\n elsif @item_health <= 0 #when the item's health is 0 or below 0 before the tool's health\n puts \"The #{@item_name} breaks first!\"\n elsif tool_condition.tool_health <= 0 #when the tool's health reaches 0 or below 0 before the item's health\n puts \"Your #{tool_condition.tool_name} breaks first!\"\n else\n puts \"Nothing breaks. \\nYour #{tool_condition.tool_name}'s health is now #{tool_condition.tool_health}. \\nThe #{@item_name}'s health is now #{@item_health}.\"\n end\n end", "def skill_effect_power0(skill)\r\n # If power is 0\r\n if skill.power == 0\r\n # Set damage to an empty string\r\n self.damage = \"\"\r\n # If state is unchanged\r\n unless @state_changed\r\n # Set damage to \"Miss\"\r\n self.damage = 'Miss'\r\n end\r\n end\r\n end", "def adventuring() skill(:adventuring) end", "def skillitem_process(ch, object)\n # determine whether skill or item for easier reference\n case object\n when RPG::Skill\n skill, d, time = true, Skills.range(object.id), Skills.trap(object.id)\n type, charge = Skills.type(object.id), Skills.charge(object.id)\n projectile_speed = Skills.projectile_speed(object.id)\n spriteset = BlizzABS::SPRProjSkill\n when RPG::Item\n skill, d, time = false, Items.range(object.id), Items.trap(object.id)\n type, charge = Items.type(object.id), Items.charge(object.id)\n projectile_speed = Items.projectile_speed(object.id)\n spriteset = BlizzABS::SPRProjItem\n end\n # fix the missing explosion animation error\n type[2] = 0 if type[1] != EXPLNone && type[2] == nil\n # if enemy\n if ch.is_a?(Map_Enemy) && charge[0] == CHARGETrigger\n # correct charge type\n charge[0] = CHARGEMove\n end\n # if not charging already and no selection data\n if charge[0] != CHARGENone && !ch.charging? &&\n $game_temp.select_data == nil\n # setup charging\n ch.setup_charge(object, charge)\n # not used yet\n return false\n end\n # if summoning\n if type[0] == SUMMON\n # nobody except actors can summon with caterpillar turned on\n return false unless ch.is_a?(Map_Actor) && $game_system.caterpillar\n # get summoning data\n summon = (skill ? Skills.summon(object.id) : Items.summon(object.id))\n # if summon ID or time is 0\n if summon[0] == SUMMONNone || summon[1] == 0 || summon[2] == 0\n # no summoning\n return false \n end\n # no summoning if already summoned\n return false if (@pets + @monsters).any? {|b| b.battler_id == summon[1]}\n # if any summon limit reached\n if summon[0] == SUMMONPet && @pets.size >= BlizzABS::Config::MAX_PETS ||\n summon[0] == SUMMONMonster &&\n @monsters.size >= BlizzABS::Config::MAX_MONSTERS ||\n @pets.size + @monsters.size >= BlizzABS::Config::MAX_SUMMONS\n # no summoning\n return false\n end\n # create new map actor\n new_battler = Map_Actor.new(summon[1])\n # if pet\n if summon[0] == SUMMONPet\n # summon pet\n summon_pet(new_battler, summon[2])\n # if monster\n elsif summon[0] == SUMMONMonster\n # summon monster\n summon_monster(new_battler, summon[2])\n else\n # something's not right here, no summoning\n return false\n end\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # move to correct position\n new_battler.moveto(ch.x / pix, ch.y / pix)\n # set correct battler\n new_battler.battler = $game_actors[summon[1]]\n # heal the battler completely\n new_battler.battler.recover_all\n # return to caterpillar first\n new_battler.cindex, new_battler.ai.state = nil, AI::Return\n # refresh display\n new_battler.refresh\n # set animation\n new_battler.animation_id = object.animation2_id\n # summon successful\n return true\n end\n # skill/item used (can be a common event call) if no target scope\n return true if object.scope == 0\n # if targeting self\n if object.scope == 7\n # if skill\n if skill\n # execute skill upon user\n ch.skill_effect(ch, ch.battler, object)\n # check special skill effects\n self.check_special_skills(ch, [ch], object)\n else\n # execute item upon user\n ch.item_effect(ch, object)\n end\n # clear damage displays\n ch.battler.damage, ch.battler.damage_pop = nil, false\n # skill/item used\n return true\n end\n # correct range\n d = 1 if d < 1\n # determine target alignment, dead flag and all flag\n enemy, dead, all = $BlizzABS.util.get_scope_data(object.scope)\n # doesn't target all and no death roulette initially\n target_all = false\n # if Tons is there and skill process\n if $tons_version != nil && $tons_version >= 6.02 && skill\n # if version is correct and Target 'em all! is being used for this skill\n if $game_system.TARGET_EM_ALL && FULL_TARGET_IDS.include?(object.id)\n # targets all and forces all flag\n target_all = all = true\n end\n end\n # temporary variable\n ai = ch.ai\n # determine whether actor or enemy for easier reference\n if ch.is_a?(Map_Actor)\n # decide target group\n group = (((ch == $game_player || ch.restriction != 3) == enemy) ?\n ai.negative : ai.positive)\n else\n # determine target group depending on confusion\n group = (((ch.restriction == 3) == enemy) ? ai.positive : ai.negative)\n end\n # selection only if player using selectable skill/item and not charging\n if ch == $game_player && $game_temp.select_data == nil &&\n (charge[0] == CHARGENone || charge[0] != CHARGENone &&\n ch.charged?) && (target_all || type[0] == HOMING ||\n type[0] == DIRECT || type[0] == BEAM && all)\n # temporary variable, selection skill/item\n handling = 0\n else\n # set handling for projectile skill/item or direct skill/item\n handling = ((type[0] == SHOOT || type[0] == HOMING ||\n type[0] == TRAP || type[0] == TIMED) ? 1 : 2)\n end\n # depending on handling\n case handling\n when 0 # selection\n # create circle shape data\n area = $BlizzABS.util.get_circle_area(ch, d)\n # create fullscreen rectangle\n screen = $BlizzABS.util.get_fullscreen_area\n # no use if scene not Scene_Map or spriteset doesn't exist\n return false if !$scene.is_a?(Scene_Map) || $scene.spriteset == nil\n # get all selectable map battlers\n available = $scene.spriteset.character_sprites.find_all {|sprite|\n sprite.character.is_a?(Map_Battler) &&\n !sprite.character.is_a?(Map_Remote) &&\n group.include?(sprite.character.ai.group) &&\n can_be_hit(sprite.character, dead, type, all, screen, area)}\n # no use if no selectable targets\n return false if available.size == 0\n # sort selectable targets by coordinates\n available.sort {|a, b| b.y > a.y ? 1 : b.y < a.y ? -1 : (b.x <=> a.x)}\n # setup select interuption\n $game_temp.select_data = [object, d * 32, type[0], available]\n # don't use skill/item yet\n return false\n when 1 # projectile\n # decide process branch depending on skill type\n case type[0]\n # set normal or break-through projectile data\n when SHOOT\n # if break-through\n if all\n # set break-through projectile skill or item\n projectype = (skill ? REMBreakSkill : REMBreakSkill)\n else\n # set normal projectile skill or item\n projectype = (skill ? REMNormalSkill : REMNormalItem)\n end\n # set range\n targets = [d]\n # homing skill/item\n when HOMING\n # get circle area\n area = $BlizzABS.util.get_circle_area(ch, d)\n # create fullscreen rectangle\n screen = $BlizzABS.util.get_fullscreen_area\n # get all targets that can be hit\n targets = ($game_map.battlers + $BlizzABS.battlers).find_all {|b|\n can_be_hit(b, dead, type, all, screen, area)}\n # if targetting everybody\n if target_all\n # reflection possible on everybody\n other = targets.clone\n else\n # reflection possible on non-target group\n other = targets.find_all {|b| !group.include?(b.ai.group)}\n # if predefined target exists\n if !all && ai.target != nil\n # set predefined target\n targets = [ai.target]\n else\n # set possible targets\n targets = targets.find_all {|b| group.include?(b.ai.group)}\n end\n end\n # set homing projectile type\n projectype = (skill ? REMInitSkill : REMInitItem)\n # homing skill/item\n when TRAP\n # targets for selection, other targets\n targets, other = [], []\n # set homing projectile type\n projectype = (skill ? REMTrapSkill : REMTrapItem)\n # homing skill/item\n when TIMED\n # targets for selection, other targets\n targets, other = [], []\n # set homing projectile type\n projectype = (skill ? REMTimedSkill : REMTimedItem)\n end\n when 2 # direct\n # if direct skill or shockwave skill\n if type[0] == DIRECT\n # get circle area\n area = $BlizzABS.util.get_circle_area(ch, d)\n # if beam skill (fullscreen skill that does not target all)\n elsif !all\n # get affection area rectangle\n area = $BlizzABS.util.get_front_area(ch, d)\n # initialize\n this = nil\n # if scene is Scene_Map and spriteset exists\n if $scene.is_a?(Scene_Map) && $scene.spriteset != nil\n # find the sprite of this character\n $scene.spriteset.character_sprites.each {|spr|\n if spr.character == ch\n this = spr\n break\n end}\n end\n # if sprite exists\n if this != nil\n # create sprite\n sprite = Sprite.new($scene.spriteset.viewport1)\n # try to\n begin\n # load the characterset file\n sprite.bitmap = RPG::Cache.character(object.icon_name, 0)\n # temporary variables\n w1, h = sprite.bitmap.width, sprite.bitmap.height\n # if failed\n rescue\n # get width and height\n w1, h = 24, d*32\n # create bitmap\n sprite.bitmap = Bitmap.new(w1, h)\n # get image from cache\n b = $BlizzABS.cache.image('beam1')\n # copy the beam image\n (0...h).each {|i|\n a = (i < h/2 ? i**2*2 : (h-i-1)**2*2)\n a = 255 if a > 255\n sprite.bitmap.blt(0, i, b, Rect.new(0, 0, b.width, b.height), a)}\n end\n w2 = case ch.direction\n when 6 then 16-w1/2\n else\n w1/2+16\n end\n # set sprite position, rotation and offsets depending on facing\n case ch.direction\n when 2\n sprite.angle, sprite.ox = 0, w1/2\n sprite.x, sprite.y, sprite.z = this.x, this.y, this.z+1\n when 4\n sprite.angle, sprite.ox, sprite.oy = 270, w2, w1/2+16\n sprite.x, sprite.y, sprite.z = this.x-w1-16, this.y, this.z-1\n when 6\n sprite.angle, sprite.ox, sprite.oy = 90, -w2, -w1/2+16\n sprite.x, sprite.y, sprite.z = this.x+16, this.y, this.z-1\n when 8\n sprite.angle, sprite.ox, sprite.oy = 180, w1/2, h+16\n sprite.x, sprite.y, sprite.z = this.x, this.y-h-32, this.z-32\n end\n # add sprite for handling\n $BlizzABS.cache.beams.push([sprite, 20])\n # set beam flag\n beam = true\n end\n end\n # create fullscreen rectangle\n screen = $BlizzABS.util.get_fullscreen_area\n # get all targets that can be hit\n targets = ($game_map.battlers + $BlizzABS.battlers).find_all {|b|\n can_be_hit(b, dead, type, all, screen, area)}\n # if targetting everybody\n if target_all\n # reflection possible on everybody\n other = targets.clone\n else\n # reflection possible on non-target group\n other = targets.find_all {|b| !group.include?(b.ai.group)}\n # if predefined target exists\n if !all && ai.target != nil\n # set predefined target\n targets = [ai.target]\n else\n # set possible targets\n targets = targets.find_all {|b| group.include?(b.ai.group)}\n end\n end\n end\n # if no selectable targets and not trap\n if targets.size == 0 && projectype != REMTrapSkill &&\n projectype != REMTrapItem && projectype != REMTimedSkill &&\n projectype != REMTimedItem\n # no use\n return (beam == true)\n end\n # if Full Reflection System is being used and not breaking reflection skill\n if $full_reflection_system != nil && $full_reflection_system >= 3.01 &&\n targets[0].is_a?(Map_Battler) && skill && !beam &&\n !BlizzCFG::BREAK_REFLECT.include?(object.id) &&\n projectype != REMTrapSkill && projectype != REMTrapItem &&\n projectype != REMTimedSkill && projectype != REMTimedItem\n # execute reflection effect in Blizz-ABS\n BlizzCFG.reflection_effect_blizzabs(ch, targets, other, object)\n end\n # get a random target if not targeting all and no beam or death roulette\n targets = [targets[rand(targets.size)]] if !all && !beam\n # if projectile data is available and projectile should be created\n if projectype != nil\n # temporary variable\n explode = (type[1] != EXPLNone ? type[1, 3] : nil)\n # if trap\n if projectype == REMTrapSkill || projectype == REMTrapItem\n # create trap\n proj = Map_Trap.new(spriteset + object.id.to_s, ch, object.id, d,\n time, projectype, group, dead, explode)\n # add trap to buffer\n $BlizzABS.cache.remotes.push(proj)\n # if timed trap\n elsif projectype == REMTimedSkill || projectype == REMTimedItem\n # create timed trap\n proj = Map_Timed.new(spriteset + object.id.to_s, ch, object.id, d,\n time, projectype, group, dead, explode)\n # add timed trap to buffer\n $BlizzABS.cache.remotes.push(proj)\n else\n # iterate through all targets\n targets.each {|target|\n # create projectile\n proj = Map_Projectile.new(spriteset + object.id.to_s, ch,\n object.id, target, projectile_speed, projectype, group, dead,\n explode)\n # add projectile to buffer\n $BlizzABS.cache.remotes.push(proj)}\n end\n # if skill\n elsif skill\n # execute skill effect upon all targets\n targets.each {|target| target.skill_effect(ch, ch.battler, object)}\n # check special skill effects\n self.check_special_skills(ch, targets, object)\n # clear damage displays upon all targets\n targets.each {|target|\n target.battler.damage, target.battler.damage_pop = nil, false}\n else\n # upon all targets\n targets.each {|target|\n # execute item effect\n target.item_effect(ch, object)\n # clear damage displays\n target.battler.damage, target.battler.damage_pop = nil, false}\n end\n # skill/item use successful\n return true\n end", "def test_nameSkill\n f = SkillFilter.new(\"name\", \"Fire\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 1\n end", "def homunculus_item_conditions_met?(state_id)\n return false if $game_switches[Bubs::HomunculusItem::DISABLE_HOMUNCULUS_SWITCH_ID]\n return false unless actor?\n return false unless state_id == death_state_id\n return false unless @hp > 0\n return false unless state_addable?(state_id)\n return false unless @homunculus_item_id > 0\n return false unless $game_party.has_item?($data_items[@homunculus_item_id])\n return true\n end", "def item_effect(item)\n # Clear critical flag\n self.critical = false\n # If item scope is for ally with 1 or more HP, and your own HP = 0,\n # or item scope is for ally with 0 HP, and your own HP = 1 or more\n if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or\n ((item.scope == 5 or item.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= item.common_event_id > 0\n # Determine hit\n hit_result = (rand(100) < item.hit)\n # Set effective flag is skill is uncertain\n effective |= item.hit < 100\n # If hit occurs\n if hit_result == true\n # Calculate amount of recovery\n recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp\n recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp\n if recover_hp < 0\n recover_hp += self.pdef * item.pdef_f / 20\n recover_hp += self.mdef * item.mdef_f / 20\n recover_hp = [recover_hp, 0].min\n end\n # Element correction\n recover_hp *= elements_correct(item.element_set)\n recover_hp /= 100\n recover_sp *= elements_correct(item.element_set)\n recover_sp /= 100\n # Dispersion\n if item.variance > 0 and recover_hp.abs > 0\n amp = [recover_hp.abs * item.variance / 100, 1].max\n recover_hp += rand(amp+1) + rand(amp+1) - amp\n end\n if item.variance > 0 and recover_sp.abs > 0\n amp = [recover_sp.abs * item.variance / 100, 1].max\n recover_sp += rand(amp+1) + rand(amp+1) - amp\n end\n # If recovery code is negative\n if recover_hp < 0\n # Guard correction\n if self.guarding?\n recover_hp /= 2\n end\n end\n # Set damage value and reverse HP recovery amount\n self.damage = -recover_hp\n # HP and SP recovery\n last_hp = self.hp\n last_sp = self.sp\n self.hp += recover_hp\n self.sp += recover_sp\n effective |= self.hp != last_hp\n effective |= self.sp != last_sp\n # State change\n @state_changed = false\n effective |= states_plus(item.plus_state_set)\n effective |= states_minus(item.minus_state_set)\n # If parameter value increase is effective\n if item.parameter_type > 0 and item.parameter_points != 0\n # Branch by parameter\n case item.parameter_type\n when 1 # Max HP\n @maxhp_plus += item.parameter_points\n when 2 # Max SP\n @maxsp_plus += item.parameter_points\n when 3 # Strength\n @str_plus += item.parameter_points\n when 4 # Dexterity\n @dex_plus += item.parameter_points\n when 5 # Agility\n @agi_plus += item.parameter_points\n when 6 # Intelligence\n @int_plus += item.parameter_points\n end\n # Set to effective flag\n effective = true\n end\n # If HP recovery rate and recovery amount are 0\n if item.recover_hp_rate == 0 and item.recover_hp == 0\n # Set damage to empty string\n self.damage = \"\"\n # If SP recovery rate / recovery amount are 0, and parameter increase\n # value is ineffective.\n if item.recover_sp_rate == 0 and item.recover_sp == 0 and\n (item.parameter_type == 0 or item.parameter_points == 0)\n # If state is unchanged\n unless @state_changed\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n end\n end\n # If miss occurs\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n end\n # If not in battle\n unless $game_temp.in_battle\n # Set damage to nil\n self.damage = nil\n end\n # End Method\n return effective\n end", "def valid_attributes\n {:hp_id => valid_id?(@valid_id1)}\n end", "def condition(identifier)\n ->(e) { e[\"HTTP_X_COND#{identifier}\"] == 'true' }\nend", "def make_skill_action_result\n # Get skill\n @skill = $data_skills[@active_battler.current_action.skill_id]\n # If not a forcing action\n unless @active_battler.current_action.forcing\n # If unable to use due to SP running out\n unless @active_battler.skill_can_use?(@skill.id)\n # Clear battler being forced into action\n $game_temp.forcing_battler = nil\n # Shift to step 1\n @phase4_step = 1\n return\n end\n end\n # Use up SP\n @active_battler.sp -= @skill.sp_cost\n # Refresh status window\n @status_window.refresh\n # Show skill name on help window\n @help_window.set_text(@skill.name, 1)\n # Set animation ID\n @animation1_id = @skill.animation1_id\n @animation2_id = @skill.animation2_id\n # Set command event ID\n @common_event_id = @skill.common_event_id\n # Set target battlers\n set_target_battlers(@skill.scope)\n # Apply skill effect\n for target in @target_battlers\n target.skill_effect(@active_battler, @skill)\n end\n end", "def execute_action_skill\n # Call a custom battle method\n ty_execute_action_skill\n # Call the original battle method if still attacking\n if @active_battler.action.kind == 1\n ty_ammo_requirements_execute_skill\n end\n end", "def set_skill\n @skill = Skill.all.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def create\n params[:encounter_event_skill_check_condition][:skill] = EncounterEventSkillCheckCondition::SKILLS.invert[params[:encounter_event_skill_check_condition][:skill].to_i]\n @encounter_event_skill_check_condition = EncounterEventSkillCheckCondition.new(params[:encounter_event_skill_check_condition])\n \n respond_to do |format|\n if @encounter_event_skill_check_condition.save\n format.html { redirect_to(@encounter_event_skill_check_condition.encounter_event.encounter.adventure, :notice => 'Encounter event skill check condition was successfully created.') }\n format.xml { render :xml => @encounter_event_skill_check_condition, :status => :created, :location => @encounter_event_skill_check_condition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter_event_skill_check_condition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def target_hk_enabled?(target_name, timeout = 10)\n\n counter = get_tlm_cnt(\"#{target_name.upcase}\", \"#{target_name.upcase + HK_PACKET_SUFFIX}\")\n wait_check_expression(\"get_tlm_cnt(\\\"#{target_name.upcase}\\\", \\\"#{target_name.upcase + HK_PACKET_SUFFIX}\\\") > #{counter}\", timeout) \n end", "def get_new_skills(level)\n self.skills.select do |skill|\n skill.min_level == level\n end\n end", "def set_buildskill\n @buildskill = Buildskill.find(params[:id])\n end", "def skill_effect_first_hit_result(user, skill)\r\n hit = skill.hit\r\n if skill.atk_f > 0\r\n hit *= user.hit / 100\r\n end\r\n return hit, (rand(100) < hit)\r\n end", "def cant_counter_skill(current)\n return (not skill_can_use?(current)) if current.numeric?\n for skill_id in current\n return false if skill_can_use?(skill_id)\n end\n return true\n end", "def set_skill\n @skill = Skill.friendly.find(params[:id])\n end", "def set_skill\n @skill = Skill.find_by_id(params[:id])\n end", "def update_skill\n # continue input update if skill should be used\n return false if !self.check_skill_condition?\n # if skill not usable or skill use process not executed and no selection\n if $game_player.battler.skill == 0 ||\n !$game_player.use_skill($data_skills[$game_player.battler.skill]) &&\n $game_temp.select_data == nil\n # play buzzer, can't use\n $game_system.se_play($data_system.buzzer_se)\n end\n # stop input update\n return true\n end", "def update\n @quest = Quest.find(params[:id])\n if iAmQuestMaster @quest.speciality_id\n if (getMyQuestMasterLevel (@quest.speciality_id))>(@quest.level)\n respond_to do |format|\n if @quest.update_attributes(params[:quest])\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to \"/\", notice: 'No tienes el nivel suficiente para editar esta quest!'\n end\n else\n redirect_to \"/\", notice: 'No tienes la especialdidad necesaria para editar esta quest!'\n end\n end", "def find_hatchet\r\n HATCHET_ID.each do |id|\r\n weapon = character.equipment.get EquipmentConstants::WEAPON\r\n if weapon.id == id\r\n return HATCHET[id]\r\n end\r\n if character.inventory.contains id\r\n return HATCHET[id]\r\n end\r\n end\r\n return nil\r\n end", "def idme_loa\n attributes['level_of_assurance']&.to_i\n end" ]
[ "0.6695021", "0.66221845", "0.6189036", "0.6120013", "0.60196644", "0.6017671", "0.59831667", "0.5981362", "0.5961391", "0.5950628", "0.59329593", "0.58321065", "0.5809862", "0.5766323", "0.5749785", "0.5739937", "0.5737943", "0.57009745", "0.5615313", "0.55593765", "0.55535823", "0.55054235", "0.5490352", "0.5478181", "0.5462609", "0.54570264", "0.54419607", "0.54252374", "0.5405805", "0.53999287", "0.539866", "0.53701955", "0.5364704", "0.5354618", "0.5352706", "0.53412", "0.53247607", "0.53047174", "0.5302331", "0.5302067", "0.5274705", "0.52735204", "0.52683586", "0.52504843", "0.5238992", "0.52360827", "0.52262527", "0.5208285", "0.5194444", "0.5191404", "0.5172159", "0.5159805", "0.5156638", "0.514904", "0.5142548", "0.51377684", "0.5114238", "0.5095856", "0.50956935", "0.50927657", "0.50878215", "0.5085428", "0.5085323", "0.5073261", "0.50699663", "0.5055159", "0.5054516", "0.5054045", "0.50483674", "0.5047221", "0.5027242", "0.50210905", "0.5015097", "0.5014598", "0.5007354", "0.50015163", "0.49879998", "0.4977445", "0.49753156", "0.49666572", "0.49637923", "0.49582353", "0.49572033", "0.49551132", "0.49542543", "0.49542543", "0.49542543", "0.49542543", "0.49535888", "0.49498105", "0.49421945", "0.49344218", "0.49259412", "0.4925439", "0.49252617", "0.49223667", "0.49190784", "0.4916097", "0.49083877", "0.49039245" ]
0.66674626
1
Check SP condition id : skill ID
def skill_sp(id) if Skill_Sp[id]['integer'] != nil return true if eval("self.sp #{Skill_Sp[id]['integer']}") end if Skill_Sp[id]['rate'] != nil return true if eval("(self.sp * 100 / [self.maxsp, 1].max) #{Skill_Sp[id]['rate']}") end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard_skill_id\r\n return 2\r\n end", "def attack_skill_id\r\n return 1\r\n end", "def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end", "def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end", "def skill_conditions_met?(skill)\r\n usable_item_conditions_met?(skill) &&\r\n skill_wtype_ok?(skill) && skill_cost_payable?(skill) &&\r\n !skill_sealed?(skill.id) && !skill_type_sealed?(skill.stype_id)\r\n end", "def skill_sw_on(id)\n if Skill_Sw_On[id]['include'] != nil\n for i in Skill_Sw_On[id]['include']\n return true if $game_switches[i]\n end\n end\n if Skill_Sw_On[id]['set'] != nil\n for i in Skill_Sw_On[id]['set']\n return false unless $game_switches[i]\n end\n return true\n end\n return false \n end", "def skill_var(id)\n for var in Skill_Var[id]\n return true if eval(\"$game_variables[#{var[0]}] #{var[1]}\")\n end\n return false \n end", "def garbage_check(id)\n\t return @skills.include?(id)\n\tend", "def set_my_condition\n @my_condition = MyCondition.find(params[:id])\n end", "def skill_effect_scope(skill)\r\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\r\n # or skill scope is for ally with 0, and your own HP = 1 or more\r\n return (((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\r\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1))\r\n end", "def skill_wtype_ok?(skill)\r\n return true\r\n end", "def skill_check? skill\n if !skill.nil?\n curr_skill = Skill.find_by_skill_name(skill)\n if curr_skill.nil?\n sms_error(\"Skills: #{skill} is not a current skill we have. Text 'Skills' to get a list of skills we currently have.\")\n return false\n else\n return true\n end\n end\n return true\n end", "def combination_can_use?(skill_id)\n skill = $data_skills[skill_id]\n if check_include(skill, 'CONSUMEHP')\n return false if calc_sp_cost(skill) > self.hp\n else\n return false if calc_sp_cost(skill) > self.sp\n end\n return false if dead?\n return false if $data_skills[skill_id].atk_f == 0 and self.restriction == 1\n occasion = skill.occasion\n return (occasion == 0 or occasion == 1) if $game_temp.in_battle\n return (occasion == 0 or occasion == 2) if !$game_temp.in_battle\n end", "def skill?\n return (@kind == ACTSkill)\n end", "def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def set_skill\n @skill = @project.skills.find(params[:skillId])\n end", "def delete_check\n if Skill.where(id:params[:id]).blank?\n render json: {result: 'couldnt process delete request'} #dont give extra failure info security-wise\n else\n @skill = Skill.find(params[:id])\n end\n end", "def set_s_skill\n @s_skill = SSkill.find(params[:id])\n end", "def special_skill(launcher, target, skill)\n case skill.symbol\n when :s_counter #Riposte & co\n if skill.id == 64 and (count = target.skill_category_amount(1)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n elsif skill.id == 243 and (count = target.skill_category_amount(2)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n else\n @IA_Info[:other_factor] = rand * 0.7\n end\n else\n return false\n end\n return true\n end", "def set_condition\n @condition = Condition.find(params[:id])\n end", "def skill_ok?\n check_ok?(:skill) || all_ok?\n end", "def check_on_skill_use(user,target,skill,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Skill_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_skill_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end", "def set_skill\n @skill = policy_scope(Skill).find(params[:id])\n authorize(@skill)\n end", "def skill_state_on(id)\n if Skill_State_On[id]['include'] != nil\n for i in Skill_State[id]['include']\n return true if @state.include?(i)\n end\n end\n if Skill_State[id]['set'] != nil\n for i in Skill_State[id]['set']\n return false unless @state.include?(i)\n end\n return true\n end\n return false\n end", "def set_skill_level\n @skill_level = SkillLevel.find(params[:id])\n end", "def skill_can_use?(skill_id)\n if not skill_learn?(skill_id)\n return false\n end\n return super\n end", "def find_question_by_id(question_id)\n question = Pairwise::Question.find question_id\n return question #if question.local_identifier == @local_identifier.to_s\n end", "def condition(identifier)\n ->(e) { e[\"HTTP_X_COND#{identifier}\"] == 'true' }\nend", "def validate_id(answer)\n id = answer.to_i #converts id to an integer value \n type = answer.class\n if type == String && answer == 'exit' || answer == 'no' || answer == ''\n exit\n elsif id < 1 || id > Job.all.size\n print_error\n sleep(0.5)\n false\n else\n id\n end\n end", "def check_skill_condition?\n # disallow usage if skill button disabled\n return false if !$game_system.skill_button\n # disallow usage\n skill_condition = false\n # if using direct hotkeys\n if BlizzABS::Config::DIRECT_HOTKEYS\n # check direct hotkeys\n skill_condition = self.skill_hotkeys?\n # if skill button pressed\n elsif Input.trigger?(Input::Skill)\n # allow usage\n skill_condition = true\n end\n # return result\n return skill_condition\n end", "def get_condition\n @condition\n end", "def set_desired_skill\n @desired_skill = DesiredSkill.find(params[:id])\n end", "def invited_to_survey?\n current_survey_invitation != false && current_survey_invitation.survey.id == (params[:survey_id] || params[:id]).to_i\n end", "def skill_effect_effective_setup(skill)\r\n effective = false\r\n return effective |= skill.common_event_id > 0\r\n end", "def set_skill\n @skill = Skill.all.find(params[:id])\n end", "def counter_skills_id\n [data_battler.counter_skill]\n end", "def set_skill\n @skill = Skill.find_by_id(params[:id])\n end", "def set_buildskill\n @buildskill = Buildskill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def skill_sw_off(id)\n if Skill_Sw_Off[id]['include'] != nil\n for i in Skill_Sw_Off[id]['include']\n return true if $game_switches[i] == false\n end\n end\n if Skill_Sw_Off[id]['set'] != nil\n for i in Skill_Sw_Off[id]['set']\n return false unless $game_switches[i] == false\n end\n return true\n end\n return false \n end", "def specific?\n @requirement.specific?\n end", "def specific?\n @requirement.specific?\n end", "def set_skill\n @skill = Skill.find(params[:id])\n end", "def set_skill\n @skill = @character.skills.find(params[:id])\n end", "def set_myskill\n @myskill = Myskill.find(params[:id])\n end", "def proficiency_for(skill)\n SkillsUser.find_by_user_id_and_skill_id(self.id, skill.id).skill_level\n end", "def hit_condition()\n #This is a stub, used for indexing\n end", "def valid_skill\n @windows[Win_Help].move_to(2)\n @active_battler.current_action.set_skill(@spell.id)\n @targets = get_targets\n if @ATB_Active and \n GTBS::USE_WAIT_SKILLS and GTBS::ALLOW_SKILL_TARGET and \n GTBS::skill_wait(@spell.id)[0] > 0\n occ = occupied_by?(@cursor.x, @cursor.y)\n if occ and !occ.dead? \n type = Command_Confirm::Wait_Skill_Targeting\n end\n Sound.play_decision\n @cursor.active = false\n #Do immediat skill if type == nil\n @windows[Win_Confirm].ask(Command_Confirm::Skill, type)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif @targets.size >0 #unless targets 0 or less for some reason\n #make summons miss when cell is occupied\n if (GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))> 0 && occupied_by?(@cursor.x, @cursor.y)!= nil) or \n (@spell.for_opponent? && (@selected == @active_battler && !GTBS::ATTACK_ALLIES) &&\n !@active_battler.skill_range(@spell.id)[3] )\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n end\n \n elsif GTBS::is_summon?(@spell.id, @active_battler.is_a?(Game_Actor))>0 and $game_map.passable?(@cursor.x, @cursor.y, 0)\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Skill)\n @windows[Win_Status].dmg_preview(2, @active_battler, @spell, @targets)\n \n elsif (!$game_system.actors_bodies? || GTBS::REVIVE_ANY_DEAD) and \n @spell.for_dead_friend? and occupied_by?(@cursor.x, @cursor.y) == nil\n open_revive_window\n \n else\n #Unauthorized validation\n Sound.play_buzzer\n end\n end", "def set_skill_assessment\n @skill_assessment = SkillAssessment.find(params[:id])\n end", "def skill_hp(id)\n if Skill_Hp[id]['integer'] != nil\n return true if eval(\"self.hp #{Skill_Hp[id]['integer']}\")\n end\n if Skill_Hp[id]['rate'] != nil\n return true if eval(\"(self.hp * 100 / self.maxhp) #{Skill_Hp[id]['rate']}\")\n end\n return false\n end", "def skill_type_sealed?(stype_id)\r\n features_set(FEATURE_STYPE_SEAL).include?(stype_id)\r\n end", "def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy', skill_id]].dup\n for id in union.keys\n battler = set_enemy_battler(id)\n return false unless battler != nil and battler.exist?\n return false unless battler.combination_can_use?(skill_id)\n return false unless battler.inputable?\n end\n end\n return super\n end", "def create\n # 検証。同一スキルカテゴリIDかつ同一スキル名を持っている場合はエラー\n @exist = Skill.where(skill_category_id: skill_params[:skill_category_id]).where(skill_name: skill_params[:skill_name])\n\n @skill = Skill.new(skill_params)\n @skill.has_learning_level=true\n \n logger.debug(\"skill\")\n logger.debug(@skill)\n\n if @exist.present? \n render json:{errors: 'already exists.', status: :unprocessable_entity }\n else\n if @skill.save\n render json:{skill: @skill}\n else\n render json:{errors: @skill.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def teaching_level(level) \n services = self.services\n if !services.blank?\n services.each do |s|\n if s.level_id = level\n return true\n end\n end \n end \n return false \n end", "def create\n params[:encounter_event_skill_check_condition][:skill] = EncounterEventSkillCheckCondition::SKILLS.invert[params[:encounter_event_skill_check_condition][:skill].to_i]\n @encounter_event_skill_check_condition = EncounterEventSkillCheckCondition.new(params[:encounter_event_skill_check_condition])\n \n respond_to do |format|\n if @encounter_event_skill_check_condition.save\n format.html { redirect_to(@encounter_event_skill_check_condition.encounter_event.encounter.adventure, :notice => 'Encounter event skill check condition was successfully created.') }\n format.xml { render :xml => @encounter_event_skill_check_condition, :status => :created, :location => @encounter_event_skill_check_condition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @encounter_event_skill_check_condition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def key_skill; end", "def cant_counter_skill(current)\n return (not skill_can_use?(current)) if current.numeric?\n for skill_id in current\n return false if skill_can_use?(skill_id)\n end\n return true\n end", "def set_health_condition\n @health_condition = HealthCondition.find(params[:id])\n end", "def skill?\n fail NotImplementedError\n end", "def get_micr_condition\n @facility.details[:micr_line_info] && @facility_output_config.grouping == 'By Payer'\n end", "def set_skill(skill_id)\n @kind = 1\n @skill_id = skill_id\n end", "def test_supportSkill\n f = SkillFilter.new(\"support\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 29\n end", "def evaluate_proquest_status(thesis)\n proquest_status = thesis.authors.map(&:proquest_allowed).uniq\n return 'conflict' if proquest_status.length > 1\n\n proquest_status.first\n end", "def check_skill_guard(target, item)\n return unless @subject\n return if target == @subject\n return if @subject.friends_unit.members.include?(target)\n return if item.ignore_skill_guard?\n target.skills_guard.each do |sg|\n next if sg[1] > 0 && target.target_range(@subject) < sg[1]\n @subject.item_apply(target, sg[0])\n end\n end", "def can_copy_last_years_skills?\n last_years_skills= get_last_assessment\n return false if last_years_skills.nil?\n last_years_skills.goals.skill.where.not(name: goals.skill.map(&:name)).exists?\n end", "def si_check button_id, the_script\n return \"checkSalesInterfaceForFunction(#{button_id}, function() {#{the_script}});\"\n end", "def set_counter_condition(user, damage, skill = nil)\n if self.actor?\n set_counter(user, damage, skill, 'Actor')\n set_counter(user, damage, skill, 'Skill')\n set_counter(user, damage, skill, 'Armor')\n set_counter(user, damage, skill, 'Weapon')\n else\n set_counter(user, damage, skill, 'Enemy')\n end\n set_counter(user, damage, skill, 'State')\n return if @valid_counters.empty?\n self.counter_action = @valid_counters[rand(@valid_counters.size)]\n end", "def set_opening_skill\n @opening_skill = OpeningSkill.find(params[:id])\n end", "def set_special_skill\n @special_skill = SpecialSkill.find(params[:id])\n end", "def check_custom_assign_ids\n skill_to_pose_hash = bat.cust_skill_pose\n if skill_to_pose_hash != nil\n pose = skill_to_pose_hash[@character.animation_id]\n if pose != nil\n @character.set_pose(pose-1)\n @character.animation_id = 0 #clear animation id since we have handled it\n end\n end\n end", "def skill_effect_physical_hit_result(skill)\r\n # If physical attack has power other than 0\r\n if skill.power != 0 and skill.atk_f > 0\r\n # State Removed by Shock\r\n remove_states_shock\r\n # Return True\r\n return true\r\n end\r\n # Return False\r\n return false\r\n end", "def test_ut_t4_mtv_pu_004\n pu = Pu.find(1)\n pj_id = 5\n assert_equal FALSE, pu.check_pj_belong_to_pu?(pj_id)\n end", "def item_choice?\r\n @item_choice_variable_id > 0\r\n end", "def update\n @encounter_event_skill_check_condition = EncounterEventSkillCheckCondition.find(params[:id])\n\n respond_to do |format|\n if @encounter_event_skill_check_condition.update_attributes(params[:encounter_event_skill_check_condition])\n format.html { redirect_to(@encounter_event_skill_check_condition, :notice => 'Encounter event skill check condition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @encounter_event_skill_check_condition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_app_condition\n @app_condition = AppCondition.find(params[:id])\n end", "def gift_aid?\n params['GiftAid'] == '1'\n end", "def set_skill\n @skill = Skill.friendly.find(params[:id])\n end", "def test_nameSkill\n f = SkillFilter.new(\"name\", \"Fire\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 1\n end", "def condition; end", "def set_current_skill\n @current_skill = CurrentSkill.find(params[:id])\n end", "def chooseBestSkill(context, pur, weapon_type, prop)\n p \"choose best skill for #{pur}/#{weapon_type} by #{prop}\"\n # p \"skills #{context[:skills]}(size=#{context[:skills].size})}\"\n attacker_skills = context[:skills]\n \n best_skill = {\n :skill => nil\n }\n best_skill[prop] = 0\n reg2 = Regexp.new(\"#{pur}\", true)\n if (weapon_type and weapon_type.length >0)\n reg = Regexp.new(\"#{weapon_type}\", true)\n else\n reg = /./i\n end\n p \"==>1#{attacker_skills.inspect}\"\n for skill in attacker_skills\n if (!skill || skill.category=='premier')\n next\n end\n skillname = skill.query_data(\"skname\")\n p \"===>skill = #{skill}\"\n p \"===>skill name =#{skillname}\"\n #context[:thisskill] = skill\n# purpose = query_skill(skillname, \"for\", skill, context)\n\n purpose = skill.for # usage: attack parry ...\n type = skill.type # skill type: unarmed, fencing, daofa...\n \n # if skill is for attacking and has correct type with weapon\n if type=~ reg and purpose=~reg2 \n # ret = query_skill(skillname, prop, skill, context)\n # ret = skill.query(prop, context)\n ret = skill_power(skill, context[:user], pur)\n p \"===>#{prop} of #{skillname}: #{ret} \\n\"\n if (ret.to_i > best_skill[prop])\n best_skill[prop] = ret\n best_skill[:skill] = skill\n end\n end\n\n \n #p \"target:\"+@target_class+\", cmd:\"+@cmd+\", param:\"+@cparam\n end\n if ( best_skill[:skill] == nil)\n #if not found, add basic skill for this type of skill\n _skname = weapon_type\n if (pur == 'dodge')\n _skname = 'dodge'\n elsif (pur == 'parry')\n _skname = 'parry'\n end\n if _skname == nil or _skname==\"\"\n raise \"skill name is nil\"\n end\n # us = Userskill.new({\n # :uid => context[:user][:id],\n # :sid => context[:user][:sid],\n # :skid => 0,\n # :skname => _skname,\n # :skdname => \"basic #{weapon_type}\",\n # :level => 0,\n # :tp => 0,\n # :enabled => 1 \n # })\n # us.save!\n us = context[:user].set_skill(_skname, 0, 0)\n attacker_skills.push(us)\n best_skill[:skill] = us\n end\n p \"==>best skill of #{context[:user].name} for #{pur}, skill_type #{weapon_type}: #{best_skill}\"\n return best_skill\n end", "def set_win_condition\n @win_condition = WinCondition.find(params[:id])\n end", "def chain_skill_restriction?(skill)\r\r\n #return false unless actor?\r\r\n return false unless $game_party.in_battle\r\r\n return false unless skill.chain_only\r\r\n return false if (self.state?(90) || self.state?(288)) && skill.is_spell?\r\r\n return !@active_chain_enabled\r\r\n end", "def scope_condition() \"1\" end", "def condition\n return @condition\n end", "def condition\n return @condition\n end", "def set_skill_name\n @skill_name = SkillName.find(params[:id])\n end", "def set_function_skill\n @function_skill = FunctionSkill.find(params[:id])\n end", "def check_product\n #nhan ID va kiem tra\n @product=Product.find(1)\n respond_to do |format|\n if @product.instock_quality >= ??#cho nhan so luong\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def conditions\n @conditions ||= begin\n REXML::XPath.first(document, \"/p:Response/a:Assertion[@ID='#{document.signed_element_id[1,document.signed_element_id.size]}']/a:Conditions\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\n end\n end" ]
[ "0.67911553", "0.61708826", "0.5986448", "0.59855115", "0.57566106", "0.5730158", "0.57211494", "0.57147837", "0.5537426", "0.5523886", "0.5490673", "0.5383702", "0.5371006", "0.53443813", "0.5343247", "0.53366303", "0.53366303", "0.53366303", "0.53366303", "0.5327093", "0.5301267", "0.52697736", "0.5244338", "0.5240231", "0.52224773", "0.5215083", "0.52102846", "0.51920366", "0.5179711", "0.5176578", "0.51527965", "0.51473886", "0.5145306", "0.5124699", "0.51235485", "0.51197606", "0.5109962", "0.5106862", "0.5089825", "0.50840163", "0.5072952", "0.5069498", "0.50453246", "0.50453246", "0.50453246", "0.50453246", "0.50453246", "0.50453246", "0.50453246", "0.50447816", "0.50433797", "0.50433797", "0.5042275", "0.5024359", "0.5022351", "0.50203735", "0.50149965", "0.5014834", "0.50132424", "0.5012242", "0.5000622", "0.49951908", "0.4994901", "0.49909568", "0.4988863", "0.49844444", "0.49842787", "0.49792212", "0.49772382", "0.4969756", "0.49572992", "0.49560553", "0.49557558", "0.49539647", "0.49530926", "0.4930356", "0.49284512", "0.49269813", "0.49231443", "0.4898", "0.48977795", "0.48968604", "0.48965836", "0.489496", "0.48947597", "0.48931858", "0.4882685", "0.48745635", "0.4871139", "0.4869955", "0.4862116", "0.48602805", "0.48567733", "0.48561323", "0.48519897", "0.48519897", "0.48474059", "0.4845164", "0.48425376", "0.48354706" ]
0.6455193
1
is following a user?
def following?(other) following.include?(other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?(user)\n following.include?(user)\n end", "def following?\n user.present?\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def following?(user)\n following.include? user\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def following?(user)\n followings.include?(user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def following?(other_user)\n following.include?(other_user)\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def following? (other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end" ]
[ "0.89001584", "0.8830123", "0.882131", "0.87999135", "0.87602615", "0.874472", "0.874303", "0.8741129", "0.8740429", "0.8733352", "0.8731709", "0.87241656", "0.87241656", "0.87241656", "0.87241656", "0.8718604", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8718221", "0.8711341", "0.8711341", "0.8711341" ]
0.0
-1
display menu for user
def display_menu puts "1. Scrapp townhalls' emails from web" puts "2. Send massive emails to townhalls" puts "3. Follow towhalls on Twitter" puts "4. Print me the JSON" puts "5. Exit program" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displaymenu # Console only\r\n\t\t @output.puts \"Menu: (1) Play | (2) New | (3) Analysis | (9) Exit\"\r\n\t\t end", "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def display_menu(menu)\n puts menu.title\n menu.menu_items.each_with_index { |item| puts \"#{item.key_user_returns}.\\t #{item.user_message}\" }\n end", "def start_menu\n printf \"\\nPrograma para a disciplina de LPD\\n\"\n printf \"Choose one option\\n\"\n printf \"------------------------------------\\n\"\n printf \"1) Insert user\\n\"\n printf \"2) Login user\\n\"\n printf \"3) Delete user\\n\"\n printf \"0) Exit\\n\"\nend", "def menu_options\n system \"clear\"\n puts \"~~~ Welcome #{@user.username} to the Main Menu ~~~\\n\\n\" \n puts \"{1} Continue from previous story \"\n puts \"{2} Create new story\"\n puts \"{3} Delete a story\"\n puts \"{4} Tutorial\"\n puts \"{5} End My Session\"\nend", "def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end", "def menu\n # This uses a HEREDOC for multiline listing\n puts \"-------------------------\".colorize(:green) \n puts <<-MENU\n\nChoose a how you would like to see a card. You can view by name, creature, enchantment or sorcery:\n1. See cards by Name \n2. See cards by Creature \n3. See cards by Enchantment \n4. See cards by Sorcery\n\nOr type 'exit' at any time to leave the program. Type 'menu' to return to the main menu.\n MENU\n end", "def menu\n \n \n\nend", "def print_menu\n puts \"1. List patients\"\n # ....\n end", "def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend", "def display_menu_user\n\t\tsystem 'clear'\n\t\tputs \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n\t\tputs \" Let's get started !\"\n\t\tputs \" First lets give a name to Player1\"\n\t\tprint \" > \"\n\t\t@player1.name = gets.chomp\n\t\twhile(@player1.name ==\"\") do\n\t\t\tputs \" Don't let me with an empty name :(\"\n\t\t\tprint \" > \"\n\t\t\t@player1.name = gets.chomp\n\t\tend\n\t\tputs \" Now, lets give a name to Player2\"\n\t\tprint \" > \"\n\t\t@player2.name = gets.chomp\n\t\twhile(@player2.name ==\"\") do\n\t\t\tputs \" Don't let me with an empty name :(\"\n\t\t\tprint \" > \"\n\t\t\t@player2.name = gets.chomp\n\t\tend\n\t\tputs \n\t\tputs \" Great ! lets start the game :)\"\n\t\tsleep(2)\n\tend", "def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend", "def main_menu\n puts \"Here is a list of available commands:\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Show a contact\"\n puts \" search - Search contacts\"\n puts \" delete - Deletes a contact\"\n end", "def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend", "def display_menu\n title_print\n puts \"Hi #{@todays_hero.name}!\"\n puts \"***************************\"\n selection = TTY::Prompt.new.select(\"What would you like to do?\", per_page: 10, cycle: true) do |menu|\n menu.enum '>'\n\n menu.choice 'Start a fight', 1\n menu.choice 'Train for battle', 2\n menu.choice 'Go on a Quest', 3\n menu.choice 'Show Stats', 4\n menu.choice 'Display Instructions', 5\n menu.choice 'Display Leaderboard', 6\n menu.choice 'Exit', 7\n end\n self.start_game_loop(selection)\n end", "def print_menu\n puts \"User's Menu\\n-----------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def menu\nend", "def show_main_menu\n puts \"Welcome to the app. What would you like to do?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n puts \" show - shows contact with specific id\"\n puts \" find - find a user\"\n print \"> \"\n end", "def menu\n \nend", "def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend", "def main_menu\n prompt.select(\"What would you like to do today #{user.name}?\") do |menu|\n menu.choice \"Choose Protein\", -> {choose_protein}\n menu.choice \"Exit!\", -> {exit_helper}\n menu.choice \"Delete Account!?!?\", -> {delete_account_helper}\n end\n end", "def print_menu\n output.puts \"Madden's Car Selection Tool-\"\n \n # Print Current Model Info\n print_model_info\n\n # Print Menu Choices\n print_menu_choices\n\n # Get User Choice\n output.print \"Enter choice: \"\n end", "def show_main_menu\n puts \"What would you like do next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" delete - Delete a contact\"\n puts \" show - Display contact details\"\n # puts \" find - Find a contact\"\n print \"> \"\n end", "def main_menu\n menu = [\n \"My Stats\",\n \"My Hikes\",\n \"Trails\",\n \"Quit\"]\n choice = nil\n while choice != \"Quit\"\n system 'clear'\n puts \"------MAIN MENU------\"\n choice = @prompt.select(\"What would you like to do #{@current_user.name}?\", menu)\n\n case choice\n when \"My Stats\"\n user_stats\n when \"My Hikes\"\n hike_options\n when \"Trails\"\n trail_options\n end\n end\n end", "def main_menu\r\n puts \"\\nMain Menu.\"\r\n puts \"A. List Buildings\"\r\n puts \"B. List Machines\"\r\n puts \"C. List Snacks\"\r\n puts \"D. List Users\"\r\n puts \"E. Find a Snack\"\r\n puts \"F. Add a New Snack\"\r\n puts \"G. Create New User\"\r\n puts \"H. List Favorites\"\r\n puts \"I. Find Favorites\"\r\n puts \"J. Add Favorites\"\r\n puts \"Q. Quit\"\r\nend", "def main_menu(user)\n user = user\n self.clear\n Ascii.image\n menu = [\"See all my plants\",\"Add new plant\",\"Delete my account\",\"Quit\"]\n menu_selection = @@prompt.select(\"What would you like to do?\",menu)\n \n case menu_selection\n when \"See all my plants\"\n my_plant(user)\n when \"Add new plant\"\n add_plant(user)\n when \"Delete my account\"\n answer = @@prompt.yes?(\"Are you sure?\")\n answer == true ? user.destroy : self.main_menu(user)\n when \"Quit\"\n index = 0\n # binding.pry\n color = [\"#7FFF00\",\"#6B8E23\",\"#008000\",\"#2F4F4F\",\"#00008B\"]\n 5.times do\n self.clear\n # binding.pry\n puts Paint[Ascii.goodbye, color[index]] \n index += 1\n sleep(0.7)\n end \n end\n end", "def menu_display\n system(\"clear\")\n\t\tputs \"##############################\"\n\t\tputs \"# #\"\n\t\tputs \"# Select a number #\"\n\t\tputs \"# from below #\"\n\t\tputs \"# #\"\n\t\tputs \"# 1. Balance #\"\n\t\tputs \"# 2. Deposit #\"\n\t\tputs \"# 3. Withdraw #\"\n\t\tputs \"# 4. History #\"\n\t\tputs \"# 5. Exit #\"\n\t\tputs \"# #\"\n\t\tputs \"# #\"\n\t\tputs \"##############################\"\n end", "def display_main_menu(clear_screen = false)\n clear if clear_screen\n title_header(TITLES[:main_menu],\"_\",\"-\",false)\n\n Api.main_topics.each_with_index do |type, i|\n puts \"#{(\" \" * (PROFILE_SIDE / 2))}#{i+1}\".green + \". #{type}\" \n end\n\n puts \"\\n NAVIGATE: \".black.on_green + \" #{nav_main}\".on_black\n input_menu\n end", "def menu\n system('clear')\n selection = @prompt.select('》 PLAYLIST 《', ['Display', 'Add', 'Remove', 'Export To File', 'Back'])\n case selection\n when 'Display'\n list\n else\n case_menu(selection)\n end\n end", "def main_menu\n name_selector\n puts \"Okay #{@name}, what would you like to do?\"\n loop do\n case menu_arrows\n when '1'\n @recommendation.recommendation_menu\n when '2'\n puts 'you have the following number of games in your library: '\n @game_library.game_instances\n puts 'your custom list of games:'\n @game_library.user_games_lister\n when '3'\n puts 'add a game:'\n @game_library.add_title\n when '4'\n @game_library.delete_games\n when '5'\n @time_used.time_wasted\n when '6'\n @game_library.write_games\n puts 'thanks for your time!'\n exit\n end\n end\n end", "def show_main_menu\n puts \" Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" list important - List all contacts\"\n puts \" show :id - Display contact details\"\n puts \" delete - Delete an entry\"\n puts \" find - Find an entry\"\n print \"> \"\n end", "def print_menu\n\t\tsystem ('cls') or system ('clear')\n\t\t@todo_list.print_list\n\t\tprint_menu_options\n\tend", "def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end", "def menu\n puts \"- Type in a #{\"Nintendo Character\".colorize(:red)} | #{\"Game Series\".colorize(:blue)} | #{\"Amiibo Series\".colorize(:green)}\\n\\n\"\n puts \"- Type #{'1'.colorize(:yellow)} for a list of all the Game Series included in the Amiibo collection\"\n puts \"- Type #{'2'.colorize(:yellow)} for a list of all the Amiibo Series included in the Amiibo collection\"\n puts \"- Type #{'3'.colorize(:yellow)} for a list of all the Characters included in Amiibo collection\"\n puts \"- Type #{'4'.colorize(:yellow)} for a list of ALL Amiibos collection\\n\\n\"\n puts \"- Type #{'exit'.colorize(:yellow)} to exit the CLI\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(2)\n end", "def menu\n puts \"#{dashes}\\n\n Choose from the following options - using the numbers (1-6) as your input:\\n\n - 1 - Create your user profile\n - 2 - Search for doctors by region\n - 3 - Search for doctors by specialty\n - 4 - Search for the doctors the user has visited\n - 5 - Does something else\n - 6 - Quit the application\n \"\n end", "def display_menu\n\t\n\tputs \" \"\n\tputs \"Would you like to (a)dd a new apartment, (c)reate a new person?, or (q)uit?\"\n\tputs \" \"\n\tgets.chomp.downcase\nend", "def main_menu\n choice = self.prompt.select(\"Hi there, #{self.user.name}! What would you like to do today?\", [\"Create a new post\", \"Find a book\", \"View or edit my posts\", \"Delete my account\", \"Logout\"])\n\n case choice\n when \"Create a new post\"\n self.new_post\n when \"Find a book\"\n self.find_book\n when \"View or edit my posts\"\n self.view_edit_posts\n when \"Delete my account\"\n self.delete_account\n when \"Logout\"\n self.spinner(\" ✌️✌️✌️ \")\n self.greet\n end\n end", "def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\n puts \"s = Save Recipe to My Favorites\".colorize(:blue)\n puts \"r = Rate Recipe\".colorize(:blue)\n puts \"a = See Average Recipe Rating\".colorize(:blue)\n puts \"o = Open Link to See the Steps for This Recipe\".colorize(:blue)\n puts \"m = Back to Main Menu\".colorize(:blue)\n puts \"***********************************************\\n \".colorize(:magenta).blink\n end", "def create_menu\n h = { f: :create_a_file,\n d: :create_a_dir,\n s: :create_dir_with_selection,\n b: :create_bookmark }\n _, menu_text = menu 'Create Menu', h\nend", "def print_menu\n # 1. print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"9. Exit\" # '9' because we'll be adding more items later\nend", "def op_menu\n loop do\n case Prompts.op_selection\n when '1'\n user = User.new_user_input\n main_menu(user)\n when '2'\n User.user_login\n when '3'\n quit\n end\n end\n end", "def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend", "def show_main_menu\n puts \"Welcome to the app. What's next?\".yellow\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - display details via index\"\n puts \" find - find someone by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def menu\n\n puts \"________________\"\n\n puts \"insert the user name to continue\"\n @user_name = gets.chomp\n response = User.find_by(user_name: @user_name)\n\n puts \"________________\"\n\n if response\n \n mainscreen\n else\n puts \"try again\"\n menu\n end\n end", "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "def display_menu\n puts \"Welcome to Lorrayne and Sherwin's coffee emporium!\\n\\n\"\n puts \"1) Add item - $5.00 - Light Bag\"\n puts \"2) Add item - $7.50 - Medium Bag\"\n puts \"3) Add item - $9.75 - Bold Bag\"\n puts \"4) Complete Sale\"\n end", "def main_menu()\n system 'clear'\n loop do\n headline(\"My Petsitter App\")\n puts \"#{@emoji[:smiling_cat_face_with_open_mouth]} Welcome! #{@emoji[:dog_face]}\".colorize(:bold)\n puts @headline\n input = @prompt.select('Menu:') do |menu|\n menu.choice name: 'Pet Sitters', value: \"PET_SITTERS\"\n menu.choice name: 'Clients', value: \"CLIENTS\"\n menu.choice name: 'Jobs', value: \"JOBS\"\n menu.choice name: 'Logout', value: \"EXIT\"\n end\n puts '-' * 20\n go_to(input)\n end\n end", "def main_menu\n\t\tputs '################################'\n\t\tputs '######### Tic Tac Toe ##########'\n\t\tputs '################################'\n\t\tputs '================================'\n\t\tputs '== Choose your weapon warrior =='\n\t\tputs '================================'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '^^^^^^ Type Your Choice: ^^^^^^^'\n\t\tputs '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'\n\t\tputs '$$$$$$$$$$$ 1. \"X\" $$$$$$$$$$$$$'\n\t\tputs '$$$$$$$$$$$ 2. \"O\" $$$$$$$$$$$$$'\n\t\tputs '--------------------------------'\n\tend", "def show_main_menu\n puts \"\\e[H\\e[2J\"\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def menu # can do custom methods within a method/class\n end", "def display_menu\n puts \"\\nEnter option: \"\n puts '1. List Existing Threads'\n puts '2. List Single Thread'\n puts '3. Create new Thread'\n puts 'Q. Quit'\n end", "def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" delete - Delete by ID\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" find - Find by name\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "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 main_menu(owner_name, owner)\n puts \"#{page_break}\\n\n Select from the following menu options to get started:\\n\n 1 - Make New Appointent\n 2 - Reschedule Appointment\n 3 - Cancel Appointment\n 4 - Search for a Groomer\n 5 - Exit\n \"\n end", "def main()\n main_menu(SHOW_HEADER);\n end", "def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend", "def show_main_menu\n puts \"Welcome to the app. What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show id - Show info for contact id number\"\n puts \" quit - Exit Application\"\n print \"> \"\n end", "def show # Show method\n menu # Show menu method above\n end", "def display_menu_header(header, user=\"guest\")\n user == \"guest\" ? username = \"User: guest\" : username = \"User: \" + user.name\n system('clear')\n puts \"\\n\" * $sp[:t]\n puts \" \" * ($sp[:l] + $sp[:w] - username.size) + username\n header.each {|line| puts \" \" * $sp[:l] + line}\n puts \" \" * $sp[:l] + \"-\" * $sp[:w]\nend", "def print_menu\n # 1. Print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list\"\n puts \"4. Load the list\"\n puts \"9. Exit\"\nend", "def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk devices'),\n url_for(:controller => 'disk_devs')) <<\n MenuItem.new(_('Terminals'),\n url_for(:controller => 'terminals')) <<\n MenuItem.new(_('Terminal classes'),\n url_for(:controller => 'term_classes')) <<\n MenuItem.new(_('Instances'),\n url_for(:controller => 'instances')) \n\n if @sysuser.admin?\n @menu << MenuItem.new(_('User management'),\n url_for(:action => 'list', \n :controller => 'sysusers'))\n end\n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY RANGOS]-----\"\n puts \"______________________________\"\n puts \"1) Generación numérica\"\n puts \"2) Generación de letras\"\n puts \"3) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def login_menu_display\n puts \"Welcome to Ticket Search app!\"\n login_choice = @prompt.select(\"What would you like to do?\", [\"Create Account\", \"Login\", \"Exit\"])\n case login_choice\n when \"Create Account\"\n user_create\n system \"clear\"\n when \"Login\"\n account_login\n system \"clear\"\n when \"Exit\"\n exit\n end\n end", "def tableau_menu\n player_name_list = @mk.players.collect { |p| p.name }\n @@cli.choose do |menu|\n menu.prompt = \"Whose situation do you want information on? \"\n menu.choices(*player_name_list) do |chosen|\n @@cli.say \"You have chosen <%= color('#{chosen}', BOLD) %>. \"\n @mk.players.find { |p| p.name==chosen }.tableau.console_output\n end\n menu.choice(:none) { @@cli.say \"OK, leaving tableau menu\"}\n end\n end", "def interactive_menu\n loop do\n print_menu\n selection\n end\nend", "def menu\n puts \"Here is a list of available commands:\"\n puts \"\\tnew\\t- Create a new contact\"\n puts \"\\tlist\\t- List all contacts\"\n puts \"\\tshow\\t- Show a contact\"\n puts \"\\tsearch\\t- Search contacts\"\n @user_input = gets.chomp\n end", "def print_menu menu_level= '0'\n print_menu_header menu_level\n\n 20.times do |counter|\n lvl = \"#{menu_level}.#{counter}\"\n puts \" #{counter} : \" + @menu_map[lvl][0] if @menu_map.has_key?(lvl)\n end\n puts \"Make a choice between those items. (X to exit)\"\n puts \"Use left arrow to go back\"\n end", "def display_game_menu\n @output.puts '-----------------------'.center(WIDTH)\n @output.puts '| 1) Blackjack |'.center(WIDTH)\n @output.puts '| 2) Stud Poker |'.center(WIDTH)\n @output.puts \"| 3) Texas Hold 'em |\".center(WIDTH)\n @output.puts '| A) Add AI Player |'.center(WIDTH)\n @output.puts '| D) Debug Console |'.center(WIDTH)\n @output.puts '| P) Setup Player |'.center(WIDTH)\n @output.puts '| Q) Quit |'.center(WIDTH)\n @output.puts '-----------------------'.center(WIDTH)\n @output.puts # spacer\n @output.print 'Command: '\n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY ARITMETICO]]-----\"\n puts \"______________________________\"\n puts \"1) Suma\"\n puts \"2) Resta\"\n puts \"3) División\"\n puts \"4) Multiplicación\"\n puts \"5) Potencia\"\n puts \"6) Residuo\"\n puts \"7) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def booth_main_menu\n prompt.select(\"Welcome Booth Operator, what would you like to do today?\" ) do |menu|\n menu.choice \"View Merchandise\", -> {self.user.check_merchandise}\n menu.choice \"Update Inventory\", -> {self.user.add_to_inventory}\n menu.choice \"List of Customers\", -> {self.user.list_of_attendees}\n menu.choice \"Number of Sales\", -> {self.user.number_of_sales}\n menu.choice \"Items Sold\", -> {self.user.sales_made}\n menu.choice \"Sales Revenue\", -> {self.user.sales_revenue}\n menu.choice \"Exit\", -> {exit!}\n end\n end", "def show_admin_menu\n puts \"-\"*80\n puts \"¿Que deseas hacer?\"\n puts \"-\"*80\n puts \"1) Mostrar todos los vuelos\"\n puts \"2) Mostrar todas las reservaciones\"\n puts \"3) Agrega un vuelo\"\n puts \"4) Salir\"\n # puts \"5) Borrar vuelos\"\n # puts \"6) Borrar reservaciones\"\n\n puts \n puts \"Selecciona opción:\"\n input = gets.chomp\n input\n end", "def menuScreen\n @levelNo=1\n clearScreen\n puts \"You are at the menu for Sokoban\"\n puts \"To quick play: Press 'p'\"\n puts \"To choose a level: Press 'c'\"\n puts \"To stop: Press 'q'\"\n charPressedInMenu\nend", "def main_menu\n @ui.input_1_change\n @ui.user_input1.downcase\n unless %w[trains routes stations cars].include? @ui.user_input1\n puts 'There is no such option in the main menu.'\n end\n main_menu_choose_option(@ui.user_input1)\n end", "def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" update - Enter ID to update a contact\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end", "def main_menu(user_instance)\n user_greeting(user_instance)\n case help\n when \"1\", \"playlist\", \"playlists\"\n system(\"clear\")\n playlists_menu(user_instance)\n when \"2\", \"songs\", \"song\"\n system(\"clear\")\n songs_menu(user_instance)\n # when \"3\", \"artists\", \"artist\"\n # system(\"clear\")\n # artists_menu(user_instance)\n when \"exit\"\n system(\"clear\")\n goodbye\n exit\n else\n system(\"clear\")\n puts \"Please enter a valid command.\".colorize(:red).bold\n main_menu(user_instance)\n end\nend", "def print_menu\n print <<MENU\n \\nPlease choose one of the following options:\n 1. Encrypt\n 2. Decrypt\n 3. Exit\nMENU\nend", "def show_menu\n\n menu_pick = @prompt.select('Please select a menu option: ') do |menu|\n menu.choice 'Show Events by Country', 'find by country'\n menu.choice 'Show Events by City', 'find by city'\n menu.choice 'Show Events By Date', 'find by date'\n menu.choice 'Get Event Info By Name', 'find by name'\n menu.choice 'Exit', 'exit'\n end\n\n return menu_pick if menu_pick == 'exit'\n\n event = handle_input(menu_pick)\n\n display_info(event) if event\n\n end", "def display_menu()\n return 'Welcome to the Chicken Farm Simulator'\nend", "def list_all_users(menu)\n system('clear')\n puts \"All users currently in the system:\"\n puts \"==================================\"\n puts User.pluck(:name)\n puts\n puts \"Press enter to return to main menu.\"\n STDIN.gets.chomp\n if menu == \"user_select_menu\"\n self.welcome_message\n elsif menu == \"main_menu\"\n @menu_message = nil\n self.main_menu\n end\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from a file\"\n puts \"9. Exit\"\nend", "def main_menu\n @@prompt.select(\"What would you like to do today?\".colorize(:yellow)) do |menu|\n menu.choice \"Read Reviews\", -> {self.read_reviews}\n menu.choice \"Write a review\", -> { self.writing }\n menu.choice \"Update a review\", -> { self.update_reviews }\n menu.choice \"Delete a review\", -> { self.deleting }\n menu.choice \"Log Out\", -> { self.log_out }\n end\n end", "def show(screen)\n\n screen.set_pos_by_point(Point.zeroPoint)\n\n if @selected\n screen.attron(A_REVERSE)\n else\n screen.attron(A_UNDERLINE)\n end\n\n @menu_items.each do |menu_item|\n screen.addstr( \"#{menu_item} \")\n end\n\n p = screen.cur_point\n\n screen.addstr( ' ' * (screen.width - p.x) )\n\n if @selected\n screen.attroff(A_REVERSE)\n else\n screen.attroff(A_UNDERLINE)\n end\n\n end", "def show_main_menu\n puts \"Welcome to Contacts APP, What's next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contacts\"\n puts \" show - Enter ID to show detail of a contact\"\n puts \" find - Find contacts by name\"\n puts \" add - Add phone numbers\"\n puts \" save - Save contact to CSV file\"\n puts \" quit - Save & Exit Application\"\n print \"> \"\n end", "def print_menu\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list to a file\"\n puts \"9. Exit\"\nend", "def menu_list \n puts \"Please select from the following options: \"\n puts \" Enter '1' to create a new donation!\"\n puts \" Enter '2' to see a list of the organizations accepting donations\"\n puts \" Enter 'exit' if you changed your mind and wish to leave the app\"\n puts \" To see the menu options again, please enter 'menu'\"\nend", "def print_menu\n puts \"Select one of the following options:\"\n puts \"----//--------//------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list of students\"\n puts \"4. Load the list of students\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def print_menu\n isFinished = true\n while (isFinished)\n puts @menu_description\n @menu_items.each_pair { |key, value|\n puts \"(#{key}) #{value}\"\n }\n\n isFinished = determine_action(get_entry(\"Select option: \"))\n end\n end", "def menu\n\tputs \"Quelle action veux-tu effectuer?\"\n\tputs \"\\n\"\n\tputs \"a - chercher une meilleure arme\"\n\tputs \"s - chercher à se soigner\"\n\tputs \"\\n\"\n\tputs \"attaquer un joueur en vue :\"\n\ti = 0\n\tenemies_in_sight.each do |enemy|\n\t\ti +=1\n\t\tputs \"#{i} - #{enemy.name} a #{enemy.life_points} points de vie.\"\n\tend\n\tputs \"Fais ton choix\"\n\tprint \">\"\n\tend", "def display_main_menu\n puts '################################'\n puts '# {N}- Network Stuff #'\n puts '# {RF}- Read File #'\n # puts '# {GF}- Generate File #'\n # puts '# {D}- Run as Daemon #'\n # puts '# {TD}- Run as Trigger Daemon #'\n puts '# {Q}- Quit #'\n puts '################################'\nend", "def interactive_menu\n puts \"\"\n puts \"-----Student Directory Program-----\".center(50)\n loop do\n print_menu_options\n selection = STDIN.gets.chomp\n menu_options(selection)\n end\nend", "def menu\n puts `clear`\n puts Rainbow(\"Welcome to the Happitails Database\\n\\n\").blue\n print 'Choose: (L)ists, (A)nimal Management, (C)lient Management or (Q)uit. '\n gets.chomp.downcase\nend", "def employee_menu\n header(\"employee functions\")\n puts\n\n #TTY::Prompt keypress method constantly monitors keyboard for input\n @prompt = TTY::Prompt.new\n\n puts \"1) view the employee roster\"\n puts\n puts \"2) add employee\"\n puts\n puts \"3) update employee details\"\n puts\n puts \"4) delete employee\"\n puts\n puts \"5) return to main menu\"\n puts\n\n selection = @prompt.keypress(\"Please make your selection:\").to_i\n case selection\n when 1\n view_employee_roster\n system \"clear\"\n employee_menu\n when 2\n add_employee\n system 'clear'\n employee_menu\n when 3\n view_employee_roster\n update_employee\n system 'clear'\n employee_menu\n when 4\n view_employee_roster\n delete_employee\n system 'clear'\n employee_menu\n when 5\n system \"clear\"\n main_menu\n else\n error\n press_any_key\n end\n end", "def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend", "def menu(user)\n system \"clear\"\n print \"\\e[8;1000;1000t\"\n aa = Artii::Base.new :font => 'doom'\n puts aa.asciify(\"What would you like to do?\".center(110))\n puts\n puts aa.asciify(\"1. Play a New Game \".center(125))\n puts aa.asciify(\"2. View Leaderboard\".center(125))\n puts aa.asciify(\"3. How to Play \".center(125))\n puts aa.asciify(\"4. Exit \".center(125))\n user_input = gets.chomp\n if user_input == \"1\"\n start_game(user)\n elsif user_input == \"2\"\n display_leaderboard(user)\n elsif user_input == '3'\n how_to_play(user)\n elsif user_input == \"4\"\n system \"clear\"\n puts aa.asciify(\"Thanks for playing!\")\n bye_bear\n sleep(3)\n return nil\n else\n puts \"Selection not recognized\"\n system \"clear\"\n menu(user)\n end\nend", "def command_line_menu\n\tputs \"--- Command Line Menu ---\"\n\tputs \"1: mv\"\n\tputs \"2: cp\"\n\tputs \"3: mkdir\"\n\tputs \"4: ls\"\n\tputs \"5: rm\"\n\tputs \"6: Main Menu\"\n\tuser_input_command_line_menu\nend", "def menu\n\t\tputs \"\\nQuelle action veux-tu effectuer ?\"\n\t\tputs \"a - chercher une meilleure arme\"\n\t\tputs \"s - chercher à se soigner\\n\"\n\n\t\tputs \"\\nattaquer un joueur en vue :\"\n\t\tif player1.life_points > 0 \n\t\t\tputs \"0 - Josiane a #{player1.life_points} points de vie\"\n\t\tend\n\t\tif player2.life_points > 0\n\t\t\tputs \"1 - José a #{player2.life_points} points de vie\"\n\t\tend\n\t\tif player3.life_points > 0\n\t\t\tputs \"2 - José a #{player3.life_points} points de vie\"\n\t\tend\n\t\tif player4.life_points > 0\n\t\t\tputs \"3 - José a #{player4.life_points} points de vie\"\n\t\tend\n\tend", "def menu _command\n send_cmd(\"menu #{_command}\")\n end" ]
[ "0.7902932", "0.78420234", "0.76964", "0.76650155", "0.7606996", "0.7556225", "0.7528223", "0.7430219", "0.7378243", "0.7367225", "0.73633116", "0.7339624", "0.7335255", "0.7326372", "0.7320413", "0.7289805", "0.7270864", "0.7270673", "0.72700286", "0.72683805", "0.7258747", "0.7206157", "0.7200894", "0.72007775", "0.71969444", "0.7183897", "0.71659946", "0.7159652", "0.7153688", "0.7143277", "0.7141579", "0.7135928", "0.712579", "0.71230894", "0.71229357", "0.7114817", "0.7107425", "0.7096297", "0.7093976", "0.7091231", "0.70894706", "0.70817703", "0.70694196", "0.706152", "0.7054979", "0.70534754", "0.7037574", "0.7036454", "0.7035815", "0.70322764", "0.7024836", "0.7020139", "0.7016622", "0.70156485", "0.69990396", "0.6995595", "0.69897497", "0.69551426", "0.6954606", "0.6941213", "0.694108", "0.6937335", "0.69354343", "0.6929816", "0.6918254", "0.6917048", "0.69116426", "0.68930197", "0.6878409", "0.68717617", "0.68600583", "0.6855636", "0.685549", "0.6854705", "0.68526614", "0.6845314", "0.6841475", "0.6839911", "0.68396914", "0.68331295", "0.6830002", "0.68207246", "0.68207246", "0.6814863", "0.68132335", "0.68114364", "0.68111986", "0.6792952", "0.6784702", "0.67845845", "0.677744", "0.6771154", "0.67708415", "0.67656124", "0.6764642", "0.67631984", "0.6750526", "0.6748553", "0.6745455", "0.67435014" ]
0.69467837
59
This function writes out a hash or an array (list) to a file.
def write_data(filename, data) file = File.open(filename, "w") file.puts(data) file.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_out_list list, list_path\n output = File.new list_path, \"w\"\n if list.class == Array\n list.each do\n |app|\n output.puts \"#{app[0]} #{app[1]}\"\n end\n elsif list.class == Hash\n list.each do\n |app,count|\n output.puts \"#{app} #{count}\"\n end\n end\n output.flush\n output.close\nend", "def write_list_to_file(filename, data)\n file = File.open(filename, \"w\")\n data.each do |d|\n file.write(d.to_s + \"\\n\")\n end\n file.close unless file.nil?\nend", "def write_content(file_out)\n file_out.puts(@array)\n end", "def _write filename, array\n File.open(filename, \"w\") do |file| \n array.each { |row| file.puts row }\n end\n end", "def write_array_to_file\n lines = File.new('aperm.txt', 'w+')\n\n @@book_class.each_with_index do | book |\n lines.puts \"#{book.id}/#{book.title}/#{book.author}/#{book.due_date}\"end\n lines.close\n end", "def write_acct_file (acct_numbers_array, number_acct_fields)\r\n file_name = \"data/accounts\"\r\n output_file = File.open(file_name,\"w\")\r\n \r\n acct_numbers_array.each {|a| output_file.puts a}\r\n output_file.close\r\nend", "def write_array_to_file\n lines = File.new('members.txt', 'w')\n\n @@member_array.each_with_index do | member |\n lines.puts \"#{member.member_id}/#{member.member_name}/#{member.book_id_1}/#{member.book_id_2}/#{member.book_id_3}\"\n end\n lines.close\n end", "def write data, path\n\t\t\tcontent = \"\"\n\t\t\tfile_type = data.class.to_s\n\n\t\t\tif file_type == 'Array'\n\t\t\t\tdata.each do | line |\n\t\t\t\t\tline.each do | key, val |\n\t\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\tcontent << \"\\n\"\n\t\t\t\tend\n\n\t\t\telsif file_type == 'Hash'\n\t\t\t\tdata.each do | key, val |\n\t\t\t\t\tcontent << \"#{key.to_s}=#{val}\\n\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tpath = File.expand_path path\n\t\t\tFile.open(path, 'w+') do |f|\n\t\t\t\tf.write content\n\t\t\tend\n\t\tend", "def write_file(file_name_out, content_array)\n\n\toutput = File.new(file_name_out, 'w')\n\tcontent_array.each { |line| output.write line }\n\toutput.close\nend", "def write_hash_to_file(hash, file_path)\n File.open(file_path, 'w') do |f|\n f.puts hash.to_json\n end\nend", "def writeFile( arr, filename )\n f = File.new( filename, 'w' )\n f.binmode\n arr = words2bytes( arr )\n arr.each { |byte|\n f.write( byte.chr )\n }\n f.close \nend", "def writeOutput(outputFile,array)\n Write to file\n File.open(outputFile, 'w') { |file|\n file.write(array.join(\"\"))\n }\n end", "def write_counts(output)\n File.open(output, 'w') do |output_file|\n @count_array.each do |pair|\n key, value = pair\n output_file << \"#{key}\\t#{value}\\n\"\n end\n end\n end", "def save_file(filename, array)\n file = File.new(filename, \"w\")\n file.write(JSON.generate(array))\n file.close\nend", "def __write_array(ary, io)\n ary.each_with_index do |el, i|\n io.puts \"result__[#{i}] = #{el.subs(@dict)};\"\n end \n end", "def write_file(file_name, content_array)\n\n\toutput = File.new(file_name, 'w')\n\tcontent_array.each { |line| output.write line }\n\toutput.close\nend", "def write_to_file\n file = File.open(@filename_erl,\"a\")\n file.puts @head, @erl, @sig_sub\n file.puts @sub if @@sub_struct_flag\n (file.puts @un_arr.uni_def, @un_arr.uni_func, @un_arr.uni_func_2) if @@union_flag\n (file.puts @un_arr.arr_def, @un_arr.arr_func) if @@dyn_array_flag\n file.close\n File.open(@filename_hrl, \"a\") {|f| f.puts @const, @enum, @hrl}\n end", "def write_hash(hash)\n\t\twrite_byte(3)\n\t\thash.each do |key, value|\n\t\t\twrite_utf(key.to_s)\n\t\t\twrite(value)\n\t\tend\n\n\t\t# write the end object flag 0x00, 0x00, 0x09\n\t\twrite_int16_network(0)\n\t\twrite_byte(9)\n\tend", "def writeArray(a,s)\n\tcontents=''\n\tfor i in 0...a.length\t\n\tcontents+=a[i]+\"\\n\"\n\tend\n\tFile.write(s,contents)\n\tend", "def printDups(dupsHashArray)\n puts \"Writing duplicates to: /tmp/duplicates.txt\"\n File.open(\"/tmp/duplicates.txt\",\"w\") do |f|\n dupsHashArray.each { |element| f.puts(element[:filePath] + \" : \" + element[:duplicatePath]) }\n end \n end", "def write_filelist(out_file_list)\n result_list.each{|f| log f}\n File.open(out_file_list, \"w\") do |file|\n result_list.each do |item| \n file << item\n file << \"\\n\"\n end\n log \"File list created #{out_file_list}\"\n end \n end", "def write_filelist(out_file_list)\n result_list.each{|f| log f}\n File.open(out_file_list, \"w\") do |file|\n result_list.each do |item| \n file << item\n file << \"\\n\"\n end\n log \"File list created #{out_file_list}\"\n end \n end", "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def write_tag_file(tag_array)\n ::File.open(@tag_file, 'w') { |file| file.write(JSON.pretty_generate(tag_array)) }\n end", "def dump_data(array_of_hashes)\n raise NotImplementedError\n end", "def export(hash, file)\n File.open(file, 'wb:utf-8') { |f| f.write dump(hash) }\n end", "def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end", "def flush_to_file(hit_list)\n File.open($config[:output], 'a') do |file|\n file.puts(hit_list)\n end\nrescue => e\n puts \"Error writing to output file #{$config[:output]}\"\n raise e\nend", "def writeToFile(aCollection, aFilename)\n\trows = aCollection.collect { | sighting |\n\t\tsighting.to_ebird_record_format()\n\t}\n\n\tFile.open(aFilename, 'w') { |file|\n\t\trows.each do | row |\n\t\t\tfile.write(\"%s\\n\" % row.join(','))\n\t\tend\t\n\t}\t\n\n\tputs \"wrote %d sightings to %s\" % [aCollection.count(), aFilename]\nend", "def to_file( f )\n size = 0\n @indexes.each { size += Index::FORMAT_SIZE }\n @idata.each do |i| \n size += IntData::FORMAT_SIZE\n size += i.data_size\n end\n\n buf = [@source, @name, @sym, @indexes.length(), @idata.length(), \n size].pack(PFORMAT)\n f.write(buf)\n @indexes.each { |i| i.to_file(f) }\n @idata.each { |i| i.to_file(f) }\n end", "def saveListToFile()\n\t\t# f is going to equal data.txt with the 'write' capability:\n\t\tf = File.new('data.txt', 'w')\n\n\t\t# write searchSuggestionList to data.txt:\n\t\tf.write(\"#{@searchSuggestionList}\")\n\n\t\t# close data.txt/ end writing:\n\t\tf.close\n\tend", "def write(io)\n @values.each {|el|\n el.write io\n }\n end", "def write(file)\n value.each do |item|\n # always write int4 in network order (as per GDSII spec)\n file.write [item].pack('N')\n end\n end", "def write(arr, file)\n File.open(file, 'w') do |f|\n (0..8).each do |row|\n f.puts arr[row * 9, 9].join \"\\t\"\n end\n end\n end", "def write_array(array)\n\t\twrite_byte(10)\n\t\twrite_word32_network(array.length)\n\t\tarray.each do |el| \n\t\t\twrite(el)\n\t\tend\n\tend", "def write_to_file(filename = \"listsave\")\n\t\tIO.write(filename, @tasks.map(&:to_s).join(\"\\n\"))\n\t\tputs \"List has been successfully saved to #{filename}...\"\n\tend", "def writeHashToJSON(hash, filename)\n File.open(\"./\" + filename,\"w\") do |f|\n f.write(JSON.pretty_generate(hash))\n end\nend", "def create_output_file(rentals_prices_array)\n\t\tbegin\n\t\t\trentals_prices_hash = Hash.new\n\t\t\trentals_prices_hash[\"rentals\"] = rentals_prices_array\n\t\t\tFile.open(\"output1.json\",\"w\") do |f|\n\t\t\t\tf.write(JSON.pretty_generate(rentals_prices_hash))\n\t\t\tend\n\t\trescue Exception => e \n\t\t\tputs \"Error trying to create the output file.\"\n\t\t\tputs e.message\n\t\tend\n\tend", "def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n f.write(buf)\n end", "def write_file(out_file, output)\n File.open(out_file, 'w') { |f| output.each { |l| f.write(\"#{l}\\n\") } }\n end", "def write(filename, hash)\n File.open(filename, \"w\") { |f| f.write(hash.to_yaml) }\nend", "def write(file)\n padded_str = self.pad\n if padded_str.length != 1\n raise RuntimeError, \"expect 'self' to be an array of one element\"\n end\n # The following line was modified to use the [0]. Before, no\n # index was used and the call to file.write() coerced the array\n # to a string. Under Ruby 1.8 this produced a string like:\n # \"aString\"\n # under 1.9 we go a string like:\n # \"[\\\\\"aString\\\\\"]\"\n\t\t# This, among other things, produced invalid library names.\n file.write padded_str[0]\n end", "def write(*data); end", "def save_hashes_for_write\n \n end", "def create_file(arr, filename)\n\tfile = File.open(filename, \"w\")\n\tfor number in arr\n\t\tfile.puts(number)\n\tend\nend", "def list_2_file (list,file)\n\t\tputs \"Save list #{list} to plain file #{file}\" if @verbose\n\t\tbegin\n\t\t\tf = File.open(file, \"w\")\n\t\t\tlist.map do |ent|\n\t\t\t\t#ent.strip!\n\t\t\t\t# Append the unix line break\n\t\t\t\tf.write(\"#{ent}\\n\")\n\t\t\tend\n\t\t\tf.close\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{file}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def output_to_file filename, output\n result_file = File.open(filename, \"w+\")\n if output.is_a?(Hash)\n output.each_pair do |k,v|\n if v.is_a?(Array)\n unless v.empty?\n result_file.write(\"#{k}:\\n\")\n v.each do |x| \n unless x.match('parameter is not found in data model')\n result_file.write(\"#{x}\\n\")\n else\n result_file.write(\":: #{x}\\n\")\n end\n end\n end\n else\n unless v.match('parameter is not found in data model')\n result_file.write(\"#{k} = #{v}\\n\")\n else\n result_file.write(\"#{k} :: #{v}\\n\")\n end\n end\n end\n elsif output.is_a?(Array)\n output.each do |v| \n unless v.match('parameter is not found in data model')\n result_file.write(\"#{v}\\n\")\n else\n result_file.write(\":: #{v}\\n\")\n end\n end\n else\n result_file.write(output)\n end\nend", "def save_as_JSON(array)\n final_array = array\n File.open(\"emails.json\", \"w\") do |town|\n town.write(final_array.to_json)\n end\n end", "def save_to_file()\n File.open(@filename,\"w\") do |f|\n movies_hash = []\n @items.each do |movie|\n movies_hash.push(movie.to_hash)\n end\n f.write(JSON.pretty_generate(movies_hash))\n end\n end", "def >>(a)\n f = File.open(a,'w')\n f << @a.to_json\n f.close\n end", "def write(file)\n self.files.each { |l| file.puts l }\n end", "def save_workouts(workoutlist, file) \n File.open(file, 'w') { |file| \n for workout in workoutlist do\n file.write(\"Start Time: #{workout.start_time}\\n\")\n for exercise in workout.exercises do\n file.write(\" #{exercise.to_string()}\\n\")\n for set in exercise.sets do\n file.write(\" #{set.to_string()}\\n\")\n end\n end\n \n file.write(\"\\n\")\n end\n }\n end", "def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search_id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end", "def write(filename, hash)\n File.open(filename, \"a\") do |f|\n f.write(yaml(hash))\n end\nend", "def to_file(filename, hits, qvalues=[])\n File.open(filename,'w') do |out|\n out.puts HEADER.join(FILE_DELIMITER)\n hits.zip(qvalues) do |hit, qvalue|\n out.puts [hit.search.id, hit.id, hit.aaseq, hit.charge, qvalue || hit.qvalue].join(FILE_DELIMITER)\n end\n end\n filename\n end", "def save_hash(hash)\n\t\tsavefile = File.open(@fname, \"w\")\n\t\t\n\t\t# write each matrix from the hash into the save file\n\t\thash.each { |identifier, matrix|\n\t\t # only save user matrices, not cached identities and zeroes\n\t\t\tif not @parser.reserved_identifier? identifier\n\t\t\t\t# get matrix dimensions\n\t\t\t\tm = matrix.length\n\t\t\t\tn = matrix.first.length\n\t\t\t\t\n\t\t\t\t# print identifier\n\t\t\t\tsavefile.puts identifier\n\t\t\t\t\n\t\t\t\t# print matrix in a readable format into the file\n\t\t\t\tfor row in 0...m\n\t\t\t\t\tsavefile.write '| '\n\t\t\t\t\tfor col in 0...n\n\t\t\t\t\t\tsavefile.write matrix[row][col].to_s + ' '\n\t\t\t\t\tend\n\t\t\t\t\tsavefile.write '|'\n\t\t\t\t\tsavefile.puts\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# print a blank line after the end of a matrix\n\t\t\t\tsavefile.puts\n\t\t\tend\n\t\t}\n\t\tsavefile.close\n\tend", "def write_to_json\n p_hash = pretty_hash()\n File.open(\"map_data2.json\",\"w\") do |f|\n my_json = JSON.pretty_generate(p_hash)\n f.write(my_json)\n end\n end", "def exportfile arr\n begin\n file = File.open(\"result.txt\", \"w\")\n text = showResulf arr\n file.puts text\n file.close\n binding.pry\n rescue IOError => e\n puts \"Can not write file. Please try again after there.\"\n ensure\n file.close unless file.nil?\n end\nend", "def write2(file = 'default', data, mode, size)\n dump_object(file)\n dump_object(data)\n dump_object(mode)\n dump_object(size)\n puts \"===========================\"\nend", "def save_collection_to_file(filename, collection)\n\tcollection_str = JSON.pretty_generate(collection)\n\toutfile = File.new(filename, \"w\");\n\toutfile.write(collection_str)\n\toutfile.close;\nend", "def save_output_json(data)\n File.open(\"output.json\", \"wb\") {|f| f.write(JSON.pretty_generate(data))}\nend", "def save_list(file_path)\n jsonArray = @array.map { |property| \n {\n \"property_id\": property.property_id,\n \"type\": property.type,\n \"address\": {\n \"street_number\": property.address[:street_number],\n \"street_name\": property.address[:street_name],\n \"suburb\": property.address[:suburb]\n },\n \"weekly_rent\": property.rent,\n \"status\": property.status,\n \"landlord\": {\n \"first_name\": property.landlord.first_name,\n \"last_name\": property.landlord.last_name\n },\n \"tenant\": {\n \"first_name\": property.tenant.first_name,\n \"last_name\": property.tenant.last_name\n }\n }\n }\n \n File.write(file_path, JSON.pretty_generate(jsonArray))\n end", "def write_json(user_hash)\n File.exist?('public/user.json') ? json = JSON.parse(File.read('public/user.json')) : json = []\n File.open(\"public/user.json\",\"w\") { |f| f.puts JSON.pretty_generate(json << user_hash) }\nend", "def to_file( f )\n buf = [ MAGIC, VERSION, @timestamp.to_i, @analyses.length() \n ].pack(PFORMAT)\n f.write(buf)\n\n @analyses.each do |a|\n a.to_file(f)\n end\n end", "def to_file(filename)\n\tdata2write\t= JSON.pretty_generate(@json_data);\n\tFile.open(filename, 'w+'){|f| f.write(data2write)}\nend", "def write; end", "def write; end", "def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end", "def write_fund_hash(fund_hash)\n File.write(\"save.json\", JSON.generate(fund_hash))\n end", "def writeJSONToFile(b)\n count = 0\n File.open('data/all.json', 'w') do |json| \n json.puts b.getJSON(\"\\t\").chomp(\",\\n\")\n end\n end", "def write(data)\n end", "def save_array\n raise \"Cannot save array! Please use load_array to load\" if $valid_array == false\n\n File.open(@app_file_path, \"w\") do |file| \n #@data.each { |row| file.puts \"#{row[0]}\\t#{row[1]}\" }\n @data.each { |row| file.puts row.join(@app_delim) }\n end\n end", "def save_array\n raise \"Cannot save array! Please use load_array to load\" if $valid_array == false\n\n File.open(@app_file_path, \"w\") do |file| \n # FIXME: use join with @app_delim\n @data.each { |row| file.puts \"#{row[0]}\\t#{row[1]}\" }\n end\n end", "def write(output_to); end", "def write path\n File.open(path, 'w') do |io|\n io.print serialize\n end\n end", "def write(x)\n File.open(\"/tmp/mount/x\", \"w\") { |xf| xf.puts x.map(&:to_s).join(\"\\n\") }\nend", "def write_output \n output = {\n users: input[\"users\"],\n playlists: output_playlists,\n songs: input[\"songs\"]\n }\n File.new(ARGV[2], \"w\").write(output.to_json)\nend", "def write(data, *args, **kwd); end", "def toFile(filename)\t\n file = File.open(filename, 'w')\n db.each_key do |name|\n s = \"\"\n if (db[name].class == BasicFood)\n \ts+= name + \",b,\" + db[name].calories.to_s\n end\n if (db[name].class == Recipe)\n \ts = name + \",r\"\n\tdb[name].foods.each do |food|\n\t s += \",\" + food.name\n\tend\n end\n s += \"\\n\"\n file.write(s)\n end\n end", "def to_file( f )\n buf = [@name, @sym, @value].pack(PFORMAT)\n f.write(buf)\n end", "def file_output output_lines, friend\n # using 'write_to' method with given parameters\n write_to \"#{friend}.txt\" do |file|\n file.write output_lines[0]\n file.write output_lines[1]\n end\nend", "def save(link_hash)\n setup_file\n \n link_database = File.open('link_db.txt').read\n existing_links = JSON.parse(link_database)\n # link_database.close\n \n existing_links << link_hash\n link_json = JSON.generate(existing_links)\n \n\n\n File.open('link_db.txt', 'w+') do |link_database|\n link_database.write(link_json)\n end\nend", "def write_multi(pairs)\n pairs.each do |name,value|\n write(name, value)\n end\n end", "def write_multi_entries(hash, **options)\n hash.each do |key, entry|\n write_entry key, entry, **options\n end\n end", "def writeFile\n File.open(ARGV[1], \"w+\") do |f|\n $results.each{\n |result|\n f.puts(result)\n }\n end\nend", "def save_to_file(emails)\n # Open the file with writing permission\n File.open(\"email_sent_list.txt\",\"w\") do |file|\n # Iterate the array\n emails.each do |email|\n # Write in the file to save output\n file.write(\"Email successfully sent to #{email}\\n\")\n end\n end \nend", "def dump_data(to)\n data.keys.each do |key|\n FileUtils.mkdir_p(to + File.dirname(key))\n File.open(to + key, \"wb\") do |out|\n case data[key]\n when StringIO\n out.write data[key].read # .mbackup file data\n when Hash\n out.write Plist::Emit.dump(data[key]) # Info.plist, etc.\n else\n puts \"couldn't write out #{key}, don't know how to handle a #{data[key].class}\"\n end\n end\n end\n end", "def write_compact_json(filename, obj)\n begin\n Dir.mkdir File.dirname(filename)\n rescue\n end\n open(filename+\".tmp\", \"w:UTF-8\") do |out| \n if obj.kind_of?(Array)\n out.puts '['\n obj.each_with_index do |e, i|\n out.write JSON.generate(e)\n out.write (i < obj.size - 1) ? \",\\n\" : \"\\n\"\n end\n out.puts ']'\n else\n out.puts JSON.generate(obj)\n end\n File.rename filename+\".tmp\", filename\n end\n STDERR.puts \"Wrote #{obj.size} records to #{filename}\"\nend", "def write_to_file(path)\n File.open(path, \"w\") do |f|\n f.print serialize\n end\n end", "def graph_hash_to_file(file_path, graph_hash)\n file = File.new(\"#{file_path}.txt\", \"w\")\n graph_hash.keys.each do |edge|\n weight = graph_hash[edge]\n u = edge[0]\n v = edge[1]\n file.puts \"#{u},#{v}=#{weight}\"\n end\n end", "def write options={}, &block\n return unless output\n data = []\n block.call(data) if block_given?\n text = {\n :data => data.map do |measurement|\n key, value = measurement\n { :key => key, :value => value }\n end\n }.merge(options).to_json\n\n begin\n output.puts(text)\n rescue Errno::ENXIO\n # FIFO's reader isn't alive...\n end\n end", "def write_file\n match_file = File.new(\"matches.txt\", \"w\")\n no_of_match = @matchesarr.length\n match_file.puts(no_of_match.to_s)\n for i in 0..no_of_match - 1\n match_file.puts(@matchesarr[i])\n end\n match_file.close\n end", "def serialize\n File.open( FILENAME, 'wb' ){ |f| f << Marshal.dump( @all_answers ) }\n end", "def writeData(filename = \"out.csv\")\n\t\tfile = File.new(filename, \"w\")\n\t\t\n\t\t@dataArray.each do |singleEntry|\n\t\t\tfile.puts \"#{singleEntry[0]},#{singleEntry[1]},#{singleEntry[2]}\"\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend", "def output_vs_post_list(post_list,output_file)\n file=File.open(output_file, 'a')\n post_list.each do |line|\n output=line+\"\\n\"\n file.write(output)\n end\n file.close\n return\nend" ]
[ "0.7586484", "0.70758814", "0.6679203", "0.66621524", "0.66294396", "0.657567", "0.652697", "0.65226865", "0.6500102", "0.64164585", "0.6384565", "0.63591415", "0.62808913", "0.6209778", "0.61841905", "0.6154234", "0.61539054", "0.61402965", "0.61230516", "0.6095582", "0.6058683", "0.6058683", "0.60303116", "0.60303116", "0.60303116", "0.60303116", "0.6029339", "0.60114104", "0.60088944", "0.6004733", "0.5995787", "0.59924984", "0.59921235", "0.59885514", "0.5979962", "0.59554106", "0.59538764", "0.59358126", "0.5915428", "0.5913067", "0.5912977", "0.5912619", "0.5910151", "0.59003145", "0.5897039", "0.58862764", "0.5868113", "0.5846122", "0.58359456", "0.5821945", "0.5820804", "0.5794838", "0.579023", "0.578517", "0.5782111", "0.5779561", "0.5779333", "0.5751791", "0.5740333", "0.5736254", "0.57360476", "0.57335424", "0.57278615", "0.5714045", "0.5708826", "0.5701957", "0.56985426", "0.5689891", "0.5678999", "0.5678999", "0.5663478", "0.56550497", "0.5654714", "0.56523967", "0.56467235", "0.56293654", "0.56203663", "0.56184894", "0.5618086", "0.5617436", "0.56168646", "0.561595", "0.5612295", "0.5609446", "0.560232", "0.560003", "0.5590014", "0.5587926", "0.557563", "0.5573256", "0.5570488", "0.5563768", "0.5559531", "0.555802", "0.55574095", "0.55470055", "0.55454135", "0.5532754" ]
0.56971234
69
function that takes the name of a file and loads in the stop words from the file. You could return a list from this function, but a hash might be easier and more efficient. (Why? Hint: think about how you'll use the stop words.)
def load_stopwords_file(file) stop_words = {} # Looping through the file and adding each word to a hash table after chomping them File.open(file, "r").each_line do |line| stop_words[line.chomp] = 1 end return stop_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stopwords_file(file)\n f = File.open(file, \"r\")\n stopwordH = {}\n f.each_line do |stopword|\n stopwordH[stopword] = 0\n end\n return stopwordH\nend", "def get_stopword_list\n list = []\n \n begin\n File.open(\"stopwords.txt\", \"r\") do |file|\n file.each_line { |line| list.push( line.chomp ) }\n end\n rescue\n puts \"The file 'stopwords.txt' was not found.\"\n exit\n end\n\n return list\nend", "def read_stopwords_file(filename)\n stopwords = []\n CSV.foreach(filename) do |row|\n stopwords << row[0]\n end\n stopwords\n # puts \"loaded \" + stopwords.length.to_s + \" stopwords.\"\n end", "def getStopWordsSet(path)\n unless caller[0].include? \"frequencies\"\n return\n end\n Set.new(open(path){|f| f.read}.split(\",\")).merge( Set.new( ('a' .. 'z').to_a ))\nend", "def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end", "def read_stop_words\n # Meta-level: caller & caller_locations (inspect.stack in python)\n # p caller\n # p caller_locations.last(5).inspect\n if caller_locations[-3].label != 'extract_words'\n p caller_locations.last(5).inspect # just for debug\n return nil\n end\n stop_words = File.open('/Users/ravil/experimental/exips/stop_words.txt').read.split(',')\n stop_words += 'abcdefghijklmnopqrstuvwxyz'.chars\n stop_words\nend", "def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end", "def stopwords\n @stopwords ||= IO.readlines(@stopwords_file).map { |l| l.strip }\n end", "def custom_stopwords(stopwords)\n unless stopwords.is_a?(Enumerable)\n if stopwords.strip.empty?\n stopwords = []\n elsif File.exist?(stopwords)\n stopwords = File.read(stopwords).force_encoding(\"utf-8\").split\n else\n return # Do not overwrite the default\n end\n end\n Hasher::STOPWORDS[@language] = Set.new stopwords\n end", "def load_words(file_name)\n words_loaded = []\n File.open(file_name).readlines.each do |line|\n words_loaded << line if line.length.between?(5, 12)\n end\n words_loaded\n end", "def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end", "def word_list\n @word_list ||= Set.new File.read(\"dictionary.txt\").split(\"\\n\").map(&:downcase)\n end", "def prepare_words(filename)\n @words = []\n File.readlines(filename).each do |line|\n line.split.each {|word| @words << word}\n end\n end", "def load_dict\n words = []\n File.open(\"dict.txt\").each do |line| # Hard code for now\n if line.length.between?(5, 12)\n words << line.rstrip.downcase\n end\n end\n words\n end", "def create_dict(file)\n # Since wordlist is constant\n if File.file?(file)\n IO.readlines(file, chomp: true)\n else\n puts 'File not found!'\n end\n end", "def ReadFromFile()\n wordArray = Array.new\n File.open(\"mastermindWordList.txt\", \"r\") do |file| # Uncomment this to have a larger list (466000+ words)\n # Note: Only use if in original repository that contains words.txt\n # File.open(\"mastermindWordList.txt\", \"r\") do |file| # Comment this if previous line is uncommented\n file.each_line do |word|\n if CheckValidWord(word) == true\n wordArray.push(word.chomp.downcase)\n end\n end\n end\n return wordArray\nend", "def load_words\n File.read(\"../scrabble word cheat/words.txt\").split(\"\\n\")\nend", "def read_word_file(file)\n\t\tFile.foreach(file) do |line|\n\t\t\tif(@@word.legal?(line.chomp)) # Check if current line/word is legal\n\t\t\t\tLEGAL_WORDS << line.chomp # Add line/word to array of legal words\n\t\t\tend\n end\n LEGAL_WORDS.freeze # Freeze LEGAL_WORDS to make it immutable\n\tend", "def initialize(word_list_file_path)\n word_list = ::File.readlines(word_list_file_path).map(&:chomp)\n @words = word_list.map(&:downcase)\n end", "def get_spelling_words(file)\n lines = IO.readlines(file).map(&:chomp)\n review_word = false\n challenge_word = false\n words = []\n lines.each do |line|\n if md=line.match(/\\A(\\d+)\\.\\s+(\\w+)\\Z/)\n (num, word) = md.captures\n words << SpellingWord.new(num, word, review_word, challenge_word)\n elsif line.match(/\\AReview Words/)\n review_word = true\n challenge_word = false\n elsif line.match(/\\AChallenge Words/)\n challenge_word = true\n review_word = false\n end\n end\n words\nend", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Please provide the following file: #{text_file}\"\n exit\nend", "def load_word_list\n @word_list = []\n puts \"Loading word list...\"\n File.readlines(WORDLIST_FILE).each{|word|\n word.gsub!(/[\\r\\n]+/,\"\")\n if valid_word?(word, @inner_letter, @outer_letters)\n @word_list << word\n end\n }\n @word_list.sort!\n puts \"Word list loaded.\"\n end", "def readwordfile name\r\n\t\t \tl_num=0\r\n\t\t File.open(name).each do |l|\r\n\t\t \t@wordtable[l_num] = l.gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\r\n\t\t l_num +=1\r\n\t\t end\r\n\t\t return l_num\r\n\t\t end", "def wordlist(filename)\n wordlist = []\n File.foreach(filename) { |x| wordlist << x.delete!(\"\\r\\n\") }\n wordlist\nend", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/,\" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started\"\n exit\nend", "def words_from_file(text_file)\n File.read(text_file).downcase.gsub(/[^a-z]/, \" \").split\nrescue\n puts \"Give me #{text_file} and let's get the party started!\"\n exit\nend", "def blacklist\n @blacklist ||= YAML.load_file(blacklist_file).map { |word| /(#{word})+/i }\n end", "def make_list\n file = File.new(\"dictionary.txt\")\n dict_list = Array.new\n # add all the words that are the same length as the user's word to an array\n while (line = file.gets)\n if (line.length - 1 == @word1.length)\n dict_list.push line.chomp\n end\n end\n dict_list\n end", "def words_from_file( f )\n result = Array.new\n File.foreach( f ) do | line |\n result << self.words_from_string( line )\n end\n result.flatten\n end", "def LoadFile ()\n\t\n\tinput = \"\"\n\tFile.foreach(\"../Data Files/042-Words.txt\") {|x| input = x }\n\tnames = input.split(\",\")\n\t\n\treturn names;\nend", "def load(file)\n words = File.readlines(file)\n words = words.collect {|word| Word.new(word.chomp.downcase) }\n change_wordlist(words.select {|word| word.word.length >= 5 && word.word =~ /^([a-z])+$/ })\n self\n end", "def to_check file_to_check\n #Opens the file to check\n file = File.open(file_to_check, 'r')\n #Reads until the end of the file\n until file.eof?\n #For each line check the spelling of each word\n file.each_line do |line|\n line.chomp!.downcase!\n #cleans punctuation\n line.gsub!($remove_punctuation, \"\")\n #Removes numbers since they can't be spelled wrong\n line.gsub!(/\\d/, \"\")\n line.split.each do |word|\n $words[word] = false\n end\n end\n end\nend", "def remove_stop_words\n f = File.open('/Users/ravil/experimental/exips/stop_words.txt')\n $stack.push(f.read.split(','))\n f.close\n # add single letter words\n $stack[-1] += 'abcdefghijklmnopqrstuvwxyz'.chars # Python's list(string.ascii_lowercase)\n $heap[:stop_words] = $stack.pop\n $heap[:words] = []\n while $stack.length > 0\n if $heap[:stop_words].include? $stack.last\n $stack.pop\n else\n $heap[:words].append $stack.pop # pop it, store it\n end\n end\n $stack += $heap[:words] # Load the words onto the stack\n $heap[:stop_words] = nil; $heap[:words] = nil # Not needed\nend", "def words_file(words)\n File.read(words).lines.select do |l|\n (3..9).cover?(l.strip.size)\n end\n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def initialize(dictionary_file_name)\n @dictionary = Set.new(File.open(dictionary_file_name).readlines.map(&:chomp))\n @current_words = []\n @all_seen_words = {}\n end", "def bannedWords(inputFile)\n\t\ttext = File.open(inputFile).read\n\t\twords = []\n\t\ttext.each_line do |line|\n\t\t\twords.push(line.gsub(\"\\r\\n\",\"\"))\n\t\tend\n\t\treturn words\n\tend", "def initialize file\n word_set = Set.new\n\n File.open(file, \"r\") do |f|\n f.each_line do |raw_line|\n line = raw_line.strip.upcase\n\n if HangmanGame.acceptable_word? line\n word_set.add line\n end\n end\n end\n\n @words = word_set.to_a.freeze\n\n Random.srand\n end", "def load_used_phrases\n\t@used_phrases = load_collection_from_file(@phrase_file_name, {});\nend", "def generate_words\r\n words = Hash.new\r\n\r\n # TODO - add error handling\r\n dictionary = \"bigdict.txt\"\r\n dictionary = \"test.txt\" if DEBUG\r\n \r\n # for benchmarking purposes, we search 80k records in about 1 second. mindblowing increase in computing power since 1980!\r\n time = Time.new\r\n\r\n File.foreach dictionary do |word|\r\n word.chomp!\r\n words[word] = score_word(word) if valid_word?(word)\r\n end #end file.each\r\n\r\n time = Time.new - time\r\n\r\n # output all words in descending score value\r\n words.sort_by { |word, score| score }.reverse.each do |result|\r\n puts \"#{result[0]} - #{result[1]}\"\r\n end\r\n\r\n puts \"Found #{words.length} words in #{time} seconds\"\r\nend", "def initialize\n self.word_list = []\n WORD_FILES.each do |word_file|\n contents = File.read(File.dirname(__FILE__)+word_file)\n self.word_list = word_list + contents.split(/\\n/)\n end\n end", "def read_words(dictionary)\n unless FileTest.file?(dictionary)\n p \"Provided #{dictionary} is not a filepath or such file doesn't exist.\"\n return []\n end\n\n words = []\n IO.foreach(dictionary) { |line| words << line.strip }\n words\n end", "def load_dictionary(filename)\n File.open(filename, \"r\").each_line do |line|\n bloom_filter(line.strip).each do |i|\n @bitmap[i] = true\n end\n end\n end", "def load_tag_from_file (file, lc=false)\n puts \"Loading tag data file: #{file}\"\tif @verbose\n\t\t\t@tag_store=Hash.new\n\t\t\tf = File.open(file, 'r')\n\t\t\tf.each_line do |line|\n\t\t\t\tputs \"Processing line: #{line}\" if @verbose\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tentry=line.split(',')\n\t\t\t\tif @tag_store.key?(entry[0])\n\t\t\t\t\tnext\n\t\t\t\telse\n\t\t\t\t\t@tag_store[entry[0]]=[entry[1].strip, entry[2].strip, entry[3], entry[4]]\n\t\t\t\tend\n\t\t\tend\n\t\t\tf.close\n\t\t\treturn @tag_store\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n \tend", "def initialize\n @words_set = Set.new\n words_file = File.expand_path(File.dirname(__FILE__) + '/words.txt')\n File.readlines(words_file).each do |line|\n @words_set.add(line.to_s.strip)\n end\n end", "def add_words_from_text_file(file_path)\n words = []\n\n File.open(file_path, 'r') do |file|\n file.each do |line|\n words.push(line.chomp)\n end\n end\n\n add_words(words)\n end", "def get_words(filename)\n graph = Graph.new\n graph = read_file(filename, graph)\n paths = graph.paths\n permutations = permutations(paths)\n wordlist = wordlist('wordlist.txt')\n validwords = real_words(permutations, wordlist)\n puts \"\\nLongest valid word(s): from dictionary\"\n longest_words(validwords, longest_length(validwords))\nend", "def scan\n $stderr.print \"[words] \"\n\n files.each do |file|\n if $DEBUG\n $stderr.print \"\\n[scan] #{file}\"\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n if valid_word?(word)\n\t\t self[word] ||= Word.new(word)\n\t\t self[word].file!(file)\n end\n end\n end\n end\n\n $stderr.puts\n end", "def set_word_list\n word_list = []\n min_length = 5\n max_length = 12\n # Fixed external word_list file has only one word per line\n if File.exist? \"../word_list.txt\"\n File.open(\"../word_list.txt\").each do |line|\n line_clean = line.chomp\n if (line_clean.length >= min_length && line_clean.length <= max_length)\n word_list.push(line_clean)\n end\n end\n else\n word_list.push(\"FileWordListTextDoesNotExist\")\n end\n return word_list\n end", "def initialize(stop_word_file = 'project1/src/resources/stop_words.yml')\n # load stop words\n # CLASS VARIABLE \n @@stopWords = YAML::load_file(stop_word_file)\n puts \"#{@@stopWords.length} stop words loaded...\" \n end", "def file_2_list(f,lc=true)\n puts \"Loading records from file: #{f}\" if @verbose\n begin\n list=Array.new\n file = File.open(f, \"r\")\n file.each_line do |line|\n line=line.chomp.strip\n next if line.nil?\n next if line.empty?\n next if line =~ /^\\s*#/\n line=line.downcase if lc==true\n list.push(line.chomp.strip)\n end\n file.close\n return list\n rescue => ee\n puts \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n return nil\n end\n end", "def get_random_word(filename)\n dictFile = File.open filename\n words = dictFile.readlines.reduce([]) do |words, word|\n if word.strip!.length >= 8\n words << word\n end\n words\n end\n words[(rand words.length)]\nend", "def init_word_array(plaintext_file)\n ary = File.read(plaintext_file).split(\" \").map do |word|\n word.downcase.gsub(/[^a-z]/, '')\n end\n return ary\n end", "def initialize(text_file_name)\n @dictionary = Hash.new(0)\n contents = IO.read(text_file_name)\n wordsInFile = words(contents)\n train!(wordsInFile)\n end", "def file_reader file_name\n @words_count = {}\n File.read(file_name).each_line{ |line| count_words( line.split(',')[2] ) }\n hash_to_file(@words_count, file_name)\nend", "def mode_wordlist(file)\n self.increment_length = nil\n self.incremental = nil\n self.max_runtime = nil\n self.mask = nil\n if cracker == 'john'\n self.wordlist = file\n self.rules = 'wordlist'\n elsif cracker == 'hashcat'\n self.wordlist = file\n self.attack = '0'\n end\n end", "def file_2_list(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\tlist=Array.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tlist.push(line.chomp.strip)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn list\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for file #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def initialize(file_name)\n @words_loaded = load_words(file_name)\n @word_selected = select_word(@words_loaded)\n @hidden_word = hide_word(@word_selected)\n @correct_guesses = []\n @wrong_guesses = []\n @max_wrong_guesses = 10\n @current_wrong_guesses = 0\n end", "def initialize(filename=\"data/dictionary.txt\")\n file = File.new(filename, \"r\")\n @data = {}\n while (word = file.gets)\n if (word)\n word = word.chomp.upcase\n add_word(word)\n end\n end\n # @max_word_size = 4\n end", "def stop_words\n # Words taken from Jonathan Feinberg's cue.language (via jasondavies.com), see lib/cue.language/license.txt.\n \"i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|im|youre|hes|shes|its|were|theyre|ive|youve|weve|theyve|id|youd|hed|shed|wed|theyd|ill|youll|hell|shell|well|theyll|isnt|arent|wasnt|werent|hasnt|havent|hadnt|doesnt|dont|didnt|wont|wouldnt|shant|shouldnt|cant|cannot|couldnt|mustnt|lets|thats|whos|whats|heres|theres|whens|wheres|whys|hows|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall\"\nend", "def get_dictionary\n dictionary = {}\n File.foreach(FILE_PATH) do |word| # loop throughout file\n word = word.chop.to_s.downcase # get only word (chop out enter)\n word_length = word.length\n if ALLOWED_LENGTHS.include?(word_length) # check whether word length is in ALLOWED_LENGTHS\n number_keys = \"\"\n (0...word_length).each do |i|\n number_keys += @letter_num_hash[word[i]] # append numbers based on each letter\n end\n word_value = dictionary.fetch(number_keys, []) # fetch word value else initialize new array\n word_value << word\n dictionary[number_keys] = word_value # assign word to respective numbers key\n end\n end\n return dictionary #return final dictionary\n end", "def initialize(dictionary)\n @words, @maxwords = [], []\n File.open(dictionary).each do |line|\n l = line.strip.downcase\n @words << l if (l.length >= MINCHARACTERS && l.length <= MAXCHARACTERS)\n @maxwords << l if l.length == MAXCHARACTERS\n end\n end", "def wordlist\n # Split defaults to splitting on white space\n File.read(File.expand_path('../data/subdomains.txt', __FILE__)).split\n end", "def initialize(text_file_name)\n @dictionary = Hash.new 0 \n #read file text_file_name\n #extract words from string (file contents) using method 'words' below.\n #put in dictionary with their frequency (calling train! method)\n File.open(text_file_name) do |f|\n f.each_line do |line|\n words = line.split\n words.each do |word|\n \n train! words word\n\n end\n end\n end\n end", "def load_list filename\n\tlist = []\n\tbegin\n\t\topen filename do |f|\n\t\t\tuntil (line = f.gets).nil?\n\t\t\t\tnext if line.strip.empty?\n\t\t\t\tlist << line.strip\n\t\t\tend\n\t\tend\n\trescue Errno::ENOENT\n\tend\n\tlist\nend", "def read_file(path)\n lines = []\n count = 0\n vocab = Set.new\n File.open(path, \"r:ISO-8859-1\").each do |line|\n line = line.strip\n vocab.merge(parse_vocab(line))\n lines << line\n count += 1\n end\n return lines, vocab\nend", "def hashdump dictfilepath\n @lookup = {}\n IO.foreach(dictfilepath) do |word|\n next unless word.size > 3\n word.chomp!\n @lookup[ word.sort2 ] ||= []\n @lookup[ word.sort2 ] << word\n end\n end", "def spawn_blacklist\n\tFile.open(\"blacklist.txt\", \"r\").each_line do |line|\n\t\tBlacklist.create(:word => line.strip) unless !Blacklist.find_by_word(line.strip).nil?\n\tend\nend", "def dictionary\n @dictionary ||= Set.new(File.read('../dictionary.txt').downcase.split(\"\\n\"))\n end", "def unixWords(inputFile)\n\t\ttext = File.open(inputFile).read\n\t\twords = []\n\t\ttext.each_line do |line|\n\t\t\twords.push(line.gsub(\"\\n\",\"\"))\n\t\tend\n\t\treturn words\n\tend", "def analyse(file_path)\n fixed = 0\n words = []\n File.open(file_path, \"r:iso-8859-1\") do |f|\n words = f.readlines(sep=\" \")\n words.dup.each_with_index do |word, i|\n word.delete!(\" \")\n match, dist = @tree.best word.downcase\n if !match.nil? && dist != 0\n fixed+=1\n words[i] = capitalize_if_needed(word, match)\n # puts \"#{word} - #{match}\"\n end\n end\n end\n # print \"file: #{file_path}\\nwords: #{words.size}\\nfixed words:#{((fixed.to_f/(words.size).to_f)*100).round(2)}%\\n\"\n save words, file_path\n end", "def readNames(path)\n return File.read(path).rstrip.split(/\\n/).map{|r| r.downcase.split(/\\|/)}\nend", "def words\n scrabble_words = File.readlines(\"words.txt\")\n scrabble_words.map { |x| x.delete(\"\\n\") }\nend", "def read_files\r\n @prefixes = IO.read('prefixes.txt').split(' ')\r\n @syllables = IO.read('syllables.txt').split(' ')\r\n @postfixes = IO.read('postfixes.txt').split(' ')\r\n end", "def word_count(file)\n wc = Hash.new(0)\n File.open(file, 'r') do |f|\n f.each_line do |line|\n line.split.each do |word|\n word = word.gsub(/[^a-zA-Z]/, '').downcase\n wc[word.to_sym] += 1\n end\n end\n end\n wc\nend", "def necessary_spellings\n spellings = []\n if necessary_file\n File.readlines(necessary_file).each do |line|\n line.strip!\n spellings << line unless line == \"\"\n end\n end\n spellings\n end", "def file_process(file)\n\n stop_words = File.read('stop_words.txt').split(\"\\n\")\n\n lines = File.readlines(file)\n title = lines[0]\n speech = lines[1..-1]\n line_count = speech.size\n text = speech.join\n char_count = text.length\n char_count_nospaces = text.force_encoding('UTF-8').gsub(/\\s+/, '').length\n word_count = text.scan(/\\w+/).length\n sentence_count = text.split(/\\.|\\?|!/).length\n average_words_sentence = word_count / sentence_count\n paragraph_count = text.split(/\\n\\n/).length\n word_frequency_hash = {}\n word_frequency_top = []\n\n text.split().each do |word|\n unless stop_words.include?(word.downcase)\n if word_frequency_hash.has_key?(word.downcase)\n word_frequency_hash[word.downcase] += 1\n else\n word_frequency_hash[word.downcase] = 1\n end\n end\n end\n\n non_fluff_words = (word_frequency_hash.size.to_f / word_count.to_f * 100).to_i\n\n array_of_sentences = text.scan(/[^\\.!?]+[\\.!?]/).map(&:strip).sort_by { |sentence| sentence.length }\n ideal_sentences = array_of_sentences[array_of_sentences.length/3..array_of_sentences.length - array_of_sentences.length/3]\n\n word_frequency = word_frequency_hash.sort_by { |key, value| value}.reverse\n word_frequency.flatten.each_with_index { |word, index| word_frequency_top << word if index.even? }\n\n puts \"#{title}\"\n puts \"#{line_count} lines\"\n puts \"#{char_count} characters\"\n puts \"#{char_count_nospaces} characters excluding spaces\"\n puts \"#{word_count} words\"\n puts \"#{sentence_count} sentences\"\n puts \"#{paragraph_count} paragraphs\"\n puts \"#{average_words_sentence} words per sentence (average)\"\n puts \"#{word_frequency_hash.size} non-fluff words\"\n puts \"roughly #{non_fluff_words} percent non-fluff words.\"\n puts \"Top 10 non-fluff words: #{word_frequency_top.take(10)} top 10 non-fluff words.\"\n puts \"Ideal sentences array: #{ideal_sentences.take(7) }\"\n puts\n puts\n\nend", "def load_words\n words = []\n\n begin\n sql = \"SELECT word_id, spelling, count FROM Words;\"\n stm = @db.prepare sql\n rs = stm.execute\n\t\t while (row = rs.next) do\n\t\t id, s, c = *row\n\t\t words << Word.new(s, :count=>c, :id=>id)\n\t\t end\n ensure\n stm.close\n end\n\n begin \n sql = \"SELECT file_path, file_count FROM WordFiles WHERE word_id = ?\"\n stm = @db.prepare sql\n\n\t\t words.each do |w|\n\t\t rs = stm.execute(w.id)\n\t\t files = {}\n\t\t while (row = rs.next) do\n\t\t path, count = *row\n\t\t files[path] = count\n\t\t end\n\t\t w.files = files\n\t\t end\n ensure\n stm.close\n end\n\n return words\n end", "def load_sig_from_file (file, lc=true)\n puts \"Loading data file: #{file}\"\tif @verbose\n\t\t\tdata_store=Hash.new\n\t\t\tf = File.open(file, 'r')\n\t\t\tf.each_line do |line|\n\t\t\t\tputs \"Processing line: #{line}\" if @verbose\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tentry=line.split(',')\n\t\t\t\tif data_store.key?(entry[0])\n\t\t\t\t\tnext\n\t\t\t\telse\n\t\t\t\t\tdata_store[entry[0]]=entry[1].strip\n\t\t\t\tend\n\t\t\tend\n\t\t\tf.close\n\t\t\treturn data_store\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n \tend", "def generate_words\n ret = []\n\n File.open('enable.txt').each do |line|\n new_line = line\n # We don't care for the new line character in the game of hangman.\n new_line = new_line.delete(\"\\n\")\n ret << new_line\n end\n\n return ret\nend", "def word_map(lines)\n words = []\n lines.each_with_index do |s, i|\n words[i] = []\n start = -1\n word = ''\n in_word = false\n (s + '|').each_char.each_with_index do |c, j|\n if in_word\n if '.?!*|'.include?(c)\n words[i][start] = word\n words[i][j-1] = word\n in_word = false\n else\n word << c\n end\n else\n unless '.?!*|'.include?(c)\n in_word = true\n word = c\n start = j\n end\n end\n end\n end\n words\n end", "def scanner\n @sentences ||= File.open(@path) do |file|\n file.each_line.each_with_object([]) do |line, acc|\n stripped_line = line.strip\n\n unless stripped_line.nil? || stripped_line.empty?\n acc << line.split(' ').map do |word|\n word.split('/').first\n end.join(' ')\n end\n end\n end\n\n end", "def get_word_from_dictionary(filename)\n words = File.readlines(filename, chomp: true) # read in dictionary\n # get only valid length words\n valid_words = words.select do |word|\n word.length >= 5 && word.length <= 12\n end\n # choose a random valid_word\n valid_words.sample\n end", "def run\n load_the_file\n word_frequency\n match_the_word\n end", "def get_stop_word_array\n\t\treturn ['a','about','above','after','again','against','all','am','an','and','any','are',\"aren't\",'as','at','be','because','been','before','being','below','between','both','but','by',\n\t\t\t\t\"can't\",'cannot','could',\"couldn't\",'did',\"didn't\",'do','does',\"doesn't\",'doing',\"don't\",'down','during','each','few','for','from','further','had',\"hadn't\",'has',\"hasn't\",\n\t\t\t\t'have',\"haven't\",'having','he',\"he'd\",\"he'll\",\"he's\",'her','here',\"here's\",'hers','herself','him','himself','his','how',\"how's\",'i',\"i'd\",\"i'll\",\"i'm\",\"i've\",'if','in','into',\n\t\t\t\t'is',\"isn't\",'it',\"it's\",'its','itself',\"let's\",'me','more','most',\"mustn't\",'my','myself','no','nor','not','of','off','on','once','only','or','other','ought','our','ours',\n\t\t\t\t'ourselves','out','over','own','same',\"shan't\",'she',\"she'd\",\"she'll\",\"she's\",'should',\"shouldn't\",'so','some','such','than','that',\"that's\",'the','their','theirs','them',\n\t\t\t\t'themselves','then','there',\"there's\",'these','they',\"they'd\",\"they'll\",\"they're\",\"they've\",'this','those','through','to','too','under','until','up','very','was',\"wasn't\",\n\t\t\t\t'we',\"we'd\",\"we'll\",\"we're\",\"we've\",'were',\"weren't\",'what',\"what's\",'when',\"when's\",'where',\"where's\",'which','while','who',\"who's\",'whom','why',\"why's\",'with',\"won't\",\n\t\t\t\t'would',\"wouldn't\",'you',\"you'd\",\"you'll\",\"you're\",\"you've\",'your','yours','yourself','yourselves','zero']\n\tend", "def load_data(fileName)\n set = open(fileName, 'r')\n data = []\n set.each_line do |line|\n categories = line.split(' ')\n data.push(categories)\n end\n return data\n end", "def read_search_term_file(file_name)\n file = File.open \"jobs/twitter_resources/#{file_name}.json\"\n data = JSON.load file\n file.close\n return data[\"search_terms\"]\nend", "def pick_secret_word(filename = 'word_list')\n secret_word = nil\n if File.exist? filename\n words = File.readlines filename\n suitable_words = words.select { |word| word.size.between?(5, 12) }\n secret_word = suitable_words.sample.downcase.chomp\n else\n puts 'file does not exist'\n end\n secret_word\n end", "def keywords(limit = 20)\n @keywords ||= {}\n @keywords[limit] ||= begin\n list = []\n count = 0\n _stopwords = Vidibus::Words.stopwords(*locales)\n for word in sort\n clean = word.permalink.gsub('-','')\n unless _stopwords.include?(clean)\n list << word\n count += 1\n break if count >= limit\n end\n end\n list\n end\n end", "def initialize(text_file_name)\n text = \"\"\n #read file text_file_name\n File.open(text_file_name, \"r\") do |f|\n f.each_line do |line|\n\ttext << line.chomp << \" \"\n end\n end\n\n #extract words from string (file contents) using method 'words' below.\n word_list = words(text)\n\n #put in dictionary with their frequency (calling train! method)\n train!(word_list)\n end", "def stopwords\n @stopwords ||= @stopword_generator.to_set\n end", "def words\n file = File.open(\"words.txt\")\n words = file.read.split(\",\").map { |x| x.gsub(\"\\\"\", \"\") }\n file.close\n words\nend", "def import\n print 'Import filename: '\n $stdout.flush\n file = gets.chomp\n fd = File.new(file, \"r\")\n itecky = file.rindex('.')\n raise 'missing dot in filename' if itecky == nil\n fname = file[0,itecky]\n fname.upcase!\n puts\n fd.each do\n |row|\n if row.strip.length == 0 or row[0,1] == '*' or row[0,1] == '#'\n next\n end\n row.chomp!\n items = row.split # deleni row na polozky oddelene mezerou\n nitems = items.length # pocet polozek\n raise \"only one word on the line\\n[#{row}]\" if nitems == 1\n if nitems == 2 # slovicka bez oddelovaci carky\n en = items[0]\n cz = items[1]\n else # slovicka a fraze s oddelovaci carkou\n i = row.index(' - ') # oddelovac anglickeho a ceskeho vyrazu\n raise \"missing ' - ' between English and Czech phrases\\n[#{row}]\" if i == nil\n en = row[0,i+1].strip # prvni cast radku - anglicka\n cz = row[i+3..-1].strip # druha cast radku - ceska\n end\n flag = false\n for iw in 0 ... $words.length do\n if $words[iw].fname == fname and\n ($words[iw].english == en or $words[iw].czech == cz) then\n flag = true\n break\n end\n end\n if flag == true then next end\n $words << Word.new(fname,0,0,en,cz)\n w = konverze($words.last.english + ' | ' + $words.last.czech)\n puts w\n end\n puts\n $stdout.flush\nend", "def load_words(max=1000)\n return nil unless File.exist?('log/words.dat')\n\n a = []\n File.readlines('log/words.dat').each do |line|\n rank, word = line.strip.split(/\\s+/)\n a << [word, Float(rank)]\n end\n\n a.sort!{ |a, b| b <=> a }\n\n h = {}\n a.each do |(word, rank)|\n h[word] = rank.to_f\n end\n h\n end", "def dictionary\n if File.file?('/usr/share/dict/words')\n words_file('/usr/share/dict/words')\n elsif File.file?('/usr/dict/words')\n words_file('/usr/dict/words')\n else\n %w(\n this is a jury rigged dictionary banana monkey apple pear peach\n computers are so great robot dance\n )\n end\n end", "def scan\n $stderr.print \"[lexicon] \"\n\n dict = Set.new\n\n files.each do |file|\n if $DEBUG\n $stderr.puts \"[scanning dictionary] #{file}\" if $DEBUG\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n dict << word if valid_word?(word)\n end\n end\n end\n\n @set = dict\n\n $stderr.puts\n end", "def read_keywords\n messages = (list(:cur) + list(:new)).inject({}) { |m, msg| m[msg.unique_name] = msg ; m }\n t = Time.now.to_i / 300\n keywords = []\n state = :head\n # process :list\n list_file = File.join(keyword_dir, ':list')\n File.open(list_file).each_line do |line|\n line.strip!\n if state == :head\n if line.empty?\n state = :messages\n next\n end\n keywords << line\n else\n key, ids = line.split(':')\n if msg = messages[key]\n msg.set_keywords(ids.split(/\\s/).map {|id| keywords[id.to_i - 1] })\n end\n end\n end if File.exist?(list_file)\n # collect keyword files\n keyword_files = (Dir.entries(keyword_dir) - %w(. .. :list)).inject({}) do |keyword_files, file|\n if file =~ /^\\.(\\d+)\\.(.*)$/\n n = $1\n key = $2\n else\n n = t + 1\n key = file\n FileUtils.mv(File.join(keyword_dir, file), File.join(keyword_dir, \".#{n}.#{key}\"))\n end\n if msg = messages[key]\n (keyword_files[key] ||= []) << [n, key]\n else # message doesn't exist\n fname = File.join(keyword_dir, file)\n if File.stat(fname).ctime < (Time.now - (15 * 60))\n File.unlink(fname)\n end\n end\n next(keyword_files)\n end\n # process keyword files\n keyword_files.each_pair do |key, files|\n files.sort! { |a, b| a[0] <=> b[0] }\n files[0..-2].each { |f| File.unlink(File.join(keyword_dir, \".#{f.join('.')}\")) } if files.last[0] < t\n msg = messages[key]\n file = (File.exist?(File.join(keyword_dir, files.last[1])) ? files.last[1] : \".#{files.last.join('.')}\")\n current_keywords = File.read(File.join(keyword_dir, file)).split(/\\s+/)\n msg.set_keywords(current_keywords)\n if (add = (current_keywords - keywords)).any?\n keywords += add\n end\n end\n # rebuild :list\n @keywords = {}\n tmp_file = File.join(path, 'tmp', ':list')\n File.open(tmp_file, 'w') { |f|\n f.write(keywords.join(\"\\n\")+\"\\n\\n\")\n messages.each_pair do |key, msg|\n next unless msg.keywords\n f.puts([key, msg.keywords.map{|kw| keywords.index(kw) + 1 }.sort.join(' ')].join(':'))\n @keywords[key] = msg.keywords\n end\n }\n FileUtils.mv(tmp_file, list_file)\n end", "def read_file\n\t\t\treturn 'wordlists/reverse_ip.txt'\n\t\tend", "def define_word_CEDICT(word)\n @cedict = 'cedict.txt'\n @word_matches = File.readlines(@cedict).grep(/#{word}/)\n\n @best_match = []\n\n @word_matches.each do |x|\n # CEDICT lists simplified and traditional characters, space delimited\n # 学 = \"學 学 [xue2] /to learn/to study/science/-ology/\"\n @match = x.split\n\n if @match[0] == word || @match[1] == word\n @best_match << x\n end\n end\n\n return @best_match\n end", "def fetch_words\n unless File.exists?(DEPRECATED_BLACKLIST_PATH)\n fetch_yaml(BLACKLIST_PATH, File.dirname(__FILE__) + \"/blacklist.yml\")\n else\n YAML.load(File.open(DEPRECATED_BLACKLIST_PATH)).freeze\n end\n end" ]
[ "0.7985723", "0.7368552", "0.7265786", "0.72610134", "0.7143473", "0.70698315", "0.70198655", "0.70190686", "0.6995447", "0.68674725", "0.6856073", "0.6821236", "0.67191386", "0.6646942", "0.66306347", "0.6599554", "0.65971243", "0.6593243", "0.6484252", "0.6483898", "0.64471495", "0.6437479", "0.6405564", "0.63667387", "0.6284638", "0.6268843", "0.6254996", "0.62355554", "0.6234757", "0.6211523", "0.6207455", "0.6145242", "0.61252666", "0.61190075", "0.6111874", "0.60780895", "0.6062493", "0.6040115", "0.6012518", "0.6000999", "0.5949067", "0.5902439", "0.59015286", "0.5874899", "0.58693266", "0.5864096", "0.58546484", "0.5831059", "0.582772", "0.58213663", "0.581788", "0.5817676", "0.5816997", "0.58153397", "0.58086246", "0.5808569", "0.5783705", "0.5760358", "0.575909", "0.5752943", "0.5748211", "0.57074934", "0.57066303", "0.5701613", "0.56982213", "0.5697201", "0.56930244", "0.56829226", "0.5647513", "0.56326246", "0.5632107", "0.560964", "0.55850977", "0.55821836", "0.5576594", "0.5574736", "0.5569728", "0.55584794", "0.5540809", "0.55375266", "0.55349976", "0.5532408", "0.5532317", "0.552419", "0.552057", "0.5511718", "0.5509728", "0.5507888", "0.5503551", "0.5498506", "0.5495172", "0.5494275", "0.54842246", "0.54824996", "0.54803914", "0.54757917", "0.5469324", "0.54686636", "0.54524523", "0.5446844" ]
0.8104293
0
function that takes the name of a directory, and returns a list of all the filenames in that directory.
def list_files(dir) # Getting all the files names in the directory file_names = Dir[dir + "*"] return file_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_files(dir)\n# Getting all the files names in the directory\n file_names = Dir[dir + \"*\"]\n return file_names\nend", "def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end", "def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end", "def files(directory)\n files_list = Dir[directory + '/*']\n files = []\n\n files_list.each do |file|\n if File.directory?(file)\n dir_files = files(file)\n dir_files.each { |f| files << f }\n end\n files << file\n end\n files\n end", "def file_name_array(directory_name)\n filenames_array = []\n Dir.foreach(directory_name) do |filename|\n unless filename == \".\" || filename == \"..\" || filename == \".DS_Store\"\n filenames_array << filename\n end\n end\n parse_filenames(directory_name, filenames_array)\n end", "def all_files_in(dir_name)\n Nanoc::FilesystemTools.all_files_in(dir_name)\n end", "def dir(directory)\n if session.type == 'meterpreter'\n return session.fs.dir.entries(directory)\n end\n\n if session.platform == 'windows'\n return session.shell_command_token(\"dir #{directory}\").split(/[\\r\\n]+/)\n end\n\n if command_exists?('ls')\n return session.shell_command_token(\"ls #{directory}\").split(/[\\r\\n]+/)\n end\n\n # Result on systems without ls command\n if directory[-1] != '/'\n directory = directory + \"/\"\n end\n result = []\n data = session.shell_command_token(\"for fn in #{directory}*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1, line)\n end\n\n result\n end", "def dir_files(dir)\n Find.find(dir).to_a.reject!{|f| File.directory?(f) }\nend", "def recursive_file_list( root_dir)\n\t\treturn nil unless File.directory?(root_dir)\n\t\tlist = []\n\t\tDir.entries( root_dir).reject{|e| e=~/^\\./}.each { |e| \n\t\t\tpath = File.join( root_dir, e)\n\t\t\tif File.directory?( path)\n\t\t\t\t# puts \"Dir: #{path}\"\n\t\t\t\t list += recursive_file_list(path)\n\t\t\telsif File.file?(path)\n\t\t\t\t# puts \"File: #{path}\"\n\t\t\t\t list << path\n\t\t\tend\t\n\t\t}\n\t\tlist\n\tend", "def ls(directory)\n out = []\n tmp = cmd_exec(\"ls -a -m #{directory}\")\n tmp = session.remove_colors(tmp)\n if tmp\n tmp.delete!(\"\\r\")\n tmp.delete!(\"\\n\")\n tmp.split(/,\\s{0,1}/).each do |f|\n next if f.empty?\n next if f == './'\n next if f == '../'\n next if f == '.'\n next if f == '..'\n out << f\n end\n end\n out\n end", "def list_files_in_directory(dir, options)\n normalized_file_list(options, Dir.glob(File.join(dir, \"*\")), false, options.exclude)\n end", "def all_files_in_dir(p_dir)\n [File.join(p_dir, \"**\", \"*\"), File.join(p_dir, \"**\", \".*\")]\n end", "def list_files_in_directory(dir, options)\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list options, files, false, options.exclude\n end", "def list_files_in_directory(dir, options)\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list options, files, false, options.exclude\n end", "def all_directories dir\n Dir[\"#{dir}**/\"]\nend", "def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end", "def file_list(dir, opts={})\r\n\topts={:recursive => false, :exclude => []}.merge(opts)\r\n\tf = []\r\n\tDir.glob(File.join(dir,\"*\")).each do | file |\r\n\t\tif File.file?(file) then\r\n\t\t\tnext if opts[:exclude].include? file\r\n\t\t\tf << file\r\n\t\telse\r\n\t\t\tf << file_list(file) if opts[:recursive] && File.directory?(file)\r\n\t\tend\r\n\tend\r\n\treturn f\r\nend", "def directory_contents(directory)\n return Dir.glob(File.join(directory, '*'))\n end", "def fakedir_get_all_names(root, basename = '')\n result = (['.', '..'] + root[:files] + root[:dirs].keys).map{|e| basename + e}\n root[:dirs].each do |name, content|\n result += fakedir_get_all_names(content, \"#{basename}#{name}/\")\n end\n result\n end", "def list_directory(directory)\n return if directory == nil\n \n repo = File.join(path, directory)\n return unless File.directory?(repo) \n \n Dir.chdir(repo)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def get_files(directory)\n Dir.entries(directory).select { |entry| not is_dir?(\"#{directory}/#{entry}\") }\n end", "def get_directory_files(directory, verbose_flag=false)\n exists = File.directory?(directory)\n if exists\n files = Dir[\"#{directory}/*\"] # grab all the files inside that directory\n return files\n else\n puts \"Unable to find a directory at #{directory}\" if verbose_flag\n return nil\n end\nend", "def list_files( dir = directory )\n Dir.entries(directory).tap do |files|\n files.delete('.')\n files.delete('..')\n end\n end", "def enumerate_files(directory)\n return directory.\n children.\n reject(&:directory?).\n map(&:expand_path)\n end", "def get_file_names(dir, file_names)\n Dir.foreach(dir) do |fname|\n unless fname == '.' || fname == '..'\n file_names << fname\n end\n end\nend", "def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)", "def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end", "def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end", "def takeFilesNames\nDir['result*.*'].each do |file_name|\n @files_names.push(file_name)\nend\nend", "def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end", "def list_all_in_current_directory\n Dir.glob('**/*').sort\nend", "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(directory,f)) &&\n f != '.' && f != '..' }\n files = allFiles.reject{ |f| File.directory?(File.join(directory,f)) }\n result += files\n dirs.each do |subdir|\n result += visible_files_under(File.join(directory,subdir))\n end\n end\n return result\n end", "def ls(path)\n files = []\n Dir.glob(\"#{path}/*\") {|f| files << f.split('/').last}\n\n return files\n end", "def dirglob(dir='')\n pattern = dir.sub(/\\/+$/, ?/) + ?*\n files = []\n dirs = []\n Dir[pattern].flat_map do |f|\n if File.directory?(f)\n f = f.sub(/\\/*$/, ?/)\n dirs += ['', f] + dirglob(f)\n else\n files << f\n end\n end\n files + dirs\nend", "def get_files_in_dir(path)\n Dir[\"#{path}*\"].sort! { |e1, e2| stringnum_comparison(e1, e2) }\n end", "def file_list(full_directory_path)\r\n path = File.join(full_directory_path, '*')\r\n Dir[path].reject { |fn| File.directory?(fn) || File.basename(fn) == @folder_config }\r\n end", "def get_files_in(directory_name, options = {})\n options = {\n :traverse => false,\n :full_paths => true\n }.merge(options)\n \n ## If directory name is not absolute, go one-up to what should\n ## be the root directory of the app. (I.e. We're in ROOT/helpers.)\n path = directory_name =~ /^\\// ? directory_name : File.join(File.dirname(__FILE__), '..', directory_name)\n \n pattern = options[:traverse] ? \"/**/*.rb\" : \"/*.rb\"\n files = Dir[path + pattern].select { |e| e =~ /^.+\\.rb$/ }\n\n if options[:full_paths]\n files\n else\n files.map { |file| file.match(/\\/([A-Za-z0-9_]+\\.rb)$/)[1] }\n end\n end", "def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end", "def get_files(dir, name)\n Dir[\"#{dir}/**/#{name || \"*.xml\"}\"]\nend", "def ls(path) \n ary = Array.new\n Dir.chdir(path) {\n Dir.glob(\"*\").each {|dir|\n ary.push(dir)\n }\n }\n return ary\nend", "def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end", "def list_files\n files = remote_directory.files.map { |file| file.key }\n\n # The first item in the array is only the path an can be discarded.\n files = files.slice(1, files.length - 1) || []\n\n files\n .map { |file| Pathname.new(file).basename.to_s }\n .sort\n .reverse\n end", "def readDirectoryFiles(directory,formats)\n files=[]\n Dir.chdir(directory){\n for i in 0...formats.length\n Dir.glob(formats[i]){|f| files.push(f) }\n end\n }\n return files\nend", "def get_directories_names path\n get_directories_absolute_paths(path).map {|dir| File.basename(dir) }\n end", "def get_files_in_path(path)\n puts \"Scanning for files in directory: #{path}\"\n Dir.entries(path).reject { |f| File.directory? f }\nend", "def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end", "def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end", "def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', 'mets.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end", "def get_directory_list( dirname, pattern )\n res = []\n begin\n Dir.foreach( dirname ) do |f|\n if pattern.match( f )\n res << f\n end\n end\n rescue => e\n end\n\n return res.sort { |x, y| directory_sort_order( x, y ) }\n end", "def files\n\t\t# if the directory doesn't exist, we bail out with a nil\n\t\treturn nil unless File.directory? dir\n\t\t\n\t\tf = Dir.entries(dir)\n\t\tf.delete(\".\")\n\t\tf.delete(\"..\")\n\n\t\treturn f\n\tend", "def ls(filename)\n if File.directory?(filename)\n puts(Dir['./' + filename + '/*'])\n elsif File.file?(filename)\n puts(filename)\n else \n puts(\"error\")\n end\nend", "def get_children(directory)\n file = Pathname.new(directory)\n if file.directory?\n file.children\n else \n []\n end\nend", "def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end", "def get_files\n\tnames = Array.new\n\n\tDir.glob(\"*.xls\").each do |f| \n\t\tnames << f\n\tend\n\n\treturn names\nend", "def get_files(src)\n files = Array.new\n if File.directory? src\n Find.find(src) do |path|\n next if File.directory? path\n files.push path\n end\n else\n log(\"error: source directory of \\\"#{src}\\\" does not exist!\")\n exit 2\n end\n files.reverse\nend", "def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\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 files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end", "def file_list(group)\n return Dir[File.join(@dir, group, FILE_EXT)].sort\nend", "def get_image_name_list(path)\n image_name_list = []\n Dir.glob(path + '*' + FILE_SUFFIX).each do |file|\n image_name_list << file\n end\n image_name_list\n end", "def all_filenames\n\n\n # This checks for it being an array and not nil!\n # return @filenames if @filenames && !@filenames.empty?\n\n # This means we can add files to the output\n return $filenames if $filenames && $filenames.size > 5 # I guess that small numbers are errors too\n \n if @directory\n @output_directory ||= File.join(@directory, 'Build')\n $filenames = Dir.glob(File.join(@directory, \"**/*\")).map {|file|\n next if file.start_with?(@output_directory)\n next if File.directory?(file)\n file.gsub(@directory+\"/\", \"\")\n }.compact\n else\n []\n end\n end", "def ls(path)\n dir = scope.get(path)\n InvalidPath.raise! {!dir.try(:is_dir)}\n dir.files.map(&:path)\n end", "def getFiles(dirs)\n files = []\n for dir in dirs\n # This is recursive...could use Dir.glob() for local lookups.\n Find.find(dir) do |path|\n files << path if goodPath(path)\n end\n end\n return files\nend", "def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end", "def read_files(file_path)\n\tlist=Dir.entries(file_path)\n\treturn list\nend", "def files\n filename = Dir.entries(@path).find_all {|file| file.include?(\".mp3\")}\n # binding.pry\n # [[\"Thundercat - For Love I Come - dance.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\"]]\n\n #binding.pry\n end", "def get_image_paths(directory)\n Dir[\"#{directory}/**/*.jpg\"]\nend", "def files\n array = []\n @list.each do |k,v|\n array += v.filename\n end\n array\n end", "def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end", "def crawl_hiera_directory(directory)\n files = []\n Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }\n return files\n end", "def filenames\n files.map(&:filename)\n end", "def filenames\n files.map(&:filename)\n end", "def filenames\n files.map(&:filename)\n end", "def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end", "def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end", "def files_in(dir)\n Dir.chdir(dir) do\n Dir.glob('**/*').select { |f| File.file?(f) }\n end\nend", "def get_files(dir)\r\n\t\r\n\t\t\tfiles = Dir.glob(dir)\r\n\t\t\tdir_path = dir.chomp(\"*\")\r\n\r\n\t\t\tfor file in files\r\n\t\t\t\tunless File.directory?(file)\r\n\t\t\t\t\tif @ext.include?(File.extname(file))\r\n\t\t\t\t\t\tread_lines file\r\n\t\t\t\t\t\t@num_files = @num_files+1\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\telse\r\n\t\t\t\t\tget_files file+\"/*\"\r\n\t\t\t\tend\r\n\r\n\t\t\tend\r\n\t\tend", "def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end", "def files_in(dir)\r\n ensure_dir_data(dir)\r\n @dirs[dir][:files].keys\r\n end", "def list\n factory.system.list(@path).collect do |item|\n candidate = dir(item)\n if (not candidate.exists?)\n candidate = file(item)\n end\n candidate\n end\n end", "def enumerate_directories(directory)\n return directory.\n children.\n select(&:directory?).\n map(&:expand_path)\n end", "def ls(path = '/')\n dirlist = []\n @sftp.dir.foreach(path) do |element|\n dirlist << element\n end\n return dirlist\n end", "def files() = files_path.glob('**/*')", "def readdir(path, fileinfo)\n puts \"#readdir \" + path\n [\"hello.txt\"]\n end", "def files_for_manifested_dir(dir)\n files = []\n begin\n manfile = File.open(File.join(dir,\"import_manifest\"), \"r\")\n rescue\n raise Exception.new(\"import manifest not found for #{dir}\")\n end\n\n manfile.each_line do |l|\n line = l.strip()\n next if line[0] == \"#\"\n next if line == \"\"\n\n files << line\n end\n\n files\nend", "def get_dir_listing( sftp, dir)\n list = []\n\n sftp.dir.foreach(dir) do |entry|\n list << entry.name\n end\n\n Set.new(list)\n end", "def getFilesInDirCompiler(path)\n files = []\n #search for all of the files in the directory\n Dir.foreach(path) do |filename|\n #dont include parent files\n next if filename == '.' || filename == '..'\n\n #dont include files that are not jack files\n next unless filename.to_s.include?(\"jack\")\n\n #push the file to the list\n files.push(path+\"/\"+filename)\n end\n\n return files\nend", "def files(name)\n self.glob(name, '.') + self.glob(name, '/')\n end", "def files(dir)\n Dir[dir + '/**/*'].reject do |filename|\n File.directory?(filename) ||\n filename =~ /(~|\\.orig|\\.rej|\\.bak)$/\n end\n end", "def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end", "def file_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.file?(File.join(dirname,e))\n }\n end", "def list_directories\n Dir.chdir(path)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end", "def get_flist\n pp_ok \"Started in directory #{Dir.pwd}\"\n Dir.chdir(@xml_dir)\n pp_ok \"Moved to directory #{Dir.pwd}\"\n return Dir.glob(\"*.{xml}\")\n end", "def files(prefix = '')\n full_list = []\n\n directory.files.all(:prefix => prefix).each do |file|\n full_list.push(\n File.new(file.identity,\n :content_type => file.content_type,\n :stored_in => [self],\n :last_update_ts => file.last_modified\n )\n )\n end\n\n full_list\n end", "def files\n array_full_names = Dir.glob(\"#{@path}/*.mp3\")\n array_full_names.collect do |full_name|\n full_name[21..-1]\n end\n end", "def file_list(dir)\n array = Array.new\n array += File.readlines(dir).map(&:chomp)\nend", "def names_list\n @names_list ||= Dir[\"#{ANALYSES_FOLDER}/*\"].collect{|d| File.basename(d)}\n end", "def find_files( dirs, lang, name, exts )\n results = []\n glob_files( dirs, lang, name, exts ) { |file,base,ext| results << file }\n results\n end", "def scan_dir (dirname)\n log \"*** Inspect: \" + dirname\n Dir.foreach(dirname) do |filename|\n path_cand = File.join(dirname , filename)\n if File.directory?(path_cand)\n #exams directories\n if (filename != \".\" && filename != \"..\")\n unless @filter_dir.index(filename)\n #directory not filtered\n @explore_dir.push(path_cand)\n @dir_list << path_cand\n end\n end\n else\n # file to be listed\n unless file_is_filtered?(path_cand)\n # file is not filtered\n #p path_cand\n if file_has_admitted_extension?(path_cand)\n @result_list.push(path_cand)\n end\n end\n end #file.directory?\n end\n next_dir = @explore_dir.pop\n scan_dir(next_dir) if next_dir \n end" ]
[ "0.80133253", "0.78187627", "0.7615698", "0.74597514", "0.7405495", "0.73551685", "0.73167235", "0.720857", "0.72048825", "0.7196617", "0.71838427", "0.7153261", "0.7131933", "0.7131933", "0.711905", "0.7115317", "0.709747", "0.70915383", "0.7090699", "0.7077409", "0.7062205", "0.7061486", "0.70545375", "0.70454663", "0.7035273", "0.70347655", "0.70250446", "0.69780725", "0.69359535", "0.69346297", "0.69029933", "0.6867804", "0.68484825", "0.68451285", "0.6790796", "0.67641973", "0.6734234", "0.67246073", "0.6695692", "0.6680639", "0.6664497", "0.6661441", "0.6657726", "0.6635899", "0.6586478", "0.65828264", "0.657364", "0.6573215", "0.6567656", "0.655162", "0.65236133", "0.65204096", "0.65155524", "0.6503115", "0.64974016", "0.64837515", "0.6474696", "0.6452085", "0.642905", "0.64282256", "0.6400196", "0.6398574", "0.6381694", "0.6375559", "0.6367294", "0.6352232", "0.6350003", "0.63338137", "0.6331935", "0.6323991", "0.6323852", "0.6321615", "0.6321615", "0.6321615", "0.6316796", "0.6308524", "0.63064206", "0.629713", "0.629351", "0.62924606", "0.62825036", "0.62824285", "0.62822413", "0.62684005", "0.6261956", "0.6244972", "0.62443477", "0.6242862", "0.62326896", "0.62284946", "0.6228321", "0.62124914", "0.6205294", "0.62052697", "0.6202104", "0.61989653", "0.61952597", "0.61825466", "0.61811465", "0.61799693" ]
0.80001473
1
CUSTOM FUNCTIONS parse_html takes the HTML code of a document and removes all the junk from it in order to return the text content on the page
def parse_html(html) doc = Nokogiri::HTML(html) # Removing style and script tag content such as Javascript tags in order to get rid of JUNK text doc.xpath("//script").remove doc.xpath("//style").remove begin text = doc.at('body').inner_text rescue NoMethodError puts "NoMethodError" # puts file_name #title = nil end return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_html(html)\n cleaned = html.gsub(/\\n/, '').gsub(/>\\s*</m, '><').gsub /\\x00/, ''\n doc = Nokogiri::HTML(cleaned, nil, nil, Nokogiri::XML::ParseOptions.new.default_html.noblanks)\n # remove all 'script' and 'style' nodes from the document\n doc.css('style').each {|n| n.remove }\n doc.css('script').each {|n| n.remove }\n doc\n end", "def strip_html(text)\n Nokogiri::HTML.fragment(text).content\n end", "def strip_tags(html); end", "def strip_tags(html); end", "def strip_tags(html); end", "def clean_html(doc)\n\n # Remove font tags\n doc.xpath('//font').each do |node|\n node.children.each do |child|\n child.parent = node.parent\n end\n node.remove\n end\n\n # Remove path to links:\n doc.xpath('//a').each do |node|\n href = node.attr(\"href\")\n href =~ /([^\\/]*)$/\n node.set_attribute(\"href\", $1)\n end\n\n # Remove <br> tags within li elements\n doc.xpath('//li').each do |li|\n li.xpath('//br').each do |br|\n br.remove\n end\n end\n\n # Remove <p> tags within li elements\n doc.xpath('//li').each do |li|\n li.xpath('//p').each do |p|\n p.children.each do |child|\n child.parent = p.parent\n end\n p.remove\n end\n end\n\n return doc\n end", "def parse\n #use regex to split\n arr = @html_string.scan(TAGS_AND_TEXT).flatten\n\n #remove nil values and return\n arr.compact!\n\n #remove white spaces\n arr.map! { |s| s.strip}\n end", "def htmlClean(html)\n html\nend", "def extract_content(response_doc)\n doc = Nokogiri::HTML(response_doc)\n\n doc.xpath('//javascript').remove\n doc.xpath('//script').remove\n\n doc.xpath('//head').remove\n doc.xpath('//header').remove\n doc.xpath('//footer').remove\n doc.xpath('//*[contains(@class, \"nav\")]').remove\n\n doc.xpath('//*[contains(@class, \"head\")]').each do |n|\n n.remove unless n[\"class\"].length > 9\n end\n\n doc.xpath('//*[contains(@class, \"foot\")]').each do |n|\n n.remove unless n[\"class\"].length > 9\n end\n\n doc.xpath('//input').remove\n doc.xpath('//button').remove\n\n doc.xpath('//style').remove\n\n body = doc.at_css('body')\n body = doc unless !body.blank?\n\n body.traverse do |node|\n begin\n node_content = node.content.clean\n if node_content.length > 35\n node.content = node_content + (node_content.last == \".\" ? \" \" : \". \")\n elsif node.name == \"td\"\n node.content = node_content + \" \"\n elsif node_content.to_s.count(\" \") < 1\n node.remove\n else\n node.content = node_content + \" \"\n end\n rescue Java::JavaLang::NullPointerException => e\n rescue NoMethodError => e\n # Swallow error from mutating the document while traversing it.\n end\n end\n\n return body.content.clean\n end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s.gsub(\"\\n\", \"\")\n end", "def clean!(html)\n @whitelist_nodes = []\n fragment = Nokogiri::HTML::DocumentFragment.parse(html)\n clean_node!(fragment)\n @whitelist_nodes = []\n\n output_method_params = {:encoding => 'utf-8', :indent => 0}\n\n if @config[:output] == :xhtml\n output_method = fragment.method(:to_xhtml)\n output_method_params[:save_with] = Nokogiri::XML::Node::SaveOptions::AS_XHTML\n elsif @config[:output] == :html\n output_method = fragment.method(:to_html)\n else\n raise Error, \"unsupported output format: #{@config[:output]}\"\n end\n\n result = output_method.call(output_method_params)\n\n # Ensure that the result is always a UTF-8 string in Ruby 1.9, no matter\n # what. Nokogiri seems to return empty strings as ASCII for some reason.\n result.force_encoding('utf-8') if RUBY_VERSION >= '1.9'\n\n return result == html ? nil : html[0, html.length] = result\n end", "def get_text_contents(html_string)\n\t# Remove HTML and scripts\n\thtml_regex = /<head>.*?<\\/head>|<script>.*?<\\/script>|<noscript>.*?<\\/noscript>/m\n\ttext_string = html_string.gsub(html_regex,\"\")\n\n\t# Remove tags\n\ttag_regex = /<[^<>]*?>/m\n\ttext_string.gsub!(tag_regex,\"\")\n\n\t# Replace multiple spaces with one\n\ttext_string.gsub!(/\\s{2,}/m,\" \")\n\n\t# Remove STX\n\ttext_string.gsub!(/\\^B/,\"\")\n\n\treturn text_string\nend", "def text_wikimedia_html page\n html = @client.text_wikimedia_html page\n # normalize html by removing <!-- html comments -->\n doc = Nokogiri.HTML html\n (doc.xpath '//comment()').remove\n doc.inner_html\n end", "def parse_html(html_body)\t\n #puts \"Parsing the html content: #{html_body}. Return DOM \" if @verbose\n\t\tbegin\n doc = Nokogiri::HTML(html_body)\n\t\t\t#puts \"Successfully crawling the url: #{url_object.base_uri.to_s}\" if @verbose\n\t\t\t#puts \"doc: #{doc}\" if @verbose\n\t\t\treturn doc\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n\tend", "def sanitize_text(text)\n doc = Nokogiri::HTML.fragment(text)\n UNSUPPORTED_HTML_TAGS.each do |tag|\n doc.search(tag).each(&:remove)\n end\n doc.inner_html\n end", "def html2text(html)\n\n result = ''\n begin\n web_doc = Hpricot(html)\n web_doc.search(\"//comment()\").remove\n web_doc.search(\"script\").remove\n web_doc.search(\"style\").remove\n web_doc.search(\"noscript\").remove\n web_doc.search(\"object\").remove\n web_doc.search(\"embed\").remove\n web_doc.search(\"head\").remove\n\n web_doc.traverse_text do |e| \n\n begin\n if e.content\n result += e.content+\"\\n\"\n end\n rescue\n # ignore errors\n end\n end\n rescue Exception => e\n # ignore errors\n warn \"html2text() - Exception '#{e.message}' trying to parse '#{html}'\"\n end\n\n if result == ''\n # Use a simple regular-expression approach to remove all tags\n result = html.gsub(/<[^>]*>/, '')\n end\n\n coder = HTMLEntities.new\n result = coder.decode(result)\n\n result.gsub!(/\\n[\\r\\n \\t]*/, \"\\n\")\n\n result\nend", "def normalise(html)\n doc = Nokogiri::HTML(html)\n body = doc.xpath('//body')\n\n body.xpath('//script').each {|s| s.remove}\n body.xpath('//comment()').each {|c| c.remove}\n body.xpath('//text()').find_all {|t| t.to_s.strip == ''}.map(&:remove)\n body.xpath('//header').remove\n body.xpath('//footer').remove\n body.xpath('//div[@id = \"global-cookie-message\"]').remove\n body.xpath('//div[@id = \"global-header-bar\"]').remove\n body.xpath('//div[@class = \"phase-banner-alpha\"]').remove\n body.xpath('//@class').remove\n body.xpath('//@id').remove\n body.xpath('//a').xpath('//@href').remove\n body.xpath('//label').xpath('//@for').remove\n body.xpath('//input').xpath('//@name').remove\n body.xpath('//input').xpath('//@value').remove\n\n remove_attributes(body, 'data')\n remove_attributes(body, 'aria')\n\n body.to_s\n .gsub(/>\\s+/, '>')\n .gsub(/\\s+</, '<')\n .gsub('><', \">\\n<\")\n end", "def strip_html\n gsub(HTML_TAG_PATTERN, \"\")\n end", "def strip_tags(html)\n return html if html.blank?\n if html.index(\"<\")\n text = \"\"\n tokenizer = ::HTML::Tokenizer.new(html)\n while token = tokenizer.next\n node = ::HTML::Node.parse(nil, 0, 0, token, false)\n # result is only the content of any Text nodes\n text << node.to_s if node.class == ::HTML::Text\n end\n # strip any comments, and if they have a newline at the end (ie. line with\n # only a comment) strip that too\n text.gsub(/<!--(.*?)-->[\\n]?/m, \"\")\n else\n html # already plain text\n end\n end", "def strip_links(html); end", "def strip_links(html); end", "def strip_links(html); end", "def strip_html( html )\n html.gsub(/<\\/?[^>]*>/, '')\n end", "def parse_text(text)\n ## Strip html\n Sanitize::clean!(text, :remove_contents => ['script','style'])\n text.gsub!(/[\\n\\t]+/, ' ')\n text\n end", "def text_only(html)\n Nokogiri::HTML.parse(html).text.gsub(/\\A\\p{Space}+|\\p{Space}+\\z/, '')\n .strip\n end", "def strip_html(text)\n unless text.nil?\n strip_tags(text)\n end\n end", "def html2text\n doc = self.scrape.hdoc\n text = node_to_text(doc)\n# text.gsub!(NamedCharRegex){|s| \"#{lookup_named_char(s)}\"}\n # clean up white space\n text.gsub!(\"\\r\",\" \")\n text.squeeze!(\" \")\n text.strip!\n ret = ''\n text.split(/\\n/).each do |l|\n l.strip!\n next if l == ''\n next if l =~ /^\\?+$/\n ret += \"#{l}\\n\"\n end\n return ret\n end", "def lstrip_html\n return if self.blank?\n\n m = self.match(/\\A(\\s*?[^<]|(.*?)>\\s*[^<])/) #Find first printing character\n return self unless m\n \n ldr = m[0]\n ldr_last = ldr.slice(ldr.size-1, ldr.size)\n ldr = ldr.slice(0,ldr.size-1) # portion up to the first printing character\n bdy = ldr_last + m.post_match # portion following the first printing character\n \n cln_ldr = ldr.gsub(/<p/mi, \"<span\")\n cln_ldr = cln_ldr.gsub(/<\\/p/mi, \"</span\")\n cln_ldr = cln_ldr.gsub(/<br(.*?)>/mi, \"\")\n \n m = bdy.match(/(\\A.*?)<p/mi)\n if !m\n bdy = bdy.sub(/<\\/p/mi, \"</span\") # change first closing </p> from an open <p> remaining from ldr\n else\n l = m.post_match\n f_cln = m[0].gsub(/<\\/p/mi, \"</span\") # change any closing </p> from and open <p> remaining from ldr\n bdy = f_cln + l \n end\n return cln_ldr + bdy \n end", "def sanitize(text)\n return nil if text.nil? || text.empty?\n string = text.to_s # ensure we have a string\n\n doc = Nokogiri::HTML.parse(text)\n\n doc.xpath('//@style').remove\n doc.xpath('//@class').remove\n doc.xpath('//@id').remove\n doc.xpath('//@font-size').remove\n doc.xpath('//@color').remove\n doc.xpath('//@size').remove\n doc.xpath('//@face').remove\n doc.xpath('//@bgcolor').remove\n doc.xpath('//comment()').remove\n\n # remove \"bad\" elements\n doc.css('script, link, img, style').each { |node| node.remove }\n\n # convert all <div>s to <p>s\n doc.css('div').each do |div|\n node = doc.create_element 'p'\n node.inner_html = div.inner_html\n div.replace(node)\n end\n\n # remove <font> and <span> tags, but preserve their content\n doc.css('font, span').each do |node|\n node.swap(node.children)\n end\n\n # removing tags leaves dangling text nodes that should really be merged, so let's\n # re-build the document\n doc = Nokogiri::HTML.parse(doc.to_s)\n\n # wrap orphaned text nodes in <p> tags\n doc.css('html body').children.each do |orphan|\n if orphan.class == Nokogiri::XML::Text && !orphan.text.strip.gsub(Envelope::Message::ALL_SPACES, '').empty?\n node = doc.create_element 'p'\n node.inner_html = orphan.text\n orphan.replace(node)\n end\n end\n\n # remove all <p><br><p>\n doc.css('p br').each do |node|\n node.remove\n end\n\n # convert all new lines to br and trim content\n doc.css('p').each do |node|\n node.inner_html = node.inner_html.gsub(\"\\n\", '<br>').strip\n end\n\n # remove empty tags\n doc.css('html body > *').each do |node|\n unless %w(br p).include?(node.name)\n node.remove if node.inner_html.gsub(Envelope::Message::ALL_SPACES, '').empty?\n end\n end\n\n doc.css('html body > *').to_s.gsub(/[\\n\\t]+?/, '')\n end", "def get_html_contents(url)\n\turl_string=\"\"\n\t# Open page and store contents\n\topen(url) { |data| \n\t\turl_string = data.read\n\t}\n\n\t# Remove \"not to be confused with\" links\n\thatnote_regex = /<div class=\"hatnote\">.*?<\\/div>/m\n\thtml_string = url_string.gsub(hatnote_regex,\"\")\n\n\treturn html_string\nend", "def as_text\n return self if self.blank?\n mytext = self.gsub(/<p>(.*?)<\\/p>/mi,'\\1'+\"\\n\\n\")\n mytext = mytext.gsub(/<br(.*?)>/mi,\"\\n\") \n mytext = mytext.gsub(/<p(.*?)>/mi,\"\\n\\n\") \n mytext = mytext.gsub(/<\\/p>/mi,\"\") \n mytext = mytext.gsub(/<div(.*?)>/mi, \"\")\n mytext = mytext.gsub(/<\\/div>/mi,\"\") \n # Go ahead and strip all the other html tags as well\n mytext = mytext.gsub(/<\\/?[^>]*>/, \"\")\n CGI.unescapeHTML(mytext).strip\n end", "def extract_content(doc)\n content = ''\n ce = content_element(doc)\n ce = ce.inner_html if ce.respond_to? :inner_html\n content = strip_tags(strip_comments(ce)) if ce\n # (ce/'h1, h2, h3, h4, h5, h6, p, li, dt, dd, td, address, option, ').each do |child|\n # extract_text child, content\n return content.strip\n end", "def text\n html.gsub(REGEX_TAGS, \"\")\n end", "def clean_article_body\n get_source_selectors.each do |selector|\n if @page.search(selector).present?\n @page = page.search(selector)\n break\n end\n end\n # Strip unwanted spaces and newlines.\n @page.collect {|elt| elt.content.strip.gsub(/\\n|\\r/, '').gsub(/\\ +/, ' ')}.join(' ')\n end", "def presentable_html(html)\n # sanitize edited, tags: %w(body p span a h1 h2 h3 h4 h5 h6 ul ol li) if work.file_content_html %> -->\n # doc = Nokogiri::HTML(html_junk)\n # body = doc.at_xpath(\"//body\")\n # body.css('*').remove_attr('class')\n # edited = body.to_html\n return raw html\n end", "def clean_html\n cleaned = ConverterMachine.clean_html(self) # => {html: clean html, css: Nokogiri extracted <style>...</style>}\n self.update_attributes!(file_content_html: cleaned[:html], file_content_css: cleaned[:css])\n end", "def parse_page\n @doc = Nokogiri::HTML(@html)\n end", "def strip_tags(html)\n # First we need to get rid of any embedded code.\n html = strip_embedded(html)\n\n # Remove comments\n html = html.gsub(/<!--.*?--\\s*>/m, \"\\xEF\\xBF\\xBC\")\n\n # SGML Declarations\n html = html.gsub(/<!.*?>/m, \"\\xEF\\xBF\\xBC\")\n\n # Remove script and css blocks\n html = html.gsub(/<script.*?>.*?<\\/script>/m, \"\\xEF\\xBF\\xBC\")\n html = html.gsub(/<style.*?>.*?<\\/style>/m, \"\\xEF\\xBF\\xBC\")\n\n # Strip html tags\n html = html.gsub(/<\\/? # opening tag with optional slash\n (\n [^<>\"'] | # match anything unquoted\n \".*?\" | # match double quotes…\n '.*?' # and single ones\n )* # any combination of the three\n > # close tag\n /xm, \"\\xEF\\xBF\\xBC\") # placeholder\n\n # Handle placeholders\n html = html.gsub(/^[ \\t]*\\xEF\\xBF\\xBC[ \\t]*(\\n|\\r|\\r\\n)/xm, '') # Remove lines with only tags\n html = html.gsub(/\\xEF\\xBF\\xBC/xm, '') # Remove other placeholders\n return html\nend", "def clean_html(options={:url => nil})\n use_http_get = true\n call_api('clean-html', options, use_http_get)\n end", "def purify_html\n doc= Nokogiri::XML::DocumentFragment.parse(self.to_s)\n doc.search(\".//strong\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h4\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h3\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h2\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n doc.search(\".//h1\").each do |e|\n e.swap \"<b>#{e.inner_html}</b>\"\n end\n\n doc.search(\".//em\").each do |e|\n e.swap \"<i>#{e.inner_html}</i>\"\n end\n\n doc.search(\".//ul\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//ol\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n doc.search(\".//li\").each do |e|\n e.swap \"<p>#{e.inner_html}</p>\"\n end\n doc.search(\".//span\").each do |e|\n e.swap \"#{e.inner_html}\"\n end\n\n doc.to_xml(:encoding => \"UTF-8\").gsub(/\\n/,\" \").gsub(/\\s+/,\" \")\n end", "def html2text(html)\n html ||= \"\" # ensure string is non-nil\n text = html.\n gsub(/(&nbsp;|\\n|\\s)+/im, ' ').squeeze(' ').strip.\n gsub(/<([^\\s]+)[^>]*(src|href)=\\s*(.?)([^>\\s]*)\\3[^>]*>\\4<\\/\\1>/i, '\\4')\n\n linkregex = /<[^>]*(src|href)=\\s*(.?)([^>\\s]*)\\2[^>]*>\\s*/i\n while linkregex.match(text)\n text.sub!(linkregex, \"\")\n end\n \n text = CGI.unescapeHTML(\n text.\n gsub(/<(script|style)[^>]*>.*<\\/\\1>/im, '').\n gsub(/<!--.*-->/m, '').\n gsub(/<hr(| [^>]*)>/i, \"___\\n\").\n gsub(/<li(| [^>]*)>/i, \"\\n* \").\n gsub(/<blockquote(| [^>]*)>/i, '> ').\n gsub(/<(br)(| [^>]*)>/i, \"\\n\").\n gsub(/<(\\/h[\\d]+|p)(| [^>]*)>/i, \"\\n\\n\").\n gsub(/<[^>]*>/, '')\n ).lstrip.gsub(/\\n[ ]+/, \"\\n\") + \"\\n\"\n\n converted = []\n text.split(//).collect { |c| converted << ( c[0] > 127 ? \"&##{c[0]};\" : c ) }\n converted.join('')\n end", "def strip_html(text)\n @name =\n # Remove HTML from the text\n Sanitize.clean(text).\n # Replace newlines with a space\n gsub(/\\n|\\r/, ' ').\n # Replaces runs of spaces by a single space\n squeeze(' ').\n # Remove leading and trailing whitespace\n strip\nend", "def html_parser; end", "def normalise_html(html)\n Nokogiri::HTML5.fragment(html).to_s\n end", "def html_remove\n gsub(/<\\/?[^>]+>/, '')\n end", "def strip_html_tags(text)\n return text.gsub!(/(<[^>]*>)|\\n|\\t/s) {\" \"}\n end", "def nice_html_to_text(html_text)\n doc = Hpricot(html_text)\n doc.search(\"//text()\").text\n end", "def process_full_text(text)\n frag = Nokogiri::HTML::DocumentFragment.parse text.to_html\n clean_text = Nokogiri::HTML::DocumentFragment.parse \"\"\n\n frag.traverse do |node|\n # skip empty <br> elements\n next if node.nil? || node.name == \"br\"\n\n # Construct a new <p> with extracted text\n if node.text?\n new_p = Nokogiri::XML::Node.new(\"p\", clean_text)\n new_p.content = node.text.strip\n clean_text << new_p\n end\n end\n clean_text.to_html\n end", "def sanitize(html)\n doc = Nokogiri::HTML::DocumentFragment.parse(html)\n if Mako.config.sanitize_images\n doc.css('img').each do |n|\n begin\n n.name = 'a'\n n.content = n['alt'] ? \"📷 #{n['alt']}\" : '📷 Image'\n n['href'] = URI.parse(n['src']).absolutize!(uri)\n rescue URI::InvalidURIError\n # if there's a problem, just ignore it\n next\n end\n end\n end\n doc.css('h1,h2,h3,h4,h5,h6').each { |n| n.name = 'p'; n.set_attribute('class', 'bold') }\n doc.to_s\n end", "def text\n return @text if (defined?(@text) && !@text.nil?)\n content = Readability::Document.new(@html).content #segfaults be damned\n\n if content.nil? || content.empty?\n #this is reaalll dirty...but it mostly works\n @text = encode_utf8_with_extreme_prejudice(@html).\n gsub(/\\&\\w+\\;|\\<\\S+|\\s\\>|\\\"|\\\\n|\\/|\\\\r|\\u0093|\\u0094|\\n|\\r|\\t/, \" \"). #remove HTML tags and wierd Unicode charecters\n scan(/([\\w+\\s+\\:\\-\\(\\)\\?\\.\\,\\\"\\'\\/\\`\\$\\u2013\\u2019\\u201C\\u201D\\!\\\\xC2\\\\xA0]{300,})/).join. #scan for blocks of text with punctuation 300+ chars\n gsub(/\\xC2\\xA0/, \" \").gsub(/\\?/, \"? \").gsub(/\\s\\?/, \"?\").gsub(/\\!/, \"! \").gsub(/\\./, \". \"). #fix broken punctuation\n gsub(/\\:/, \": \").gsub(/[A-Z]\\w/, ' \\0').gsub(/\\s{2,}/, \" \").gsub(/[A-Za-z0-9]{30,}/,\"\") #fix even more punctuation, remove extraneous data\n else\n #even the Readability text has HTML in it. Remove it.\n @text = (Nokogiri::HTML(content).text).gsub(/\\n|\\t|\\r/,\"\").gsub(/\\?/, \"? \").gsub(/\\s\\?/, \"?\").\n gsub(/\\!/, \"! \").gsub(/\\:/, \": \").gsub(/\\s{2,}/, \" \")\n end\n\n filter_param = (self.params[:q] || self.params[:query] || self.params[:search])\n\n if filter_param\n @text = @text.split.map{|x| x.split(/(#{filter_param})/i).each_slice(2).map(&:join)}.flatten.join(\" \")\n end\n\n return @text\n end", "def parse_text\n @doc = Nokogiri::HTML(wrap(@text)) do |config|\n #config.strict\n end\n rescue Exception => e\n log(\"Error parsing text, couldn't continue. #{e}\")\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 html_to_text(text)\n return nil if text.nil? || text.empty?\n text.gsub! /<br( \\/)?>/i, \"\\n\"\n\n string = Nokogiri::HTML.parse(text.to_s).css('body').text\n string.gsub! /[[:blank:]]/, ' '\n string = string.split(\"\\n\").collect{ |line| line.strip }.join(\"\\n\")\n string.gsub! /(\\n{1,})\\n/ do |match|; $1; end # convert x\\n to (x-1)\\n\n string.strip!\n string\n end", "def text_body(html_body)\n # Add URL to the end of link text.\n page = Nokogiri::HTML(html_body)\n page.css('a').each {|a| a.inner_html += \" (#{a['href']})\"}\n\n lines = ActionController::Base.helpers.sanitize(page.to_s).strip.lines.map {|l| l.strip }\n\n body = \"\"\n lines.map do |line|\n if line.empty?\n body += \"\\n\\n\"\n else\n body += \" #{line}\"\n end\n end\n\n return body.lines.map {|l| l.strip }.join(\"\\n\")\n end", "def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n html.gsub! /[\\n|\\r]/ , ' '\n html.gsub! /&nbsp;/ , ' '\n\n # this will convert UNICODE into ASCII. \n #It will also strip any possiblity of using a foreign language!\n #converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') \n #html = converter.iconv(html).unpack('U*').select{ |cp| cp < 127 }.pack('U*')\n # keep only the things we want.\n unless (Sanitize::Config::RELAXED[:attributes][\"table\"].include?(\"align\"))\n Sanitize::Config::RELAXED[:attributes][\"table\"] << \"align\"\n end\n\n config = Sanitize::Config::RELAXED\n if (html.encoding.name == 'ASCII-8BIT')\n config[:output_encoding] = 'ASCII'\n end\n html = Sanitize.clean( html, config)\n\n # butt up any tags\n html.gsub! />\\s+</ , '><'\n\n #remove email address lines\n html.gsub! email_regex , '<p>'\n\n # post sanitize cleanup of empty blocks\n # the order of removal is import - this is the way word stacks these elements\n html.gsub! /<i><\\/i>/ , ''\n html.gsub! /<b><\\/b>/ , ''\n html.gsub! /<\\/b><b>/ , ''\n html.gsub! /<p><\\/p>/ , ''\n html.gsub! /<p><b><\\/b><\\/p>/ , ''\n\n # misc - fix butted times\n html.gsub! /(\\d)am / , '\\1 am '\n html.gsub! /(\\d)pm / , '\\1 pm '\n # misc - remove multiple space that may cause doc specific regexs to fail (in dates for example)\n html.gsub! /\\s+/ , ' '\n\n # add new lines at the end of lines\n html.gsub! /<\\/(p|h\\d|dt|dd|dl)>/, '</\\1>' + \"\\n\"\n html.gsub! /<dl>/ , '<dl>' + \"\\n\"\n\n self.contents = html\n end\n end", "def content_from(html, url)\n \n def extract_pre_from(html)\n regex = /<pre.*?>.*?<\\/pre>/m\n pre_list = html.scan regex\n html.gsub! regex, 'DUMMY-STRING'\n [pre_list, html]\n end\n\n def add_domain(html, domain)\n html.gsub! /a href=\\\"(\\/.*?\\\")/, \"a href=\\\"#{domain}\\\\1\"\n html.gsub! /img src=\\\"(\\/.*?\\\")/, \"img src=\\\"#{domain}\\\\1\"\n html\n end\n\n def add_pre(html, pre_list)\n pre_list.each do |p|\n html.sub!('DUMMY-STRING', p)\n end\n html\n end\n \n pre_list, replaced = extract_pre_from html\n params = { :tags => %w[div span p a b i pre h1 h2 h3 h4 h5 h6 strong small em\n blockquote ul ol li img],\n :attributes => %w[href src] }\n html = HtmlPress.press Readability::Document.new(replaced, params).content\n domain = domain_of url\n output = add_pre(add_domain(html, domain), pre_list)\n output = sanitize_with_img output\n output.gsub /<img /, \"<img onError=\\\"this.style.display='none';\\\" \"\n \n end", "def clean_html\n HTML::WhiteListSanitizer.allowed_protocols << 'data'\n self.content = ActionController::Base.helpers.sanitize(self.body, :tags => ALLOWED_TAGS, :attributes => ALLOWED_ATTRIBUTES)\n end", "def content\n return @content if @content\n matches = class_const(:CONTENT_RE).match(page)\n if matches\n @content = class_const(:KILL_CHARS_RE).gsub(matches[1].to_s, '')\n content_processor\n @content.collect! { |p| decode_entities(p.strip) }\n @content.delete_if { |p| p == '' or p.nil? }\n end\n @content = [] if @content.nil?\n @content\n end", "def strip_html (s)\ns.gsub(/<[^>]*(>+|\\s*\\z)/m, '');\nend", "def clean_up_text\n text.gsub!(/<br/, \"\\n<br\")\n text.gsub!(/<p/, \"\\n<p\")\n text.gsub!(/<\\/?span(.*?)?>/, '')\n text.gsub!(/<\\/?div(.*?)?>/, '')\n end", "def parse_html(old_dom, path_to_article)\n # ToC and lead-in\n # NOTE: ToC may prove to be a problem because it appears in the left-hand column on the page. we may want to do some JS node swapping onDOMReady. ignoring it for now.\n # 1) get children of <ul class=\"acm\">\n # 2) remove lead-in pound-down if present (first LI)\n # 3) get .inner_html of second <p> after <a name=\"lead-in\"></a> if A exists\n\n toc_node = (old_dom/\"ul.acm\")[0]\n toc_node.children.reject! { |el| (el/\"//a[@href='#lead-in']\").length > 0 }\n\n # the (4) is because of the whitespace nodes in between the element nodes\n # NOTE: the nodes_at method is a bit noisy and outputs some text in the console. weird.\n leadin_node = (old_dom/\"//a[@name='lead-in']\")\n leadin = leadin_node.length > 0 ? remove_whitespace(leadin_node[0].nodes_at(4).inner_html) : \"\"\n\n # journal name\n # 1) get .inner_html of <div class=\"jrnl\">\n\n journal_name = remove_whitespace((old_dom/\".jrnl\")[0].inner_html)\n\n # vol, issue, page #\n # 1) get .inner_html of <div class=\"iss\">\n\n vol_issue_page = remove_whitespace((old_dom/\".iss\")[0].inner_html)\n\n # full-text Anchor / Heading structure (observed)\n # \n # lead-in => extracted\n # body-1 => kept intact, back-to-top removed\n # body-n => kept intact\n # references => kept intact\n # authorinfo => kept intact\n # footnotes => kept intact\n # figures => kept intact\n # tables => kept intact\n # sidebar-1 => kept intact\n # sidebar-n => kept intact\n # permission => kept intact, back-to-top removed\n\n # \"body-n\" section headings / back to top look like this:\n # \n # <a name=\"body-3\"></a>\n # <p>\n # <a href=\"#top\"><img src=\"http://portal.acm.org/img/arrowu.gif\" border=\"0\" alt=\"back to top\">&nbsp;</a>\n # <b>Moderator</b>\n # </p>\n # \n # 1) attempt to find each <a name=\"body-n\"></a> element\n # 2) immediately after element is the P that contains the back to top link and B tag with the section heading\n # NOTE: body-1 does not have a B tag in the P (i've seen it referenced as \"Introduction\" or \"Article\" in the ToC)... remove it.\n # 3) get inner_html of B tag\n # 4) remove P tag\n # 5) insert new back to top link before A tag\n # <p class=\"totop\"><a href=\"#PageTop\">Back to Top</a></p>\n # 6) insert new Hx tag (with contents of the B tag) after A tag \n # NOTE: we may want it in Hx tag, or give the Hx tag the ID of the old A tag and remove the A tag altogether... we'll see\n\n # known headings look like this:\n # \n # <a name=\"authorinfo\"></a>\n # <p>\n # <a href=\"#top\"><img src=\"http://portal.acm.org/img/arrowu.gif\" border=\"0\" alt=\"back to top\">&nbsp;</a>\n # <b>Author</b>\n # </p>\n # \n # (same as body-n headings except we replace them with slightly different Hx tags... TBD exactly)\n\n known_headings = %w(references authorinfo footnotes figures tables permission)\n body_regex = /^body-\\d+$/\n sidebar_regex = /^sidebar-\\d+$/\n back_to_top = %{<p class=\"totop\"><a href=\"#PageTop\">Back to Top</a></p>\\n\\n}\n\n (old_dom/\"//a[@name]\").each do |anchor|\n next unless known_headings.include?(anchor['name']) || anchor['name'].match(body_regex) || anchor['name'].match(sidebar_regex)\n\n # the (2) is because of the whitespace nodes in between the element nodes\n p = anchor.nodes_at(2)\n\n if anchor['name'] == \"body-1\"\n p.remove\n\n elsif anchor['name'] == \"permission\"\n p.remove\n anchor.before(%{<hr class=\"Separator\" />\\n})\n\n else\n heading = remove_whitespace((p/'b')[0].inner_html)\n p.remove\n # put the back-to-top link in between the comments so the soon-to-be-created DIV doesn't wrap it\n anchor.nodes_at(-2).before(back_to_top)\n classname = known_headings.include?(anchor['name']) ? ' class=\"known-headings\"' : \"\"\n anchor.after(%{\\n<h3#{classname}>#{heading}</h3>})\n end\n end\n \n # Fix Article figures and tables\n HtmlMaid.fix_figures_and_tables(old_dom)\n \n # We just gave the figures \"back to top\" link the wrong class name. Fix:\n (old_dom/\".ThumbnailParagraph\").each do |thumb_para|\n thumb_para.set_attribute :class, \"totop\" if thumb_para.inner_text.downcase.eql?(\"back to top\")\n end\n \n # Rewrites URLs and img SRCs to point to deliveryimages.org\n HtmlMaid.change_link_and_img_paths(old_dom, path_to_article)\n \n # final processing\n # 1) body.inner_html\n # 2) remove everything up to <!-- BEGIN BODY-1 -->\n\n html = (old_dom/:body).inner_html.gsub(/^.+(<!-- BEGIN BODY-1 -->)/m, '\\\\1')\n\n # add DIVs around known sections for styling purposes\n # \n # FIXME: this can probably be optimized by avoiding the ruby interator \n # and using regexp groups and backreferences to pull out the individual items\n known_headings.each do |heading|\n re = Regexp.new(\"(<!-- BEGIN #{heading.upcase} -->)(.+)(<!-- END #{heading.upcase} -->)\", Regexp::MULTILINE)\n html = html.gsub(re, %{\\\\1\\n<div id=\"article-#{heading}\">\\n\\\\2\\n</div>\\n\\\\3})\n end\n\n # do the same for sidebars, albeit a bit more complicated regex-wise\n html = html.gsub(/(<!-- BEGIN (SIDEBAR-(\\d)) -->)\\s*(<a name=\"(sidebar-\\3)\"><\\/a>)(.+)(<!-- END \\2 -->)/m, %{\\\\1\\n<div class=\"ArticleSidebar\" id=\"article-\\\\5\">\\n\\\\4\\n\\\\6\\n</div>\\n\\\\7})\n \n # Why don't all tables and figures get a \"back to top\" link? Not sure, \n # but let's give it one... unless it's a black sheep that already has one.\n \n # Now we're going to be evil and RE-parse this stuff to safely re-insert\n # some back to top links for figures and tables...\n \n new_dom = Hpricot(html)\n \n # Find the DIVs that are now wrapping the figures and tables. \n \n figures_div = new_dom.at(\"#article-figures\")\n tables_div = new_dom.at(\"#article-tables\")\n \n if figures_div\n # Don't add double back-to-top links!\n unless figures_div.children_of_type(\"p\").last.get_attribute(:class).eql?(\"totop\")\n # Just to be paranoid, let's also make sure they didn't sneak one in\n # after the wrapping div, either...\n unless figures_div.next_sibling.name.eql?(\"p\") and figures_div.next_sibling['class'].eql?(\"totop\")\n \n # Swap the ENTIRE div for the div + totop link\n # Why can't Hpricot just insert a string after an Hpricot::Elem?\n # ... I'll add that to my hpricot_extensions wish list.\n \n figures_div.swap(figures_div.to_html + '<p class=\"totop\"><a href=\"#PageTop\">Back to top</a></p>')\n end\n end\n end\n \n # Rinse, repeat\n if tables_div\n unless tables_div.children_of_type(\"p\").last.get_attribute(:class).eql?(\"totop\")\n unless tables_div.next_sibling.name.eql?(\"p\") and tables_div.next_sibling['class'].eql?(\"totop\")\n tables_div.swap(tables_div.to_html + '<p class=\"totop\"><a href=\"#PageTop\">Back to top</a></p>')\n end\n end\n end\n \n # OK, back to packaging this up...\n html = new_dom.to_html\n \n return {\n :full_text => html,\n :leadin => leadin,\n :journal_name => journal_name,\n :vol_issue_page => vol_issue_page,\n :toc => toc_node.inner_html\n }\n\n ensure\n toc_node = nil\n old_dom = nil\n leadin_node = nil\n GC.start\n end", "def preprocess!\n input_html\n nil\n end", "def clean_html(html)\n Sanitize.clean(html) rescue html\n end", "def strip_html(str)\n str.gsub HTML_TAG, \"\" if str\n end", "def sanitize_html\n self.data = self.class.clean_html(self.data) unless self.data.nil?\n end", "def strip_tags(html)\n html.gsub(/<\\/?[^>]*>/, \"\") if html\n end", "def strip_html_tags!\n @raw.gsub!(/<[^>]+?>/, ' ')\n end", "def parse_html(source)\n Nokogiri::HTML(open(source))\n end", "def parse html\n return if html.nil?\n @fragment = Nokogiri::HTML.fragment(html)\n @fragment_copy = Nokogiri::HTML.fragment(html)\n end", "def parseHtml(html)\n\t\t\tregex = /<(#{tag}(.*?)>(.*?)<\\/#{tag}>)/\n\t\t\tresults = html.scan(regex)\n\t\t\treturn results.empty? ? '' : results[0][-1]\n\t\tend", "def clean_html(str)\n\t str = str.gsub(/<script(.*)>(.*)<\\/script>/i, \"\")\n\t str = str.gsub(/<frame(.*)>(.*)<\\/frame>/i, \"\")\n\t str = str.gsub(/<iframe(.*)>(.*)<\\/iframe>/i, \"\")\n\t\n\t return str\n end", "def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end", "def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end", "def parse_raw_html(el, &block); end", "def html_markup_html(text); end", "def parse_html\n scraped_content = Nokogiri::HTML(open(@url).read)\n raise WrongIDforURL if scraped_content.text == 'No such item.'\n return scraped_content\n end", "def html_reducer(html_doc)\n html_doc_chars = html_doc.strip.split(\"\")\n\n self_closing_tags = [\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\",\"command\",\"keygen\",\"menuitem\"]\n reopenable_tags = [\"b\",\"i\",\"a\",\"font\",\"em\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"pre\",\"strong\",\"u\"]\n nestable_tags = [\"div\"]\n\n element_stack = [] # stack of open elements\n reduction = [] # results array\n buffer = \"\"\n\n while html_doc_chars.length > 0\n buffer << html_doc_chars.shift # get another char\n\n closing_script_regex = /<\\/script\\s*>\\z/i\n closing_script_match = buffer.match(closing_script_regex)\n\n closing_style_regex = /<\\/style\\s*>\\z/i\n closing_style_match = buffer.match(closing_style_regex)\n\n self_closing_tag_regex = /<[a-z][^>]*\\/\\s*>\\z/i\n self_closing_tag_match = buffer.match(self_closing_tag_regex)\n\n tag_regex = /<[a-z][^>]*>\\z/i\n tag_match = buffer.match(tag_regex)\n\n closing_tag_regex = /<\\/[a-z][^>]*>\\z/i\n closing_tag_match = buffer.match(closing_tag_regex)\n\n doctype_regex = /<!doctype\\s*[^>]*>\\z/i\n doctype_match = buffer.match(doctype_regex)\n\n comment_regex = /<!--.*?-->\\z/\n comment_match = buffer.match(comment_regex)\n\n # closing script tag\n if closing_script_match\n text = buffer.split(closing_script_regex).first.to_s.strip\n if text != \"\"\n element_stack.last.contents << text\n end\n buffer = \"\"\n element_stack.pop\n\n # closing style tag\n elsif closing_style_match\n text = buffer.split(closing_style_regex).first.to_s.strip\n if text != \"\"\n element_stack.last.contents << text\n end\n buffer = \"\"\n element_stack.pop\n\n # comment\n elsif comment_match\n contents = (element_stack.last&.contents) || reduction\n text = buffer.split(comment_regex).first.to_s.strip\n if text != \"\"\n contents << text\n end\n contents << comment_match.to_s\n\n buffer = \"\"\n\n # inside a script\n elsif tag_in_stack(element_stack,\"script\")\n # do nothing\n\n elsif tag_in_stack(element_stack,\"style\")\n # do nothing\n\n elsif buffer.include?(\"<!--\")\n # do nothing\n\n # self closing tag containing /> (doesn't get pushed to the stack)\n elsif self_closing_tag_match\n text = buffer.split(self_closing_tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n contents << HTML_element.from_string(self_closing_tag_match.to_s)\n buffer = \"\"\n \n # tag\n elsif tag_match\n text = buffer.split(tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n elem = HTML_element.from_string(tag_match.to_s)\n\n if !self_closing_tags.include?(elem.tag) # push to the stack\n # check whether nesting is possible\n if tag_in_stack(element_stack,elem.tag) && !nestable_tags.include?(elem.tag)\n tmp_stack = []\n while tag_in_stack(element_stack,elem.tag)\n tmp = element_stack.pop\n contents = (element_stack.last&.contents) || reduction\n if reopenable_tags.include?(tmp.tag) && (tmp.tag != elem.tag)\n tmp_stack << tmp\n end\n end\n \n contents << elem\n element_stack.push(elem)\n contents = (element_stack.last&.contents) || reduction\n while tmp_stack.length > 0\n new_elem = HTML_element.from_html_element(tmp_stack.pop)\n contents << new_elem\n element_stack.push(new_elem)\n contents = (element_stack.last&.contents) || reduction\n end\n else\n contents << elem\n element_stack.push(elem)\n end\n else\n contents << elem\n end\n\n buffer = \"\"\n\n # closing tag\n elsif closing_tag_match\n text = buffer.split(closing_tag_regex).first.to_s.strip\n contents = (element_stack.last&.contents) || reduction\n if text != \"\"\n contents << text\n end\n tag = HTML_element.tag_from_string(closing_tag_match.to_s)\n if tag_in_stack(element_stack, tag)\n tmp_stack = []\n until element_stack.last.tag == tag\n tmp = element_stack.pop\n if reopenable_tags.include?(tmp.tag) && (tmp.tag != tag)\n tmp_stack << tmp\n end\n end\n element_stack.pop\n contents = (element_stack.last&.contents) || reduction\n \n while tmp_stack.length > 0\n new_elem = HTML_element.from_html_element(tmp_stack.pop)\n contents << new_elem\n element_stack.push(new_elem)\n contents = (element_stack.last&.contents) || reduction\n end\n end\n buffer = \"\"\n\n # doctype (stack must be empty)\n elsif doctype_match\n text = buffer.split(doctype_regex).first.to_s.strip\n if text != \"\"\n reduction << text\n end\n reduction << doctype_match.to_s\n buffer = \"\"\n end\n end\n\n contents = (element_stack.last&.contents) || reduction\n contents << buffer\n\n reduction\nend", "def clean(html)\n dupe = html.dup\n clean!(dupe) || dupe\n end", "def strip_html(string=\"\")\n begin\n string = strip_tags(string)\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- error stripping html from: #{string} -->\")\n end\n end", "def process_html(content)\n head, opener, tail = content.output.partition(OPENING_BODY_TAG_REGEX)\n body_content, *rest = tail.partition(\"</body>\")\n\n processed_markup = process_anchor_tags(body_content)\n\n content.output = String.new(head) << opener << processed_markup << rest.join\n end", "def strip_tags(html)\n strip(Sanitize.clean(html, :elements => [], :attributes => []))\n end", "def text_of(nokogiri_doc)\n nokogiri_doc.text.gsub(\"\\n\", ' ')\nend", "def stripped_content\n\t\treturn self.content.gsub( /<.*?>/, '' ).tr( \"\\n\\t \", ' ' ).strip\n\tend", "def parse_page(response)\n\t\tNokogiri::HTML(response.body)\n\tend", "def parsed\n @parsed ||= Nokogiri::HTML(@document.to_s)\n rescue Exception => e\n @exception_log << e\n end", "def clean_content\n return @clean_content if @clean_content\n if content.blank?\n @clean_content = nil\n else\n c = remove_script\n # now replace any tags\n c.gsub!(%r{<[^>]*>}im, \" \")\n @clean_content = c\n end\n end", "def to_html text\n html = (''.encode text.encoding).dup\n\n encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]\n\n s = StringScanner.new text\n insquotes = false\n indquotes = false\n after_word = nil\n\n until s.eos? do\n case\n when s.scan(/<(tt|code)>.*?<\\/\\1>/) then # skip contents of tt\n html << s.matched.gsub('\\\\\\\\', '\\\\')\n when s.scan(/<(tt|code)>.*?/) then\n warn \"mismatched <#{s[1]}> tag\" # TODO signal file/line\n html << s.matched\n when s.scan(/<[^>]+\\/?s*>/) then # skip HTML tags\n html << s.matched\n when s.scan(/\\\\(\\S)/) then # unhandled suppressed crossref\n html << s[1]\n after_word = nil\n when s.scan(/\\.\\.\\.(\\.?)/) then\n html << s[1] << encoded[:ellipsis]\n after_word = nil\n when s.scan(/\\(c\\)/i) then\n html << encoded[:copyright]\n after_word = nil\n when s.scan(/\\(r\\)/i) then\n html << encoded[:trademark]\n after_word = nil\n when s.scan(/---/) then\n html << encoded[:em_dash]\n after_word = nil\n when s.scan(/--/) then\n html << encoded[:en_dash]\n after_word = nil\n when s.scan(/&quot;|\"/) then\n html << encoded[indquotes ? :close_dquote : :open_dquote]\n indquotes = !indquotes\n after_word = nil\n when s.scan(/``/) then # backtick double quote\n html << encoded[:open_dquote]\n after_word = nil\n when s.scan(/(?:&#39;|'){2}/) then # tick double quote\n html << encoded[:close_dquote]\n after_word = nil\n when s.scan(/`/) then # backtick\n if insquotes or after_word\n html << '`'\n after_word = false\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n when s.scan(/&#39;|'/) then # single quote\n if insquotes\n html << encoded[:close_squote]\n insquotes = false\n elsif after_word\n # Mary's dog, my parents' house: do not start paired quotes\n html << encoded[:close_squote]\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n\n after_word = nil\n else # advance to the next potentially significant character\n match = s.scan(/.+?(?=[<\\\\.(\"'`&-])/) #\"\n\n if match then\n html << match\n after_word = match =~ /\\w$/\n else\n html << s.rest\n break\n end\n end\n end\n\n html\n end", "def html_markup_text(text); end", "def parse(html, options = {})\n # clean html\n clean_html = cleaner.clean(html, options)\n\n # fix html\n pdf_model = fixer.fix(clean_html, options)\n end", "def parse_html(data,tag)\n return data.scan(%r{<#{tag}\\s*.*?>(.*?)</#{tag}>}im).flatten\nend", "def html_markup_org(text); end", "def strip_tags(html)\n Sanitize.clean(html.strip).strip\n end", "def strip_tags(html)\n Sanitize.clean(html.strip).strip\n end", "def parse_content_from_yuletide_file(story)\n @doc = Nokogiri::HTML.parse(story) rescue \"\"\n content_table = (@doc/\"table[@class='form']/tr/td[2]\")\n content = \"\"\n unless content_table\n content = (@doc/\"body\").inner_html\n else\n centers = content_table.css(\"center\")\n centers[0].remove\n # trying to remove comment links at the bottom\n if !centers[-1].nil? && centers[-1].to_html.match(/<!-- COMMENTLINK START -->/)\n centers[-1].remove\n end\n content = content_table.inner_html\n end\n \n @storyparser ||= StoryParser.new\n content = @storyparser.clean_storytext(content)\n content.gsub!(/<a href=\"\\//, '<a href=\"http://yuletidetreasure.org/')\n content\n end", "def markup_manipulation(html_fragment)\n html_doc = Nokogiri::HTML html_fragment\n html_doc = link_manipulations html_doc\n html_doc = image_manipulations html_doc\n return html_doc.css('body').children.to_s\n end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def sanitize(html)\n HTML5::HTMLParser.\n parse_fragment(html, :tokenizer => HTML5::HTMLSanitizer, :encoding => 'utf-8').\n to_s\n end", "def sanitize(html)\n HTML5::HTMLParser.\n parse_fragment(html, :tokenizer => HTML5::HTMLSanitizer, :encoding => 'utf-8').\n to_s\n end", "def process_html(document)\n\t\t\t\n\t\t\t# Add link and raw HTML to a hash as key/value\n\t\t\t# for later storage in database\n\t\t\tunless @raw_html.has_value?(document)\n\t\t \t\tprint \".\"\n\t\t \t\t@raw_html[@document.base_uri.to_s] = document\n\t\t\tend\n\t\t\t\t\n\t\tend", "def sanitize_feed_content(html, sanitize_tables = false)\n options = sanitize_tables ? {} : { tags: %w[table thead tfoot tbody td tr th] }\n sanitized = html.strip do |html|\n html.gsub! /&amp;(#\\d+);/ do |_s|\n \"&#{Regexp.last_match(1)};\"\n end\n end\n sanitized\n end" ]
[ "0.7567121", "0.7501477", "0.7323203", "0.7323203", "0.7323203", "0.7320719", "0.72193927", "0.7167748", "0.71563166", "0.712633", "0.70980257", "0.7087345", "0.7078445", "0.70275867", "0.70126086", "0.6989239", "0.69694614", "0.69290084", "0.6917967", "0.68704647", "0.68704647", "0.68704647", "0.68571496", "0.68112", "0.6806763", "0.6806654", "0.6794459", "0.6756527", "0.6746581", "0.6726581", "0.67250824", "0.67082214", "0.6687904", "0.66463846", "0.664544", "0.6637662", "0.6629043", "0.66242003", "0.6605342", "0.6577558", "0.65748984", "0.65732265", "0.65431726", "0.65323335", "0.6530046", "0.65292966", "0.649253", "0.64822686", "0.64727426", "0.64612067", "0.64545876", "0.6389587", "0.638733", "0.63826525", "0.636027", "0.6358457", "0.6352762", "0.63285846", "0.6328516", "0.63088745", "0.6291739", "0.62839836", "0.62836236", "0.6273753", "0.6251557", "0.6232561", "0.6219478", "0.6191647", "0.6178034", "0.61615443", "0.61430556", "0.61227953", "0.61227953", "0.6117613", "0.6116748", "0.61029845", "0.6098071", "0.60943913", "0.6091768", "0.60912615", "0.6074689", "0.6073555", "0.6053147", "0.605295", "0.60499895", "0.6048367", "0.60246176", "0.60204804", "0.6008021", "0.6007104", "0.60059035", "0.59982955", "0.59982955", "0.59898627", "0.59853125", "0.5976075", "0.59752417", "0.59752417", "0.5954506", "0.59502" ]
0.779717
0