query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This method runs through associated methods to play game from start to finish
def game_start clear warning clear if @intro introduction() end clear countdown until @promptarr == [] game_round() end @running = game_over(@score) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\n #calls to all the methods that produce game!\n end", "def run\n start_game\n game_loop\n end_game\n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def play\n board_setup\n gameplay_setup\n end", "def start\n set_player_name\n deal_cards\n show_flop\n p...
[ "0.7865569", "0.75245976", "0.74567115", "0.73908234", "0.7294335", "0.72778505", "0.72335535", "0.7217435", "0.72111005", "0.71543074", "0.712392", "0.71198195", "0.7109642", "0.70838356", "0.70731586", "0.7031003", "0.70221263", "0.70036185", "0.6952738", "0.6939107", "0.69...
0.6475712
84
displays title, rules and difficulty selection
def introduction if title clear yes_no('Do you want to read the rules and see a live demo?') ? rules : nil clear difficulty_key = difficulty_menu @difficulty = DIFFICULTY[difficulty_key] @promptarr = prompt_select(difficulty_key) else @running = false exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_decision args\n decision = current_decision args\n # text is either the value of decision's description key or warning that no description exists\n args.labels << [640, 360, decision[:description] || \"No definition found for #{args.state.decision_id}. Please update decision.rb.\", 0, 1] # uses strin...
[ "0.65320915", "0.6472997", "0.6243883", "0.6082494", "0.6067164", "0.60515064", "0.5995115", "0.59249747", "0.5781903", "0.57759476", "0.57571274", "0.57196015", "0.5712373", "0.56638217", "0.5651451", "0.5649874", "0.5641299", "0.5628317", "0.5615754", "0.56043065", "0.55864...
0.66344327
0
Runs a single game round, deleting selected prompt after game.
def game_round phrases = @phrasearr.dup @difficulty[3].times do clear phrase = selector(phrases) display_to_user(phrase) phrases = deleter(phrase, phrases) end clear prompt = selector(@promptarr) display_to_user(prompt) input = timed_input print @cursor.hide scorer(checker(input, prompt)) deleter(prompt, @promptarr) check_score end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n choose_game(prompt)\nend", "def run_round\n increment_round!\n switch_player!\n question = Question.new(@question_cap)\n puts \"________ Question #{@which_round} ________\"\n puts \"#{@active_player.name}, you have #{@active_player.lives} #{(@active_player.lives) =...
[ "0.7317986", "0.6866906", "0.6503713", "0.6490024", "0.63478863", "0.633555", "0.6335471", "0.6312196", "0.62999356", "0.6222438", "0.621772", "0.61630213", "0.61584806", "0.6124103", "0.61213666", "0.6111646", "0.61089647", "0.6105396", "0.61021256", "0.6101698", "0.6099545"...
0.7121119
1
Wraps display methods into a single method to slim code
def display_to_user(string) puts score_display(@score, @difficulty) random_cursor(@height, @width) round_typer(string, @difficulty) string_flasher(string, @difficulty, @height, @width, @score) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display\n # Don't no why i thought i would need that. or if i need this.\n end", "def display_method(method)\n @display.display_method_info method\n end", "def display\r\n end", "def display_method name\n out = RDoc::Markup::Document.new\n\n add_method out, name\n\n display out\n end",...
[ "0.75489724", "0.74765074", "0.7348369", "0.7185729", "0.69452053", "0.69175255", "0.68946093", "0.6871269", "0.6868405", "0.68280005", "0.6808056", "0.67753065", "0.6771355", "0.6771355", "0.6771355", "0.6771355", "0.6771355", "0.6771355", "0.6771355", "0.6771355", "0.677135...
0.0
-1
Method takes the filtered command line arguments and changes instance variables accordingly
def command_line_arguments(array) array.size.times do if array.include?('-nc') colour_changer(:white) array.delete('-nc') elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x } key = (array[0])[1, 2].to_sym @difficulty = DIFFICULTY[key] @promptarr = prompt_select(key) @intro = false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse!( args )\n @args = args\n @options.grep!(args)\n end", "def initialize(*args)\n @options = Launchr::OrderedHash.new\n @arguments = Launchr::OrderedHash.new\n @options_arguments = Launchr::OrderedHash.new\n @config = Hash.new\n @filtered_argv = []\n...
[ "0.6569299", "0.65084624", "0.6484879", "0.627293", "0.627293", "0.6240226", "0.6145978", "0.61411166", "0.6071793", "0.6052049", "0.60415816", "0.60415816", "0.60200983", "0.6016583", "0.60029304", "0.5972238", "0.5937756", "0.5927264", "0.58701026", "0.5867334", "0.586444",...
0.5498468
88
This method raises an error if the command line argument includes crash
def game_crash(array) raise StandardError, 'Why did you do this to me, John?' if array.include?('-crash') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invalid_args!(message)\n raise InvalidCommandLine, message\n end", "def arg_error\r\n puts \"Usage:\\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns*\\n*seed* should be an integer\\n*num_prospectors*\"\\\r\n \" should be a non-negative integer\\n*num_turns* should be a non-negative ...
[ "0.69124395", "0.6691374", "0.6602561", "0.6549968", "0.6549968", "0.6491495", "0.6470695", "0.64637417", "0.64584154", "0.6447529", "0.6398112", "0.6396801", "0.6392604", "0.6388345", "0.6388123", "0.6374333", "0.63207036", "0.63152224", "0.63137645", "0.6279709", "0.6268175...
0.562881
79
Starts timeout for input as well as flushing the keyboard buffer so previous key strikes will not influence answer
def timed_input Timeout.timeout(@difficulty[1]) do starting = Process.clock_gettime(Process::CLOCK_MONOTONIC) print @cursor.show $stdin.iflush input = STDIN.gets.strip ending = Process.clock_gettime(Process::CLOCK_MONOTONIC) @elapsed = (ending - starting).round(2) return input end rescue StandardError $stdin.iflush 'no answer' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_input_thread\n @input_thread ||= Thread.new do\n until @stopped\n char = getch\n @on_key.call(char)\n end\n end\n end", "def pause\n $stderr.write('Press CTRL+j or ENTER to continue') && $stdin.gets\n end", "def pause\r\n STDIN.gets\r\n end", "def enter_...
[ "0.6592917", "0.6443215", "0.6344444", "0.6301539", "0.6260086", "0.62253803", "0.621325", "0.6156754", "0.6133035", "0.61119604", "0.61003184", "0.60935557", "0.607862", "0.6054125", "0.5991456", "0.5988817", "0.59772784", "0.5970319", "0.5895818", "0.5879395", "0.5876559", ...
0.68718255
0
Changes the score according to the given string by the checker method and displays appropriate message
def scorer(string) system 'clear' if string == 'true' type_and_delete 'You answered in enough time!' type_and_delete "Answered in #{@elapsed} seconds" @score = (@score - (@elapsed * 100)).to_i elsif string == 'false' type_and_delete 'You typed it wrong!' @score = (@score - @difficulty[2]).to_i else type_and_delete 'You ran out of time!' @score = (@score - @difficulty[2]).to_i end type_and_delete "Your score is now #{@score >= 0 ? @score : 0}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n # string\n answer = params[:answer]\n # also string now\n letters = params[:letters].gsub(/\\s+/, '')\n\n if check_letters(answer, letters)\n if check_dictionary(answer)\n @answer = 'Well done! Here is your score: XXXX'\n else @answer = 'This is not even an English word,...
[ "0.70384014", "0.67382014", "0.6641393", "0.64921737", "0.64832383", "0.63781685", "0.6356002", "0.6248281", "0.6232831", "0.6152167", "0.61493295", "0.6129478", "0.612894", "0.6115092", "0.6094892", "0.6069479", "0.605631", "0.6054789", "0.60399115", "0.6035348", "0.6035348"...
0.7069547
0
Checks the score each prompt and will set the prompt array to an empty array, therefore ending the game, if the score is 0
def check_score @promptarr = [] if @score <= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_round\n phrases = @phrasearr.dup\n @difficulty[3].times do\n clear\n phrase = selector(phrases)\n display_to_user(phrase)\n phrases = deleter(phrase, phrases)\n end\n\n clear\n prompt = selector(@promptarr)\n display_to_user(prompt)\n input = timed_inpu...
[ "0.6420287", "0.63369846", "0.6329157", "0.62287635", "0.6214056", "0.6208716", "0.6205123", "0.6182755", "0.61587274", "0.61503845", "0.6094432", "0.6064249", "0.60589164", "0.6051953", "0.6032133", "0.60059756", "0.60038507", "0.59649956", "0.59367204", "0.59366727", "0.592...
0.83077407
0
Use callbacks to share common setup or constraints between actions.
def set_manifestation @manifestation = Manifestation.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_...
[ "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.0
-1
Only allow a trusted parameter "white list" through.
def manifestation_params params.require(:manifestation).permit(:description, :url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7122997", "0.70535856", "0.6947653", "0.6902139", "0.6736141", "0.67172843", "0.66890657", "0.66776687", "0.66612494", "0.65556705", "0.6527668", "0.6458227", "0.64516383", "0.6451055", "0.6447473", "0.6435168", "0.641298", "0.641298", "0.6390906", "0.63801134", "0.6380113...
0.0
-1
GET /event_dates GET /event_dates.json
def index @event_dates = EventDate.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if @event != nil\n @event_dates = @event.event_dates.all\n else\n @event_dates = EventDate.all\n end\n end", "def index\n @events = Event.where(\"date >= ?\", Date.today).order(:date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { ren...
[ "0.7127112", "0.70412695", "0.69778174", "0.6940614", "0.6918086", "0.688325", "0.68282074", "0.68276334", "0.6755155", "0.6750845", "0.6740897", "0.6736398", "0.67270565", "0.67096007", "0.6700448", "0.6689643", "0.66798466", "0.6638686", "0.66353023", "0.66256857", "0.66217...
0.7160381
0
GET /event_dates/1 GET /event_dates/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if @event != nil\n @event_dates = @event.event_dates.all\n else\n @event_dates = EventDate.all\n end\n end", "def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end", "def i...
[ "0.69117415", "0.68830174", "0.68526095", "0.679131", "0.661467", "0.66076684", "0.6552227", "0.6547696", "0.65228873", "0.6497042", "0.6482347", "0.64774656", "0.64757746", "0.64579976", "0.6455474", "0.64255553", "0.64091885", "0.6394033", "0.6377522", "0.63734233", "0.6364...
0.0
-1
POST /event_dates POST /event_dates.json
def create @event_date = EventDate.new(event_date_params) respond_to do |format| if @event_date.save format.html { redirect_to @event_date } format.json { render :show, status: :created, location: @event_date } else format.html { render :new } format.json { render json: @event_date.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if @event != nil\n @event_date = @event.event_dates.create(event_date_params)\n else\n @event_date = EventDate.create(event_date_params)\n end\n\n respond_to do |format|\n if @event_date.valid?\n format.html { redirect_to [@event, @event_date], notice: \"Event date wa...
[ "0.70780414", "0.65769404", "0.6462583", "0.6439234", "0.6341615", "0.62753797", "0.6261783", "0.6254618", "0.62475216", "0.62034065", "0.6174673", "0.6172451", "0.61525965", "0.61376584", "0.61215574", "0.61192197", "0.6118629", "0.61062086", "0.6084529", "0.6080191", "0.607...
0.68350166
1
PATCH/PUT /event_dates/1 PATCH/PUT /event_dates/1.json
def update respond_to do |format| if @event_date.update(event_date_params) EventDate.admin_edit(@event_date.id) format.html { redirect_to '/admin_calendar_global/display' } format.json { render :show, status: :ok, location: @event_date } else format.html { render :edit } format.json { render json: @event_date.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @event_date.update(event_date_params)\n format.html { redirect_to [@event, @event_date], notice: \"Event date was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event_date }\n else\n format.html { render :ed...
[ "0.7005258", "0.69370365", "0.6923054", "0.6902576", "0.68403935", "0.68360835", "0.6821008", "0.6810401", "0.6764964", "0.67584056", "0.6700218", "0.6700218", "0.6672447", "0.6626336", "0.6552481", "0.6526539", "0.6513769", "0.6491028", "0.6491028", "0.6470515", "0.64671195"...
0.6828959
6
DELETE /event_dates/1 DELETE /event_dates/1.json
def destroy @event_date.destroy respond_to do |format| format.html { redirect_to event_dates_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event_date.destroy\n respond_to do |format|\n format.html { redirect_to event_event_dates_path, notice: \"Event date was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @event = Event.find_by_id(params[:id])\n #if params[:delete...
[ "0.7559857", "0.7304228", "0.7224325", "0.71911246", "0.7180541", "0.71797687", "0.71797687", "0.71797687", "0.7169272", "0.71651715", "0.7154012", "0.715123", "0.71434855", "0.7129702", "0.7129702", "0.7129702", "0.7129702", "0.7129702", "0.7129702", "0.7129702", "0.7129702"...
0.78873956
0
Use callbacks to share common setup or constraints between actions.
def set_event_date @event_date = EventDate.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_...
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def event_date_params params.require(:event_date).permit(:event_id, :start_date, :end_date, :host_id, :location, :capacity) 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...
[ "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.0
-1
TODO: this is lame. Just publish agents and store them over there, so we can render them properly.
def body parts = [] parts << if !name.blank? if url.blank? name else "<a href='#{sanitize_url}'>#{name}</a>" end elsif !url.blank? "[<a href='#{sanitize_url}'>website</a>]" end parts << "[<a href='mailto:#{sanitize_email}'>email</a>]" if email parts.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent; end", "def agent\n @agent\n end", "def agents\n return @agents unless @agents.nil?\n agents_array = []\n agents = @doc.xpath('//mets:agent')\n agents.each do |agent|\n type = agent.attr('TYPE')\n role = agent.attr('ROLE')\n id = agent.attr('ID')\n if agent.element...
[ "0.67584085", "0.63965714", "0.63850665", "0.63533145", "0.6350395", "0.63237625", "0.6238076", "0.62078613", "0.6148642", "0.6129066", "0.6092575", "0.6060676", "0.6007127", "0.59961206", "0.59401417", "0.5930177", "0.5929722", "0.5850565", "0.5794449", "0.579069", "0.569362...
0.0
-1
filtert die Index raus
def filter_index entry filter_regex = /(\[.+?\]|<Prior.+?>|<JLPT.+?>|<GENKI.+?>|<LangNiv.+?>|<Usage.+?>|<JWD.+?>|<Jap.+?>|<DaID.+?>|<Etym.+?>|\(<Ref.+?>\))/ entry.gsub(filter_regex, "") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_index\n filter\n end", "def index\n index_filter\n end", "def construct_index\n end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def tableau index_tableau\n tableaux_in(resultat_final)[index_tableau]\n end", "def index_filters\n {}\n end", "de...
[ "0.72811645", "0.67015177", "0.6628419", "0.64517534", "0.64212507", "0.6408441", "0.6272559", "0.625543", "0.62383807", "0.60827845", "0.6074172", "0.6045798", "0.60185003", "0.5984116", "0.59729505", "0.5953032", "0.59522176", "0.59522176", "0.59522176", "0.5928582", "0.591...
0.5989139
13
Datei extrahieren und in eine neue Datei schreiben
def extract(wdk_raw, wdk_new) content = File.readlines(wdk_raw).drop(1) new_content = content.map{|entry| generate entry}.flatten.join("\n") file = File.new(wdk_new, "w") file.puts new_content file.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date; end", "def date; end", "def date; end", "def date; end", "def date\n self.publicized_or_packaged || super\n end", "def date\n self.publicized_or_packaged || super\n end", "def modification_date=(_); end", "def read_date=(_); end", "def read_date; end", "def modification_date; en...
[ "0.62783504", "0.62783504", "0.62783504", "0.62783504", "0.62358356", "0.62358356", "0.61385727", "0.6090308", "0.6080108", "0.59976447", "0.5913481", "0.58545005", "0.5778568", "0.57410955", "0.57368743", "0.5725014", "0.5653268", "0.550694", "0.54962194", "0.54943657", "0.5...
0.0
-1
Call super at the end of configuring defaults
def initialize(config) @display_name = '360 Link Resolver' @display_text = 'Get Full Text via 360 Link' @http_open_timeout = 3 @http_read_timeout = 5 @credits = { 'SerialsSolutions' => 'http://www.serialssolutions.com/en/services/360-link' } # Call super to get @base_url, @open_timeout, and @read_timeout super @client = UmlautThreeSixtyLink::Client::Agent.new( @base_url, @open_timeout, @read_timeout ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults\n super\n end", "def set_defaults\n super\n end", "def defaults\n super\n end", "def initialize(*)\n super\n apply_defaults\n end", "def set_defaults\n end", "def set_defaults\n end", "def set_defaults\n\n end", "def set_defaults\n\n end", "def set_...
[ "0.7803575", "0.7803575", "0.7574514", "0.7407108", "0.7108725", "0.7108725", "0.71049684", "0.71049684", "0.71049684", "0.71049684", "0.71049684", "0.71049684", "0.7047907", "0.6999848", "0.68084794", "0.673244", "0.67239046", "0.67065114", "0.67065114", "0.6696239", "0.6616...
0.0
-1
Returns an array of strings. Used by auto background updater.
def service_types_generated [ ServiceTypeValue['fulltext'], ServiceTypeValue['holding'], ServiceTypeValue['highlighted_link'], ServiceTypeValue['disambiguation'], ServiceTypeValue['site_message'] ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_strings\n return @stringpool_main.values\n end", "def get_all\n return @strings\n end", "def get_triggers_a\n\n return [] if self.triggers.nil? or self.triggers.empty?\n\n array = self.triggers.split('|')\n array.compact!\n array.delete('')\n\n return array\n end", "def rp...
[ "0.6463305", "0.61786926", "0.59928167", "0.58729917", "0.57318884", "0.5729852", "0.56969833", "0.5682547", "0.5673193", "0.5644905", "0.56416434", "0.5638154", "0.5636246", "0.56238717", "0.56115866", "0.55820376", "0.55721277", "0.5553552", "0.5534852", "0.55258644", "0.54...
0.0
-1
GET /payments GET /payments.json
def index @payments = Payment.order('creation_date DESC').all if current_login.has_role? :administrator @payments = Payment.find_by_sql('select * from Payments p, (select clinic_id, max(due_date) as d from payments group by clinic_id) s where p.clinic_id = s.clinic_id and p.due_date = s.d order by payed') elsif current_login.has_role? :manager logged_user = Manager.first(:conditions => "login_id = #{current_login.id}") @payments = Payment.in_clinic(logged_user.clinic.id).all end respond_to do |format| format.html # index.html.erb format.json { render json: @payments } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def index\n @payments = Payment.all\n\n resp...
[ "0.7790701", "0.74445295", "0.74445295", "0.7429904", "0.7286045", "0.7228507", "0.71124196", "0.6980838", "0.6933879", "0.69167763", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609", "0.6906609",...
0.6144172
86
GET /payments/1 GET /payments/1.json
def show @payment = Payment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @payment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def index\n @payments = Payment.all\n\n resp...
[ "0.7829067", "0.72982544", "0.72982544", "0.72298133", "0.7149938", "0.70899385", "0.69870526", "0.69148904", "0.68950033", "0.68077666", "0.67922235", "0.6785993", "0.6785993", "0.6785993", "0.6785993", "0.6785993", "0.6785993", "0.6785993", "0.6785993", "0.6785993", "0.6785...
0.6970363
12
GET /payments/new GET /payments/new.json
def new @payment = Payment.new respond_to do |format| format.html # new.html.erb format.json { render json: @payment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json ...
[ "0.78900564", "0.7813253", "0.7801824", "0.7589509", "0.7438776", "0.7423119", "0.7403823", "0.7393967", "0.733632", "0.72890246", "0.72342414", "0.71780854", "0.7177509", "0.71756154", "0.7142453", "0.71091694", "0.7081583", "0.7067264", "0.70595646", "0.7051346", "0.7037092...
0.7971785
1
POST /payments POST /payments.json
def create clinic_id = params[:payment].delete(:clinic_id) @payment = Payment.new(params[:payment]) @payment.clinic_id = clinic_id respond_to do |format| if @payment.save format.html { redirect_to @payment, notice: 'Payment was successfully created.' } format.json { render json: @payment, status: :created, location: @payment } else format.html { render action: "new" } format.json { render json: @payment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment(params)\n check_token\n\n Request.perform(:post, URI.parse(Urls::PAYMENTS_URL), headers_for_other, params.to_json)\n end", "def create\n @payment = @contract.payments.new(payment_params)\n\n if @payment.save\n render :show, status: :created, location: url_for([@contract, @paym...
[ "0.74993503", "0.7224439", "0.704463", "0.6982641", "0.6973938", "0.683383", "0.67899615", "0.6766158", "0.67450583", "0.6741064", "0.67387027", "0.67272806", "0.6715693", "0.6715693", "0.67008054", "0.6693388", "0.6672226", "0.6672226", "0.6672226", "0.6672226", "0.6661855",...
0.6060816
82
PUT /payments/1 PUT /payments/1.json
def update clinic_id = params[:payment].delete(:clinic_id) @payment = Payment.find(params[:id]) @payment.clinic_id = clinic_id respond_to do |format| if @payment.update_attributes(params[:payment]) format.html { redirect_to @payment, notice: 'Payment was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @payment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @payment.update(payment_params)\n render :show, status: :ok, location: contract_payment_path(@payment)\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def update\n [:amount, :refund_amount].each do |a|\n next unless params[:payment]....
[ "0.6742403", "0.65547293", "0.6536093", "0.6513724", "0.64838463", "0.64838463", "0.64838463", "0.64838463", "0.64838463", "0.64838463", "0.6467167", "0.6436574", "0.6359977", "0.6331778", "0.6313587", "0.63038707", "0.63038707", "0.63038707", "0.63038707", "0.63038707", "0.6...
0.59912115
52
DELETE /payments/1 DELETE /payments/1.json
def destroy @payment = Payment.find(params[:id]) @payment.destroy respond_to do |format| format.html { redirect_to payments_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment.destroy\n respond_to do |format|\n format.html { redirect_to payments_url }\n format.json { head :no_co...
[ "0.7636133", "0.7606506", "0.7606506", "0.7606506", "0.7606506", "0.7606506", "0.7606506", "0.7606506", "0.7429057", "0.74214697", "0.7371915", "0.7351707", "0.7343066", "0.7337776", "0.7335601", "0.7335601", "0.73115087", "0.73098475", "0.73066723", "0.72919405", "0.7277644"...
0.76477057
7
Create a routing rule on route :to from socket :src to socket :dest. This doesn't actually run much except for parameter checking and adding the rule to the internal list. Options: :to either a symbolic route or a route UUID :src ZMQ socket to read from :dest ZMQ socket to write to :static (bool) this route cannot be modified at runtime Examples: r.route :type => :counter, :src => agent_router_sock, :dest => stat_sink_sock r.route :type => :counter, :src => agent_router_sock, :dest => stats_tap_sock r.route :type => :log, :src => agent_router_sock, :dest => cass_log_sock r.route :type => :log, :src => agent_router_sock, :dest => file_sink_sock r.route( :type => :log, :from => '62780b2f8d1248409c6ee89dae8cd322', :src => agent_router_sock, :dest => console_debug_sock, ) r.route( :from => '9321829560814871b9df6c3961a9ae94', :to => 'bc7dbea3da62477c88bd468481a68d6b', :src => agent_router_sock, :dest => event_ack_tap_sock, )
def route(opts) unless opts[:to] or opts[:from] or opts[:type] raise ArgumentError.new "One or more of :to, :from, or :type is required" end raise ArgumentError.new ":src is required" unless opts.has_key? :src raise ArgumentError.new ":dest is required" unless opts.has_key? :dest unless opts[:src].kind_of? ZMQ::Socket raise ArgumentError.new "Only ZMQ::Sockets are allowed and :src is a #{opts[:src].class}." end unless opts[:dest].kind_of? ZMQ::Socket raise ArgumentError.new "Only ZMQ::Sockets are allowed and :dest is a #{opts[:dest].class}." end # ZMQ::Poller already checks if it already knows about a socket, so let it handle duplicates # only poll for readability in the primary poll, only poll writability once and let it block as needed @poller.register_readable opts[:src] route = { :src => opts[:src], :dest => opts[:dest], :static => opts[:static] ? true : false } if opts[:to] if Hastur::Util.valid_uuid?(opts[:to]) route[:to] = opts[:to] else raise ArgumentError.new ":to must be a valid Hastur route (id or symbol) or a 36-byte hex UUID (#{opts[:to]})" end end if opts[:from] and Hastur::Util.valid_uuid?(opts[:from]) route[:from] = opts[:from] end if opts[:type] if Hastur::Message.type_id? opts[:type] route[:type] = opts[:type] elsif Hastur::Message.symbol? opts[:type] route[:type] = Hastur::Message.symbol_to_type_id(opts[:type]) else raise ArgumentError.new ":type must be a valid Hastur::Message type, '#{opts[:type]}' is not valid." end end src_id = Hastur::Util.sockid(route[:src]) @route_ids[src_id] ||= [] @route_ids[src_id] << route end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_route( rule, output_channel )\n validate_arguments( binding() )\n routes.push( RouteSpecification.new( rule, output_channel ) )\n end", "def add(pattern, dest, options)\n options[:prio]=255 unless options[:prio] # default\n @route[pat...
[ "0.6202177", "0.5926008", "0.5892745", "0.5858985", "0.57897574", "0.5648514", "0.55141884", "0.545741", "0.5358642", "0.53186905", "0.52593243", "0.52535486", "0.5227084", "0.521241", "0.52075636", "0.5205296", "0.5171426", "0.5141911", "0.5127538", "0.51170856", "0.5076274"...
0.7260886
0
return all of the routes, mostly for dumping to console at the moment
def routes { :static => @route_ids, :dynamic => @dynamic } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_routes\n matching_routes\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def show_all_routes\n if @routes.empty?\n routes_void\n else\n routes_list\n end\n end", "def sh...
[ "0.82064056", "0.79773414", "0.79773414", "0.7930683", "0.791322", "0.7867025", "0.7860391", "0.78257805", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7773017", "0.7746068", "0.7746068", ...
0.7013831
50
Allow registration of a single block for a socket to be checked in the poll() loop. This is for things like control sockets to manage a router.
def handle(socket, &block) @poller.register_readable socket @handlers[Hastur::Util.sockid(socket)] = block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkin(socket)\n if socket && socket.pool\n socket.checkin\n end\n sync_refresh\n end", "def checkin(socket)\n fiber = Fiber.current\n\n @available.push(@reserved.delete(fiber.object_id))\n if pending = @pending.shift\n pending.resume\n end\n true\n ...
[ "0.6130828", "0.59597194", "0.58048815", "0.57779866", "0.5771207", "0.5632938", "0.5598833", "0.55626804", "0.5533245", "0.55275595", "0.5522132", "0.54923385", "0.5447772", "0.5441683", "0.5394449", "0.536226", "0.5360546", "0.5323102", "0.52874684", "0.52709156", "0.526945...
0.6743092
0
poll all of the sockets set up via .route() for read and route messages based on those rules
def poll_zmq(zmq_poll_timeout=0.001) rc = @poller.poll(zmq_poll_timeout) # nothing waiting or socket error, take a hit and make sure we don't spin a CPU if rc < 1 @errors += 1 sleep zmq_poll_timeout return rc end @poller.readables.each do |socket| # use the "id" to map back to a route list id = Hastur::Util.sockid(socket) # additional socket handlers can be registered for things like control or route advertisement if @handlers[id] @handlers[id].call(socket) next end # everything else is expected to be a Hastur message rc = socket.recvmsgs zmq_messages=[] hastur_message = zmq_messages.pop hastur_envelope = zmq_messages.pop envelope = Hastur::Envelope.parse(hastur_envelope.copy_out_string) hastur_envelope.close # convenience variables from = envelope.from to = envelope.to type = envelope.type_id # append this router's identity to the message envelope envelope.add_router @uuid # Write the zmq headers into the dynamic route cache on every noop message. # This cache is used to route messages the correct agent on the router socket. if type == @noop_type_id # cache a copy of the binary string rather than the ZMQ::Message to avoid free() headaches headers = zmq_messages.map { |m| m.copy_out_string } @dynamic[from] = [socket, headers] @timestamps[from] = Time.now next # do not continue processing, noops are unroutable end # keep track of how many times a message is routed so we can easily tell when a message is unroutable times_routed = 0 @route_ids[id].each do |r| # test in the order of popularity # simple :type routes without :to or :from should be well over 90% of cases, e.g. if r[:type] == type and not r.has_key? :to and not r.has_key? :from forward r[:dest], envelope.pack, hastur_message @stats[:type] += 1 times_routed += 1 # r.route :to => uuid, :src => agent_router_sock, :dest => stat_sink_sock elsif r[:to] == to and not r.has_key? :from and not r.has_key? :type forward r[:dest], envelope.pack, hastur_message @stats[:to] += 1 times_routed += 1 # only match on from, generally expected to be used for agent debugging/test replaying, e.g. # r.route :from => agent_uuid, :src => agent_router_sock, :dest => agent_tap_sock elsif r[:from] == from and not r.has_key? :to and not r.has_key? :type forward r[:dest], envelope.pack, hastur_message @stats[:from] += 1 times_routed += 1 # all three of to/from/type are specified elsif r[:to] == to and r[:from] == from and r[:type] == type forward r[:dest], envelope.pack, hastur_message @stats[:to_from_type] += 1 times_routed += 1 # very specific :to and :from exact specification # mostly useful for tapping a specific stream from a specific source, e.g. # r.route :to => :stat, :from => agent_uuid, :src => agent_router_sock, :dest => stat_tap_sock elsif r[:to] == to and r[:from] == from forward r[:dest], envelope.pack, hastur_message @stats[:to_from] += 1 times_routed += 1 else # might be interesting if the router seems slow - a high number of misses for a given route # isn't bad, but might be indicitave that it's time to optimize the order above @stats[:missed] += 1 end end # Messages destined to agents on the ROUTER socket can only be reached via their random identity. # For every message we receive from an agent, we cache its identity in @dynamic as a binary string # that can be converted back to the ZMQ envelope part before sending on the router socket. This will # allow ZeroMQ to route the message to the right agent. # This is a lot like ARP on IPv4 ethernet networks. # Future: We may eventually want a router broadcast channel for an arp-like "who has" pattern. if @dynamic.has_key? to forward @dynamic[to][0], @dynamic[to][1], envelope.pack, hastur_message times_routed += 1 end # no route match, should not happen really except in integration tests that don't wire everything up if times_routed < 1 body_str = hastur_message.copy_out_string @logger.warn "unroutable message | #{envelope.to_json} | #{body_str} |" # forward to the error socket if it's set up if @error_socket.kind_of? ZMQ::Socket error = Hastur::Message::Error.new(:from => @uuid, :data => { :error => :unroutable, :data => { :envelope => envelope.to_hash, :message => body_str } }) error.send @error_socket end end hastur_message.close if hastur_message # update stats @num_msgs += 1 end # Expire really old dynamic routes we haven't heard from for more than a day. now = Time.now if now - @last_expiry_check > 300 # every 5 minutes @timestamps.each do |key,timestamp| if now - timestamp > @dynamic_route_expire @dynamic.delete(key) if @dynamic.has_key?(key) @timestamps.delete key end end @last_expiry_check = now end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poll_zmq\n @poller.poll_nonblock\n\n # read messages from Hastur (router)\n while @poller.readables.include?(@router_socket)\n msg = Hastur::Message.recv(@router_socket)\n @counters[:zmq_recv] += 1\n case msg\n when Hastur::Message::Ack\n ack_...
[ "0.63217103", "0.63195497", "0.6256685", "0.61672765", "0.61524415", "0.6137997", "0.613683", "0.6094036", "0.60604405", "0.601373", "0.59867847", "0.59436476", "0.59178495", "0.5890647", "0.5887368", "0.5868569", "0.58132493", "0.57825714", "0.57463217", "0.5700439", "0.5685...
0.63747406
0
Flushes the Router's stats to Hastur and resets the counters once time expires.
def poll_stats curr_time = Time.now # After some timeout, send the incremental difference to Hastur if curr_time - @last_stat_flush > @stats_interval Hastur.counter("router.num_msgs", @num_msgs, curr_time) # reset stats @num_msgs = 0 @last_stat_flush = curr_time end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_stats; reset!; end", "def clear_stats\n reset!\n NewRelic::Agent::BusyCalculator.reset\n end", "def stats_reset\n @stats = nil\n end", "def reset_fasthttp_statistics\n super\n end", "def flush!\n @_cache = {}\n end", "def reset_http_statistics\n sup...
[ "0.67137235", "0.66145974", "0.65002435", "0.63372177", "0.6329026", "0.6273344", "0.62462676", "0.62462676", "0.614196", "0.61189204", "0.6100604", "0.606336", "0.6057662", "0.6023801", "0.6023562", "0.602082", "0.6007128", "0.5944995", "0.59392923", "0.5937563", "0.5937563"...
0.60812056
11
Set the shutdown flag so the run() loop exits cleanly.
def shutdown @running = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown\n log 'Exiting...'\n Thread.list.each { |t| t[:shutdown] = true }\n @shutdown = true\n end", "def shutdown\n @shutdown = true\n exit if @sleeping\n end", "def shutdown\n @shutdown = true\n end", "def shutdown\n @shutdown = true\n e...
[ "0.7927039", "0.7823945", "0.7766014", "0.7766014", "0.7673354", "0.7649361", "0.7641007", "0.76311696", "0.7460144", "0.74366146", "0.73688287", "0.73688287", "0.73353386", "0.7215662", "0.71593565", "0.71399313", "0.70863116", "0.70752263", "0.7037364", "0.70156515", "0.701...
0.7815342
2
run in a loop while .running == true
def run(zmq_poll_timeout=0.1) @running = true while @running == true poll_zmq(zmq_poll_timeout) poll_stats end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n while @running\n step\n end\n end", "def loop_forever; end", "def run\n while 1\n if step == 1 then break end\n end\n end", "def loop; end", "def run()\n while(true)\n cycle() ;\n sleep(2) ;\n end\n end", "def running; end", "de...
[ "0.8213365", "0.7821319", "0.7795343", "0.7726189", "0.7714185", "0.76260424", "0.76260424", "0.75674146", "0.75674146", "0.75607467", "0.75104004", "0.73249596", "0.7261248", "0.7258608", "0.72340506", "0.72235847", "0.7205589", "0.7136888", "0.7123715", "0.7071556", "0.7036...
0.0
-1
Return whether this field is NULL.
def null?(record) type.nullable? && record[:header][:field_nulls][position] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null?(field_info, field)\n field_info[\"notnull\"] == 1 && self.send(field).blank?\n end", "def is_not_null?\n @flags & NOT_NULL_FLAG != 0\n end", "def is_not_null?\n @flags & NOT_NULL_FLAG != 0\n end", "def null?\n IsNull.new(self)\n end", "def null?\n false\n ...
[ "0.81921834", "0.8118804", "0.8118804", "0.786439", "0.7743553", "0.7732369", "0.7723996", "0.7723996", "0.7704121", "0.7650987", "0.7643656", "0.7643656", "0.7643656", "0.7628292", "0.74790794", "0.7478884", "0.74608964", "0.74608964", "0.7430078", "0.7379002", "0.7379002", ...
0.76027626
14
Return the actual length of this variablelength field.
def length(record) if type.variable? record[:header][:field_lengths][position] else type.length end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length\n value.length\n end", "def length\n @val.length\n end", "def length\n self.to_s.length\n end", "def length_in_long_words\n return @bits.attr_length\n end", "def length\n @fields.length\n end", "def value_length(value)\n value.length\n rescue N...
[ "0.775053", "0.7562866", "0.75512874", "0.7534576", "0.7492129", "0.7366488", "0.7365881", "0.7365881", "0.7365881", "0.7326975", "0.7326156", "0.7271387", "0.71332896", "0.71242905", "0.71177727", "0.7081951", "0.7078762", "0.7073468", "0.7061656", "0.7030941", "0.7026027", ...
0.712346
14
Read an InnoDB encoded data field.
def read(record, cursor) return :NULL if null?(record) cursor.name(type.name) { type.reader.read(record, cursor, length(record)) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def data; Marshal.load(Base64.decode64(read_attribute(:data))); end", "def data\n self.data_pointer.read_string(self.da...
[ "0.6550093", "0.64183116", "0.6133852", "0.6034587", "0.5974168", "0.59654087", "0.5835131", "0.57840824", "0.5777498", "0.5704816", "0.5681984", "0.56776255", "0.5643009", "0.5617884", "0.56121564", "0.56100905", "0.559549", "0.55917364", "0.5587634", "0.5583195", "0.5575686...
0.51628983
56
options: :name => can specify an alternative queue name
def get(options={}) if options.is_a?(String) options = {:name=>options} end options[:name] ||= @client.cache_name res = @client.parse_response(@client.get("#{path(options)}")) Cache.new(@client, res) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end", "def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end", "def name\n @queue_string\n end", "def queue(queue_name)\n @queues[queue_name]\n end", "def name\n @queue.name\n ...
[ "0.7796891", "0.77906454", "0.77839136", "0.7643971", "0.75336057", "0.7505586", "0.7505586", "0.7412281", "0.72761595", "0.72668976", "0.72524637", "0.72336364", "0.7207264", "0.72029984", "0.7192737", "0.7139906", "0.7102403", "0.7088299", "0.697136", "0.69413257", "0.69401...
0.0
-1
Used if lazy loading
def load_cache q = @client.caches.get(:name=>name) @client.logger.debug "GOT Q: " + q.inspect @data = q.raw q end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lazy?; @lazy; end", "def eager_load!; end", "def eager_load!; end", "def eager_load!; end", "def eager_load!; end", "def eager_load; end", "def eager_load; end", "def eager_load; end", "def lazy\n Fetcher.new(self).lazy\n end", "def forbid_lazy_load\n @forbid_lazy_load = true...
[ "0.71597296", "0.7098278", "0.7098278", "0.7098278", "0.7098278", "0.70170224", "0.70170224", "0.70170224", "0.686272", "0.6793782", "0.67177665", "0.67059666", "0.668894", "0.6606199", "0.6542429", "0.65018964", "0.65018964", "0.65018964", "0.64171666", "0.64023006", "0.6379...
0.0
-1
not supported in API yet def size return raw["size"] if raw["size"]
def put(k, v, options={}) @client.items.put(k, v, options.merge(:cache_name=>name)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n info[\"size\"]\n end", "def size\n Integer(metadata[\"size\"]) if metadata[\"size\"]\n end", "def size ; data['size'] ; end", "def size\n @info[:size]\n end", "def size\n @gapi[\"size\"]\n end", "def size\n self[:size]\n end", "def get_size\n\t\t...
[ "0.86233217", "0.85605425", "0.8541805", "0.85165435", "0.8037744", "0.7995132", "0.7878525", "0.7868856", "0.7868856", "0.78645533", "0.7822755", "0.77931565", "0.77931565", "0.77931565", "0.7781809", "0.7737466", "0.7737466", "0.7722802", "0.7722802", "0.7722802", "0.772280...
0.0
-1
GET /experiences/1 GET /experiences/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @experiences = Experience.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiences }\n end\n end", "def show\n @experiencedetail = Experiencedetail.find(params[:id])\n\n respond_to do |format|\n fo...
[ "0.77600574", "0.7657752", "0.76093024", "0.7520248", "0.7520248", "0.7520248", "0.744143", "0.73095155", "0.7248359", "0.72416604", "0.7185915", "0.71649224", "0.7004135", "0.6959315", "0.6959315", "0.6959315", "0.69455516", "0.6934084", "0.6893394", "0.6881585", "0.68784297...
0.0
-1
Handles 1 or more motion_active results of value 1.0 or 0.0 require url to contain sense param with value motion_active
def motion_active(a) rawtime, raw_motion = a.last time = Time.at(rawtime.to_s[0..-4].to_i) motion = raw_motion.first.to_i == 1 if @exe_motion[0] and motion and not @prev_motion then @exe_motion[0].call() elsif @exe_motion[1] and not motion and @prev_motion then @exe_motion[1].call() end @prev_motion = motion puts [time, motion] if @debug return motion == true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_voice_indicative_mood_perfect_tense\n return @proxyVerb.send :passive_voice_indicative_mood_perfect_tense\n end", "def url_active?\n begin\n response = Net::HTTP.get_response URI.parse(self.url)\n active_status = %w(200 301 302)\n active_status.include? response.code\...
[ "0.5287653", "0.50802815", "0.5033951", "0.49480006", "0.48863536", "0.48629975", "0.48305318", "0.48111108", "0.47501868", "0.4734622", "0.47309822", "0.4719957", "0.4702894", "0.46992594", "0.4666637", "0.46618637", "0.46529365", "0.46522182", "0.4642033", "0.4630357", "0.4...
0.57892734
0
GET /seances GET /seances.json
def index if params[:cinema_id] @seance = @cinema.seances.all elsif params[:film_id] @seance = @film.seances.all end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n ...
[ "0.64014685", "0.63534725", "0.6271774", "0.6271774", "0.62502956", "0.6248366", "0.6228095", "0.6163355", "0.61558634", "0.6094313", "0.6084832", "0.60296303", "0.6028119", "0.60180914", "0.5994971", "0.59933114", "0.599185", "0.5947112", "0.5942129", "0.59076875", "0.589521...
0.0
-1
GET /seances/1 GET /seances/1.json
def show if params[:cinema_id] @seance = @cinema.seances.find(params[:id]) elsif params[:film_id] @seance = @film.seances.find(params[:id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end", "def show\n @seance = Seance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seance }\n end\n end", "def show\n render json: Seances::...
[ "0.6527725", "0.6457196", "0.6409986", "0.63941413", "0.6272129", "0.626155", "0.62072814", "0.61969864", "0.61656696", "0.61479247", "0.61216617", "0.61193985", "0.61126804", "0.6105227", "0.6102494", "0.6082567", "0.60564333", "0.60537124", "0.6045396", "0.6042778", "0.6041...
0.0
-1
POST /seances POST /seances.json
def create if params[:cinema_id] @seance= @cinema.seances.new(params[:seance]) respond_to do |format| if @seance.save format.html { redirect_to [@cinema, @seance], notice: 'Seance was successfully created.' } format.json { render :show, status: :created, location: @seance } else format.html { render :new } format.json { render json: @seance.errors, status: :unprocessable_entity } end end elsif params[:film_id] @seance= @film.seances.new(params[:seance]) respond_to do |format| if @seance.save format.html { redirect_to [@film, @seance], notice: 'Seance was successfully created.' } format.json { render :show, status: :created, location: @seance } else format.html { render :new } format.json { render json: @seance.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @seance = Seances::UseCases::Create.new.call(params: seance_params)\n\n if @seance.valid?\n render jsonapi: @seance, status: :created\n else\n render jsonapi_errors: @seance.errors, status: :unprocessable_entity\n end\n end", "def create\n @seance = Seance.new...
[ "0.68065166", "0.64989185", "0.6270447", "0.6171902", "0.6028379", "0.59287786", "0.5820646", "0.57842267", "0.5769579", "0.5710784", "0.5688683", "0.5681236", "0.5667063", "0.5667063", "0.562555", "0.5625306", "0.5617639", "0.561124", "0.5606016", "0.558132", "0.5574383", ...
0.54339296
41
PATCH/PUT /seances/1 PATCH/PUT /seances/1.json
def update if params[:cinema_id] @seance= @cinema.seances.find(params[:id]) respond_to do |format| if @seance.update(seance_params) format.html { redirect_to [@cinema, @seance], notice: 'Seance was successfully updated.' } format.json { render :show, status: :ok, location: @seance } else format.html { render :edit } format.json { render json: @seance.errors, status: :unprocessable_entity } end end elsif params[:film_id] @seance= @film.seances.find(params[:id]) respond_to do |format| if @seance.update(seance_params) format.html { redirect_to [@film, @seance], notice: 'Seance was successfully updated.' } format.json { render :show, status: :ok, location: @seance } else format.html { render :edit } format.json { render json: @seance.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @seance = Seances::UseCases::Update.new.call(id: params[:id], params: seance_params)\n\n if @seance.valid?\n render jsonapi: @seance\n else\n render jsonapi_errors: @seance.errors, status: :unprocessable_entity\n end\n end", "def update\n @seance = Seance.find...
[ "0.6783936", "0.6548289", "0.65371287", "0.6344412", "0.6266698", "0.6265012", "0.61634564", "0.6156869", "0.61297953", "0.60941696", "0.6067998", "0.60669494", "0.6066447", "0.6060071", "0.60586476", "0.6045475", "0.6042467", "0.604067", "0.6036659", "0.60353106", "0.6032947...
0.0
-1
DELETE /seances/1 DELETE /seances/1.json
def destroy if params[:cinema_id] @seance = @cinema.seances.find(params[:id]) @seance.destroy respond_to do |format| format.html { redirect_to cinema_seances_path(@cinema)} format.json { head :no_content } end elsif params[:film_id] @seance = @film.seances.find(params[:id]) @seance.destroy respond_to do |format| format.html { redirect_to film_seances_path(@film)} format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content ...
[ "0.7203178", "0.7203178", "0.7067603", "0.6773491", "0.67469573", "0.6735076", "0.6726548", "0.6725678", "0.67250407", "0.6723869", "0.6719345", "0.67167467", "0.67108274", "0.6708601", "0.67076206", "0.6701576", "0.66886", "0.66621476", "0.66504", "0.66504", "0.6644648", "...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_seance @seance = Seance.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_...
[ "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.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def seance_params params.require(:seance).permit(:heure, :film_id, :cinema_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "...
0.0
-1
returns the amount of time it took for the block to execute (in seconds).
def bench(&block) t0 = Time.now block.call t1 = Time.now t1 - t0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile (block_description, &block)\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend", "def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_descr...
[ "0.70364964", "0.69733137", "0.6955019", "0.69347763", "0.6901364", "0.65410936", "0.6495946", "0.6479436", "0.6461831", "0.640167", "0.6323503", "0.6270904", "0.6268365", "0.62125", "0.62005186", "0.6171634", "0.61538994", "0.6152136", "0.60789156", "0.60674787", "0.6062712"...
0.57333636
54
================= = Guard methods = ================= If one of those methods raise an exception, the Guard::GuardName instance will be removed from the active guards. Called once when Guard starts Please override initialize method to init stuff
def start true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard; end", "def guard(*args)\n @guard_count += 1\n super\n end", "def unguarded(&block)\n @guard_count += 1\n super\n end", "def init(guard_name = nil)\n ::Guard.initialize_template(guard_name)\n end", "def init(guard_name = nil)\r\n if !File.exist?('Guardfile')...
[ "0.6766729", "0.64534646", "0.64384156", "0.63895565", "0.632998", "0.6063293", "0.58028704", "0.55477977", "0.55376554", "0.55284494", "0.5494319", "0.54572165", "0.54134893", "0.5328048", "0.5303259", "0.5235388", "0.51880807", "0.51816463", "0.5108145", "0.5105131", "0.509...
0.0
-1
Called on CtrlC signal (when Guard quits)
def stop true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_on_ctrl_c(pids, options); end", "def on_termination_signal( signo )\n\t\tself.log.warn \"Terminated (%p)\" % [ signo ]\n\t\tself.shutdown\n\tend", "def add_sigint_handler\n trap 'INT' do\n puts '\\nCancelled. Bye Bye!'\n exit!\n end\n end", "def handle_interrupt\n system \"SIGINT...
[ "0.6168103", "0.60099417", "0.59414303", "0.58043957", "0.5730398", "0.5704228", "0.5687569", "0.5678841", "0.5665896", "0.56334364", "0.56334364", "0.5551272", "0.5497009", "0.547946", "0.5472104", "0.5467176", "0.5467176", "0.54591227", "0.5454675", "0.5446126", "0.5436625"...
0.0
-1
Called on CtrlZ signal This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
def reload true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_restart(&block); end", "def action_reload\n return if options['never_reload']\n if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP'\n if options[:reload_shim]\n Process.kill(new_resource.reload_signal, pid)\n else\n check_reload...
[ "0.67104524", "0.66562974", "0.6485701", "0.6446132", "0.6443522", "0.64184225", "0.64184225", "0.64184225", "0.64184225", "0.63537097", "0.6328838", "0.6205524", "0.6177274", "0.6168215", "0.61427504", "0.6140243", "0.61317044", "0.61110646", "0.607982", "0.607982", "0.60798...
0.5625817
58
Called on Ctrl/ signal This method should be principally used for long action like running all specs/tests/...
def run_all true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal\n end", "def signal; end", "def signal; end", "def interrupt; end", "def doge_control_signal\r\n end", "def before_shutdown\n end", "def before_shutdown\n end", "def signal\n @cmd_result.signal\n end", "def before_shutdown()\n end", "def signal_received; end", "def...
[ "0.6884936", "0.6850475", "0.6850475", "0.6411552", "0.63611937", "0.6277068", "0.6277068", "0.6178205", "0.6127588", "0.609921", "0.6095257", "0.6091487", "0.6045729", "0.6040031", "0.6039864", "0.6006009", "0.5984503", "0.59737235", "0.5961664", "0.59452057", "0.59312636", ...
0.0
-1
Called on file modifications and additions
def run_on_changes(paths) paths.each do |path| unless updated?(path) return false end end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified_files; end", "def modified_files(options); end", "def modified_files(options); end", "def on_change(modified, added, deleted)\n # Modifications and additions are treated the same.\n (modified + added).uniq.each do |path|\n if file = Ichiban::ProjectFile.from_abs(path)\n ...
[ "0.763606", "0.72470945", "0.72470945", "0.7181523", "0.690635", "0.67868394", "0.6754064", "0.6734533", "0.6734533", "0.66358083", "0.6605205", "0.654031", "0.65207064", "0.6458966", "0.6449576", "0.62503093", "0.62241596", "0.621331", "0.62081236", "0.62032264", "0.6173687"...
0.0
-1
warn a user that we don't do anything to handle deleted files. does not call super, so guard action isn't triggered
def run_on_removals(paths) paths.each do |path| warn "file #{path} removed -- it's up to you to remove it from the server if desired" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obsolete_files; end", "def check\n super\n uncommitted = Perforce.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n end", "def remove_check_file(opts)\n opts = check_params(opts,[:file_inf...
[ "0.6575612", "0.61901844", "0.6139273", "0.605394", "0.6052168", "0.6052048", "0.6034226", "0.60179883", "0.60068434", "0.5884572", "0.5858478", "0.5820912", "0.5759928", "0.5752451", "0.57176036", "0.5703263", "0.5679491", "0.56552255", "0.5640356", "0.562636", "0.5601374", ...
0.5367939
57
finds sitecookbooks/flume/recipes/default.rb => ["cookbooks", "flume" ] alicescookbooks/cookbooks/bob/templates/default/charlie.rb => ["cookbooks", "bob" ]
def split_path(path) m = CHEF_OBJECT_RE.match(path) unless m warn "Skipping '#{path}' -- it doesn't look like '*cookbooks/**/*', '*roles/*.{rb,json}', '*environments/*.{rb,json}' or '*data_bags/*.{rb,json}'" return else parent_seg, child_seg = m.captures child_seg.gsub!(/\.(rb|json)$/, "") extension = $1 [parent_seg, child_seg, extension] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cookbooks\n cookbooks = []\n Dir.foreach($opts[:repo]) do |cookbook_dir|\n if File.directory?(File.join($opts[:repo], cookbook_dir)) && !cookbook_dir.start_with?('.')\n cookbooks << cookbook_dir\n end\n end\n cookbooks\nend", "def known_cookbook_paths\n # Keep a cache of it for pe...
[ "0.65914494", "0.6486716", "0.6258798", "0.6232727", "0.62124914", "0.60335624", "0.5994859", "0.5946207", "0.58678985", "0.58583736", "0.5854738", "0.5722355", "0.56676966", "0.563112", "0.563112", "0.56300116", "0.562662", "0.560219", "0.55974936", "0.5577243", "0.55758387"...
0.0
-1
handle attributes for a single post not all of them
def add_post_attributes(attributes_hash) attributes_hash.each do |attribute, value| self.send("#{attribute}=", value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_attributes\n attributes_for :post\n end", "def set_atts_from_post(post_data, user)\r\n #MES- Did we get any post data?\r\n if post_data.has_key? 'user_atts'\r\n #MES- Run through the post data hash\r\n post_data['user_atts'].each_pair do | key, value |\r\n #MES- Set this att-...
[ "0.64478487", "0.6283253", "0.618624", "0.61806977", "0.6005279", "0.5842449", "0.5776111", "0.5774273", "0.5671679", "0.56271446", "0.5583676", "0.5583676", "0.55642295", "0.5564114", "0.5557674", "0.5557674", "0.55547893", "0.5541641", "0.5511283", "0.5501821", "0.5467417",...
0.5683621
8
If apt has not been updated since the last repo deployment it is updated. Otherwise this is a noop
def update_apt_if_needed if self['platform'] =~ /debian|ubuntu|cumulus/ if @apt_needs_update execute("apt-get update") @apt_needs_update = false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apt_get_update_install\n @app.packages.present? ? install_additional_packages : update_apt\n end", "def update_apt_if_needed\n if self['platform'] =~ /debian|ubuntu|cumulus|huaweios/\n if @apt_needs_update\n execute(\"apt-get update\")\n @apt_needs_update = false\n end\n end...
[ "0.72934234", "0.70303595", "0.68717635", "0.6822281", "0.6787691", "0.67019475", "0.65302867", "0.62362075", "0.61040616", "0.608728", "0.5997442", "0.5909354", "0.5905425", "0.5838368", "0.58173865", "0.5786", "0.5786", "0.5774639", "0.5764233", "0.57629615", "0.57529634", ...
0.717695
1
Upgrade an installed package to the latest available version
def upgrade_package(name, cmdline_args = '', opts = {}) case self['platform'] when /sles-/ execute("zypper --non-interactive --no-gpg-checks up #{name}", opts) when /el-4/ @logger.debug("Package upgrade is not supported on rhel4") when /fedora-22/ execute("dnf -y #{cmdline_args} update #{name}", opts) when /cisco|fedora|centos|eos|el-/ execute("yum -y #{cmdline_args} update #{name}", opts) when /ubuntu|debian|cumulus/ update_apt_if_needed execute("apt-get install -o Dpkg::Options::='--force-confold' #{cmdline_args} -y --force-yes #{name}", opts) when /solaris-11/ execute("pkg #{cmdline_args} update #{name}", opts) when /solaris-10/ execute("pkgutil -u -y #{cmdline_args} ${name}", opts) else raise "Package #{name} cannot be upgraded on #{self}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade_package host, package_name\n host.upgrade_package package_name\n end", "def upgrade_package(name, cmdline_args = '')\n raise \"Package #{name} cannot be upgraded on #{self}\"\n end", "def upgrade_package(name, cmdline_args = '')\n raise \"Package #{name} cannot be upgrade...
[ "0.75550914", "0.71617216", "0.71617216", "0.7152232", "0.69738805", "0.6963213", "0.6912411", "0.6912411", "0.6899609", "0.6801978", "0.67985773", "0.6730884", "0.6713269", "0.66976833", "0.66691756", "0.6649155", "0.6645992", "0.6645992", "0.65695864", "0.65171546", "0.6420...
0.6656769
15
Examine the host system to determine the architecture
def determine_if_x86_64 if self[:platform] =~ /solaris/ result = exec(Beaker::Command.new("uname -a | grep x86_64"), :accept_all_exit_codes => true) result.exit_code == 0 else result = exec(Beaker::Command.new("arch | grep x86_64"), :accept_all_exit_codes => true) result.exit_code == 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (...
[ "0.8243184", "0.8166032", "0.7860428", "0.7796818", "0.77720106", "0.7751454", "0.773666", "0.773666", "0.7601487", "0.75521535", "0.7493352", "0.7425347", "0.7402528", "0.7396291", "0.7336981", "0.7336981", "0.7325657", "0.71720535", "0.71528226", "0.7135042", "0.71212596", ...
0.6872767
28
GET /hoges/new GET /hoges/new.json
def new @hoge = Hoge.new respond_to do |format| format.html # new.html.erb format.json { render json: @hoge } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @hijo = Hijo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hijo }\n end\n end", "def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was...
[ "0.738861", "0.7354802", "0.72007215", "0.71712184", "0.7169876", "0.715398", "0.7136253", "0.7132826", "0.71236056", "0.71236056", "0.71226704", "0.7114379", "0.711282", "0.71003574", "0.70722985", "0.7055696", "0.7035463", "0.7030366", "0.7026619", "0.70158136", "0.69970554...
0.80759174
0
POST /hoges POST /hoges.json
def create @hoge = Hoge.new(params[:hoge]) respond_to do |format| if @hoge.save format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' } format.json { render json: @hoge, status: :created, location: @hoge } else format.html { render action: "new" } format.json { render json: @hoge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @hoho = Hoho.new(hoho_params)\n\n respond_to do |format|\n if @hoho.save\n format.html { redirect_to @hoho, notice: 'Hoho was successfully created.' }\n format.json { render :show, status: :created, location: @hoho }\n else\n format.html { render :new }\n fo...
[ "0.6495951", "0.6389661", "0.63412553", "0.60854876", "0.6080125", "0.60430574", "0.60271746", "0.58560157", "0.5855105", "0.5824463", "0.57980096", "0.57830256", "0.5762294", "0.5748842", "0.57479054", "0.57460606", "0.574095", "0.57291764", "0.5719706", "0.5680351", "0.5677...
0.7311768
0
PUT /hoges/1 PUT /hoges/1.json
def update @hoge = Hoge.find(params[:id]) respond_to do |format| if @hoge.update_attributes(params[:hoge]) format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @hoge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @hoho.update(hoho_params)\n format.html { redirect_to @hoho, notice: 'Hoho was successfully updated.' }\n format.json { render :show, status: :ok, location: @hoho }\n else\n format.html { render :edit }\n format.json { render json: @...
[ "0.62536544", "0.6245052", "0.62134117", "0.6137807", "0.61190975", "0.6086884", "0.60821253", "0.6080219", "0.60354173", "0.6008615", "0.5986078", "0.59486955", "0.59473944", "0.5914064", "0.5904404", "0.5899578", "0.5881405", "0.5873917", "0.584325", "0.58282906", "0.580652...
0.6939379
0
DELETE /hoges/1 DELETE /hoges/1.json
def destroy @hoge = Hoge.find(params[:id]) @hoge.destroy respond_to do |format| format.html { redirect_to hoges_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\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_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", ...
[ "0.7170443", "0.70382696", "0.70380944", "0.6938344", "0.6915919", "0.6731879", "0.67259103", "0.67005897", "0.66963357", "0.6696088", "0.6691566", "0.6690584", "0.6681865", "0.66481644", "0.66401464", "0.66260445", "0.66243076", "0.6617448", "0.6604923", "0.6602291", "0.6602...
0.7364269
0
GET /csv_attributes GET /csv_attributes.json
def index @csv_attributes = CsvAttribute.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_attributes\n [\n \"Nimi\" => \"name\",\n \"Järjestys\" => \"numbering_order\",\n \"Lyhenne\" => \"shorten\",\n \"Ehdokkaita\" => :candidate_count,\n \"Vaalirengas\" => :coalition_name\n ]\n end", "def attr_csv(*attributes)\n define_attribute_methods ...
[ "0.65124094", "0.5920902", "0.5863393", "0.58498746", "0.5808843", "0.5769092", "0.5745061", "0.57436496", "0.5714019", "0.5695806", "0.562169", "0.56109405", "0.56052023", "0.5589923", "0.55819", "0.5564703", "0.5559588", "0.55590993", "0.54968315", "0.5463554", "0.54340017"...
0.69933605
0
GET /csv_attributes/1 GET /csv_attributes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @csv_attributes = CsvAttribute.all\n end", "def csv_attributes\n [\n \"Nimi\" => \"name\",\n \"Järjestys\" => \"numbering_order\",\n \"Lyhenne\" => \"shorten\",\n \"Ehdokkaita\" => :candidate_count,\n \"Vaalirengas\" => :coalition_name\n ]\n end", "...
[ "0.68611217", "0.6085818", "0.60819477", "0.60267663", "0.5904409", "0.57835895", "0.56996924", "0.56735146", "0.5665495", "0.5643796", "0.5578238", "0.557529", "0.55696887", "0.55283993", "0.55196726", "0.55160195", "0.55082923", "0.5498998", "0.5485968", "0.5474407", "0.544...
0.0
-1
POST /csv_attributes POST /csv_attributes.json
def create @csv_attribute = CsvAttribute.new(csv_attribute_params) respond_to do |format| if @csv_attribute.save format.html { redirect_to project_csv_type_csv_attributes_path(@csv_attribute.csv_type.project, @csv_attribute.csv_type), notice: 'Csv type was successfully created.' } format.json { render :show, status: :created, location: @csv_attribute } else format.html { render :new } format.json { render json: @csv_attribute.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_attribute_params\n params.require(:csv_attribute).permit(:name, :csv_type_id)\n end", "def attr_csv(*attributes)\n define_attribute_methods rescue nil\n super\n attributes.reject { | attr | attr.is_a?(Hash) }.each { | attr | alias_method \"#{attr}_before_type_cast\", at...
[ "0.70142734", "0.6357485", "0.6321397", "0.59471667", "0.5887325", "0.58674407", "0.58039767", "0.5614778", "0.5599342", "0.5482569", "0.5459697", "0.5449529", "0.5431911", "0.5339893", "0.5336952", "0.5332584", "0.5329313", "0.53284174", "0.5284252", "0.52754724", "0.5260829...
0.67967904
1
PATCH/PUT /csv_attributes/1 PATCH/PUT /csv_attributes/1.json
def update respond_to do |format| if @csv_attribute.update(csv_attribute_params) format.html { redirect_to @csv_attribute, notice: 'Csv attribute was successfully updated.' } format.json { render :show, status: :ok, location: @csv_attribute } else format.html { render :edit } format.json { render json: @csv_attribute.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @csv = Csv.find(params[:id])\n\n respond_to do |format|\n if @csv.update_attributes(params[:csv])\n format.html { redirect_to @csv, notice: 'Csv was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.66033703", "0.646439", "0.63928056", "0.60134953", "0.5873694", "0.5828784", "0.57586753", "0.5738838", "0.5728704", "0.5721901", "0.5710053", "0.56309944", "0.5618569", "0.5578466", "0.55759305", "0.55725414", "0.556685", "0.5563908", "0.55621547", "0.55559623", "0.554345...
0.7190758
0
DELETE /csv_attributes/1 DELETE /csv_attributes/1.json
def destroy @csv_attribute.destroy respond_to do |format| format.html { redirect_to project_csv_type_csv_attributes_url, notice: 'Csv attribute was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ais_attribute = AisAttribute.find(params[:id])\n @ais_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to ais_attributes_url, notice: 'Record was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @csv = Csv.find(...
[ "0.63574994", "0.63516295", "0.63171047", "0.63171047", "0.62921244", "0.6255255", "0.62312406", "0.62199587", "0.62089527", "0.6170748", "0.61356235", "0.60846263", "0.6083007", "0.60704213", "0.60601294", "0.6045403", "0.6032575", "0.60275596", "0.5957555", "0.5945468", "0....
0.7241734
0
Use callbacks to share common setup or constraints between actions.
def set_csv_attribute @csv_attribute = CsvAttribute.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_...
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def csv_attribute_params params.require(:csv_attribute).permit(:name, :csv_type_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "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.0
-1
GET /heels GET /heels.json
def index @heels = Heel.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end", "def index\n @trucks = Truck.all\n\n render json: @trucks\n end", ...
[ "0.6489556", "0.6356366", "0.6294696", "0.62873155", "0.6276096", "0.6266686", "0.6222199", "0.61825186", "0.6138705", "0.6134125", "0.61336535", "0.61156875", "0.61097586", "0.6099687", "0.608562", "0.6083534", "0.60798967", "0.6069244", "0.6056069", "0.6038756", "0.6016682"...
0.66989326
0
GET /heels/1 GET /heels/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @heels = Heel.all\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.j...
[ "0.6387077", "0.62821865", "0.62437993", "0.62133723", "0.61544895", "0.60948795", "0.6091983", "0.6073148", "0.60652226", "0.6040963", "0.60352886", "0.6034472", "0.60302866", "0.6010653", "0.5985685", "0.59782636", "0.59574074", "0.59331214", "0.59289145", "0.59286857", "0....
0.0
-1
POST /heels POST /heels.json
def create @heel = Heel.new(heel_params) respond_to do |format| if @heel.save format.html { redirect_to @heel, notice: 'Heel was successfully created.' } format.json { render :show, status: :created, location: @heel } else format.html { render :new } format.json { render json: @heel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @trash_wheel = TrashWheel.new(trash_w...
[ "0.5709507", "0.566809", "0.558384", "0.54974234", "0.5479514", "0.5415418", "0.5384948", "0.5364633", "0.5338301", "0.5279267", "0.5260327", "0.52548116", "0.5247197", "0.52445704", "0.5243632", "0.5225035", "0.5213211", "0.5194055", "0.5187854", "0.5187605", "0.5155852", ...
0.6044204
0
PATCH/PUT /heels/1 PATCH/PUT /heels/1.json
def update respond_to do |format| if @heel.update(heel_params) format.html { redirect_to @heel, notice: 'Heel was successfully updated.' } format.json { render :show, status: :ok, location: @heel } else format.html { render :edit } format.json { render json: @heel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\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!(params)\n res ...
[ "0.64401317", "0.641886", "0.6389466", "0.63520485", "0.62836903", "0.6278931", "0.62604266", "0.6137306", "0.6108782", "0.60875994", "0.60696363", "0.60696363", "0.60132337", "0.6005269", "0.59953356", "0.5989026", "0.5947367", "0.5934901", "0.5923492", "0.5923492", "0.59216...
0.6229965
7
DELETE /heels/1 DELETE /heels/1.json
def destroy @heel.destroy respond_to do |format| format.html { redirect_to heels_url, notice: 'Heel was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "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", ...
[ "0.72472674", "0.70898056", "0.70158887", "0.6923617", "0.6881021", "0.6833064", "0.67870396", "0.67781764", "0.67781764", "0.67781764", "0.67781764", "0.67508245", "0.67345047", "0.6724883", "0.67167324", "0.66771686", "0.6673415", "0.66707426", "0.6666593", "0.66627306", "0...
0.66094834
33
Use callbacks to share common setup or constraints between actions.
def set_heel @heel = Heel.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_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def heel_params params.require(:heel).permit(:height) 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...
[ "0.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "...
0.0
-1
GET /slider_tops GET /slider_tops.json
def index @slider_tops = SliderTop.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @slider_servs = SliderServ.all\n end", "def set_slider_top\n @slider_top = SliderTop.find(params[:id])\n end", "def index\n @main_sliders = MainSlider.all\n end", "def index\n @urls = Url.get_top(25)\n # render json: @urls\n end", "def index\n @food_sliders = FoodSlide...
[ "0.6771438", "0.65366507", "0.6501006", "0.64683837", "0.63394344", "0.6337733", "0.6324636", "0.6286404", "0.6078568", "0.6076236", "0.60635525", "0.60056585", "0.5992074", "0.5887564", "0.57958376", "0.57601005", "0.5740091", "0.57312953", "0.5691093", "0.5668371", "0.56683...
0.7847465
0
GET /slider_tops/1 GET /slider_tops/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @slider_tops = SliderTop.all\n end", "def index\n @slider_servs = SliderServ.all\n end", "def show\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_slider }\n end\n end", "def inde...
[ "0.75113434", "0.6886019", "0.6648511", "0.66482234", "0.6539262", "0.65151626", "0.6398692", "0.6398692", "0.63977873", "0.63629186", "0.6280661", "0.6255588", "0.62238514", "0.6200264", "0.6166468", "0.61053884", "0.6101478", "0.5986073", "0.5895699", "0.58884364", "0.58485...
0.0
-1
POST /slider_tops POST /slider_tops.json
def create @slider_top = SliderTop.new(slider_top_params) respond_to do |format| if @slider_top.save format.html { redirect_to @slider_top, notice: 'Slider top was successfully created.' } format.json { render :show, status: :created, location: @slider_top } else format.html { render :new } format.json { render json: @slider_top.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @slider_tops = SliderTop.all\n end", "def slider_top_params\n params.require(:slider_top).permit(:link, :img, :n_contrato)\n end", "def create\n @roll = Slider.new(roll_params)\n\n respond_to do |format|\n if @roll.save\n format.html { redirect_to sliders_path, notice:...
[ "0.65081453", "0.622788", "0.6072722", "0.60036767", "0.59609705", "0.5935694", "0.5803803", "0.58036125", "0.57706124", "0.5693444", "0.564692", "0.5639441", "0.5506163", "0.54982007", "0.5474013", "0.5420899", "0.5362634", "0.53545463", "0.5343297", "0.53311026", "0.5321933...
0.74511343
0
PATCH/PUT /slider_tops/1 PATCH/PUT /slider_tops/1.json
def update respond_to do |format| if @slider_top.update(slider_top_params) format.html { redirect_to @slider_top, notice: 'Slider top was successfully updated.' } format.json { render :show, status: :ok, location: @slider_top } else format.html { render :edit } format.json { render json: @slider_top.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @slider.update(slider_params)\n format.html { redirect_to action: :index, notice: 'Обновлено.' }\n format.json { render :index, status: :ok, location: @slider }\n else\n format.html { render :crop }\n format.json { render json: @slid...
[ "0.6486764", "0.64745003", "0.6290639", "0.6152035", "0.61222875", "0.60510623", "0.60426927", "0.59990627", "0.59967685", "0.58922374", "0.5858346", "0.5824024", "0.5820393", "0.5790393", "0.5775844", "0.5775501", "0.5771553", "0.5730541", "0.57061654", "0.5697975", "0.56717...
0.7455079
0
DELETE /slider_tops/1 DELETE /slider_tops/1.json
def destroy @slider_top.destroy respond_to do |format| format.html { redirect_to slider_tops_url, notice: 'Slider top was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @slider.destroy\n respond_to do |format|\n format.html { redirect_to sliders_url, notice: 'Удалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_slider = FoodSlider.find(params[:id])\n @food_slider.destroy\n\n respond_to do |format|\n fo...
[ "0.72976375", "0.7283472", "0.7009378", "0.7007126", "0.69862556", "0.695798", "0.69516706", "0.6903979", "0.6901481", "0.68814516", "0.6754676", "0.6741525", "0.6689721", "0.6636404", "0.662938", "0.662938", "0.662938", "0.6616958", "0.6587009", "0.65737134", "0.65655965", ...
0.7506562
0
Use callbacks to share common setup or constraints between actions.
def set_slider_top @slider_top = SliderTop.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_...
[ "0.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def slider_top_params params.require(:slider_top).permit(:link, :img, :n_contrato) 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...
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
GET /pastes GET /pastes.xml
def index unless read_fragment({}) @pastes = Paste.find(:all, :order => "created_at DESC").paginate :page => params[:page], :per_page => 4 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(id)\n self.class.get(\"/paste/#{id}\").parsed_response\n end", "def show\n @paste = Paste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paste }\n end\n end", "def get_paste(id)\n uri = URI.parse(\"#{BASE_URL}/pa...
[ "0.67540944", "0.6576967", "0.6359016", "0.5881583", "0.5772183", "0.57615316", "0.5606964", "0.55185705", "0.54804814", "0.541303", "0.5391166", "0.53862834", "0.5271303", "0.5245453", "0.52340084", "0.5232978", "0.5227446", "0.5216518", "0.5195171", "0.5191834", "0.517234",...
0.6415835
2
GET /pastes/1 GET /pastes/1.xml
def show @paste = Paste.find(params[:id], :include => :language) @contenido = begin Uv.parse(@paste.content.to_s, "xhtml", @paste.language_id, true, @theme ) rescue ArgumentError flash[:notice] = "Non se pode elexir esa configuración" Uv.parse(@paste.content.to_s, "xhtml", "actionscript", true, "blackboard") rescue NoMethodError flash[:notice] = "Non se pode elexir esa configuración" Uv.parse(@paste.content.to_s, "xhtml", "actionscript", true, @theme) end respond_to do |format| format.html # show.html.erb format.xml { render :xml => @paste } format.text { render :text => "Paste #{@paste.id} \nEscrito en: #{@paste.language.name}\n------------------------------------\n\n"+@paste.content.to_s} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @paste = Paste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paste }\n end\n end", "def get(id)\n self.class.get(\"/paste/#{id}\").parsed_response\n end", "def show\n @pastor = Pastor.find(params[:id])\n\n ...
[ "0.65493953", "0.63709456", "0.61454195", "0.60696155", "0.5849818", "0.5829455", "0.56041944", "0.5449568", "0.5422229", "0.537156", "0.53567773", "0.5348611", "0.53480476", "0.53223", "0.5311295", "0.5292102", "0.5239574", "0.5239574", "0.5237301", "0.5227026", "0.52255297"...
0.51043886
31
GET /pastes/new GET /pastes/new.xml
def new @paste = Paste.new @languages = Language.find :all respond_to do |format| format.html # new.html.erb format.xml { render :xml => @paste } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @paste = Paste.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paste }\n end\n end", "def new\n @pastor = Pastor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pastor }\n end\...
[ "0.73086643", "0.68265766", "0.6479939", "0.64247465", "0.63064045", "0.619655", "0.6100021", "0.6100021", "0.60960895", "0.60703003", "0.60487527", "0.6008923", "0.60028195", "0.59945273", "0.5994462", "0.5948595", "0.5943398", "0.5943398", "0.5931296", "0.5922742", "0.58945...
0.66543823
2
Examples: LinearEntity.new(Point.new(0, 0), Point.new(1, 2)) LinearEntity.new([0, 0], [1, 2])
def initialize(point1, point2) @p1 = point1; @p2 = point2 check_input_points! validate! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*points_or_lines)\n @points = []\n points_or_lines.each { |pol| self << pol }\n end", "def <<(*things)\n if things.size == 1\n thing = things.first\n if thing.is_a?(Point)\n @points << thing\n elsif thing.is_a?(Line)\n @points << thing.p1\n @points << ...
[ "0.6062611", "0.5698614", "0.54008394", "0.5384868", "0.53847307", "0.5380551", "0.53609467", "0.5359424", "0.53394777", "0.5329412", "0.531617", "0.52911246", "0.52911246", "0.5266875", "0.5266355", "0.5263579", "0.52561635", "0.5252428", "0.52403253", "0.52362764", "0.52235...
0.0
-1
The direction vector of the LinearEntity. Returns: Vector; the ray from the origin to this point is the direction of `self`.
def direction @direction ||= Vector.new(p2.x - p1.x, p2.y - p1.y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direction\n self.vector.normalize\n end", "def direction\n return nil if x_vel.zero? && y_vel.zero?\n vector_to_angle(*drop_diagonal)\n end", "def vector_to_direction(x, y)\n return 8 if y > 0 && x == 0\n return 2 if y < 0 && x == 0\n return 6 if x > 0 && y == 0\n return 4 if...
[ "0.7500789", "0.70677316", "0.64156646", "0.6370247", "0.6324729", "0.62075293", "0.61908585", "0.6182339", "0.61235505", "0.6083622", "0.6029747", "0.59797156", "0.5936142", "0.5911972", "0.5911972", "0.5896549", "0.5880915", "0.5847783", "0.569732", "0.56344056", "0.5581077...
0.6964893
2
Return the nonreflex angle formed by rays emanating from the origin with directions the same as the direction vectors of the linear entities. From the dot product of vectors v1 and v2 it is known that: ``dot(v1, v2) = |v1||v2|cos(A)`` where A is the angle formed between the two vectors. We can get the directional vectors of the two lines and readily find the angle between the two using the above formula. Parameters: LinearEntity Returns: angle in radians
def angle_between(other) raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity) v1 = self.direction v2 = other.direction # Convert numerator to BigDecimal for more precision. numerator = BigDecimal(v1.dot(v2).to_f.to_s) denominator = v1.to_point.abs * v2.to_point.abs return Math.acos(numerator / denominator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end", "def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n...
[ "0.6385433", "0.6067073", "0.590616", "0.5762918", "0.55990463", "0.5594754", "0.5426333", "0.5407778", "0.5407778", "0.53942156", "0.53936565", "0.52890986", "0.52843374", "0.525748", "0.5204063", "0.5198629", "0.51507926", "0.5140227", "0.51207507", "0.51028806", "0.5100309...
0.6839121
0
Are two LinearEntity parallel? Parameters: LinearEntity Returns: true if self and other LinearEntity are parallel. false otherwise.
def parallel_to?(other) raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity) self.direction.cross_product(other.direction) == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallel?(other)\n cross(other).magnitude == 0\n end", "def perpendicular_to?(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n self.direction.dot(other.direction) == 0\n end", "def parallel?( vector2 )\n if( crossProduct( vect...
[ "0.71521217", "0.6696794", "0.6674456", "0.65505326", "0.62438554", "0.60533804", "0.59317964", "0.5868123", "0.5838507", "0.58349764", "0.5801284", "0.5543827", "0.5543827", "0.5543827", "0.5393484", "0.5393484", "0.5393484", "0.538656", "0.53643024", "0.53277886", "0.532391...
0.8500799
0
Are two linear entities perpendicular? Parameters: LinearEntity Returns: true if self and other LinearEntity are perpendicular. false otherwise.
def perpendicular_to?(other) raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity) self.direction.dot(other.direction) == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perpendicular?( vector2 )\n if( dotProduct( vector2 ) == 0 )\n return true\n else\n return false\n end\n end", "def perpendicular?(vector2)\n end", "def parallel_to?(other)\n raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity)\n self.d...
[ "0.7796525", "0.7443835", "0.6938337", "0.6913993", "0.68722403", "0.6796743", "0.64452064", "0.6430446", "0.63637155", "0.6279648", "0.6254745", "0.5975088", "0.581728", "0.5781587", "0.573284", "0.5574352", "0.5553529", "0.55450517", "0.5505285", "0.54530936", "0.5417054", ...
0.8960538
0
Are two linear entities similar? Return: true if self and other are contained in the same line.
def similar_to?(other) raise TypeError, 'Must pass only LinearEntity objects.' unless other.is_a?(LinearEntity) l = Line.new(p1, p2) l.contains?(other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n return false unless other.is_a?(Line)\n Point.is_collinear?(self.p1, other.p1, self.p2, other.p2)\n end", "def crosses_line_string?(rhs)\n self_ints = SweeplineIntersector.new(segments).proper_intersections\n self_ints += SweeplineIntersector.new(rhs.segments).pro...
[ "0.6993756", "0.66654325", "0.6612983", "0.6568725", "0.65545195", "0.6486589", "0.64348626", "0.6365451", "0.6357516", "0.62651783", "0.62228876", "0.620882", "0.616386", "0.61295235", "0.6090045", "0.6063786", "0.60554457", "0.60407716", "0.6027596", "0.60204935", "0.600951...
0.78505313
0
The intersection with another geometrical entity Parameters: Point or LinearEntity Returns: Array of geometrical entities
def intersection(other) other = Point.new(other[0], other[1]) if other.is_a?(Array) # Other is a Point. if other.is_a?(Point) return [other] if self.contains?(other) return [] end # Other is a LinearEntity if other.is_a?(LinearEntity) # break into cases based on whether # the lines are parallel, non-parallel intersecting, or skew rank = Point.affine_rank(self.p1, self.p2, other.p1, other.p2) if rank == 1 # we're collinear return [other] if self.is_a?(Line) return [self] if other.is_a?(Line) if self.is_a?(Ray) && other.is_a?(Ray) return intersect_parallel_rays(self, other) end if self.is_a?(Ray) && other.is_a?(Segment) return intersect_parallel_ray_and_segment(self, other) end if self.is_a?(Segment) && other.is_a?(Ray) return intersect_parallel_ray_and_segment(other, self) end if self.is_a?(Segment) && other.is_a?(Segment) return intersect_parallel_segments(self, other) end elsif rank == 2 # we're in the same plane l1 = Line.new(self.p1, self.p2) l2 = Line.new(other.p1, other.p2) # check to see if we're parallel. If we are, we can't # be intersecting, since the collinear case was already # handled return [] if l1.parallel_to?(l2) # Use Cramers rule: # https://en.wikipedia.org/wiki/Cramer%27s_rule det = l1.a * l2.b - l2.a * l1.b det = det x = (l1.b * l2.c - l1.c * l2.b) / det y = (l2.a * l1.c - l2.c * l1.a ) / det intersection_point = Point.new(x, y) # if we're both lines, we can skip a containment check return [intersection_point] if self.is_a?(Line) && other.is_a?(Line) if self.contains?(intersection_point) && other.contains?(intersection_point) return [intersection_point] end return [] else # we're skew return [] end end if other.respond_to?(:intersection) return other.intersection(self) end raise TypeError, "Intersection between LinearEntity and #{ other.class } is not defined" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_intersection\n end", "def intersection\n self.reduce(&:intersection)\n end", "def entities_overlapping(x, y)\n entities_at_points(corner_points_of_entity(x, y))\n end", "def intersection(other)\n intersection_result = []\n \n if other.is_a?(Polygon) \n k =...
[ "0.6925844", "0.6685854", "0.6602229", "0.65830505", "0.6567762", "0.6489292", "0.64389366", "0.62630457", "0.61716616", "0.61209613", "0.6111581", "0.6085097", "0.6080088", "0.6002646", "0.60011816", "0.59933496", "0.5951347", "0.5947163", "0.59368616", "0.5929075", "0.59260...
0.70670915
0
Create a new Line parallel to this linear entity which passes through the point p Parameters: Point Returns: Line
def parallel_line(point) point = Point.new(point[0], point[1]) if point.is_a?(Array) raise TypeError, 'Must pass only Point.' unless point.is_a?(Point) Line.new(point, point + self.direction.to_point) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perpendicular_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n # any two lines in R^2 intersect, so blindly making\n # a line through p in an orthogonal direction will work\n Lin...
[ "0.70585847", "0.67822474", "0.6528479", "0.64946043", "0.6457261", "0.6414466", "0.64093435", "0.6383004", "0.6375209", "0.63672656", "0.6303772", "0.6263047", "0.62564546", "0.6221887", "0.621053", "0.60413593", "0.60371566", "0.6031091", "0.6031091", "0.60172975", "0.60172...
0.76177824
0
Create a new Line perpendicular to this linear entity which passes through the `point`. Parameters: Point Returns: Line
def perpendicular_line(point) point = Point.new(point[0], point[1]) if point.is_a?(Array) raise TypeError, 'Must pass only Point.' unless point.is_a?(Point) # any two lines in R^2 intersect, so blindly making # a line through p in an orthogonal direction will work Line.new(point, point + self.direction.orthogonal_direction.to_point) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallel_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n Line.new(point, point + self.direction.to_point)\n end", "def perpendicular_segment(point)\n point = Point.new(point[0],...
[ "0.75728875", "0.7527552", "0.6903855", "0.6846281", "0.6652813", "0.6413633", "0.63724464", "0.6369572", "0.619384", "0.59977764", "0.59860414", "0.59769064", "0.59612095", "0.59534997", "0.594916", "0.57699037", "0.5745813", "0.5745813", "0.56149364", "0.56010985", "0.55664...
0.8727516
0